預約系統電腦版

index-e95a9740.js 2.1MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559
  1. var __getOwnPropNames = Object.getOwnPropertyNames;
  2. var __commonJS = (cb, mod) => function __require() {
  3. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  4. };
  5. var require_index_001 = __commonJS({
  6. "assets/index-e95a9740.js"(exports, module) {
  7. function makeMap(str, expectsLowerCase) {
  8. const map2 = /* @__PURE__ */ Object.create(null);
  9. const list = str.split(",");
  10. for (let i = 0; i < list.length; i++) {
  11. map2[list[i]] = true;
  12. }
  13. return expectsLowerCase ? (val) => !!map2[val.toLowerCase()] : (val) => !!map2[val];
  14. }
  15. const EMPTY_OBJ = {};
  16. const EMPTY_ARR = [];
  17. const NOOP = () => {
  18. };
  19. const NO = () => false;
  20. const onRE = /^on[^a-z]/;
  21. const isOn = (key) => onRE.test(key);
  22. const isModelListener = (key) => key.startsWith("onUpdate:");
  23. const extend = Object.assign;
  24. const remove = (arr, el) => {
  25. const i = arr.indexOf(el);
  26. if (i > -1) {
  27. arr.splice(i, 1);
  28. }
  29. };
  30. const hasOwnProperty$e = Object.prototype.hasOwnProperty;
  31. const hasOwn = (val, key) => hasOwnProperty$e.call(val, key);
  32. const isArray$3 = Array.isArray;
  33. const isMap$2 = (val) => toTypeString(val) === "[object Map]";
  34. const isSet$2 = (val) => toTypeString(val) === "[object Set]";
  35. const isDate = (val) => toTypeString(val) === "[object Date]";
  36. const isFunction$2 = (val) => typeof val === "function";
  37. const isString$1 = (val) => typeof val === "string";
  38. const isSymbol$1 = (val) => typeof val === "symbol";
  39. const isObject$1 = (val) => val !== null && typeof val === "object";
  40. const isPromise = (val) => {
  41. return (isObject$1(val) || isFunction$2(val)) && isFunction$2(val.then) && isFunction$2(val.catch);
  42. };
  43. const objectToString$1 = Object.prototype.toString;
  44. const toTypeString = (value) => objectToString$1.call(value);
  45. const toRawType = (value) => {
  46. return toTypeString(value).slice(8, -1);
  47. };
  48. const isPlainObject$2 = (val) => toTypeString(val) === "[object Object]";
  49. const isIntegerKey = (key) => isString$1(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  50. const isReservedProp = /* @__PURE__ */ makeMap(
  51. // the leading comma is intentional so empty string "" is also included
  52. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  53. );
  54. const cacheStringFunction = (fn2) => {
  55. const cache2 = /* @__PURE__ */ Object.create(null);
  56. return (str) => {
  57. const hit = cache2[str];
  58. return hit || (cache2[str] = fn2(str));
  59. };
  60. };
  61. const camelizeRE = /-(\w)/g;
  62. const camelize = cacheStringFunction((str) => {
  63. return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
  64. });
  65. const hyphenateRE = /\B([A-Z])/g;
  66. const hyphenate = cacheStringFunction(
  67. (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
  68. );
  69. const capitalize$1 = cacheStringFunction((str) => {
  70. return str.charAt(0).toUpperCase() + str.slice(1);
  71. });
  72. const toHandlerKey = cacheStringFunction((str) => {
  73. const s2 = str ? `on${capitalize$1(str)}` : ``;
  74. return s2;
  75. });
  76. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  77. const invokeArrayFns = (fns, arg) => {
  78. for (let i = 0; i < fns.length; i++) {
  79. fns[i](arg);
  80. }
  81. };
  82. const def = (obj, key, value) => {
  83. Object.defineProperty(obj, key, {
  84. configurable: true,
  85. enumerable: false,
  86. value
  87. });
  88. };
  89. const looseToNumber = (val) => {
  90. const n = parseFloat(val);
  91. return isNaN(n) ? val : n;
  92. };
  93. const toNumber$1 = (val) => {
  94. const n = isString$1(val) ? Number(val) : NaN;
  95. return isNaN(n) ? val : n;
  96. };
  97. let _globalThis;
  98. const getGlobalThis = () => {
  99. return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
  100. };
  101. function normalizeStyle(value) {
  102. if (isArray$3(value)) {
  103. const res = {};
  104. for (let i = 0; i < value.length; i++) {
  105. const item = value[i];
  106. const normalized = isString$1(item) ? parseStringStyle(item) : normalizeStyle(item);
  107. if (normalized) {
  108. for (const key in normalized) {
  109. res[key] = normalized[key];
  110. }
  111. }
  112. }
  113. return res;
  114. } else if (isString$1(value) || isObject$1(value)) {
  115. return value;
  116. }
  117. }
  118. const listDelimiterRE = /;(?![^(]*\))/g;
  119. const propertyDelimiterRE = /:([^]+)/;
  120. const styleCommentRE = /\/\*[^]*?\*\//g;
  121. function parseStringStyle(cssText) {
  122. const ret = {};
  123. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  124. if (item) {
  125. const tmp = item.split(propertyDelimiterRE);
  126. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  127. }
  128. });
  129. return ret;
  130. }
  131. function normalizeClass(value) {
  132. let res = "";
  133. if (isString$1(value)) {
  134. res = value;
  135. } else if (isArray$3(value)) {
  136. for (let i = 0; i < value.length; i++) {
  137. const normalized = normalizeClass(value[i]);
  138. if (normalized) {
  139. res += normalized + " ";
  140. }
  141. }
  142. } else if (isObject$1(value)) {
  143. for (const name in value) {
  144. if (value[name]) {
  145. res += name + " ";
  146. }
  147. }
  148. }
  149. return res.trim();
  150. }
  151. function normalizeProps(props) {
  152. if (!props)
  153. return null;
  154. let { class: klass, style } = props;
  155. if (klass && !isString$1(klass)) {
  156. props.class = normalizeClass(klass);
  157. }
  158. if (style) {
  159. props.style = normalizeStyle(style);
  160. }
  161. return props;
  162. }
  163. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  164. const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
  165. function includeBooleanAttr(value) {
  166. return !!value || value === "";
  167. }
  168. function looseCompareArrays(a2, b2) {
  169. if (a2.length !== b2.length)
  170. return false;
  171. let equal = true;
  172. for (let i = 0; equal && i < a2.length; i++) {
  173. equal = looseEqual(a2[i], b2[i]);
  174. }
  175. return equal;
  176. }
  177. function looseEqual(a2, b2) {
  178. if (a2 === b2)
  179. return true;
  180. let aValidType = isDate(a2);
  181. let bValidType = isDate(b2);
  182. if (aValidType || bValidType) {
  183. return aValidType && bValidType ? a2.getTime() === b2.getTime() : false;
  184. }
  185. aValidType = isSymbol$1(a2);
  186. bValidType = isSymbol$1(b2);
  187. if (aValidType || bValidType) {
  188. return a2 === b2;
  189. }
  190. aValidType = isArray$3(a2);
  191. bValidType = isArray$3(b2);
  192. if (aValidType || bValidType) {
  193. return aValidType && bValidType ? looseCompareArrays(a2, b2) : false;
  194. }
  195. aValidType = isObject$1(a2);
  196. bValidType = isObject$1(b2);
  197. if (aValidType || bValidType) {
  198. if (!aValidType || !bValidType) {
  199. return false;
  200. }
  201. const aKeysCount = Object.keys(a2).length;
  202. const bKeysCount = Object.keys(b2).length;
  203. if (aKeysCount !== bKeysCount) {
  204. return false;
  205. }
  206. for (const key in a2) {
  207. const aHasKey = a2.hasOwnProperty(key);
  208. const bHasKey = b2.hasOwnProperty(key);
  209. if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a2[key], b2[key])) {
  210. return false;
  211. }
  212. }
  213. }
  214. return String(a2) === String(b2);
  215. }
  216. function looseIndexOf(arr, val) {
  217. return arr.findIndex((item) => looseEqual(item, val));
  218. }
  219. const toDisplayString = (val) => {
  220. return isString$1(val) ? val : val == null ? "" : isArray$3(val) || isObject$1(val) && (val.toString === objectToString$1 || !isFunction$2(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  221. };
  222. const replacer = (_key, val) => {
  223. if (val && val.__v_isRef) {
  224. return replacer(_key, val.value);
  225. } else if (isMap$2(val)) {
  226. return {
  227. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  228. entries[`${key} =>`] = val2;
  229. return entries;
  230. }, {})
  231. };
  232. } else if (isSet$2(val)) {
  233. return {
  234. [`Set(${val.size})`]: [...val.values()]
  235. };
  236. } else if (isObject$1(val) && !isArray$3(val) && !isPlainObject$2(val)) {
  237. return String(val);
  238. }
  239. return val;
  240. };
  241. let activeEffectScope;
  242. class EffectScope {
  243. constructor(detached = false) {
  244. this.detached = detached;
  245. this._active = true;
  246. this.effects = [];
  247. this.cleanups = [];
  248. this.parent = activeEffectScope;
  249. if (!detached && activeEffectScope) {
  250. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  251. this
  252. ) - 1;
  253. }
  254. }
  255. get active() {
  256. return this._active;
  257. }
  258. run(fn2) {
  259. if (this._active) {
  260. const currentEffectScope = activeEffectScope;
  261. try {
  262. activeEffectScope = this;
  263. return fn2();
  264. } finally {
  265. activeEffectScope = currentEffectScope;
  266. }
  267. }
  268. }
  269. /**
  270. * This should only be called on non-detached scopes
  271. * @internal
  272. */
  273. on() {
  274. activeEffectScope = this;
  275. }
  276. /**
  277. * This should only be called on non-detached scopes
  278. * @internal
  279. */
  280. off() {
  281. activeEffectScope = this.parent;
  282. }
  283. stop(fromParent) {
  284. if (this._active) {
  285. let i, l2;
  286. for (i = 0, l2 = this.effects.length; i < l2; i++) {
  287. this.effects[i].stop();
  288. }
  289. for (i = 0, l2 = this.cleanups.length; i < l2; i++) {
  290. this.cleanups[i]();
  291. }
  292. if (this.scopes) {
  293. for (i = 0, l2 = this.scopes.length; i < l2; i++) {
  294. this.scopes[i].stop(true);
  295. }
  296. }
  297. if (!this.detached && this.parent && !fromParent) {
  298. const last = this.parent.scopes.pop();
  299. if (last && last !== this) {
  300. this.parent.scopes[this.index] = last;
  301. last.index = this.index;
  302. }
  303. }
  304. this.parent = void 0;
  305. this._active = false;
  306. }
  307. }
  308. }
  309. function effectScope(detached) {
  310. return new EffectScope(detached);
  311. }
  312. function recordEffectScope(effect, scope = activeEffectScope) {
  313. if (scope && scope.active) {
  314. scope.effects.push(effect);
  315. }
  316. }
  317. function getCurrentScope() {
  318. return activeEffectScope;
  319. }
  320. function onScopeDispose(fn2) {
  321. if (activeEffectScope) {
  322. activeEffectScope.cleanups.push(fn2);
  323. }
  324. }
  325. const createDep = (effects) => {
  326. const dep = new Set(effects);
  327. dep.w = 0;
  328. dep.n = 0;
  329. return dep;
  330. };
  331. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  332. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  333. const initDepMarkers = ({ deps }) => {
  334. if (deps.length) {
  335. for (let i = 0; i < deps.length; i++) {
  336. deps[i].w |= trackOpBit;
  337. }
  338. }
  339. };
  340. const finalizeDepMarkers = (effect) => {
  341. const { deps } = effect;
  342. if (deps.length) {
  343. let ptr = 0;
  344. for (let i = 0; i < deps.length; i++) {
  345. const dep = deps[i];
  346. if (wasTracked(dep) && !newTracked(dep)) {
  347. dep.delete(effect);
  348. } else {
  349. deps[ptr++] = dep;
  350. }
  351. dep.w &= ~trackOpBit;
  352. dep.n &= ~trackOpBit;
  353. }
  354. deps.length = ptr;
  355. }
  356. };
  357. const targetMap = /* @__PURE__ */ new WeakMap();
  358. let effectTrackDepth = 0;
  359. let trackOpBit = 1;
  360. const maxMarkerBits = 30;
  361. let activeEffect;
  362. const ITERATE_KEY = Symbol("");
  363. const MAP_KEY_ITERATE_KEY = Symbol("");
  364. class ReactiveEffect {
  365. constructor(fn2, scheduler = null, scope) {
  366. this.fn = fn2;
  367. this.scheduler = scheduler;
  368. this.active = true;
  369. this.deps = [];
  370. this.parent = void 0;
  371. recordEffectScope(this, scope);
  372. }
  373. run() {
  374. if (!this.active) {
  375. return this.fn();
  376. }
  377. let parent = activeEffect;
  378. let lastShouldTrack = shouldTrack;
  379. while (parent) {
  380. if (parent === this) {
  381. return;
  382. }
  383. parent = parent.parent;
  384. }
  385. try {
  386. this.parent = activeEffect;
  387. activeEffect = this;
  388. shouldTrack = true;
  389. trackOpBit = 1 << ++effectTrackDepth;
  390. if (effectTrackDepth <= maxMarkerBits) {
  391. initDepMarkers(this);
  392. } else {
  393. cleanupEffect(this);
  394. }
  395. return this.fn();
  396. } finally {
  397. if (effectTrackDepth <= maxMarkerBits) {
  398. finalizeDepMarkers(this);
  399. }
  400. trackOpBit = 1 << --effectTrackDepth;
  401. activeEffect = this.parent;
  402. shouldTrack = lastShouldTrack;
  403. this.parent = void 0;
  404. if (this.deferStop) {
  405. this.stop();
  406. }
  407. }
  408. }
  409. stop() {
  410. if (activeEffect === this) {
  411. this.deferStop = true;
  412. } else if (this.active) {
  413. cleanupEffect(this);
  414. if (this.onStop) {
  415. this.onStop();
  416. }
  417. this.active = false;
  418. }
  419. }
  420. }
  421. function cleanupEffect(effect2) {
  422. const { deps } = effect2;
  423. if (deps.length) {
  424. for (let i = 0; i < deps.length; i++) {
  425. deps[i].delete(effect2);
  426. }
  427. deps.length = 0;
  428. }
  429. }
  430. let shouldTrack = true;
  431. const trackStack = [];
  432. function pauseTracking() {
  433. trackStack.push(shouldTrack);
  434. shouldTrack = false;
  435. }
  436. function resetTracking() {
  437. const last = trackStack.pop();
  438. shouldTrack = last === void 0 ? true : last;
  439. }
  440. function track(target, type2, key) {
  441. if (shouldTrack && activeEffect) {
  442. let depsMap = targetMap.get(target);
  443. if (!depsMap) {
  444. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  445. }
  446. let dep = depsMap.get(key);
  447. if (!dep) {
  448. depsMap.set(key, dep = createDep());
  449. }
  450. trackEffects(dep);
  451. }
  452. }
  453. function trackEffects(dep, debuggerEventExtraInfo) {
  454. let shouldTrack2 = false;
  455. if (effectTrackDepth <= maxMarkerBits) {
  456. if (!newTracked(dep)) {
  457. dep.n |= trackOpBit;
  458. shouldTrack2 = !wasTracked(dep);
  459. }
  460. } else {
  461. shouldTrack2 = !dep.has(activeEffect);
  462. }
  463. if (shouldTrack2) {
  464. dep.add(activeEffect);
  465. activeEffect.deps.push(dep);
  466. }
  467. }
  468. function trigger(target, type2, key, newValue, oldValue, oldTarget) {
  469. const depsMap = targetMap.get(target);
  470. if (!depsMap) {
  471. return;
  472. }
  473. let deps = [];
  474. if (type2 === "clear") {
  475. deps = [...depsMap.values()];
  476. } else if (key === "length" && isArray$3(target)) {
  477. const newLength = Number(newValue);
  478. depsMap.forEach((dep, key2) => {
  479. if (key2 === "length" || !isSymbol$1(key2) && key2 >= newLength) {
  480. deps.push(dep);
  481. }
  482. });
  483. } else {
  484. if (key !== void 0) {
  485. deps.push(depsMap.get(key));
  486. }
  487. switch (type2) {
  488. case "add":
  489. if (!isArray$3(target)) {
  490. deps.push(depsMap.get(ITERATE_KEY));
  491. if (isMap$2(target)) {
  492. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  493. }
  494. } else if (isIntegerKey(key)) {
  495. deps.push(depsMap.get("length"));
  496. }
  497. break;
  498. case "delete":
  499. if (!isArray$3(target)) {
  500. deps.push(depsMap.get(ITERATE_KEY));
  501. if (isMap$2(target)) {
  502. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  503. }
  504. }
  505. break;
  506. case "set":
  507. if (isMap$2(target)) {
  508. deps.push(depsMap.get(ITERATE_KEY));
  509. }
  510. break;
  511. }
  512. }
  513. if (deps.length === 1) {
  514. if (deps[0]) {
  515. {
  516. triggerEffects(deps[0]);
  517. }
  518. }
  519. } else {
  520. const effects = [];
  521. for (const dep of deps) {
  522. if (dep) {
  523. effects.push(...dep);
  524. }
  525. }
  526. {
  527. triggerEffects(createDep(effects));
  528. }
  529. }
  530. }
  531. function triggerEffects(dep, debuggerEventExtraInfo) {
  532. const effects = isArray$3(dep) ? dep : [...dep];
  533. for (const effect2 of effects) {
  534. if (effect2.computed) {
  535. triggerEffect(effect2);
  536. }
  537. }
  538. for (const effect2 of effects) {
  539. if (!effect2.computed) {
  540. triggerEffect(effect2);
  541. }
  542. }
  543. }
  544. function triggerEffect(effect2, debuggerEventExtraInfo) {
  545. if (effect2 !== activeEffect || effect2.allowRecurse) {
  546. if (effect2.scheduler) {
  547. effect2.scheduler();
  548. } else {
  549. effect2.run();
  550. }
  551. }
  552. }
  553. function getDepFromReactive(object2, key) {
  554. var _a2;
  555. return (_a2 = targetMap.get(object2)) == null ? void 0 : _a2.get(key);
  556. }
  557. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  558. const builtInSymbols = new Set(
  559. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol$1)
  560. );
  561. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  562. function createArrayInstrumentations() {
  563. const instrumentations = {};
  564. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  565. instrumentations[key] = function(...args) {
  566. const arr = toRaw(this);
  567. for (let i = 0, l2 = this.length; i < l2; i++) {
  568. track(arr, "get", i + "");
  569. }
  570. const res = arr[key](...args);
  571. if (res === -1 || res === false) {
  572. return arr[key](...args.map(toRaw));
  573. } else {
  574. return res;
  575. }
  576. };
  577. });
  578. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  579. instrumentations[key] = function(...args) {
  580. pauseTracking();
  581. const res = toRaw(this)[key].apply(this, args);
  582. resetTracking();
  583. return res;
  584. };
  585. });
  586. return instrumentations;
  587. }
  588. function hasOwnProperty$d(key) {
  589. const obj = toRaw(this);
  590. track(obj, "has", key);
  591. return obj.hasOwnProperty(key);
  592. }
  593. class BaseReactiveHandler {
  594. constructor(_isReadonly = false, _shallow = false) {
  595. this._isReadonly = _isReadonly;
  596. this._shallow = _shallow;
  597. }
  598. get(target, key, receiver) {
  599. const isReadonly2 = this._isReadonly, shallow = this._shallow;
  600. if (key === "__v_isReactive") {
  601. return !isReadonly2;
  602. } else if (key === "__v_isReadonly") {
  603. return isReadonly2;
  604. } else if (key === "__v_isShallow") {
  605. return shallow;
  606. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  607. return target;
  608. }
  609. const targetIsArray = isArray$3(target);
  610. if (!isReadonly2) {
  611. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  612. return Reflect.get(arrayInstrumentations, key, receiver);
  613. }
  614. if (key === "hasOwnProperty") {
  615. return hasOwnProperty$d;
  616. }
  617. }
  618. const res = Reflect.get(target, key, receiver);
  619. if (isSymbol$1(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  620. return res;
  621. }
  622. if (!isReadonly2) {
  623. track(target, "get", key);
  624. }
  625. if (shallow) {
  626. return res;
  627. }
  628. if (isRef(res)) {
  629. return targetIsArray && isIntegerKey(key) ? res : res.value;
  630. }
  631. if (isObject$1(res)) {
  632. return isReadonly2 ? readonly(res) : reactive(res);
  633. }
  634. return res;
  635. }
  636. }
  637. class MutableReactiveHandler extends BaseReactiveHandler {
  638. constructor(shallow = false) {
  639. super(false, shallow);
  640. }
  641. set(target, key, value, receiver) {
  642. let oldValue = target[key];
  643. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  644. return false;
  645. }
  646. if (!this._shallow) {
  647. if (!isShallow(value) && !isReadonly(value)) {
  648. oldValue = toRaw(oldValue);
  649. value = toRaw(value);
  650. }
  651. if (!isArray$3(target) && isRef(oldValue) && !isRef(value)) {
  652. oldValue.value = value;
  653. return true;
  654. }
  655. }
  656. const hadKey = isArray$3(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  657. const result = Reflect.set(target, key, value, receiver);
  658. if (target === toRaw(receiver)) {
  659. if (!hadKey) {
  660. trigger(target, "add", key, value);
  661. } else if (hasChanged(value, oldValue)) {
  662. trigger(target, "set", key, value);
  663. }
  664. }
  665. return result;
  666. }
  667. deleteProperty(target, key) {
  668. const hadKey = hasOwn(target, key);
  669. target[key];
  670. const result = Reflect.deleteProperty(target, key);
  671. if (result && hadKey) {
  672. trigger(target, "delete", key, void 0);
  673. }
  674. return result;
  675. }
  676. has(target, key) {
  677. const result = Reflect.has(target, key);
  678. if (!isSymbol$1(key) || !builtInSymbols.has(key)) {
  679. track(target, "has", key);
  680. }
  681. return result;
  682. }
  683. ownKeys(target) {
  684. track(
  685. target,
  686. "iterate",
  687. isArray$3(target) ? "length" : ITERATE_KEY
  688. );
  689. return Reflect.ownKeys(target);
  690. }
  691. }
  692. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  693. constructor(shallow = false) {
  694. super(true, shallow);
  695. }
  696. set(target, key) {
  697. return true;
  698. }
  699. deleteProperty(target, key) {
  700. return true;
  701. }
  702. }
  703. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  704. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  705. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
  706. true
  707. );
  708. const toShallow = (value) => value;
  709. const getProto = (v2) => Reflect.getPrototypeOf(v2);
  710. function get$1(target, key, isReadonly2 = false, isShallow2 = false) {
  711. target = target["__v_raw"];
  712. const rawTarget = toRaw(target);
  713. const rawKey = toRaw(key);
  714. if (!isReadonly2) {
  715. if (hasChanged(key, rawKey)) {
  716. track(rawTarget, "get", key);
  717. }
  718. track(rawTarget, "get", rawKey);
  719. }
  720. const { has: has2 } = getProto(rawTarget);
  721. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  722. if (has2.call(rawTarget, key)) {
  723. return wrap(target.get(key));
  724. } else if (has2.call(rawTarget, rawKey)) {
  725. return wrap(target.get(rawKey));
  726. } else if (target !== rawTarget) {
  727. target.get(key);
  728. }
  729. }
  730. function has(key, isReadonly2 = false) {
  731. const target = this["__v_raw"];
  732. const rawTarget = toRaw(target);
  733. const rawKey = toRaw(key);
  734. if (!isReadonly2) {
  735. if (hasChanged(key, rawKey)) {
  736. track(rawTarget, "has", key);
  737. }
  738. track(rawTarget, "has", rawKey);
  739. }
  740. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  741. }
  742. function size(target, isReadonly2 = false) {
  743. target = target["__v_raw"];
  744. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  745. return Reflect.get(target, "size", target);
  746. }
  747. function add(value) {
  748. value = toRaw(value);
  749. const target = toRaw(this);
  750. const proto = getProto(target);
  751. const hadKey = proto.has.call(target, value);
  752. if (!hadKey) {
  753. target.add(value);
  754. trigger(target, "add", value, value);
  755. }
  756. return this;
  757. }
  758. function set$1(key, value) {
  759. value = toRaw(value);
  760. const target = toRaw(this);
  761. const { has: has2, get: get2 } = getProto(target);
  762. let hadKey = has2.call(target, key);
  763. if (!hadKey) {
  764. key = toRaw(key);
  765. hadKey = has2.call(target, key);
  766. }
  767. const oldValue = get2.call(target, key);
  768. target.set(key, value);
  769. if (!hadKey) {
  770. trigger(target, "add", key, value);
  771. } else if (hasChanged(value, oldValue)) {
  772. trigger(target, "set", key, value);
  773. }
  774. return this;
  775. }
  776. function deleteEntry(key) {
  777. const target = toRaw(this);
  778. const { has: has2, get: get2 } = getProto(target);
  779. let hadKey = has2.call(target, key);
  780. if (!hadKey) {
  781. key = toRaw(key);
  782. hadKey = has2.call(target, key);
  783. }
  784. get2 ? get2.call(target, key) : void 0;
  785. const result = target.delete(key);
  786. if (hadKey) {
  787. trigger(target, "delete", key, void 0);
  788. }
  789. return result;
  790. }
  791. function clear() {
  792. const target = toRaw(this);
  793. const hadItems = target.size !== 0;
  794. const result = target.clear();
  795. if (hadItems) {
  796. trigger(target, "clear", void 0, void 0);
  797. }
  798. return result;
  799. }
  800. function createForEach(isReadonly2, isShallow2) {
  801. return function forEach(callback, thisArg) {
  802. const observed = this;
  803. const target = observed["__v_raw"];
  804. const rawTarget = toRaw(target);
  805. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  806. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  807. return target.forEach((value, key) => {
  808. return callback.call(thisArg, wrap(value), wrap(key), observed);
  809. });
  810. };
  811. }
  812. function createIterableMethod(method2, isReadonly2, isShallow2) {
  813. return function(...args) {
  814. const target = this["__v_raw"];
  815. const rawTarget = toRaw(target);
  816. const targetIsMap = isMap$2(rawTarget);
  817. const isPair = method2 === "entries" || method2 === Symbol.iterator && targetIsMap;
  818. const isKeyOnly = method2 === "keys" && targetIsMap;
  819. const innerIterator = target[method2](...args);
  820. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  821. !isReadonly2 && track(
  822. rawTarget,
  823. "iterate",
  824. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  825. );
  826. return {
  827. // iterator protocol
  828. next() {
  829. const { value, done } = innerIterator.next();
  830. return done ? { value, done } : {
  831. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  832. done
  833. };
  834. },
  835. // iterable protocol
  836. [Symbol.iterator]() {
  837. return this;
  838. }
  839. };
  840. };
  841. }
  842. function createReadonlyMethod(type2) {
  843. return function(...args) {
  844. return type2 === "delete" ? false : type2 === "clear" ? void 0 : this;
  845. };
  846. }
  847. function createInstrumentations() {
  848. const mutableInstrumentations2 = {
  849. get(key) {
  850. return get$1(this, key);
  851. },
  852. get size() {
  853. return size(this);
  854. },
  855. has,
  856. add,
  857. set: set$1,
  858. delete: deleteEntry,
  859. clear,
  860. forEach: createForEach(false, false)
  861. };
  862. const shallowInstrumentations2 = {
  863. get(key) {
  864. return get$1(this, key, false, true);
  865. },
  866. get size() {
  867. return size(this);
  868. },
  869. has,
  870. add,
  871. set: set$1,
  872. delete: deleteEntry,
  873. clear,
  874. forEach: createForEach(false, true)
  875. };
  876. const readonlyInstrumentations2 = {
  877. get(key) {
  878. return get$1(this, key, true);
  879. },
  880. get size() {
  881. return size(this, true);
  882. },
  883. has(key) {
  884. return has.call(this, key, true);
  885. },
  886. add: createReadonlyMethod("add"),
  887. set: createReadonlyMethod("set"),
  888. delete: createReadonlyMethod("delete"),
  889. clear: createReadonlyMethod("clear"),
  890. forEach: createForEach(true, false)
  891. };
  892. const shallowReadonlyInstrumentations2 = {
  893. get(key) {
  894. return get$1(this, key, true, true);
  895. },
  896. get size() {
  897. return size(this, true);
  898. },
  899. has(key) {
  900. return has.call(this, key, true);
  901. },
  902. add: createReadonlyMethod("add"),
  903. set: createReadonlyMethod("set"),
  904. delete: createReadonlyMethod("delete"),
  905. clear: createReadonlyMethod("clear"),
  906. forEach: createForEach(true, true)
  907. };
  908. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  909. iteratorMethods.forEach((method2) => {
  910. mutableInstrumentations2[method2] = createIterableMethod(
  911. method2,
  912. false,
  913. false
  914. );
  915. readonlyInstrumentations2[method2] = createIterableMethod(
  916. method2,
  917. true,
  918. false
  919. );
  920. shallowInstrumentations2[method2] = createIterableMethod(
  921. method2,
  922. false,
  923. true
  924. );
  925. shallowReadonlyInstrumentations2[method2] = createIterableMethod(
  926. method2,
  927. true,
  928. true
  929. );
  930. });
  931. return [
  932. mutableInstrumentations2,
  933. readonlyInstrumentations2,
  934. shallowInstrumentations2,
  935. shallowReadonlyInstrumentations2
  936. ];
  937. }
  938. const [
  939. mutableInstrumentations,
  940. readonlyInstrumentations,
  941. shallowInstrumentations,
  942. shallowReadonlyInstrumentations
  943. ] = /* @__PURE__ */ createInstrumentations();
  944. function createInstrumentationGetter(isReadonly2, shallow) {
  945. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  946. return (target, key, receiver) => {
  947. if (key === "__v_isReactive") {
  948. return !isReadonly2;
  949. } else if (key === "__v_isReadonly") {
  950. return isReadonly2;
  951. } else if (key === "__v_raw") {
  952. return target;
  953. }
  954. return Reflect.get(
  955. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  956. key,
  957. receiver
  958. );
  959. };
  960. }
  961. const mutableCollectionHandlers = {
  962. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  963. };
  964. const shallowCollectionHandlers = {
  965. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  966. };
  967. const readonlyCollectionHandlers = {
  968. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  969. };
  970. const reactiveMap = /* @__PURE__ */ new WeakMap();
  971. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  972. const readonlyMap = /* @__PURE__ */ new WeakMap();
  973. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  974. function targetTypeMap(rawType) {
  975. switch (rawType) {
  976. case "Object":
  977. case "Array":
  978. return 1;
  979. case "Map":
  980. case "Set":
  981. case "WeakMap":
  982. case "WeakSet":
  983. return 2;
  984. default:
  985. return 0;
  986. }
  987. }
  988. function getTargetType(value) {
  989. return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
  990. }
  991. function reactive(target) {
  992. if (isReadonly(target)) {
  993. return target;
  994. }
  995. return createReactiveObject(
  996. target,
  997. false,
  998. mutableHandlers,
  999. mutableCollectionHandlers,
  1000. reactiveMap
  1001. );
  1002. }
  1003. function shallowReactive(target) {
  1004. return createReactiveObject(
  1005. target,
  1006. false,
  1007. shallowReactiveHandlers,
  1008. shallowCollectionHandlers,
  1009. shallowReactiveMap
  1010. );
  1011. }
  1012. function readonly(target) {
  1013. return createReactiveObject(
  1014. target,
  1015. true,
  1016. readonlyHandlers,
  1017. readonlyCollectionHandlers,
  1018. readonlyMap
  1019. );
  1020. }
  1021. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1022. if (!isObject$1(target)) {
  1023. return target;
  1024. }
  1025. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1026. return target;
  1027. }
  1028. const existingProxy = proxyMap.get(target);
  1029. if (existingProxy) {
  1030. return existingProxy;
  1031. }
  1032. const targetType = getTargetType(target);
  1033. if (targetType === 0) {
  1034. return target;
  1035. }
  1036. const proxy = new Proxy(
  1037. target,
  1038. targetType === 2 ? collectionHandlers : baseHandlers
  1039. );
  1040. proxyMap.set(target, proxy);
  1041. return proxy;
  1042. }
  1043. function isReactive(value) {
  1044. if (isReadonly(value)) {
  1045. return isReactive(value["__v_raw"]);
  1046. }
  1047. return !!(value && value["__v_isReactive"]);
  1048. }
  1049. function isReadonly(value) {
  1050. return !!(value && value["__v_isReadonly"]);
  1051. }
  1052. function isShallow(value) {
  1053. return !!(value && value["__v_isShallow"]);
  1054. }
  1055. function isProxy(value) {
  1056. return isReactive(value) || isReadonly(value);
  1057. }
  1058. function toRaw(observed) {
  1059. const raw = observed && observed["__v_raw"];
  1060. return raw ? toRaw(raw) : observed;
  1061. }
  1062. function markRaw(value) {
  1063. def(value, "__v_skip", true);
  1064. return value;
  1065. }
  1066. const toReactive = (value) => isObject$1(value) ? reactive(value) : value;
  1067. const toReadonly = (value) => isObject$1(value) ? readonly(value) : value;
  1068. function trackRefValue(ref2) {
  1069. if (shouldTrack && activeEffect) {
  1070. ref2 = toRaw(ref2);
  1071. {
  1072. trackEffects(ref2.dep || (ref2.dep = createDep()));
  1073. }
  1074. }
  1075. }
  1076. function triggerRefValue(ref2, newVal) {
  1077. ref2 = toRaw(ref2);
  1078. const dep = ref2.dep;
  1079. if (dep) {
  1080. {
  1081. triggerEffects(dep);
  1082. }
  1083. }
  1084. }
  1085. function isRef(r) {
  1086. return !!(r && r.__v_isRef === true);
  1087. }
  1088. function ref(value) {
  1089. return createRef(value, false);
  1090. }
  1091. function shallowRef(value) {
  1092. return createRef(value, true);
  1093. }
  1094. function createRef(rawValue, shallow) {
  1095. if (isRef(rawValue)) {
  1096. return rawValue;
  1097. }
  1098. return new RefImpl(rawValue, shallow);
  1099. }
  1100. class RefImpl {
  1101. constructor(value, __v_isShallow) {
  1102. this.__v_isShallow = __v_isShallow;
  1103. this.dep = void 0;
  1104. this.__v_isRef = true;
  1105. this._rawValue = __v_isShallow ? value : toRaw(value);
  1106. this._value = __v_isShallow ? value : toReactive(value);
  1107. }
  1108. get value() {
  1109. trackRefValue(this);
  1110. return this._value;
  1111. }
  1112. set value(newVal) {
  1113. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  1114. newVal = useDirectValue ? newVal : toRaw(newVal);
  1115. if (hasChanged(newVal, this._rawValue)) {
  1116. this._rawValue = newVal;
  1117. this._value = useDirectValue ? newVal : toReactive(newVal);
  1118. triggerRefValue(this);
  1119. }
  1120. }
  1121. }
  1122. function triggerRef(ref2) {
  1123. triggerRefValue(ref2);
  1124. }
  1125. function unref(ref2) {
  1126. return isRef(ref2) ? ref2.value : ref2;
  1127. }
  1128. const shallowUnwrapHandlers = {
  1129. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  1130. set: (target, key, value, receiver) => {
  1131. const oldValue = target[key];
  1132. if (isRef(oldValue) && !isRef(value)) {
  1133. oldValue.value = value;
  1134. return true;
  1135. } else {
  1136. return Reflect.set(target, key, value, receiver);
  1137. }
  1138. }
  1139. };
  1140. function proxyRefs(objectWithRefs) {
  1141. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1142. }
  1143. function toRefs(object2) {
  1144. const ret = isArray$3(object2) ? new Array(object2.length) : {};
  1145. for (const key in object2) {
  1146. ret[key] = propertyToRef(object2, key);
  1147. }
  1148. return ret;
  1149. }
  1150. class ObjectRefImpl {
  1151. constructor(_object, _key, _defaultValue) {
  1152. this._object = _object;
  1153. this._key = _key;
  1154. this._defaultValue = _defaultValue;
  1155. this.__v_isRef = true;
  1156. }
  1157. get value() {
  1158. const val = this._object[this._key];
  1159. return val === void 0 ? this._defaultValue : val;
  1160. }
  1161. set value(newVal) {
  1162. this._object[this._key] = newVal;
  1163. }
  1164. get dep() {
  1165. return getDepFromReactive(toRaw(this._object), this._key);
  1166. }
  1167. }
  1168. class GetterRefImpl {
  1169. constructor(_getter) {
  1170. this._getter = _getter;
  1171. this.__v_isRef = true;
  1172. this.__v_isReadonly = true;
  1173. }
  1174. get value() {
  1175. return this._getter();
  1176. }
  1177. }
  1178. function toRef(source, key, defaultValue) {
  1179. if (isRef(source)) {
  1180. return source;
  1181. } else if (isFunction$2(source)) {
  1182. return new GetterRefImpl(source);
  1183. } else if (isObject$1(source) && arguments.length > 1) {
  1184. return propertyToRef(source, key, defaultValue);
  1185. } else {
  1186. return ref(source);
  1187. }
  1188. }
  1189. function propertyToRef(source, key, defaultValue) {
  1190. const val = source[key];
  1191. return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
  1192. }
  1193. class ComputedRefImpl {
  1194. constructor(getter, _setter, isReadonly2, isSSR) {
  1195. this._setter = _setter;
  1196. this.dep = void 0;
  1197. this.__v_isRef = true;
  1198. this["__v_isReadonly"] = false;
  1199. this._dirty = true;
  1200. this.effect = new ReactiveEffect(getter, () => {
  1201. if (!this._dirty) {
  1202. this._dirty = true;
  1203. triggerRefValue(this);
  1204. }
  1205. });
  1206. this.effect.computed = this;
  1207. this.effect.active = this._cacheable = !isSSR;
  1208. this["__v_isReadonly"] = isReadonly2;
  1209. }
  1210. get value() {
  1211. const self2 = toRaw(this);
  1212. trackRefValue(self2);
  1213. if (self2._dirty || !self2._cacheable) {
  1214. self2._dirty = false;
  1215. self2._value = self2.effect.run();
  1216. }
  1217. return self2._value;
  1218. }
  1219. set value(newValue) {
  1220. this._setter(newValue);
  1221. }
  1222. }
  1223. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  1224. let getter;
  1225. let setter;
  1226. const onlyGetter = isFunction$2(getterOrOptions);
  1227. if (onlyGetter) {
  1228. getter = getterOrOptions;
  1229. setter = NOOP;
  1230. } else {
  1231. getter = getterOrOptions.get;
  1232. setter = getterOrOptions.set;
  1233. }
  1234. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  1235. return cRef;
  1236. }
  1237. function warn(msg, ...args) {
  1238. return;
  1239. }
  1240. function callWithErrorHandling(fn2, instance, type2, args) {
  1241. let res;
  1242. try {
  1243. res = args ? fn2(...args) : fn2();
  1244. } catch (err) {
  1245. handleError(err, instance, type2);
  1246. }
  1247. return res;
  1248. }
  1249. function callWithAsyncErrorHandling(fn2, instance, type2, args) {
  1250. if (isFunction$2(fn2)) {
  1251. const res = callWithErrorHandling(fn2, instance, type2, args);
  1252. if (res && isPromise(res)) {
  1253. res.catch((err) => {
  1254. handleError(err, instance, type2);
  1255. });
  1256. }
  1257. return res;
  1258. }
  1259. const values = [];
  1260. for (let i = 0; i < fn2.length; i++) {
  1261. values.push(callWithAsyncErrorHandling(fn2[i], instance, type2, args));
  1262. }
  1263. return values;
  1264. }
  1265. function handleError(err, instance, type2, throwInDev = true) {
  1266. const contextVNode = instance ? instance.vnode : null;
  1267. if (instance) {
  1268. let cur = instance.parent;
  1269. const exposedInstance = instance.proxy;
  1270. const errorInfo = type2;
  1271. while (cur) {
  1272. const errorCapturedHooks = cur.ec;
  1273. if (errorCapturedHooks) {
  1274. for (let i = 0; i < errorCapturedHooks.length; i++) {
  1275. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  1276. return;
  1277. }
  1278. }
  1279. }
  1280. cur = cur.parent;
  1281. }
  1282. const appErrorHandler = instance.appContext.config.errorHandler;
  1283. if (appErrorHandler) {
  1284. callWithErrorHandling(
  1285. appErrorHandler,
  1286. null,
  1287. 10,
  1288. [err, exposedInstance, errorInfo]
  1289. );
  1290. return;
  1291. }
  1292. }
  1293. logError(err, type2, contextVNode, throwInDev);
  1294. }
  1295. function logError(err, type2, contextVNode, throwInDev = true) {
  1296. {
  1297. console.error(err);
  1298. }
  1299. }
  1300. let isFlushing = false;
  1301. let isFlushPending = false;
  1302. const queue = [];
  1303. let flushIndex = 0;
  1304. const pendingPostFlushCbs = [];
  1305. let activePostFlushCbs = null;
  1306. let postFlushIndex = 0;
  1307. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  1308. let currentFlushPromise = null;
  1309. function nextTick(fn2) {
  1310. const p2 = currentFlushPromise || resolvedPromise;
  1311. return fn2 ? p2.then(this ? fn2.bind(this) : fn2) : p2;
  1312. }
  1313. function findInsertionIndex(id) {
  1314. let start = flushIndex + 1;
  1315. let end2 = queue.length;
  1316. while (start < end2) {
  1317. const middle = start + end2 >>> 1;
  1318. const middleJob = queue[middle];
  1319. const middleJobId = getId(middleJob);
  1320. if (middleJobId < id || middleJobId === id && middleJob.pre) {
  1321. start = middle + 1;
  1322. } else {
  1323. end2 = middle;
  1324. }
  1325. }
  1326. return start;
  1327. }
  1328. function queueJob(job) {
  1329. if (!queue.length || !queue.includes(
  1330. job,
  1331. isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
  1332. )) {
  1333. if (job.id == null) {
  1334. queue.push(job);
  1335. } else {
  1336. queue.splice(findInsertionIndex(job.id), 0, job);
  1337. }
  1338. queueFlush();
  1339. }
  1340. }
  1341. function queueFlush() {
  1342. if (!isFlushing && !isFlushPending) {
  1343. isFlushPending = true;
  1344. currentFlushPromise = resolvedPromise.then(flushJobs);
  1345. }
  1346. }
  1347. function invalidateJob(job) {
  1348. const i = queue.indexOf(job);
  1349. if (i > flushIndex) {
  1350. queue.splice(i, 1);
  1351. }
  1352. }
  1353. function queuePostFlushCb(cb) {
  1354. if (!isArray$3(cb)) {
  1355. if (!activePostFlushCbs || !activePostFlushCbs.includes(
  1356. cb,
  1357. cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
  1358. )) {
  1359. pendingPostFlushCbs.push(cb);
  1360. }
  1361. } else {
  1362. pendingPostFlushCbs.push(...cb);
  1363. }
  1364. queueFlush();
  1365. }
  1366. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  1367. for (; i < queue.length; i++) {
  1368. const cb = queue[i];
  1369. if (cb && cb.pre) {
  1370. queue.splice(i, 1);
  1371. i--;
  1372. cb();
  1373. }
  1374. }
  1375. }
  1376. function flushPostFlushCbs(seen) {
  1377. if (pendingPostFlushCbs.length) {
  1378. const deduped = [...new Set(pendingPostFlushCbs)];
  1379. pendingPostFlushCbs.length = 0;
  1380. if (activePostFlushCbs) {
  1381. activePostFlushCbs.push(...deduped);
  1382. return;
  1383. }
  1384. activePostFlushCbs = deduped;
  1385. activePostFlushCbs.sort((a2, b2) => getId(a2) - getId(b2));
  1386. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  1387. activePostFlushCbs[postFlushIndex]();
  1388. }
  1389. activePostFlushCbs = null;
  1390. postFlushIndex = 0;
  1391. }
  1392. }
  1393. const getId = (job) => job.id == null ? Infinity : job.id;
  1394. const comparator = (a2, b2) => {
  1395. const diff = getId(a2) - getId(b2);
  1396. if (diff === 0) {
  1397. if (a2.pre && !b2.pre)
  1398. return -1;
  1399. if (b2.pre && !a2.pre)
  1400. return 1;
  1401. }
  1402. return diff;
  1403. };
  1404. function flushJobs(seen) {
  1405. isFlushPending = false;
  1406. isFlushing = true;
  1407. queue.sort(comparator);
  1408. const check = NOOP;
  1409. try {
  1410. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  1411. const job = queue[flushIndex];
  1412. if (job && job.active !== false) {
  1413. if (false)
  1414. ;
  1415. callWithErrorHandling(job, null, 14);
  1416. }
  1417. }
  1418. } finally {
  1419. flushIndex = 0;
  1420. queue.length = 0;
  1421. flushPostFlushCbs();
  1422. isFlushing = false;
  1423. currentFlushPromise = null;
  1424. if (queue.length || pendingPostFlushCbs.length) {
  1425. flushJobs();
  1426. }
  1427. }
  1428. }
  1429. function emit(instance, event, ...rawArgs) {
  1430. if (instance.isUnmounted)
  1431. return;
  1432. const props = instance.vnode.props || EMPTY_OBJ;
  1433. let args = rawArgs;
  1434. const isModelListener2 = event.startsWith("update:");
  1435. const modelArg = isModelListener2 && event.slice(7);
  1436. if (modelArg && modelArg in props) {
  1437. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  1438. const { number: number2, trim } = props[modifiersKey] || EMPTY_OBJ;
  1439. if (trim) {
  1440. args = rawArgs.map((a2) => isString$1(a2) ? a2.trim() : a2);
  1441. }
  1442. if (number2) {
  1443. args = rawArgs.map(looseToNumber);
  1444. }
  1445. }
  1446. let handlerName;
  1447. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  1448. props[handlerName = toHandlerKey(camelize(event))];
  1449. if (!handler && isModelListener2) {
  1450. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  1451. }
  1452. if (handler) {
  1453. callWithAsyncErrorHandling(
  1454. handler,
  1455. instance,
  1456. 6,
  1457. args
  1458. );
  1459. }
  1460. const onceHandler = props[handlerName + `Once`];
  1461. if (onceHandler) {
  1462. if (!instance.emitted) {
  1463. instance.emitted = {};
  1464. } else if (instance.emitted[handlerName]) {
  1465. return;
  1466. }
  1467. instance.emitted[handlerName] = true;
  1468. callWithAsyncErrorHandling(
  1469. onceHandler,
  1470. instance,
  1471. 6,
  1472. args
  1473. );
  1474. }
  1475. }
  1476. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  1477. const cache2 = appContext.emitsCache;
  1478. const cached = cache2.get(comp);
  1479. if (cached !== void 0) {
  1480. return cached;
  1481. }
  1482. const raw = comp.emits;
  1483. let normalized = {};
  1484. let hasExtends = false;
  1485. if (!isFunction$2(comp)) {
  1486. const extendEmits = (raw2) => {
  1487. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  1488. if (normalizedFromExtend) {
  1489. hasExtends = true;
  1490. extend(normalized, normalizedFromExtend);
  1491. }
  1492. };
  1493. if (!asMixin && appContext.mixins.length) {
  1494. appContext.mixins.forEach(extendEmits);
  1495. }
  1496. if (comp.extends) {
  1497. extendEmits(comp.extends);
  1498. }
  1499. if (comp.mixins) {
  1500. comp.mixins.forEach(extendEmits);
  1501. }
  1502. }
  1503. if (!raw && !hasExtends) {
  1504. if (isObject$1(comp)) {
  1505. cache2.set(comp, null);
  1506. }
  1507. return null;
  1508. }
  1509. if (isArray$3(raw)) {
  1510. raw.forEach((key) => normalized[key] = null);
  1511. } else {
  1512. extend(normalized, raw);
  1513. }
  1514. if (isObject$1(comp)) {
  1515. cache2.set(comp, normalized);
  1516. }
  1517. return normalized;
  1518. }
  1519. function isEmitListener(options, key) {
  1520. if (!options || !isOn(key)) {
  1521. return false;
  1522. }
  1523. key = key.slice(2).replace(/Once$/, "");
  1524. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  1525. }
  1526. let currentRenderingInstance = null;
  1527. let currentScopeId = null;
  1528. function setCurrentRenderingInstance(instance) {
  1529. const prev = currentRenderingInstance;
  1530. currentRenderingInstance = instance;
  1531. currentScopeId = instance && instance.type.__scopeId || null;
  1532. return prev;
  1533. }
  1534. function pushScopeId(id) {
  1535. currentScopeId = id;
  1536. }
  1537. function popScopeId() {
  1538. currentScopeId = null;
  1539. }
  1540. function withCtx(fn2, ctx = currentRenderingInstance, isNonScopedSlot) {
  1541. if (!ctx)
  1542. return fn2;
  1543. if (fn2._n) {
  1544. return fn2;
  1545. }
  1546. const renderFnWithContext = (...args) => {
  1547. if (renderFnWithContext._d) {
  1548. setBlockTracking(-1);
  1549. }
  1550. const prevInstance = setCurrentRenderingInstance(ctx);
  1551. let res;
  1552. try {
  1553. res = fn2(...args);
  1554. } finally {
  1555. setCurrentRenderingInstance(prevInstance);
  1556. if (renderFnWithContext._d) {
  1557. setBlockTracking(1);
  1558. }
  1559. }
  1560. return res;
  1561. };
  1562. renderFnWithContext._n = true;
  1563. renderFnWithContext._c = true;
  1564. renderFnWithContext._d = true;
  1565. return renderFnWithContext;
  1566. }
  1567. function markAttrsAccessed() {
  1568. }
  1569. function renderComponentRoot(instance) {
  1570. const {
  1571. type: Component,
  1572. vnode,
  1573. proxy,
  1574. withProxy,
  1575. props,
  1576. propsOptions: [propsOptions],
  1577. slots,
  1578. attrs,
  1579. emit: emit2,
  1580. render: render2,
  1581. renderCache,
  1582. data,
  1583. setupState,
  1584. ctx,
  1585. inheritAttrs
  1586. } = instance;
  1587. let result;
  1588. let fallthroughAttrs;
  1589. const prev = setCurrentRenderingInstance(instance);
  1590. try {
  1591. if (vnode.shapeFlag & 4) {
  1592. const proxyToUse = withProxy || proxy;
  1593. const thisProxy = false ? new Proxy(proxyToUse, {
  1594. get(target, key, receiver) {
  1595. warn(
  1596. `Property '${String(
  1597. key
  1598. )}' was accessed via 'this'. Avoid using 'this' in templates.`
  1599. );
  1600. return Reflect.get(target, key, receiver);
  1601. }
  1602. }) : proxyToUse;
  1603. result = normalizeVNode(
  1604. render2.call(
  1605. thisProxy,
  1606. proxyToUse,
  1607. renderCache,
  1608. props,
  1609. setupState,
  1610. data,
  1611. ctx
  1612. )
  1613. );
  1614. fallthroughAttrs = attrs;
  1615. } else {
  1616. const render22 = Component;
  1617. if (false)
  1618. ;
  1619. result = normalizeVNode(
  1620. render22.length > 1 ? render22(
  1621. props,
  1622. false ? {
  1623. get attrs() {
  1624. markAttrsAccessed();
  1625. return attrs;
  1626. },
  1627. slots,
  1628. emit: emit2
  1629. } : { attrs, slots, emit: emit2 }
  1630. ) : render22(
  1631. props,
  1632. null
  1633. /* we know it doesn't need it */
  1634. )
  1635. );
  1636. fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
  1637. }
  1638. } catch (err) {
  1639. blockStack.length = 0;
  1640. handleError(err, instance, 1);
  1641. result = createVNode(Comment);
  1642. }
  1643. let root2 = result;
  1644. if (fallthroughAttrs && inheritAttrs !== false) {
  1645. const keys2 = Object.keys(fallthroughAttrs);
  1646. const { shapeFlag } = root2;
  1647. if (keys2.length) {
  1648. if (shapeFlag & (1 | 6)) {
  1649. if (propsOptions && keys2.some(isModelListener)) {
  1650. fallthroughAttrs = filterModelListeners(
  1651. fallthroughAttrs,
  1652. propsOptions
  1653. );
  1654. }
  1655. root2 = cloneVNode(root2, fallthroughAttrs);
  1656. }
  1657. }
  1658. }
  1659. if (vnode.dirs) {
  1660. root2 = cloneVNode(root2);
  1661. root2.dirs = root2.dirs ? root2.dirs.concat(vnode.dirs) : vnode.dirs;
  1662. }
  1663. if (vnode.transition) {
  1664. root2.transition = vnode.transition;
  1665. }
  1666. {
  1667. result = root2;
  1668. }
  1669. setCurrentRenderingInstance(prev);
  1670. return result;
  1671. }
  1672. const getFunctionalFallthrough = (attrs) => {
  1673. let res;
  1674. for (const key in attrs) {
  1675. if (key === "class" || key === "style" || isOn(key)) {
  1676. (res || (res = {}))[key] = attrs[key];
  1677. }
  1678. }
  1679. return res;
  1680. };
  1681. const filterModelListeners = (attrs, props) => {
  1682. const res = {};
  1683. for (const key in attrs) {
  1684. if (!isModelListener(key) || !(key.slice(9) in props)) {
  1685. res[key] = attrs[key];
  1686. }
  1687. }
  1688. return res;
  1689. };
  1690. function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
  1691. const { props: prevProps, children: prevChildren, component: component2 } = prevVNode;
  1692. const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
  1693. const emits = component2.emitsOptions;
  1694. if (nextVNode.dirs || nextVNode.transition) {
  1695. return true;
  1696. }
  1697. if (optimized && patchFlag >= 0) {
  1698. if (patchFlag & 1024) {
  1699. return true;
  1700. }
  1701. if (patchFlag & 16) {
  1702. if (!prevProps) {
  1703. return !!nextProps;
  1704. }
  1705. return hasPropsChanged(prevProps, nextProps, emits);
  1706. } else if (patchFlag & 8) {
  1707. const dynamicProps = nextVNode.dynamicProps;
  1708. for (let i = 0; i < dynamicProps.length; i++) {
  1709. const key = dynamicProps[i];
  1710. if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
  1711. return true;
  1712. }
  1713. }
  1714. }
  1715. } else {
  1716. if (prevChildren || nextChildren) {
  1717. if (!nextChildren || !nextChildren.$stable) {
  1718. return true;
  1719. }
  1720. }
  1721. if (prevProps === nextProps) {
  1722. return false;
  1723. }
  1724. if (!prevProps) {
  1725. return !!nextProps;
  1726. }
  1727. if (!nextProps) {
  1728. return true;
  1729. }
  1730. return hasPropsChanged(prevProps, nextProps, emits);
  1731. }
  1732. return false;
  1733. }
  1734. function hasPropsChanged(prevProps, nextProps, emitsOptions) {
  1735. const nextKeys = Object.keys(nextProps);
  1736. if (nextKeys.length !== Object.keys(prevProps).length) {
  1737. return true;
  1738. }
  1739. for (let i = 0; i < nextKeys.length; i++) {
  1740. const key = nextKeys[i];
  1741. if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
  1742. return true;
  1743. }
  1744. }
  1745. return false;
  1746. }
  1747. function updateHOCHostEl({ vnode, parent }, el) {
  1748. while (parent && parent.subTree === vnode) {
  1749. (vnode = parent.vnode).el = el;
  1750. parent = parent.parent;
  1751. }
  1752. }
  1753. const COMPONENTS = "components";
  1754. const DIRECTIVES = "directives";
  1755. function resolveComponent(name, maybeSelfReference) {
  1756. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  1757. }
  1758. const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
  1759. function resolveDynamicComponent(component2) {
  1760. if (isString$1(component2)) {
  1761. return resolveAsset(COMPONENTS, component2, false) || component2;
  1762. } else {
  1763. return component2 || NULL_DYNAMIC_COMPONENT;
  1764. }
  1765. }
  1766. function resolveDirective(name) {
  1767. return resolveAsset(DIRECTIVES, name);
  1768. }
  1769. function resolveAsset(type2, name, warnMissing = true, maybeSelfReference = false) {
  1770. const instance = currentRenderingInstance || currentInstance;
  1771. if (instance) {
  1772. const Component = instance.type;
  1773. if (type2 === COMPONENTS) {
  1774. const selfName = getComponentName(
  1775. Component,
  1776. false
  1777. /* do not include inferred name to avoid breaking existing code */
  1778. );
  1779. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize$1(camelize(name)))) {
  1780. return Component;
  1781. }
  1782. }
  1783. const res = (
  1784. // local registration
  1785. // check instance[type] first which is resolved for options API
  1786. resolve(instance[type2] || Component[type2], name) || // global registration
  1787. resolve(instance.appContext[type2], name)
  1788. );
  1789. if (!res && maybeSelfReference) {
  1790. return Component;
  1791. }
  1792. return res;
  1793. }
  1794. }
  1795. function resolve(registry, name) {
  1796. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize$1(camelize(name))]);
  1797. }
  1798. const isSuspense = (type2) => type2.__isSuspense;
  1799. function queueEffectWithSuspense(fn2, suspense) {
  1800. if (suspense && suspense.pendingBranch) {
  1801. if (isArray$3(fn2)) {
  1802. suspense.effects.push(...fn2);
  1803. } else {
  1804. suspense.effects.push(fn2);
  1805. }
  1806. } else {
  1807. queuePostFlushCb(fn2);
  1808. }
  1809. }
  1810. function watchEffect(effect, options) {
  1811. return doWatch(effect, null, options);
  1812. }
  1813. const INITIAL_WATCHER_VALUE = {};
  1814. function watch(source, cb, options) {
  1815. return doWatch(source, cb, options);
  1816. }
  1817. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
  1818. var _a2;
  1819. const instance = getCurrentScope() === ((_a2 = currentInstance) == null ? void 0 : _a2.scope) ? currentInstance : null;
  1820. let getter;
  1821. let forceTrigger = false;
  1822. let isMultiSource = false;
  1823. if (isRef(source)) {
  1824. getter = () => source.value;
  1825. forceTrigger = isShallow(source);
  1826. } else if (isReactive(source)) {
  1827. getter = () => source;
  1828. deep = true;
  1829. } else if (isArray$3(source)) {
  1830. isMultiSource = true;
  1831. forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2));
  1832. getter = () => source.map((s2) => {
  1833. if (isRef(s2)) {
  1834. return s2.value;
  1835. } else if (isReactive(s2)) {
  1836. return traverse(s2);
  1837. } else if (isFunction$2(s2)) {
  1838. return callWithErrorHandling(s2, instance, 2);
  1839. } else
  1840. ;
  1841. });
  1842. } else if (isFunction$2(source)) {
  1843. if (cb) {
  1844. getter = () => callWithErrorHandling(source, instance, 2);
  1845. } else {
  1846. getter = () => {
  1847. if (instance && instance.isUnmounted) {
  1848. return;
  1849. }
  1850. if (cleanup) {
  1851. cleanup();
  1852. }
  1853. return callWithAsyncErrorHandling(
  1854. source,
  1855. instance,
  1856. 3,
  1857. [onCleanup]
  1858. );
  1859. };
  1860. }
  1861. } else {
  1862. getter = NOOP;
  1863. }
  1864. if (cb && deep) {
  1865. const baseGetter = getter;
  1866. getter = () => traverse(baseGetter());
  1867. }
  1868. let cleanup;
  1869. let onCleanup = (fn2) => {
  1870. cleanup = effect.onStop = () => {
  1871. callWithErrorHandling(fn2, instance, 4);
  1872. cleanup = effect.onStop = void 0;
  1873. };
  1874. };
  1875. let ssrCleanup;
  1876. if (isInSSRComponentSetup) {
  1877. onCleanup = NOOP;
  1878. if (!cb) {
  1879. getter();
  1880. } else if (immediate) {
  1881. callWithAsyncErrorHandling(cb, instance, 3, [
  1882. getter(),
  1883. isMultiSource ? [] : void 0,
  1884. onCleanup
  1885. ]);
  1886. }
  1887. if (flush === "sync") {
  1888. const ctx = useSSRContext();
  1889. ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
  1890. } else {
  1891. return NOOP;
  1892. }
  1893. }
  1894. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  1895. const job = () => {
  1896. if (!effect.active) {
  1897. return;
  1898. }
  1899. if (cb) {
  1900. const newValue = effect.run();
  1901. if (deep || forceTrigger || (isMultiSource ? newValue.some((v2, i) => hasChanged(v2, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  1902. if (cleanup) {
  1903. cleanup();
  1904. }
  1905. callWithAsyncErrorHandling(cb, instance, 3, [
  1906. newValue,
  1907. // pass undefined as the old value when it's changed for the first time
  1908. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  1909. onCleanup
  1910. ]);
  1911. oldValue = newValue;
  1912. }
  1913. } else {
  1914. effect.run();
  1915. }
  1916. };
  1917. job.allowRecurse = !!cb;
  1918. let scheduler;
  1919. if (flush === "sync") {
  1920. scheduler = job;
  1921. } else if (flush === "post") {
  1922. scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
  1923. } else {
  1924. job.pre = true;
  1925. if (instance)
  1926. job.id = instance.uid;
  1927. scheduler = () => queueJob(job);
  1928. }
  1929. const effect = new ReactiveEffect(getter, scheduler);
  1930. if (cb) {
  1931. if (immediate) {
  1932. job();
  1933. } else {
  1934. oldValue = effect.run();
  1935. }
  1936. } else if (flush === "post") {
  1937. queuePostRenderEffect(
  1938. effect.run.bind(effect),
  1939. instance && instance.suspense
  1940. );
  1941. } else {
  1942. effect.run();
  1943. }
  1944. const unwatch = () => {
  1945. effect.stop();
  1946. if (instance && instance.scope) {
  1947. remove(instance.scope.effects, effect);
  1948. }
  1949. };
  1950. if (ssrCleanup)
  1951. ssrCleanup.push(unwatch);
  1952. return unwatch;
  1953. }
  1954. function instanceWatch(source, value, options) {
  1955. const publicThis = this.proxy;
  1956. const getter = isString$1(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  1957. let cb;
  1958. if (isFunction$2(value)) {
  1959. cb = value;
  1960. } else {
  1961. cb = value.handler;
  1962. options = value;
  1963. }
  1964. const cur = currentInstance;
  1965. setCurrentInstance(this);
  1966. const res = doWatch(getter, cb.bind(publicThis), options);
  1967. if (cur) {
  1968. setCurrentInstance(cur);
  1969. } else {
  1970. unsetCurrentInstance();
  1971. }
  1972. return res;
  1973. }
  1974. function createPathGetter(ctx, path) {
  1975. const segments = path.split(".");
  1976. return () => {
  1977. let cur = ctx;
  1978. for (let i = 0; i < segments.length && cur; i++) {
  1979. cur = cur[segments[i]];
  1980. }
  1981. return cur;
  1982. };
  1983. }
  1984. function traverse(value, seen) {
  1985. if (!isObject$1(value) || value["__v_skip"]) {
  1986. return value;
  1987. }
  1988. seen = seen || /* @__PURE__ */ new Set();
  1989. if (seen.has(value)) {
  1990. return value;
  1991. }
  1992. seen.add(value);
  1993. if (isRef(value)) {
  1994. traverse(value.value, seen);
  1995. } else if (isArray$3(value)) {
  1996. for (let i = 0; i < value.length; i++) {
  1997. traverse(value[i], seen);
  1998. }
  1999. } else if (isSet$2(value) || isMap$2(value)) {
  2000. value.forEach((v2) => {
  2001. traverse(v2, seen);
  2002. });
  2003. } else if (isPlainObject$2(value)) {
  2004. for (const key in value) {
  2005. traverse(value[key], seen);
  2006. }
  2007. }
  2008. return value;
  2009. }
  2010. function withDirectives(vnode, directives) {
  2011. const internalInstance = currentRenderingInstance;
  2012. if (internalInstance === null) {
  2013. return vnode;
  2014. }
  2015. const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
  2016. const bindings = vnode.dirs || (vnode.dirs = []);
  2017. for (let i = 0; i < directives.length; i++) {
  2018. let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
  2019. if (dir) {
  2020. if (isFunction$2(dir)) {
  2021. dir = {
  2022. mounted: dir,
  2023. updated: dir
  2024. };
  2025. }
  2026. if (dir.deep) {
  2027. traverse(value);
  2028. }
  2029. bindings.push({
  2030. dir,
  2031. instance,
  2032. value,
  2033. oldValue: void 0,
  2034. arg,
  2035. modifiers
  2036. });
  2037. }
  2038. }
  2039. return vnode;
  2040. }
  2041. function invokeDirectiveHook(vnode, prevVNode, instance, name) {
  2042. const bindings = vnode.dirs;
  2043. const oldBindings = prevVNode && prevVNode.dirs;
  2044. for (let i = 0; i < bindings.length; i++) {
  2045. const binding = bindings[i];
  2046. if (oldBindings) {
  2047. binding.oldValue = oldBindings[i].value;
  2048. }
  2049. let hook = binding.dir[name];
  2050. if (hook) {
  2051. pauseTracking();
  2052. callWithAsyncErrorHandling(hook, instance, 8, [
  2053. vnode.el,
  2054. binding,
  2055. vnode,
  2056. prevVNode
  2057. ]);
  2058. resetTracking();
  2059. }
  2060. }
  2061. }
  2062. const leaveCbKey = Symbol("_leaveCb");
  2063. const enterCbKey$1 = Symbol("_enterCb");
  2064. function useTransitionState() {
  2065. const state = {
  2066. isMounted: false,
  2067. isLeaving: false,
  2068. isUnmounting: false,
  2069. leavingVNodes: /* @__PURE__ */ new Map()
  2070. };
  2071. onMounted(() => {
  2072. state.isMounted = true;
  2073. });
  2074. onBeforeUnmount(() => {
  2075. state.isUnmounting = true;
  2076. });
  2077. return state;
  2078. }
  2079. const TransitionHookValidator = [Function, Array];
  2080. const BaseTransitionPropsValidators = {
  2081. mode: String,
  2082. appear: Boolean,
  2083. persisted: Boolean,
  2084. // enter
  2085. onBeforeEnter: TransitionHookValidator,
  2086. onEnter: TransitionHookValidator,
  2087. onAfterEnter: TransitionHookValidator,
  2088. onEnterCancelled: TransitionHookValidator,
  2089. // leave
  2090. onBeforeLeave: TransitionHookValidator,
  2091. onLeave: TransitionHookValidator,
  2092. onAfterLeave: TransitionHookValidator,
  2093. onLeaveCancelled: TransitionHookValidator,
  2094. // appear
  2095. onBeforeAppear: TransitionHookValidator,
  2096. onAppear: TransitionHookValidator,
  2097. onAfterAppear: TransitionHookValidator,
  2098. onAppearCancelled: TransitionHookValidator
  2099. };
  2100. const BaseTransitionImpl = {
  2101. name: `BaseTransition`,
  2102. props: BaseTransitionPropsValidators,
  2103. setup(props, { slots }) {
  2104. const instance = getCurrentInstance();
  2105. const state = useTransitionState();
  2106. let prevTransitionKey;
  2107. return () => {
  2108. const children = slots.default && getTransitionRawChildren(slots.default(), true);
  2109. if (!children || !children.length) {
  2110. return;
  2111. }
  2112. let child = children[0];
  2113. if (children.length > 1) {
  2114. for (const c2 of children) {
  2115. if (c2.type !== Comment) {
  2116. child = c2;
  2117. break;
  2118. }
  2119. }
  2120. }
  2121. const rawProps = toRaw(props);
  2122. const { mode } = rawProps;
  2123. if (state.isLeaving) {
  2124. return emptyPlaceholder(child);
  2125. }
  2126. const innerChild = getKeepAliveChild(child);
  2127. if (!innerChild) {
  2128. return emptyPlaceholder(child);
  2129. }
  2130. const enterHooks = resolveTransitionHooks(
  2131. innerChild,
  2132. rawProps,
  2133. state,
  2134. instance
  2135. );
  2136. setTransitionHooks(innerChild, enterHooks);
  2137. const oldChild = instance.subTree;
  2138. const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
  2139. let transitionKeyChanged = false;
  2140. const { getTransitionKey } = innerChild.type;
  2141. if (getTransitionKey) {
  2142. const key = getTransitionKey();
  2143. if (prevTransitionKey === void 0) {
  2144. prevTransitionKey = key;
  2145. } else if (key !== prevTransitionKey) {
  2146. prevTransitionKey = key;
  2147. transitionKeyChanged = true;
  2148. }
  2149. }
  2150. if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {
  2151. const leavingHooks = resolveTransitionHooks(
  2152. oldInnerChild,
  2153. rawProps,
  2154. state,
  2155. instance
  2156. );
  2157. setTransitionHooks(oldInnerChild, leavingHooks);
  2158. if (mode === "out-in") {
  2159. state.isLeaving = true;
  2160. leavingHooks.afterLeave = () => {
  2161. state.isLeaving = false;
  2162. if (instance.update.active !== false) {
  2163. instance.update();
  2164. }
  2165. };
  2166. return emptyPlaceholder(child);
  2167. } else if (mode === "in-out" && innerChild.type !== Comment) {
  2168. leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
  2169. const leavingVNodesCache = getLeavingNodesForType(
  2170. state,
  2171. oldInnerChild
  2172. );
  2173. leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
  2174. el[leaveCbKey] = () => {
  2175. earlyRemove();
  2176. el[leaveCbKey] = void 0;
  2177. delete enterHooks.delayedLeave;
  2178. };
  2179. enterHooks.delayedLeave = delayedLeave;
  2180. };
  2181. }
  2182. }
  2183. return child;
  2184. };
  2185. }
  2186. };
  2187. const BaseTransition = BaseTransitionImpl;
  2188. function getLeavingNodesForType(state, vnode) {
  2189. const { leavingVNodes } = state;
  2190. let leavingVNodesCache = leavingVNodes.get(vnode.type);
  2191. if (!leavingVNodesCache) {
  2192. leavingVNodesCache = /* @__PURE__ */ Object.create(null);
  2193. leavingVNodes.set(vnode.type, leavingVNodesCache);
  2194. }
  2195. return leavingVNodesCache;
  2196. }
  2197. function resolveTransitionHooks(vnode, props, state, instance) {
  2198. const {
  2199. appear,
  2200. mode,
  2201. persisted = false,
  2202. onBeforeEnter,
  2203. onEnter,
  2204. onAfterEnter,
  2205. onEnterCancelled,
  2206. onBeforeLeave,
  2207. onLeave,
  2208. onAfterLeave,
  2209. onLeaveCancelled,
  2210. onBeforeAppear,
  2211. onAppear,
  2212. onAfterAppear,
  2213. onAppearCancelled
  2214. } = props;
  2215. const key = String(vnode.key);
  2216. const leavingVNodesCache = getLeavingNodesForType(state, vnode);
  2217. const callHook2 = (hook, args) => {
  2218. hook && callWithAsyncErrorHandling(
  2219. hook,
  2220. instance,
  2221. 9,
  2222. args
  2223. );
  2224. };
  2225. const callAsyncHook = (hook, args) => {
  2226. const done = args[1];
  2227. callHook2(hook, args);
  2228. if (isArray$3(hook)) {
  2229. if (hook.every((hook2) => hook2.length <= 1))
  2230. done();
  2231. } else if (hook.length <= 1) {
  2232. done();
  2233. }
  2234. };
  2235. const hooks = {
  2236. mode,
  2237. persisted,
  2238. beforeEnter(el) {
  2239. let hook = onBeforeEnter;
  2240. if (!state.isMounted) {
  2241. if (appear) {
  2242. hook = onBeforeAppear || onBeforeEnter;
  2243. } else {
  2244. return;
  2245. }
  2246. }
  2247. if (el[leaveCbKey]) {
  2248. el[leaveCbKey](
  2249. true
  2250. /* cancelled */
  2251. );
  2252. }
  2253. const leavingVNode = leavingVNodesCache[key];
  2254. if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
  2255. leavingVNode.el[leaveCbKey]();
  2256. }
  2257. callHook2(hook, [el]);
  2258. },
  2259. enter(el) {
  2260. let hook = onEnter;
  2261. let afterHook = onAfterEnter;
  2262. let cancelHook = onEnterCancelled;
  2263. if (!state.isMounted) {
  2264. if (appear) {
  2265. hook = onAppear || onEnter;
  2266. afterHook = onAfterAppear || onAfterEnter;
  2267. cancelHook = onAppearCancelled || onEnterCancelled;
  2268. } else {
  2269. return;
  2270. }
  2271. }
  2272. let called = false;
  2273. const done = el[enterCbKey$1] = (cancelled) => {
  2274. if (called)
  2275. return;
  2276. called = true;
  2277. if (cancelled) {
  2278. callHook2(cancelHook, [el]);
  2279. } else {
  2280. callHook2(afterHook, [el]);
  2281. }
  2282. if (hooks.delayedLeave) {
  2283. hooks.delayedLeave();
  2284. }
  2285. el[enterCbKey$1] = void 0;
  2286. };
  2287. if (hook) {
  2288. callAsyncHook(hook, [el, done]);
  2289. } else {
  2290. done();
  2291. }
  2292. },
  2293. leave(el, remove2) {
  2294. const key2 = String(vnode.key);
  2295. if (el[enterCbKey$1]) {
  2296. el[enterCbKey$1](
  2297. true
  2298. /* cancelled */
  2299. );
  2300. }
  2301. if (state.isUnmounting) {
  2302. return remove2();
  2303. }
  2304. callHook2(onBeforeLeave, [el]);
  2305. let called = false;
  2306. const done = el[leaveCbKey] = (cancelled) => {
  2307. if (called)
  2308. return;
  2309. called = true;
  2310. remove2();
  2311. if (cancelled) {
  2312. callHook2(onLeaveCancelled, [el]);
  2313. } else {
  2314. callHook2(onAfterLeave, [el]);
  2315. }
  2316. el[leaveCbKey] = void 0;
  2317. if (leavingVNodesCache[key2] === vnode) {
  2318. delete leavingVNodesCache[key2];
  2319. }
  2320. };
  2321. leavingVNodesCache[key2] = vnode;
  2322. if (onLeave) {
  2323. callAsyncHook(onLeave, [el, done]);
  2324. } else {
  2325. done();
  2326. }
  2327. },
  2328. clone(vnode2) {
  2329. return resolveTransitionHooks(vnode2, props, state, instance);
  2330. }
  2331. };
  2332. return hooks;
  2333. }
  2334. function emptyPlaceholder(vnode) {
  2335. if (isKeepAlive(vnode)) {
  2336. vnode = cloneVNode(vnode);
  2337. vnode.children = null;
  2338. return vnode;
  2339. }
  2340. }
  2341. function getKeepAliveChild(vnode) {
  2342. return isKeepAlive(vnode) ? (
  2343. // #7121 ensure get the child component subtree in case
  2344. // it's been replaced during HMR
  2345. vnode.children ? vnode.children[0] : void 0
  2346. ) : vnode;
  2347. }
  2348. function setTransitionHooks(vnode, hooks) {
  2349. if (vnode.shapeFlag & 6 && vnode.component) {
  2350. setTransitionHooks(vnode.component.subTree, hooks);
  2351. } else if (vnode.shapeFlag & 128) {
  2352. vnode.ssContent.transition = hooks.clone(vnode.ssContent);
  2353. vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
  2354. } else {
  2355. vnode.transition = hooks;
  2356. }
  2357. }
  2358. function getTransitionRawChildren(children, keepComment = false, parentKey) {
  2359. let ret = [];
  2360. let keyedFragmentCount = 0;
  2361. for (let i = 0; i < children.length; i++) {
  2362. let child = children[i];
  2363. const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
  2364. if (child.type === Fragment) {
  2365. if (child.patchFlag & 128)
  2366. keyedFragmentCount++;
  2367. ret = ret.concat(
  2368. getTransitionRawChildren(child.children, keepComment, key)
  2369. );
  2370. } else if (keepComment || child.type !== Comment) {
  2371. ret.push(key != null ? cloneVNode(child, { key }) : child);
  2372. }
  2373. }
  2374. if (keyedFragmentCount > 1) {
  2375. for (let i = 0; i < ret.length; i++) {
  2376. ret[i].patchFlag = -2;
  2377. }
  2378. }
  2379. return ret;
  2380. }
  2381. /*! #__NO_SIDE_EFFECTS__ */
  2382. // @__NO_SIDE_EFFECTS__
  2383. function defineComponent(options, extraOptions) {
  2384. return isFunction$2(options) ? (
  2385. // #8326: extend call and options.name access are considered side-effects
  2386. // by Rollup, so we have to wrap it in a pure-annotated IIFE.
  2387. /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()
  2388. ) : options;
  2389. }
  2390. const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
  2391. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  2392. function onActivated(hook, target) {
  2393. registerKeepAliveHook(hook, "a", target);
  2394. }
  2395. function onDeactivated(hook, target) {
  2396. registerKeepAliveHook(hook, "da", target);
  2397. }
  2398. function registerKeepAliveHook(hook, type2, target = currentInstance) {
  2399. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  2400. let current = target;
  2401. while (current) {
  2402. if (current.isDeactivated) {
  2403. return;
  2404. }
  2405. current = current.parent;
  2406. }
  2407. return hook();
  2408. });
  2409. injectHook(type2, wrappedHook, target);
  2410. if (target) {
  2411. let current = target.parent;
  2412. while (current && current.parent) {
  2413. if (isKeepAlive(current.parent.vnode)) {
  2414. injectToKeepAliveRoot(wrappedHook, type2, target, current);
  2415. }
  2416. current = current.parent;
  2417. }
  2418. }
  2419. }
  2420. function injectToKeepAliveRoot(hook, type2, target, keepAliveRoot) {
  2421. const injected = injectHook(
  2422. type2,
  2423. hook,
  2424. keepAliveRoot,
  2425. true
  2426. /* prepend */
  2427. );
  2428. onUnmounted(() => {
  2429. remove(keepAliveRoot[type2], injected);
  2430. }, target);
  2431. }
  2432. function injectHook(type2, hook, target = currentInstance, prepend = false) {
  2433. if (target) {
  2434. const hooks = target[type2] || (target[type2] = []);
  2435. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  2436. if (target.isUnmounted) {
  2437. return;
  2438. }
  2439. pauseTracking();
  2440. setCurrentInstance(target);
  2441. const res = callWithAsyncErrorHandling(hook, target, type2, args);
  2442. unsetCurrentInstance();
  2443. resetTracking();
  2444. return res;
  2445. });
  2446. if (prepend) {
  2447. hooks.unshift(wrappedHook);
  2448. } else {
  2449. hooks.push(wrappedHook);
  2450. }
  2451. return wrappedHook;
  2452. }
  2453. }
  2454. const createHook = (lifecycle) => (hook, target = currentInstance) => (
  2455. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  2456. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  2457. );
  2458. const onBeforeMount = createHook("bm");
  2459. const onMounted = createHook("m");
  2460. const onBeforeUpdate = createHook("bu");
  2461. const onUpdated = createHook("u");
  2462. const onBeforeUnmount = createHook("bum");
  2463. const onUnmounted = createHook("um");
  2464. const onServerPrefetch = createHook("sp");
  2465. const onRenderTriggered = createHook(
  2466. "rtg"
  2467. );
  2468. const onRenderTracked = createHook(
  2469. "rtc"
  2470. );
  2471. function onErrorCaptured(hook, target = currentInstance) {
  2472. injectHook("ec", hook, target);
  2473. }
  2474. function renderList(source, renderItem, cache2, index2) {
  2475. let ret;
  2476. const cached = cache2 && cache2[index2];
  2477. if (isArray$3(source) || isString$1(source)) {
  2478. ret = new Array(source.length);
  2479. for (let i = 0, l2 = source.length; i < l2; i++) {
  2480. ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);
  2481. }
  2482. } else if (typeof source === "number") {
  2483. ret = new Array(source);
  2484. for (let i = 0; i < source; i++) {
  2485. ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
  2486. }
  2487. } else if (isObject$1(source)) {
  2488. if (source[Symbol.iterator]) {
  2489. ret = Array.from(
  2490. source,
  2491. (item, i) => renderItem(item, i, void 0, cached && cached[i])
  2492. );
  2493. } else {
  2494. const keys2 = Object.keys(source);
  2495. ret = new Array(keys2.length);
  2496. for (let i = 0, l2 = keys2.length; i < l2; i++) {
  2497. const key = keys2[i];
  2498. ret[i] = renderItem(source[key], key, i, cached && cached[i]);
  2499. }
  2500. }
  2501. } else {
  2502. ret = [];
  2503. }
  2504. if (cache2) {
  2505. cache2[index2] = ret;
  2506. }
  2507. return ret;
  2508. }
  2509. function createSlots(slots, dynamicSlots) {
  2510. for (let i = 0; i < dynamicSlots.length; i++) {
  2511. const slot = dynamicSlots[i];
  2512. if (isArray$3(slot)) {
  2513. for (let j = 0; j < slot.length; j++) {
  2514. slots[slot[j].name] = slot[j].fn;
  2515. }
  2516. } else if (slot) {
  2517. slots[slot.name] = slot.key ? (...args) => {
  2518. const res = slot.fn(...args);
  2519. if (res)
  2520. res.key = slot.key;
  2521. return res;
  2522. } : slot.fn;
  2523. }
  2524. }
  2525. return slots;
  2526. }
  2527. function renderSlot(slots, name, props = {}, fallback, noSlotted) {
  2528. if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
  2529. if (name !== "default")
  2530. props.name = name;
  2531. return createVNode("slot", props, fallback && fallback());
  2532. }
  2533. let slot = slots[name];
  2534. if (slot && slot._c) {
  2535. slot._d = false;
  2536. }
  2537. openBlock();
  2538. const validSlotContent = slot && ensureValidVNode(slot(props));
  2539. const rendered = createBlock(
  2540. Fragment,
  2541. {
  2542. key: props.key || // slot content array of a dynamic conditional slot may have a branch
  2543. // key attached in the `createSlots` helper, respect that
  2544. validSlotContent && validSlotContent.key || `_${name}`
  2545. },
  2546. validSlotContent || (fallback ? fallback() : []),
  2547. validSlotContent && slots._ === 1 ? 64 : -2
  2548. );
  2549. if (!noSlotted && rendered.scopeId) {
  2550. rendered.slotScopeIds = [rendered.scopeId + "-s"];
  2551. }
  2552. if (slot && slot._c) {
  2553. slot._d = true;
  2554. }
  2555. return rendered;
  2556. }
  2557. function ensureValidVNode(vnodes) {
  2558. return vnodes.some((child) => {
  2559. if (!isVNode(child))
  2560. return true;
  2561. if (child.type === Comment)
  2562. return false;
  2563. if (child.type === Fragment && !ensureValidVNode(child.children))
  2564. return false;
  2565. return true;
  2566. }) ? vnodes : null;
  2567. }
  2568. function toHandlers(obj, preserveCaseIfNecessary) {
  2569. const ret = {};
  2570. for (const key in obj) {
  2571. ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];
  2572. }
  2573. return ret;
  2574. }
  2575. const getPublicInstance = (i) => {
  2576. if (!i)
  2577. return null;
  2578. if (isStatefulComponent(i))
  2579. return getExposeProxy(i) || i.proxy;
  2580. return getPublicInstance(i.parent);
  2581. };
  2582. const publicPropertiesMap = (
  2583. // Move PURE marker to new line to workaround compiler discarding it
  2584. // due to type annotation
  2585. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  2586. $: (i) => i,
  2587. $el: (i) => i.vnode.el,
  2588. $data: (i) => i.data,
  2589. $props: (i) => i.props,
  2590. $attrs: (i) => i.attrs,
  2591. $slots: (i) => i.slots,
  2592. $refs: (i) => i.refs,
  2593. $parent: (i) => getPublicInstance(i.parent),
  2594. $root: (i) => getPublicInstance(i.root),
  2595. $emit: (i) => i.emit,
  2596. $options: (i) => resolveMergedOptions(i),
  2597. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  2598. $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
  2599. $watch: (i) => instanceWatch.bind(i)
  2600. })
  2601. );
  2602. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  2603. const PublicInstanceProxyHandlers = {
  2604. get({ _: instance }, key) {
  2605. const { ctx, setupState, data, props, accessCache, type: type2, appContext } = instance;
  2606. let normalizedProps;
  2607. if (key[0] !== "$") {
  2608. const n = accessCache[key];
  2609. if (n !== void 0) {
  2610. switch (n) {
  2611. case 1:
  2612. return setupState[key];
  2613. case 2:
  2614. return data[key];
  2615. case 4:
  2616. return ctx[key];
  2617. case 3:
  2618. return props[key];
  2619. }
  2620. } else if (hasSetupBinding(setupState, key)) {
  2621. accessCache[key] = 1;
  2622. return setupState[key];
  2623. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2624. accessCache[key] = 2;
  2625. return data[key];
  2626. } else if (
  2627. // only cache other properties when instance has declared (thus stable)
  2628. // props
  2629. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  2630. ) {
  2631. accessCache[key] = 3;
  2632. return props[key];
  2633. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2634. accessCache[key] = 4;
  2635. return ctx[key];
  2636. } else if (shouldCacheAccess) {
  2637. accessCache[key] = 0;
  2638. }
  2639. }
  2640. const publicGetter = publicPropertiesMap[key];
  2641. let cssModule, globalProperties;
  2642. if (publicGetter) {
  2643. if (key === "$attrs") {
  2644. track(instance, "get", key);
  2645. }
  2646. return publicGetter(instance);
  2647. } else if (
  2648. // css module (injected by vue-loader)
  2649. (cssModule = type2.__cssModules) && (cssModule = cssModule[key])
  2650. ) {
  2651. return cssModule;
  2652. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  2653. accessCache[key] = 4;
  2654. return ctx[key];
  2655. } else if (
  2656. // global properties
  2657. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  2658. ) {
  2659. {
  2660. return globalProperties[key];
  2661. }
  2662. } else
  2663. ;
  2664. },
  2665. set({ _: instance }, key, value) {
  2666. const { data, setupState, ctx } = instance;
  2667. if (hasSetupBinding(setupState, key)) {
  2668. setupState[key] = value;
  2669. return true;
  2670. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  2671. data[key] = value;
  2672. return true;
  2673. } else if (hasOwn(instance.props, key)) {
  2674. return false;
  2675. }
  2676. if (key[0] === "$" && key.slice(1) in instance) {
  2677. return false;
  2678. } else {
  2679. {
  2680. ctx[key] = value;
  2681. }
  2682. }
  2683. return true;
  2684. },
  2685. has({
  2686. _: { data, setupState, accessCache, ctx, appContext, propsOptions }
  2687. }, key) {
  2688. let normalizedProps;
  2689. return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
  2690. },
  2691. defineProperty(target, key, descriptor) {
  2692. if (descriptor.get != null) {
  2693. target._.accessCache[key] = 0;
  2694. } else if (hasOwn(descriptor, "value")) {
  2695. this.set(target, key, descriptor.value, null);
  2696. }
  2697. return Reflect.defineProperty(target, key, descriptor);
  2698. }
  2699. };
  2700. function useSlots() {
  2701. return getContext().slots;
  2702. }
  2703. function useAttrs$1() {
  2704. return getContext().attrs;
  2705. }
  2706. function getContext() {
  2707. const i = getCurrentInstance();
  2708. return i.setupContext || (i.setupContext = createSetupContext(i));
  2709. }
  2710. function normalizePropsOrEmits(props) {
  2711. return isArray$3(props) ? props.reduce(
  2712. (normalized, p2) => (normalized[p2] = null, normalized),
  2713. {}
  2714. ) : props;
  2715. }
  2716. let shouldCacheAccess = true;
  2717. function applyOptions(instance) {
  2718. const options = resolveMergedOptions(instance);
  2719. const publicThis = instance.proxy;
  2720. const ctx = instance.ctx;
  2721. shouldCacheAccess = false;
  2722. if (options.beforeCreate) {
  2723. callHook$1(options.beforeCreate, instance, "bc");
  2724. }
  2725. const {
  2726. // state
  2727. data: dataOptions,
  2728. computed: computedOptions,
  2729. methods,
  2730. watch: watchOptions,
  2731. provide: provideOptions,
  2732. inject: injectOptions,
  2733. // lifecycle
  2734. created,
  2735. beforeMount,
  2736. mounted,
  2737. beforeUpdate,
  2738. updated,
  2739. activated,
  2740. deactivated,
  2741. beforeDestroy,
  2742. beforeUnmount,
  2743. destroyed,
  2744. unmounted,
  2745. render: render2,
  2746. renderTracked,
  2747. renderTriggered,
  2748. errorCaptured,
  2749. serverPrefetch,
  2750. // public API
  2751. expose,
  2752. inheritAttrs,
  2753. // assets
  2754. components,
  2755. directives,
  2756. filters
  2757. } = options;
  2758. const checkDuplicateProperties = null;
  2759. if (injectOptions) {
  2760. resolveInjections(injectOptions, ctx, checkDuplicateProperties);
  2761. }
  2762. if (methods) {
  2763. for (const key in methods) {
  2764. const methodHandler = methods[key];
  2765. if (isFunction$2(methodHandler)) {
  2766. {
  2767. ctx[key] = methodHandler.bind(publicThis);
  2768. }
  2769. }
  2770. }
  2771. }
  2772. if (dataOptions) {
  2773. const data = dataOptions.call(publicThis, publicThis);
  2774. if (!isObject$1(data))
  2775. ;
  2776. else {
  2777. instance.data = reactive(data);
  2778. }
  2779. }
  2780. shouldCacheAccess = true;
  2781. if (computedOptions) {
  2782. for (const key in computedOptions) {
  2783. const opt = computedOptions[key];
  2784. const get2 = isFunction$2(opt) ? opt.bind(publicThis, publicThis) : isFunction$2(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  2785. const set2 = !isFunction$2(opt) && isFunction$2(opt.set) ? opt.set.bind(publicThis) : NOOP;
  2786. const c2 = computed({
  2787. get: get2,
  2788. set: set2
  2789. });
  2790. Object.defineProperty(ctx, key, {
  2791. enumerable: true,
  2792. configurable: true,
  2793. get: () => c2.value,
  2794. set: (v2) => c2.value = v2
  2795. });
  2796. }
  2797. }
  2798. if (watchOptions) {
  2799. for (const key in watchOptions) {
  2800. createWatcher(watchOptions[key], ctx, publicThis, key);
  2801. }
  2802. }
  2803. if (provideOptions) {
  2804. const provides = isFunction$2(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  2805. Reflect.ownKeys(provides).forEach((key) => {
  2806. provide(key, provides[key]);
  2807. });
  2808. }
  2809. if (created) {
  2810. callHook$1(created, instance, "c");
  2811. }
  2812. function registerLifecycleHook(register, hook) {
  2813. if (isArray$3(hook)) {
  2814. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  2815. } else if (hook) {
  2816. register(hook.bind(publicThis));
  2817. }
  2818. }
  2819. registerLifecycleHook(onBeforeMount, beforeMount);
  2820. registerLifecycleHook(onMounted, mounted);
  2821. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  2822. registerLifecycleHook(onUpdated, updated);
  2823. registerLifecycleHook(onActivated, activated);
  2824. registerLifecycleHook(onDeactivated, deactivated);
  2825. registerLifecycleHook(onErrorCaptured, errorCaptured);
  2826. registerLifecycleHook(onRenderTracked, renderTracked);
  2827. registerLifecycleHook(onRenderTriggered, renderTriggered);
  2828. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  2829. registerLifecycleHook(onUnmounted, unmounted);
  2830. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  2831. if (isArray$3(expose)) {
  2832. if (expose.length) {
  2833. const exposed = instance.exposed || (instance.exposed = {});
  2834. expose.forEach((key) => {
  2835. Object.defineProperty(exposed, key, {
  2836. get: () => publicThis[key],
  2837. set: (val) => publicThis[key] = val
  2838. });
  2839. });
  2840. } else if (!instance.exposed) {
  2841. instance.exposed = {};
  2842. }
  2843. }
  2844. if (render2 && instance.render === NOOP) {
  2845. instance.render = render2;
  2846. }
  2847. if (inheritAttrs != null) {
  2848. instance.inheritAttrs = inheritAttrs;
  2849. }
  2850. if (components)
  2851. instance.components = components;
  2852. if (directives)
  2853. instance.directives = directives;
  2854. }
  2855. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
  2856. if (isArray$3(injectOptions)) {
  2857. injectOptions = normalizeInject(injectOptions);
  2858. }
  2859. for (const key in injectOptions) {
  2860. const opt = injectOptions[key];
  2861. let injected;
  2862. if (isObject$1(opt)) {
  2863. if ("default" in opt) {
  2864. injected = inject(
  2865. opt.from || key,
  2866. opt.default,
  2867. true
  2868. /* treat default function as factory */
  2869. );
  2870. } else {
  2871. injected = inject(opt.from || key);
  2872. }
  2873. } else {
  2874. injected = inject(opt);
  2875. }
  2876. if (isRef(injected)) {
  2877. Object.defineProperty(ctx, key, {
  2878. enumerable: true,
  2879. configurable: true,
  2880. get: () => injected.value,
  2881. set: (v2) => injected.value = v2
  2882. });
  2883. } else {
  2884. ctx[key] = injected;
  2885. }
  2886. }
  2887. }
  2888. function callHook$1(hook, instance, type2) {
  2889. callWithAsyncErrorHandling(
  2890. isArray$3(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy),
  2891. instance,
  2892. type2
  2893. );
  2894. }
  2895. function createWatcher(raw, ctx, publicThis, key) {
  2896. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  2897. if (isString$1(raw)) {
  2898. const handler = ctx[raw];
  2899. if (isFunction$2(handler)) {
  2900. watch(getter, handler);
  2901. }
  2902. } else if (isFunction$2(raw)) {
  2903. watch(getter, raw.bind(publicThis));
  2904. } else if (isObject$1(raw)) {
  2905. if (isArray$3(raw)) {
  2906. raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
  2907. } else {
  2908. const handler = isFunction$2(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  2909. if (isFunction$2(handler)) {
  2910. watch(getter, handler, raw);
  2911. }
  2912. }
  2913. } else
  2914. ;
  2915. }
  2916. function resolveMergedOptions(instance) {
  2917. const base = instance.type;
  2918. const { mixins, extends: extendsOptions } = base;
  2919. const {
  2920. mixins: globalMixins,
  2921. optionsCache: cache2,
  2922. config: { optionMergeStrategies }
  2923. } = instance.appContext;
  2924. const cached = cache2.get(base);
  2925. let resolved;
  2926. if (cached) {
  2927. resolved = cached;
  2928. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  2929. {
  2930. resolved = base;
  2931. }
  2932. } else {
  2933. resolved = {};
  2934. if (globalMixins.length) {
  2935. globalMixins.forEach(
  2936. (m2) => mergeOptions$2(resolved, m2, optionMergeStrategies, true)
  2937. );
  2938. }
  2939. mergeOptions$2(resolved, base, optionMergeStrategies);
  2940. }
  2941. if (isObject$1(base)) {
  2942. cache2.set(base, resolved);
  2943. }
  2944. return resolved;
  2945. }
  2946. function mergeOptions$2(to, from, strats, asMixin = false) {
  2947. const { mixins, extends: extendsOptions } = from;
  2948. if (extendsOptions) {
  2949. mergeOptions$2(to, extendsOptions, strats, true);
  2950. }
  2951. if (mixins) {
  2952. mixins.forEach(
  2953. (m2) => mergeOptions$2(to, m2, strats, true)
  2954. );
  2955. }
  2956. for (const key in from) {
  2957. if (asMixin && key === "expose")
  2958. ;
  2959. else {
  2960. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  2961. to[key] = strat ? strat(to[key], from[key]) : from[key];
  2962. }
  2963. }
  2964. return to;
  2965. }
  2966. const internalOptionMergeStrats = {
  2967. data: mergeDataFn,
  2968. props: mergeEmitsOrPropsOptions,
  2969. emits: mergeEmitsOrPropsOptions,
  2970. // objects
  2971. methods: mergeObjectOptions,
  2972. computed: mergeObjectOptions,
  2973. // lifecycle
  2974. beforeCreate: mergeAsArray,
  2975. created: mergeAsArray,
  2976. beforeMount: mergeAsArray,
  2977. mounted: mergeAsArray,
  2978. beforeUpdate: mergeAsArray,
  2979. updated: mergeAsArray,
  2980. beforeDestroy: mergeAsArray,
  2981. beforeUnmount: mergeAsArray,
  2982. destroyed: mergeAsArray,
  2983. unmounted: mergeAsArray,
  2984. activated: mergeAsArray,
  2985. deactivated: mergeAsArray,
  2986. errorCaptured: mergeAsArray,
  2987. serverPrefetch: mergeAsArray,
  2988. // assets
  2989. components: mergeObjectOptions,
  2990. directives: mergeObjectOptions,
  2991. // watch
  2992. watch: mergeWatchOptions,
  2993. // provide / inject
  2994. provide: mergeDataFn,
  2995. inject: mergeInject
  2996. };
  2997. function mergeDataFn(to, from) {
  2998. if (!from) {
  2999. return to;
  3000. }
  3001. if (!to) {
  3002. return from;
  3003. }
  3004. return function mergedDataFn() {
  3005. return extend(
  3006. isFunction$2(to) ? to.call(this, this) : to,
  3007. isFunction$2(from) ? from.call(this, this) : from
  3008. );
  3009. };
  3010. }
  3011. function mergeInject(to, from) {
  3012. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  3013. }
  3014. function normalizeInject(raw) {
  3015. if (isArray$3(raw)) {
  3016. const res = {};
  3017. for (let i = 0; i < raw.length; i++) {
  3018. res[raw[i]] = raw[i];
  3019. }
  3020. return res;
  3021. }
  3022. return raw;
  3023. }
  3024. function mergeAsArray(to, from) {
  3025. return to ? [...new Set([].concat(to, from))] : from;
  3026. }
  3027. function mergeObjectOptions(to, from) {
  3028. return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
  3029. }
  3030. function mergeEmitsOrPropsOptions(to, from) {
  3031. if (to) {
  3032. if (isArray$3(to) && isArray$3(from)) {
  3033. return [.../* @__PURE__ */ new Set([...to, ...from])];
  3034. }
  3035. return extend(
  3036. /* @__PURE__ */ Object.create(null),
  3037. normalizePropsOrEmits(to),
  3038. normalizePropsOrEmits(from != null ? from : {})
  3039. );
  3040. } else {
  3041. return from;
  3042. }
  3043. }
  3044. function mergeWatchOptions(to, from) {
  3045. if (!to)
  3046. return from;
  3047. if (!from)
  3048. return to;
  3049. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  3050. for (const key in from) {
  3051. merged[key] = mergeAsArray(to[key], from[key]);
  3052. }
  3053. return merged;
  3054. }
  3055. function createAppContext() {
  3056. return {
  3057. app: null,
  3058. config: {
  3059. isNativeTag: NO,
  3060. performance: false,
  3061. globalProperties: {},
  3062. optionMergeStrategies: {},
  3063. errorHandler: void 0,
  3064. warnHandler: void 0,
  3065. compilerOptions: {}
  3066. },
  3067. mixins: [],
  3068. components: {},
  3069. directives: {},
  3070. provides: /* @__PURE__ */ Object.create(null),
  3071. optionsCache: /* @__PURE__ */ new WeakMap(),
  3072. propsCache: /* @__PURE__ */ new WeakMap(),
  3073. emitsCache: /* @__PURE__ */ new WeakMap()
  3074. };
  3075. }
  3076. let uid$1 = 0;
  3077. function createAppAPI(render2, hydrate) {
  3078. return function createApp2(rootComponent, rootProps = null) {
  3079. if (!isFunction$2(rootComponent)) {
  3080. rootComponent = extend({}, rootComponent);
  3081. }
  3082. if (rootProps != null && !isObject$1(rootProps)) {
  3083. rootProps = null;
  3084. }
  3085. const context = createAppContext();
  3086. const installedPlugins = /* @__PURE__ */ new WeakSet();
  3087. let isMounted = false;
  3088. const app = context.app = {
  3089. _uid: uid$1++,
  3090. _component: rootComponent,
  3091. _props: rootProps,
  3092. _container: null,
  3093. _context: context,
  3094. _instance: null,
  3095. version: version$1,
  3096. get config() {
  3097. return context.config;
  3098. },
  3099. set config(v2) {
  3100. },
  3101. use(plugin, ...options) {
  3102. if (installedPlugins.has(plugin))
  3103. ;
  3104. else if (plugin && isFunction$2(plugin.install)) {
  3105. installedPlugins.add(plugin);
  3106. plugin.install(app, ...options);
  3107. } else if (isFunction$2(plugin)) {
  3108. installedPlugins.add(plugin);
  3109. plugin(app, ...options);
  3110. } else
  3111. ;
  3112. return app;
  3113. },
  3114. mixin(mixin) {
  3115. {
  3116. if (!context.mixins.includes(mixin)) {
  3117. context.mixins.push(mixin);
  3118. }
  3119. }
  3120. return app;
  3121. },
  3122. component(name, component2) {
  3123. if (!component2) {
  3124. return context.components[name];
  3125. }
  3126. context.components[name] = component2;
  3127. return app;
  3128. },
  3129. directive(name, directive) {
  3130. if (!directive) {
  3131. return context.directives[name];
  3132. }
  3133. context.directives[name] = directive;
  3134. return app;
  3135. },
  3136. mount(rootContainer, isHydrate, isSVG) {
  3137. if (!isMounted) {
  3138. const vnode = createVNode(rootComponent, rootProps);
  3139. vnode.appContext = context;
  3140. if (isHydrate && hydrate) {
  3141. hydrate(vnode, rootContainer);
  3142. } else {
  3143. render2(vnode, rootContainer, isSVG);
  3144. }
  3145. isMounted = true;
  3146. app._container = rootContainer;
  3147. rootContainer.__vue_app__ = app;
  3148. return getExposeProxy(vnode.component) || vnode.component.proxy;
  3149. }
  3150. },
  3151. unmount() {
  3152. if (isMounted) {
  3153. render2(null, app._container);
  3154. delete app._container.__vue_app__;
  3155. }
  3156. },
  3157. provide(key, value) {
  3158. context.provides[key] = value;
  3159. return app;
  3160. },
  3161. runWithContext(fn2) {
  3162. currentApp = app;
  3163. try {
  3164. return fn2();
  3165. } finally {
  3166. currentApp = null;
  3167. }
  3168. }
  3169. };
  3170. return app;
  3171. };
  3172. }
  3173. let currentApp = null;
  3174. function provide(key, value) {
  3175. if (!currentInstance)
  3176. ;
  3177. else {
  3178. let provides = currentInstance.provides;
  3179. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  3180. if (parentProvides === provides) {
  3181. provides = currentInstance.provides = Object.create(parentProvides);
  3182. }
  3183. provides[key] = value;
  3184. }
  3185. }
  3186. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  3187. const instance = currentInstance || currentRenderingInstance;
  3188. if (instance || currentApp) {
  3189. const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
  3190. if (provides && key in provides) {
  3191. return provides[key];
  3192. } else if (arguments.length > 1) {
  3193. return treatDefaultAsFactory && isFunction$2(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
  3194. } else
  3195. ;
  3196. }
  3197. }
  3198. function hasInjectionContext() {
  3199. return !!(currentInstance || currentRenderingInstance || currentApp);
  3200. }
  3201. function initProps(instance, rawProps, isStateful, isSSR = false) {
  3202. const props = {};
  3203. const attrs = {};
  3204. def(attrs, InternalObjectKey, 1);
  3205. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  3206. setFullProps(instance, rawProps, props, attrs);
  3207. for (const key in instance.propsOptions[0]) {
  3208. if (!(key in props)) {
  3209. props[key] = void 0;
  3210. }
  3211. }
  3212. if (isStateful) {
  3213. instance.props = isSSR ? props : shallowReactive(props);
  3214. } else {
  3215. if (!instance.type.props) {
  3216. instance.props = attrs;
  3217. } else {
  3218. instance.props = props;
  3219. }
  3220. }
  3221. instance.attrs = attrs;
  3222. }
  3223. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  3224. const {
  3225. props,
  3226. attrs,
  3227. vnode: { patchFlag }
  3228. } = instance;
  3229. const rawCurrentProps = toRaw(props);
  3230. const [options] = instance.propsOptions;
  3231. let hasAttrsChanged = false;
  3232. if (
  3233. // always force full diff in dev
  3234. // - #1942 if hmr is enabled with sfc component
  3235. // - vite#872 non-sfc component used by sfc component
  3236. (optimized || patchFlag > 0) && !(patchFlag & 16)
  3237. ) {
  3238. if (patchFlag & 8) {
  3239. const propsToUpdate = instance.vnode.dynamicProps;
  3240. for (let i = 0; i < propsToUpdate.length; i++) {
  3241. let key = propsToUpdate[i];
  3242. if (isEmitListener(instance.emitsOptions, key)) {
  3243. continue;
  3244. }
  3245. const value = rawProps[key];
  3246. if (options) {
  3247. if (hasOwn(attrs, key)) {
  3248. if (value !== attrs[key]) {
  3249. attrs[key] = value;
  3250. hasAttrsChanged = true;
  3251. }
  3252. } else {
  3253. const camelizedKey = camelize(key);
  3254. props[camelizedKey] = resolvePropValue(
  3255. options,
  3256. rawCurrentProps,
  3257. camelizedKey,
  3258. value,
  3259. instance,
  3260. false
  3261. /* isAbsent */
  3262. );
  3263. }
  3264. } else {
  3265. if (value !== attrs[key]) {
  3266. attrs[key] = value;
  3267. hasAttrsChanged = true;
  3268. }
  3269. }
  3270. }
  3271. }
  3272. } else {
  3273. if (setFullProps(instance, rawProps, props, attrs)) {
  3274. hasAttrsChanged = true;
  3275. }
  3276. let kebabKey;
  3277. for (const key in rawCurrentProps) {
  3278. if (!rawProps || // for camelCase
  3279. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  3280. // and converted to camelCase (#955)
  3281. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  3282. if (options) {
  3283. if (rawPrevProps && // for camelCase
  3284. (rawPrevProps[key] !== void 0 || // for kebab-case
  3285. rawPrevProps[kebabKey] !== void 0)) {
  3286. props[key] = resolvePropValue(
  3287. options,
  3288. rawCurrentProps,
  3289. key,
  3290. void 0,
  3291. instance,
  3292. true
  3293. /* isAbsent */
  3294. );
  3295. }
  3296. } else {
  3297. delete props[key];
  3298. }
  3299. }
  3300. }
  3301. if (attrs !== rawCurrentProps) {
  3302. for (const key in attrs) {
  3303. if (!rawProps || !hasOwn(rawProps, key) && true) {
  3304. delete attrs[key];
  3305. hasAttrsChanged = true;
  3306. }
  3307. }
  3308. }
  3309. }
  3310. if (hasAttrsChanged) {
  3311. trigger(instance, "set", "$attrs");
  3312. }
  3313. }
  3314. function setFullProps(instance, rawProps, props, attrs) {
  3315. const [options, needCastKeys] = instance.propsOptions;
  3316. let hasAttrsChanged = false;
  3317. let rawCastValues;
  3318. if (rawProps) {
  3319. for (let key in rawProps) {
  3320. if (isReservedProp(key)) {
  3321. continue;
  3322. }
  3323. const value = rawProps[key];
  3324. let camelKey;
  3325. if (options && hasOwn(options, camelKey = camelize(key))) {
  3326. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  3327. props[camelKey] = value;
  3328. } else {
  3329. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  3330. }
  3331. } else if (!isEmitListener(instance.emitsOptions, key)) {
  3332. if (!(key in attrs) || value !== attrs[key]) {
  3333. attrs[key] = value;
  3334. hasAttrsChanged = true;
  3335. }
  3336. }
  3337. }
  3338. }
  3339. if (needCastKeys) {
  3340. const rawCurrentProps = toRaw(props);
  3341. const castValues = rawCastValues || EMPTY_OBJ;
  3342. for (let i = 0; i < needCastKeys.length; i++) {
  3343. const key = needCastKeys[i];
  3344. props[key] = resolvePropValue(
  3345. options,
  3346. rawCurrentProps,
  3347. key,
  3348. castValues[key],
  3349. instance,
  3350. !hasOwn(castValues, key)
  3351. );
  3352. }
  3353. }
  3354. return hasAttrsChanged;
  3355. }
  3356. function resolvePropValue(options, props, key, value, instance, isAbsent2) {
  3357. const opt = options[key];
  3358. if (opt != null) {
  3359. const hasDefault = hasOwn(opt, "default");
  3360. if (hasDefault && value === void 0) {
  3361. const defaultValue = opt.default;
  3362. if (opt.type !== Function && !opt.skipFactory && isFunction$2(defaultValue)) {
  3363. const { propsDefaults } = instance;
  3364. if (key in propsDefaults) {
  3365. value = propsDefaults[key];
  3366. } else {
  3367. setCurrentInstance(instance);
  3368. value = propsDefaults[key] = defaultValue.call(
  3369. null,
  3370. props
  3371. );
  3372. unsetCurrentInstance();
  3373. }
  3374. } else {
  3375. value = defaultValue;
  3376. }
  3377. }
  3378. if (opt[
  3379. 0
  3380. /* shouldCast */
  3381. ]) {
  3382. if (isAbsent2 && !hasDefault) {
  3383. value = false;
  3384. } else if (opt[
  3385. 1
  3386. /* shouldCastTrue */
  3387. ] && (value === "" || value === hyphenate(key))) {
  3388. value = true;
  3389. }
  3390. }
  3391. }
  3392. return value;
  3393. }
  3394. function normalizePropsOptions(comp, appContext, asMixin = false) {
  3395. const cache2 = appContext.propsCache;
  3396. const cached = cache2.get(comp);
  3397. if (cached) {
  3398. return cached;
  3399. }
  3400. const raw = comp.props;
  3401. const normalized = {};
  3402. const needCastKeys = [];
  3403. let hasExtends = false;
  3404. if (!isFunction$2(comp)) {
  3405. const extendProps = (raw2) => {
  3406. hasExtends = true;
  3407. const [props, keys2] = normalizePropsOptions(raw2, appContext, true);
  3408. extend(normalized, props);
  3409. if (keys2)
  3410. needCastKeys.push(...keys2);
  3411. };
  3412. if (!asMixin && appContext.mixins.length) {
  3413. appContext.mixins.forEach(extendProps);
  3414. }
  3415. if (comp.extends) {
  3416. extendProps(comp.extends);
  3417. }
  3418. if (comp.mixins) {
  3419. comp.mixins.forEach(extendProps);
  3420. }
  3421. }
  3422. if (!raw && !hasExtends) {
  3423. if (isObject$1(comp)) {
  3424. cache2.set(comp, EMPTY_ARR);
  3425. }
  3426. return EMPTY_ARR;
  3427. }
  3428. if (isArray$3(raw)) {
  3429. for (let i = 0; i < raw.length; i++) {
  3430. const normalizedKey = camelize(raw[i]);
  3431. if (validatePropName(normalizedKey)) {
  3432. normalized[normalizedKey] = EMPTY_OBJ;
  3433. }
  3434. }
  3435. } else if (raw) {
  3436. for (const key in raw) {
  3437. const normalizedKey = camelize(key);
  3438. if (validatePropName(normalizedKey)) {
  3439. const opt = raw[key];
  3440. const prop = normalized[normalizedKey] = isArray$3(opt) || isFunction$2(opt) ? { type: opt } : extend({}, opt);
  3441. if (prop) {
  3442. const booleanIndex = getTypeIndex(Boolean, prop.type);
  3443. const stringIndex = getTypeIndex(String, prop.type);
  3444. prop[
  3445. 0
  3446. /* shouldCast */
  3447. ] = booleanIndex > -1;
  3448. prop[
  3449. 1
  3450. /* shouldCastTrue */
  3451. ] = stringIndex < 0 || booleanIndex < stringIndex;
  3452. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  3453. needCastKeys.push(normalizedKey);
  3454. }
  3455. }
  3456. }
  3457. }
  3458. }
  3459. const res = [normalized, needCastKeys];
  3460. if (isObject$1(comp)) {
  3461. cache2.set(comp, res);
  3462. }
  3463. return res;
  3464. }
  3465. function validatePropName(key) {
  3466. if (key[0] !== "$") {
  3467. return true;
  3468. }
  3469. return false;
  3470. }
  3471. function getType(ctor) {
  3472. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  3473. return match ? match[2] : ctor === null ? "null" : "";
  3474. }
  3475. function isSameType(a2, b2) {
  3476. return getType(a2) === getType(b2);
  3477. }
  3478. function getTypeIndex(type2, expectedTypes) {
  3479. if (isArray$3(expectedTypes)) {
  3480. return expectedTypes.findIndex((t) => isSameType(t, type2));
  3481. } else if (isFunction$2(expectedTypes)) {
  3482. return isSameType(expectedTypes, type2) ? 0 : -1;
  3483. }
  3484. return -1;
  3485. }
  3486. const isInternalKey = (key) => key[0] === "_" || key === "$stable";
  3487. const normalizeSlotValue = (value) => isArray$3(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
  3488. const normalizeSlot$1 = (key, rawSlot, ctx) => {
  3489. if (rawSlot._n) {
  3490. return rawSlot;
  3491. }
  3492. const normalized = withCtx((...args) => {
  3493. if (false)
  3494. ;
  3495. return normalizeSlotValue(rawSlot(...args));
  3496. }, ctx);
  3497. normalized._c = false;
  3498. return normalized;
  3499. };
  3500. const normalizeObjectSlots = (rawSlots, slots, instance) => {
  3501. const ctx = rawSlots._ctx;
  3502. for (const key in rawSlots) {
  3503. if (isInternalKey(key))
  3504. continue;
  3505. const value = rawSlots[key];
  3506. if (isFunction$2(value)) {
  3507. slots[key] = normalizeSlot$1(key, value, ctx);
  3508. } else if (value != null) {
  3509. const normalized = normalizeSlotValue(value);
  3510. slots[key] = () => normalized;
  3511. }
  3512. }
  3513. };
  3514. const normalizeVNodeSlots = (instance, children) => {
  3515. const normalized = normalizeSlotValue(children);
  3516. instance.slots.default = () => normalized;
  3517. };
  3518. const initSlots = (instance, children) => {
  3519. if (instance.vnode.shapeFlag & 32) {
  3520. const type2 = children._;
  3521. if (type2) {
  3522. instance.slots = toRaw(children);
  3523. def(children, "_", type2);
  3524. } else {
  3525. normalizeObjectSlots(
  3526. children,
  3527. instance.slots = {}
  3528. );
  3529. }
  3530. } else {
  3531. instance.slots = {};
  3532. if (children) {
  3533. normalizeVNodeSlots(instance, children);
  3534. }
  3535. }
  3536. def(instance.slots, InternalObjectKey, 1);
  3537. };
  3538. const updateSlots = (instance, children, optimized) => {
  3539. const { vnode, slots } = instance;
  3540. let needDeletionCheck = true;
  3541. let deletionComparisonTarget = EMPTY_OBJ;
  3542. if (vnode.shapeFlag & 32) {
  3543. const type2 = children._;
  3544. if (type2) {
  3545. if (optimized && type2 === 1) {
  3546. needDeletionCheck = false;
  3547. } else {
  3548. extend(slots, children);
  3549. if (!optimized && type2 === 1) {
  3550. delete slots._;
  3551. }
  3552. }
  3553. } else {
  3554. needDeletionCheck = !children.$stable;
  3555. normalizeObjectSlots(children, slots);
  3556. }
  3557. deletionComparisonTarget = children;
  3558. } else if (children) {
  3559. normalizeVNodeSlots(instance, children);
  3560. deletionComparisonTarget = { default: 1 };
  3561. }
  3562. if (needDeletionCheck) {
  3563. for (const key in slots) {
  3564. if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
  3565. delete slots[key];
  3566. }
  3567. }
  3568. }
  3569. };
  3570. function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
  3571. if (isArray$3(rawRef)) {
  3572. rawRef.forEach(
  3573. (r, i) => setRef(
  3574. r,
  3575. oldRawRef && (isArray$3(oldRawRef) ? oldRawRef[i] : oldRawRef),
  3576. parentSuspense,
  3577. vnode,
  3578. isUnmount
  3579. )
  3580. );
  3581. return;
  3582. }
  3583. if (isAsyncWrapper(vnode) && !isUnmount) {
  3584. return;
  3585. }
  3586. const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el;
  3587. const value = isUnmount ? null : refValue;
  3588. const { i: owner, r: ref2 } = rawRef;
  3589. const oldRef = oldRawRef && oldRawRef.r;
  3590. const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
  3591. const setupState = owner.setupState;
  3592. if (oldRef != null && oldRef !== ref2) {
  3593. if (isString$1(oldRef)) {
  3594. refs[oldRef] = null;
  3595. if (hasOwn(setupState, oldRef)) {
  3596. setupState[oldRef] = null;
  3597. }
  3598. } else if (isRef(oldRef)) {
  3599. oldRef.value = null;
  3600. }
  3601. }
  3602. if (isFunction$2(ref2)) {
  3603. callWithErrorHandling(ref2, owner, 12, [value, refs]);
  3604. } else {
  3605. const _isString = isString$1(ref2);
  3606. const _isRef = isRef(ref2);
  3607. if (_isString || _isRef) {
  3608. const doSet = () => {
  3609. if (rawRef.f) {
  3610. const existing = _isString ? hasOwn(setupState, ref2) ? setupState[ref2] : refs[ref2] : ref2.value;
  3611. if (isUnmount) {
  3612. isArray$3(existing) && remove(existing, refValue);
  3613. } else {
  3614. if (!isArray$3(existing)) {
  3615. if (_isString) {
  3616. refs[ref2] = [refValue];
  3617. if (hasOwn(setupState, ref2)) {
  3618. setupState[ref2] = refs[ref2];
  3619. }
  3620. } else {
  3621. ref2.value = [refValue];
  3622. if (rawRef.k)
  3623. refs[rawRef.k] = ref2.value;
  3624. }
  3625. } else if (!existing.includes(refValue)) {
  3626. existing.push(refValue);
  3627. }
  3628. }
  3629. } else if (_isString) {
  3630. refs[ref2] = value;
  3631. if (hasOwn(setupState, ref2)) {
  3632. setupState[ref2] = value;
  3633. }
  3634. } else if (_isRef) {
  3635. ref2.value = value;
  3636. if (rawRef.k)
  3637. refs[rawRef.k] = value;
  3638. } else
  3639. ;
  3640. };
  3641. if (value) {
  3642. doSet.id = -1;
  3643. queuePostRenderEffect(doSet, parentSuspense);
  3644. } else {
  3645. doSet();
  3646. }
  3647. }
  3648. }
  3649. }
  3650. const queuePostRenderEffect = queueEffectWithSuspense;
  3651. function createRenderer(options) {
  3652. return baseCreateRenderer(options);
  3653. }
  3654. function baseCreateRenderer(options, createHydrationFns) {
  3655. const target = getGlobalThis();
  3656. target.__VUE__ = true;
  3657. const {
  3658. insert: hostInsert,
  3659. remove: hostRemove,
  3660. patchProp: hostPatchProp,
  3661. createElement: hostCreateElement,
  3662. createText: hostCreateText,
  3663. createComment: hostCreateComment,
  3664. setText: hostSetText,
  3665. setElementText: hostSetElementText,
  3666. parentNode: hostParentNode,
  3667. nextSibling: hostNextSibling,
  3668. setScopeId: hostSetScopeId = NOOP,
  3669. insertStaticContent: hostInsertStaticContent
  3670. } = options;
  3671. const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
  3672. if (n1 === n2) {
  3673. return;
  3674. }
  3675. if (n1 && !isSameVNodeType(n1, n2)) {
  3676. anchor = getNextHostNode(n1);
  3677. unmount(n1, parentComponent, parentSuspense, true);
  3678. n1 = null;
  3679. }
  3680. if (n2.patchFlag === -2) {
  3681. optimized = false;
  3682. n2.dynamicChildren = null;
  3683. }
  3684. const { type: type2, ref: ref2, shapeFlag } = n2;
  3685. switch (type2) {
  3686. case Text$1:
  3687. processText(n1, n2, container, anchor);
  3688. break;
  3689. case Comment:
  3690. processCommentNode(n1, n2, container, anchor);
  3691. break;
  3692. case Static:
  3693. if (n1 == null) {
  3694. mountStaticNode(n2, container, anchor, isSVG);
  3695. }
  3696. break;
  3697. case Fragment:
  3698. processFragment(
  3699. n1,
  3700. n2,
  3701. container,
  3702. anchor,
  3703. parentComponent,
  3704. parentSuspense,
  3705. isSVG,
  3706. slotScopeIds,
  3707. optimized
  3708. );
  3709. break;
  3710. default:
  3711. if (shapeFlag & 1) {
  3712. processElement(
  3713. n1,
  3714. n2,
  3715. container,
  3716. anchor,
  3717. parentComponent,
  3718. parentSuspense,
  3719. isSVG,
  3720. slotScopeIds,
  3721. optimized
  3722. );
  3723. } else if (shapeFlag & 6) {
  3724. processComponent(
  3725. n1,
  3726. n2,
  3727. container,
  3728. anchor,
  3729. parentComponent,
  3730. parentSuspense,
  3731. isSVG,
  3732. slotScopeIds,
  3733. optimized
  3734. );
  3735. } else if (shapeFlag & 64) {
  3736. type2.process(
  3737. n1,
  3738. n2,
  3739. container,
  3740. anchor,
  3741. parentComponent,
  3742. parentSuspense,
  3743. isSVG,
  3744. slotScopeIds,
  3745. optimized,
  3746. internals
  3747. );
  3748. } else if (shapeFlag & 128) {
  3749. type2.process(
  3750. n1,
  3751. n2,
  3752. container,
  3753. anchor,
  3754. parentComponent,
  3755. parentSuspense,
  3756. isSVG,
  3757. slotScopeIds,
  3758. optimized,
  3759. internals
  3760. );
  3761. } else
  3762. ;
  3763. }
  3764. if (ref2 != null && parentComponent) {
  3765. setRef(ref2, n1 && n1.ref, parentSuspense, n2 || n1, !n2);
  3766. }
  3767. };
  3768. const processText = (n1, n2, container, anchor) => {
  3769. if (n1 == null) {
  3770. hostInsert(
  3771. n2.el = hostCreateText(n2.children),
  3772. container,
  3773. anchor
  3774. );
  3775. } else {
  3776. const el = n2.el = n1.el;
  3777. if (n2.children !== n1.children) {
  3778. hostSetText(el, n2.children);
  3779. }
  3780. }
  3781. };
  3782. const processCommentNode = (n1, n2, container, anchor) => {
  3783. if (n1 == null) {
  3784. hostInsert(
  3785. n2.el = hostCreateComment(n2.children || ""),
  3786. container,
  3787. anchor
  3788. );
  3789. } else {
  3790. n2.el = n1.el;
  3791. }
  3792. };
  3793. const mountStaticNode = (n2, container, anchor, isSVG) => {
  3794. [n2.el, n2.anchor] = hostInsertStaticContent(
  3795. n2.children,
  3796. container,
  3797. anchor,
  3798. isSVG,
  3799. n2.el,
  3800. n2.anchor
  3801. );
  3802. };
  3803. const moveStaticNode = ({ el, anchor }, container, nextSibling) => {
  3804. let next;
  3805. while (el && el !== anchor) {
  3806. next = hostNextSibling(el);
  3807. hostInsert(el, container, nextSibling);
  3808. el = next;
  3809. }
  3810. hostInsert(anchor, container, nextSibling);
  3811. };
  3812. const removeStaticNode = ({ el, anchor }) => {
  3813. let next;
  3814. while (el && el !== anchor) {
  3815. next = hostNextSibling(el);
  3816. hostRemove(el);
  3817. el = next;
  3818. }
  3819. hostRemove(anchor);
  3820. };
  3821. const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  3822. isSVG = isSVG || n2.type === "svg";
  3823. if (n1 == null) {
  3824. mountElement(
  3825. n2,
  3826. container,
  3827. anchor,
  3828. parentComponent,
  3829. parentSuspense,
  3830. isSVG,
  3831. slotScopeIds,
  3832. optimized
  3833. );
  3834. } else {
  3835. patchElement(
  3836. n1,
  3837. n2,
  3838. parentComponent,
  3839. parentSuspense,
  3840. isSVG,
  3841. slotScopeIds,
  3842. optimized
  3843. );
  3844. }
  3845. };
  3846. const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  3847. let el;
  3848. let vnodeHook;
  3849. const { type: type2, props, shapeFlag, transition, dirs } = vnode;
  3850. el = vnode.el = hostCreateElement(
  3851. vnode.type,
  3852. isSVG,
  3853. props && props.is,
  3854. props
  3855. );
  3856. if (shapeFlag & 8) {
  3857. hostSetElementText(el, vnode.children);
  3858. } else if (shapeFlag & 16) {
  3859. mountChildren(
  3860. vnode.children,
  3861. el,
  3862. null,
  3863. parentComponent,
  3864. parentSuspense,
  3865. isSVG && type2 !== "foreignObject",
  3866. slotScopeIds,
  3867. optimized
  3868. );
  3869. }
  3870. if (dirs) {
  3871. invokeDirectiveHook(vnode, null, parentComponent, "created");
  3872. }
  3873. setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
  3874. if (props) {
  3875. for (const key in props) {
  3876. if (key !== "value" && !isReservedProp(key)) {
  3877. hostPatchProp(
  3878. el,
  3879. key,
  3880. null,
  3881. props[key],
  3882. isSVG,
  3883. vnode.children,
  3884. parentComponent,
  3885. parentSuspense,
  3886. unmountChildren
  3887. );
  3888. }
  3889. }
  3890. if ("value" in props) {
  3891. hostPatchProp(el, "value", null, props.value);
  3892. }
  3893. if (vnodeHook = props.onVnodeBeforeMount) {
  3894. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  3895. }
  3896. }
  3897. if (dirs) {
  3898. invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
  3899. }
  3900. const needCallTransitionHooks = needTransition(parentSuspense, transition);
  3901. if (needCallTransitionHooks) {
  3902. transition.beforeEnter(el);
  3903. }
  3904. hostInsert(el, container, anchor);
  3905. if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
  3906. queuePostRenderEffect(() => {
  3907. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  3908. needCallTransitionHooks && transition.enter(el);
  3909. dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
  3910. }, parentSuspense);
  3911. }
  3912. };
  3913. const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
  3914. if (scopeId) {
  3915. hostSetScopeId(el, scopeId);
  3916. }
  3917. if (slotScopeIds) {
  3918. for (let i = 0; i < slotScopeIds.length; i++) {
  3919. hostSetScopeId(el, slotScopeIds[i]);
  3920. }
  3921. }
  3922. if (parentComponent) {
  3923. let subTree = parentComponent.subTree;
  3924. if (vnode === subTree) {
  3925. const parentVNode = parentComponent.vnode;
  3926. setScopeId(
  3927. el,
  3928. parentVNode,
  3929. parentVNode.scopeId,
  3930. parentVNode.slotScopeIds,
  3931. parentComponent.parent
  3932. );
  3933. }
  3934. }
  3935. };
  3936. const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
  3937. for (let i = start; i < children.length; i++) {
  3938. const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
  3939. patch(
  3940. null,
  3941. child,
  3942. container,
  3943. anchor,
  3944. parentComponent,
  3945. parentSuspense,
  3946. isSVG,
  3947. slotScopeIds,
  3948. optimized
  3949. );
  3950. }
  3951. };
  3952. const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  3953. const el = n2.el = n1.el;
  3954. let { patchFlag, dynamicChildren, dirs } = n2;
  3955. patchFlag |= n1.patchFlag & 16;
  3956. const oldProps = n1.props || EMPTY_OBJ;
  3957. const newProps = n2.props || EMPTY_OBJ;
  3958. let vnodeHook;
  3959. parentComponent && toggleRecurse(parentComponent, false);
  3960. if (vnodeHook = newProps.onVnodeBeforeUpdate) {
  3961. invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  3962. }
  3963. if (dirs) {
  3964. invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
  3965. }
  3966. parentComponent && toggleRecurse(parentComponent, true);
  3967. const areChildrenSVG = isSVG && n2.type !== "foreignObject";
  3968. if (dynamicChildren) {
  3969. patchBlockChildren(
  3970. n1.dynamicChildren,
  3971. dynamicChildren,
  3972. el,
  3973. parentComponent,
  3974. parentSuspense,
  3975. areChildrenSVG,
  3976. slotScopeIds
  3977. );
  3978. } else if (!optimized) {
  3979. patchChildren(
  3980. n1,
  3981. n2,
  3982. el,
  3983. null,
  3984. parentComponent,
  3985. parentSuspense,
  3986. areChildrenSVG,
  3987. slotScopeIds,
  3988. false
  3989. );
  3990. }
  3991. if (patchFlag > 0) {
  3992. if (patchFlag & 16) {
  3993. patchProps(
  3994. el,
  3995. n2,
  3996. oldProps,
  3997. newProps,
  3998. parentComponent,
  3999. parentSuspense,
  4000. isSVG
  4001. );
  4002. } else {
  4003. if (patchFlag & 2) {
  4004. if (oldProps.class !== newProps.class) {
  4005. hostPatchProp(el, "class", null, newProps.class, isSVG);
  4006. }
  4007. }
  4008. if (patchFlag & 4) {
  4009. hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
  4010. }
  4011. if (patchFlag & 8) {
  4012. const propsToUpdate = n2.dynamicProps;
  4013. for (let i = 0; i < propsToUpdate.length; i++) {
  4014. const key = propsToUpdate[i];
  4015. const prev = oldProps[key];
  4016. const next = newProps[key];
  4017. if (next !== prev || key === "value") {
  4018. hostPatchProp(
  4019. el,
  4020. key,
  4021. prev,
  4022. next,
  4023. isSVG,
  4024. n1.children,
  4025. parentComponent,
  4026. parentSuspense,
  4027. unmountChildren
  4028. );
  4029. }
  4030. }
  4031. }
  4032. }
  4033. if (patchFlag & 1) {
  4034. if (n1.children !== n2.children) {
  4035. hostSetElementText(el, n2.children);
  4036. }
  4037. }
  4038. } else if (!optimized && dynamicChildren == null) {
  4039. patchProps(
  4040. el,
  4041. n2,
  4042. oldProps,
  4043. newProps,
  4044. parentComponent,
  4045. parentSuspense,
  4046. isSVG
  4047. );
  4048. }
  4049. if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
  4050. queuePostRenderEffect(() => {
  4051. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
  4052. dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
  4053. }, parentSuspense);
  4054. }
  4055. };
  4056. const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
  4057. for (let i = 0; i < newChildren.length; i++) {
  4058. const oldVNode = oldChildren[i];
  4059. const newVNode = newChildren[i];
  4060. const container = (
  4061. // oldVNode may be an errored async setup() component inside Suspense
  4062. // which will not have a mounted element
  4063. oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent
  4064. // of the Fragment itself so it can move its children.
  4065. (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement
  4066. // which also requires the correct parent container
  4067. !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything.
  4068. oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : (
  4069. // In other cases, the parent container is not actually used so we
  4070. // just pass the block element here to avoid a DOM parentNode call.
  4071. fallbackContainer
  4072. )
  4073. );
  4074. patch(
  4075. oldVNode,
  4076. newVNode,
  4077. container,
  4078. null,
  4079. parentComponent,
  4080. parentSuspense,
  4081. isSVG,
  4082. slotScopeIds,
  4083. true
  4084. );
  4085. }
  4086. };
  4087. const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
  4088. if (oldProps !== newProps) {
  4089. if (oldProps !== EMPTY_OBJ) {
  4090. for (const key in oldProps) {
  4091. if (!isReservedProp(key) && !(key in newProps)) {
  4092. hostPatchProp(
  4093. el,
  4094. key,
  4095. oldProps[key],
  4096. null,
  4097. isSVG,
  4098. vnode.children,
  4099. parentComponent,
  4100. parentSuspense,
  4101. unmountChildren
  4102. );
  4103. }
  4104. }
  4105. }
  4106. for (const key in newProps) {
  4107. if (isReservedProp(key))
  4108. continue;
  4109. const next = newProps[key];
  4110. const prev = oldProps[key];
  4111. if (next !== prev && key !== "value") {
  4112. hostPatchProp(
  4113. el,
  4114. key,
  4115. prev,
  4116. next,
  4117. isSVG,
  4118. vnode.children,
  4119. parentComponent,
  4120. parentSuspense,
  4121. unmountChildren
  4122. );
  4123. }
  4124. }
  4125. if ("value" in newProps) {
  4126. hostPatchProp(el, "value", oldProps.value, newProps.value);
  4127. }
  4128. }
  4129. };
  4130. const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4131. const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
  4132. const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
  4133. let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
  4134. if (fragmentSlotScopeIds) {
  4135. slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
  4136. }
  4137. if (n1 == null) {
  4138. hostInsert(fragmentStartAnchor, container, anchor);
  4139. hostInsert(fragmentEndAnchor, container, anchor);
  4140. mountChildren(
  4141. n2.children,
  4142. container,
  4143. fragmentEndAnchor,
  4144. parentComponent,
  4145. parentSuspense,
  4146. isSVG,
  4147. slotScopeIds,
  4148. optimized
  4149. );
  4150. } else {
  4151. if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result
  4152. // of renderSlot() with no valid children
  4153. n1.dynamicChildren) {
  4154. patchBlockChildren(
  4155. n1.dynamicChildren,
  4156. dynamicChildren,
  4157. container,
  4158. parentComponent,
  4159. parentSuspense,
  4160. isSVG,
  4161. slotScopeIds
  4162. );
  4163. if (
  4164. // #2080 if the stable fragment has a key, it's a <template v-for> that may
  4165. // get moved around. Make sure all root level vnodes inherit el.
  4166. // #2134 or if it's a component root, it may also get moved around
  4167. // as the component is being moved.
  4168. n2.key != null || parentComponent && n2 === parentComponent.subTree
  4169. ) {
  4170. traverseStaticChildren(
  4171. n1,
  4172. n2,
  4173. true
  4174. /* shallow */
  4175. );
  4176. }
  4177. } else {
  4178. patchChildren(
  4179. n1,
  4180. n2,
  4181. container,
  4182. fragmentEndAnchor,
  4183. parentComponent,
  4184. parentSuspense,
  4185. isSVG,
  4186. slotScopeIds,
  4187. optimized
  4188. );
  4189. }
  4190. }
  4191. };
  4192. const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4193. n2.slotScopeIds = slotScopeIds;
  4194. if (n1 == null) {
  4195. if (n2.shapeFlag & 512) {
  4196. parentComponent.ctx.activate(
  4197. n2,
  4198. container,
  4199. anchor,
  4200. isSVG,
  4201. optimized
  4202. );
  4203. } else {
  4204. mountComponent(
  4205. n2,
  4206. container,
  4207. anchor,
  4208. parentComponent,
  4209. parentSuspense,
  4210. isSVG,
  4211. optimized
  4212. );
  4213. }
  4214. } else {
  4215. updateComponent(n1, n2, optimized);
  4216. }
  4217. };
  4218. const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
  4219. const instance = initialVNode.component = createComponentInstance(
  4220. initialVNode,
  4221. parentComponent,
  4222. parentSuspense
  4223. );
  4224. if (isKeepAlive(initialVNode)) {
  4225. instance.ctx.renderer = internals;
  4226. }
  4227. {
  4228. setupComponent(instance);
  4229. }
  4230. if (instance.asyncDep) {
  4231. parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect);
  4232. if (!initialVNode.el) {
  4233. const placeholder = instance.subTree = createVNode(Comment);
  4234. processCommentNode(null, placeholder, container, anchor);
  4235. }
  4236. return;
  4237. }
  4238. setupRenderEffect(
  4239. instance,
  4240. initialVNode,
  4241. container,
  4242. anchor,
  4243. parentSuspense,
  4244. isSVG,
  4245. optimized
  4246. );
  4247. };
  4248. const updateComponent = (n1, n2, optimized) => {
  4249. const instance = n2.component = n1.component;
  4250. if (shouldUpdateComponent(n1, n2, optimized)) {
  4251. if (instance.asyncDep && !instance.asyncResolved) {
  4252. updateComponentPreRender(instance, n2, optimized);
  4253. return;
  4254. } else {
  4255. instance.next = n2;
  4256. invalidateJob(instance.update);
  4257. instance.update();
  4258. }
  4259. } else {
  4260. n2.el = n1.el;
  4261. instance.vnode = n2;
  4262. }
  4263. };
  4264. const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
  4265. const componentUpdateFn = () => {
  4266. if (!instance.isMounted) {
  4267. let vnodeHook;
  4268. const { el, props } = initialVNode;
  4269. const { bm, m: m2, parent } = instance;
  4270. const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
  4271. toggleRecurse(instance, false);
  4272. if (bm) {
  4273. invokeArrayFns(bm);
  4274. }
  4275. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) {
  4276. invokeVNodeHook(vnodeHook, parent, initialVNode);
  4277. }
  4278. toggleRecurse(instance, true);
  4279. if (el && hydrateNode) {
  4280. const hydrateSubTree = () => {
  4281. instance.subTree = renderComponentRoot(instance);
  4282. hydrateNode(
  4283. el,
  4284. instance.subTree,
  4285. instance,
  4286. parentSuspense,
  4287. null
  4288. );
  4289. };
  4290. if (isAsyncWrapperVNode) {
  4291. initialVNode.type.__asyncLoader().then(
  4292. // note: we are moving the render call into an async callback,
  4293. // which means it won't track dependencies - but it's ok because
  4294. // a server-rendered async wrapper is already in resolved state
  4295. // and it will never need to change.
  4296. () => !instance.isUnmounted && hydrateSubTree()
  4297. );
  4298. } else {
  4299. hydrateSubTree();
  4300. }
  4301. } else {
  4302. const subTree = instance.subTree = renderComponentRoot(instance);
  4303. patch(
  4304. null,
  4305. subTree,
  4306. container,
  4307. anchor,
  4308. instance,
  4309. parentSuspense,
  4310. isSVG
  4311. );
  4312. initialVNode.el = subTree.el;
  4313. }
  4314. if (m2) {
  4315. queuePostRenderEffect(m2, parentSuspense);
  4316. }
  4317. if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) {
  4318. const scopedInitialVNode = initialVNode;
  4319. queuePostRenderEffect(
  4320. () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode),
  4321. parentSuspense
  4322. );
  4323. }
  4324. if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) {
  4325. instance.a && queuePostRenderEffect(instance.a, parentSuspense);
  4326. }
  4327. instance.isMounted = true;
  4328. initialVNode = container = anchor = null;
  4329. } else {
  4330. let { next, bu, u: u2, parent, vnode } = instance;
  4331. let originNext = next;
  4332. let vnodeHook;
  4333. toggleRecurse(instance, false);
  4334. if (next) {
  4335. next.el = vnode.el;
  4336. updateComponentPreRender(instance, next, optimized);
  4337. } else {
  4338. next = vnode;
  4339. }
  4340. if (bu) {
  4341. invokeArrayFns(bu);
  4342. }
  4343. if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) {
  4344. invokeVNodeHook(vnodeHook, parent, next, vnode);
  4345. }
  4346. toggleRecurse(instance, true);
  4347. const nextTree = renderComponentRoot(instance);
  4348. const prevTree = instance.subTree;
  4349. instance.subTree = nextTree;
  4350. patch(
  4351. prevTree,
  4352. nextTree,
  4353. // parent may have changed if it's in a teleport
  4354. hostParentNode(prevTree.el),
  4355. // anchor may have changed if it's in a fragment
  4356. getNextHostNode(prevTree),
  4357. instance,
  4358. parentSuspense,
  4359. isSVG
  4360. );
  4361. next.el = nextTree.el;
  4362. if (originNext === null) {
  4363. updateHOCHostEl(instance, nextTree.el);
  4364. }
  4365. if (u2) {
  4366. queuePostRenderEffect(u2, parentSuspense);
  4367. }
  4368. if (vnodeHook = next.props && next.props.onVnodeUpdated) {
  4369. queuePostRenderEffect(
  4370. () => invokeVNodeHook(vnodeHook, parent, next, vnode),
  4371. parentSuspense
  4372. );
  4373. }
  4374. }
  4375. };
  4376. const effect = instance.effect = new ReactiveEffect(
  4377. componentUpdateFn,
  4378. () => queueJob(update),
  4379. instance.scope
  4380. // track it in component's effect scope
  4381. );
  4382. const update = instance.update = () => effect.run();
  4383. update.id = instance.uid;
  4384. toggleRecurse(instance, true);
  4385. update();
  4386. };
  4387. const updateComponentPreRender = (instance, nextVNode, optimized) => {
  4388. nextVNode.component = instance;
  4389. const prevProps = instance.vnode.props;
  4390. instance.vnode = nextVNode;
  4391. instance.next = null;
  4392. updateProps(instance, nextVNode.props, prevProps, optimized);
  4393. updateSlots(instance, nextVNode.children, optimized);
  4394. pauseTracking();
  4395. flushPreFlushCbs();
  4396. resetTracking();
  4397. };
  4398. const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
  4399. const c1 = n1 && n1.children;
  4400. const prevShapeFlag = n1 ? n1.shapeFlag : 0;
  4401. const c2 = n2.children;
  4402. const { patchFlag, shapeFlag } = n2;
  4403. if (patchFlag > 0) {
  4404. if (patchFlag & 128) {
  4405. patchKeyedChildren(
  4406. c1,
  4407. c2,
  4408. container,
  4409. anchor,
  4410. parentComponent,
  4411. parentSuspense,
  4412. isSVG,
  4413. slotScopeIds,
  4414. optimized
  4415. );
  4416. return;
  4417. } else if (patchFlag & 256) {
  4418. patchUnkeyedChildren(
  4419. c1,
  4420. c2,
  4421. container,
  4422. anchor,
  4423. parentComponent,
  4424. parentSuspense,
  4425. isSVG,
  4426. slotScopeIds,
  4427. optimized
  4428. );
  4429. return;
  4430. }
  4431. }
  4432. if (shapeFlag & 8) {
  4433. if (prevShapeFlag & 16) {
  4434. unmountChildren(c1, parentComponent, parentSuspense);
  4435. }
  4436. if (c2 !== c1) {
  4437. hostSetElementText(container, c2);
  4438. }
  4439. } else {
  4440. if (prevShapeFlag & 16) {
  4441. if (shapeFlag & 16) {
  4442. patchKeyedChildren(
  4443. c1,
  4444. c2,
  4445. container,
  4446. anchor,
  4447. parentComponent,
  4448. parentSuspense,
  4449. isSVG,
  4450. slotScopeIds,
  4451. optimized
  4452. );
  4453. } else {
  4454. unmountChildren(c1, parentComponent, parentSuspense, true);
  4455. }
  4456. } else {
  4457. if (prevShapeFlag & 8) {
  4458. hostSetElementText(container, "");
  4459. }
  4460. if (shapeFlag & 16) {
  4461. mountChildren(
  4462. c2,
  4463. container,
  4464. anchor,
  4465. parentComponent,
  4466. parentSuspense,
  4467. isSVG,
  4468. slotScopeIds,
  4469. optimized
  4470. );
  4471. }
  4472. }
  4473. }
  4474. };
  4475. const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4476. c1 = c1 || EMPTY_ARR;
  4477. c2 = c2 || EMPTY_ARR;
  4478. const oldLength = c1.length;
  4479. const newLength = c2.length;
  4480. const commonLength = Math.min(oldLength, newLength);
  4481. let i;
  4482. for (i = 0; i < commonLength; i++) {
  4483. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4484. patch(
  4485. c1[i],
  4486. nextChild,
  4487. container,
  4488. null,
  4489. parentComponent,
  4490. parentSuspense,
  4491. isSVG,
  4492. slotScopeIds,
  4493. optimized
  4494. );
  4495. }
  4496. if (oldLength > newLength) {
  4497. unmountChildren(
  4498. c1,
  4499. parentComponent,
  4500. parentSuspense,
  4501. true,
  4502. false,
  4503. commonLength
  4504. );
  4505. } else {
  4506. mountChildren(
  4507. c2,
  4508. container,
  4509. anchor,
  4510. parentComponent,
  4511. parentSuspense,
  4512. isSVG,
  4513. slotScopeIds,
  4514. optimized,
  4515. commonLength
  4516. );
  4517. }
  4518. };
  4519. const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
  4520. let i = 0;
  4521. const l2 = c2.length;
  4522. let e1 = c1.length - 1;
  4523. let e2 = l2 - 1;
  4524. while (i <= e1 && i <= e2) {
  4525. const n1 = c1[i];
  4526. const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4527. if (isSameVNodeType(n1, n2)) {
  4528. patch(
  4529. n1,
  4530. n2,
  4531. container,
  4532. null,
  4533. parentComponent,
  4534. parentSuspense,
  4535. isSVG,
  4536. slotScopeIds,
  4537. optimized
  4538. );
  4539. } else {
  4540. break;
  4541. }
  4542. i++;
  4543. }
  4544. while (i <= e1 && i <= e2) {
  4545. const n1 = c1[e1];
  4546. const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]);
  4547. if (isSameVNodeType(n1, n2)) {
  4548. patch(
  4549. n1,
  4550. n2,
  4551. container,
  4552. null,
  4553. parentComponent,
  4554. parentSuspense,
  4555. isSVG,
  4556. slotScopeIds,
  4557. optimized
  4558. );
  4559. } else {
  4560. break;
  4561. }
  4562. e1--;
  4563. e2--;
  4564. }
  4565. if (i > e1) {
  4566. if (i <= e2) {
  4567. const nextPos = e2 + 1;
  4568. const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor;
  4569. while (i <= e2) {
  4570. patch(
  4571. null,
  4572. c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]),
  4573. container,
  4574. anchor,
  4575. parentComponent,
  4576. parentSuspense,
  4577. isSVG,
  4578. slotScopeIds,
  4579. optimized
  4580. );
  4581. i++;
  4582. }
  4583. }
  4584. } else if (i > e2) {
  4585. while (i <= e1) {
  4586. unmount(c1[i], parentComponent, parentSuspense, true);
  4587. i++;
  4588. }
  4589. } else {
  4590. const s1 = i;
  4591. const s2 = i;
  4592. const keyToNewIndexMap = /* @__PURE__ */ new Map();
  4593. for (i = s2; i <= e2; i++) {
  4594. const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]);
  4595. if (nextChild.key != null) {
  4596. keyToNewIndexMap.set(nextChild.key, i);
  4597. }
  4598. }
  4599. let j;
  4600. let patched = 0;
  4601. const toBePatched = e2 - s2 + 1;
  4602. let moved = false;
  4603. let maxNewIndexSoFar = 0;
  4604. const newIndexToOldIndexMap = new Array(toBePatched);
  4605. for (i = 0; i < toBePatched; i++)
  4606. newIndexToOldIndexMap[i] = 0;
  4607. for (i = s1; i <= e1; i++) {
  4608. const prevChild = c1[i];
  4609. if (patched >= toBePatched) {
  4610. unmount(prevChild, parentComponent, parentSuspense, true);
  4611. continue;
  4612. }
  4613. let newIndex;
  4614. if (prevChild.key != null) {
  4615. newIndex = keyToNewIndexMap.get(prevChild.key);
  4616. } else {
  4617. for (j = s2; j <= e2; j++) {
  4618. if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) {
  4619. newIndex = j;
  4620. break;
  4621. }
  4622. }
  4623. }
  4624. if (newIndex === void 0) {
  4625. unmount(prevChild, parentComponent, parentSuspense, true);
  4626. } else {
  4627. newIndexToOldIndexMap[newIndex - s2] = i + 1;
  4628. if (newIndex >= maxNewIndexSoFar) {
  4629. maxNewIndexSoFar = newIndex;
  4630. } else {
  4631. moved = true;
  4632. }
  4633. patch(
  4634. prevChild,
  4635. c2[newIndex],
  4636. container,
  4637. null,
  4638. parentComponent,
  4639. parentSuspense,
  4640. isSVG,
  4641. slotScopeIds,
  4642. optimized
  4643. );
  4644. patched++;
  4645. }
  4646. }
  4647. const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR;
  4648. j = increasingNewIndexSequence.length - 1;
  4649. for (i = toBePatched - 1; i >= 0; i--) {
  4650. const nextIndex = s2 + i;
  4651. const nextChild = c2[nextIndex];
  4652. const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
  4653. if (newIndexToOldIndexMap[i] === 0) {
  4654. patch(
  4655. null,
  4656. nextChild,
  4657. container,
  4658. anchor,
  4659. parentComponent,
  4660. parentSuspense,
  4661. isSVG,
  4662. slotScopeIds,
  4663. optimized
  4664. );
  4665. } else if (moved) {
  4666. if (j < 0 || i !== increasingNewIndexSequence[j]) {
  4667. move(nextChild, container, anchor, 2);
  4668. } else {
  4669. j--;
  4670. }
  4671. }
  4672. }
  4673. }
  4674. };
  4675. const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
  4676. const { el, type: type2, transition, children, shapeFlag } = vnode;
  4677. if (shapeFlag & 6) {
  4678. move(vnode.component.subTree, container, anchor, moveType);
  4679. return;
  4680. }
  4681. if (shapeFlag & 128) {
  4682. vnode.suspense.move(container, anchor, moveType);
  4683. return;
  4684. }
  4685. if (shapeFlag & 64) {
  4686. type2.move(vnode, container, anchor, internals);
  4687. return;
  4688. }
  4689. if (type2 === Fragment) {
  4690. hostInsert(el, container, anchor);
  4691. for (let i = 0; i < children.length; i++) {
  4692. move(children[i], container, anchor, moveType);
  4693. }
  4694. hostInsert(vnode.anchor, container, anchor);
  4695. return;
  4696. }
  4697. if (type2 === Static) {
  4698. moveStaticNode(vnode, container, anchor);
  4699. return;
  4700. }
  4701. const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
  4702. if (needTransition2) {
  4703. if (moveType === 0) {
  4704. transition.beforeEnter(el);
  4705. hostInsert(el, container, anchor);
  4706. queuePostRenderEffect(() => transition.enter(el), parentSuspense);
  4707. } else {
  4708. const { leave, delayLeave, afterLeave } = transition;
  4709. const remove22 = () => hostInsert(el, container, anchor);
  4710. const performLeave = () => {
  4711. leave(el, () => {
  4712. remove22();
  4713. afterLeave && afterLeave();
  4714. });
  4715. };
  4716. if (delayLeave) {
  4717. delayLeave(el, remove22, performLeave);
  4718. } else {
  4719. performLeave();
  4720. }
  4721. }
  4722. } else {
  4723. hostInsert(el, container, anchor);
  4724. }
  4725. };
  4726. const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
  4727. const {
  4728. type: type2,
  4729. props,
  4730. ref: ref2,
  4731. children,
  4732. dynamicChildren,
  4733. shapeFlag,
  4734. patchFlag,
  4735. dirs
  4736. } = vnode;
  4737. if (ref2 != null) {
  4738. setRef(ref2, null, parentSuspense, vnode, true);
  4739. }
  4740. if (shapeFlag & 256) {
  4741. parentComponent.ctx.deactivate(vnode);
  4742. return;
  4743. }
  4744. const shouldInvokeDirs = shapeFlag & 1 && dirs;
  4745. const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
  4746. let vnodeHook;
  4747. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) {
  4748. invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4749. }
  4750. if (shapeFlag & 6) {
  4751. unmountComponent(vnode.component, parentSuspense, doRemove);
  4752. } else {
  4753. if (shapeFlag & 128) {
  4754. vnode.suspense.unmount(parentSuspense, doRemove);
  4755. return;
  4756. }
  4757. if (shouldInvokeDirs) {
  4758. invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
  4759. }
  4760. if (shapeFlag & 64) {
  4761. vnode.type.remove(
  4762. vnode,
  4763. parentComponent,
  4764. parentSuspense,
  4765. optimized,
  4766. internals,
  4767. doRemove
  4768. );
  4769. } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments
  4770. (type2 !== Fragment || patchFlag > 0 && patchFlag & 64)) {
  4771. unmountChildren(
  4772. dynamicChildren,
  4773. parentComponent,
  4774. parentSuspense,
  4775. false,
  4776. true
  4777. );
  4778. } else if (type2 === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) {
  4779. unmountChildren(children, parentComponent, parentSuspense);
  4780. }
  4781. if (doRemove) {
  4782. remove2(vnode);
  4783. }
  4784. }
  4785. if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) {
  4786. queuePostRenderEffect(() => {
  4787. vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
  4788. shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
  4789. }, parentSuspense);
  4790. }
  4791. };
  4792. const remove2 = (vnode) => {
  4793. const { type: type2, el, anchor, transition } = vnode;
  4794. if (type2 === Fragment) {
  4795. {
  4796. removeFragment(el, anchor);
  4797. }
  4798. return;
  4799. }
  4800. if (type2 === Static) {
  4801. removeStaticNode(vnode);
  4802. return;
  4803. }
  4804. const performRemove = () => {
  4805. hostRemove(el);
  4806. if (transition && !transition.persisted && transition.afterLeave) {
  4807. transition.afterLeave();
  4808. }
  4809. };
  4810. if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
  4811. const { leave, delayLeave } = transition;
  4812. const performLeave = () => leave(el, performRemove);
  4813. if (delayLeave) {
  4814. delayLeave(vnode.el, performRemove, performLeave);
  4815. } else {
  4816. performLeave();
  4817. }
  4818. } else {
  4819. performRemove();
  4820. }
  4821. };
  4822. const removeFragment = (cur, end2) => {
  4823. let next;
  4824. while (cur !== end2) {
  4825. next = hostNextSibling(cur);
  4826. hostRemove(cur);
  4827. cur = next;
  4828. }
  4829. hostRemove(end2);
  4830. };
  4831. const unmountComponent = (instance, parentSuspense, doRemove) => {
  4832. const { bum, scope, update, subTree, um } = instance;
  4833. if (bum) {
  4834. invokeArrayFns(bum);
  4835. }
  4836. scope.stop();
  4837. if (update) {
  4838. update.active = false;
  4839. unmount(subTree, instance, parentSuspense, doRemove);
  4840. }
  4841. if (um) {
  4842. queuePostRenderEffect(um, parentSuspense);
  4843. }
  4844. queuePostRenderEffect(() => {
  4845. instance.isUnmounted = true;
  4846. }, parentSuspense);
  4847. if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
  4848. parentSuspense.deps--;
  4849. if (parentSuspense.deps === 0) {
  4850. parentSuspense.resolve();
  4851. }
  4852. }
  4853. };
  4854. const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
  4855. for (let i = start; i < children.length; i++) {
  4856. unmount(children[i], parentComponent, parentSuspense, doRemove, optimized);
  4857. }
  4858. };
  4859. const getNextHostNode = (vnode) => {
  4860. if (vnode.shapeFlag & 6) {
  4861. return getNextHostNode(vnode.component.subTree);
  4862. }
  4863. if (vnode.shapeFlag & 128) {
  4864. return vnode.suspense.next();
  4865. }
  4866. return hostNextSibling(vnode.anchor || vnode.el);
  4867. };
  4868. const render2 = (vnode, container, isSVG) => {
  4869. if (vnode == null) {
  4870. if (container._vnode) {
  4871. unmount(container._vnode, null, null, true);
  4872. }
  4873. } else {
  4874. patch(container._vnode || null, vnode, container, null, null, null, isSVG);
  4875. }
  4876. flushPreFlushCbs();
  4877. flushPostFlushCbs();
  4878. container._vnode = vnode;
  4879. };
  4880. const internals = {
  4881. p: patch,
  4882. um: unmount,
  4883. m: move,
  4884. r: remove2,
  4885. mt: mountComponent,
  4886. mc: mountChildren,
  4887. pc: patchChildren,
  4888. pbc: patchBlockChildren,
  4889. n: getNextHostNode,
  4890. o: options
  4891. };
  4892. let hydrate;
  4893. let hydrateNode;
  4894. if (createHydrationFns) {
  4895. [hydrate, hydrateNode] = createHydrationFns(
  4896. internals
  4897. );
  4898. }
  4899. return {
  4900. render: render2,
  4901. hydrate,
  4902. createApp: createAppAPI(render2, hydrate)
  4903. };
  4904. }
  4905. function toggleRecurse({ effect, update }, allowed) {
  4906. effect.allowRecurse = update.allowRecurse = allowed;
  4907. }
  4908. function needTransition(parentSuspense, transition) {
  4909. return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
  4910. }
  4911. function traverseStaticChildren(n1, n2, shallow = false) {
  4912. const ch1 = n1.children;
  4913. const ch2 = n2.children;
  4914. if (isArray$3(ch1) && isArray$3(ch2)) {
  4915. for (let i = 0; i < ch1.length; i++) {
  4916. const c1 = ch1[i];
  4917. let c2 = ch2[i];
  4918. if (c2.shapeFlag & 1 && !c2.dynamicChildren) {
  4919. if (c2.patchFlag <= 0 || c2.patchFlag === 32) {
  4920. c2 = ch2[i] = cloneIfMounted(ch2[i]);
  4921. c2.el = c1.el;
  4922. }
  4923. if (!shallow)
  4924. traverseStaticChildren(c1, c2);
  4925. }
  4926. if (c2.type === Text$1) {
  4927. c2.el = c1.el;
  4928. }
  4929. }
  4930. }
  4931. }
  4932. function getSequence(arr) {
  4933. const p2 = arr.slice();
  4934. const result = [0];
  4935. let i, j, u2, v2, c2;
  4936. const len = arr.length;
  4937. for (i = 0; i < len; i++) {
  4938. const arrI = arr[i];
  4939. if (arrI !== 0) {
  4940. j = result[result.length - 1];
  4941. if (arr[j] < arrI) {
  4942. p2[i] = j;
  4943. result.push(i);
  4944. continue;
  4945. }
  4946. u2 = 0;
  4947. v2 = result.length - 1;
  4948. while (u2 < v2) {
  4949. c2 = u2 + v2 >> 1;
  4950. if (arr[result[c2]] < arrI) {
  4951. u2 = c2 + 1;
  4952. } else {
  4953. v2 = c2;
  4954. }
  4955. }
  4956. if (arrI < arr[result[u2]]) {
  4957. if (u2 > 0) {
  4958. p2[i] = result[u2 - 1];
  4959. }
  4960. result[u2] = i;
  4961. }
  4962. }
  4963. }
  4964. u2 = result.length;
  4965. v2 = result[u2 - 1];
  4966. while (u2-- > 0) {
  4967. result[u2] = v2;
  4968. v2 = p2[v2];
  4969. }
  4970. return result;
  4971. }
  4972. const isTeleport = (type2) => type2.__isTeleport;
  4973. const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
  4974. const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
  4975. const resolveTarget = (props, select) => {
  4976. const targetSelector = props && props.to;
  4977. if (isString$1(targetSelector)) {
  4978. if (!select) {
  4979. return null;
  4980. } else {
  4981. const target = select(targetSelector);
  4982. return target;
  4983. }
  4984. } else {
  4985. return targetSelector;
  4986. }
  4987. };
  4988. const TeleportImpl = {
  4989. name: "Teleport",
  4990. __isTeleport: true,
  4991. process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
  4992. const {
  4993. mc: mountChildren,
  4994. pc: patchChildren,
  4995. pbc: patchBlockChildren,
  4996. o: { insert, querySelector, createText, createComment }
  4997. } = internals;
  4998. const disabled = isTeleportDisabled(n2.props);
  4999. let { shapeFlag, children, dynamicChildren } = n2;
  5000. if (n1 == null) {
  5001. const placeholder = n2.el = createText("");
  5002. const mainAnchor = n2.anchor = createText("");
  5003. insert(placeholder, container, anchor);
  5004. insert(mainAnchor, container, anchor);
  5005. const target = n2.target = resolveTarget(n2.props, querySelector);
  5006. const targetAnchor = n2.targetAnchor = createText("");
  5007. if (target) {
  5008. insert(targetAnchor, target);
  5009. isSVG = isSVG || isTargetSVG(target);
  5010. }
  5011. const mount = (container2, anchor2) => {
  5012. if (shapeFlag & 16) {
  5013. mountChildren(
  5014. children,
  5015. container2,
  5016. anchor2,
  5017. parentComponent,
  5018. parentSuspense,
  5019. isSVG,
  5020. slotScopeIds,
  5021. optimized
  5022. );
  5023. }
  5024. };
  5025. if (disabled) {
  5026. mount(container, mainAnchor);
  5027. } else if (target) {
  5028. mount(target, targetAnchor);
  5029. }
  5030. } else {
  5031. n2.el = n1.el;
  5032. const mainAnchor = n2.anchor = n1.anchor;
  5033. const target = n2.target = n1.target;
  5034. const targetAnchor = n2.targetAnchor = n1.targetAnchor;
  5035. const wasDisabled = isTeleportDisabled(n1.props);
  5036. const currentContainer = wasDisabled ? container : target;
  5037. const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
  5038. isSVG = isSVG || isTargetSVG(target);
  5039. if (dynamicChildren) {
  5040. patchBlockChildren(
  5041. n1.dynamicChildren,
  5042. dynamicChildren,
  5043. currentContainer,
  5044. parentComponent,
  5045. parentSuspense,
  5046. isSVG,
  5047. slotScopeIds
  5048. );
  5049. traverseStaticChildren(n1, n2, true);
  5050. } else if (!optimized) {
  5051. patchChildren(
  5052. n1,
  5053. n2,
  5054. currentContainer,
  5055. currentAnchor,
  5056. parentComponent,
  5057. parentSuspense,
  5058. isSVG,
  5059. slotScopeIds,
  5060. false
  5061. );
  5062. }
  5063. if (disabled) {
  5064. if (!wasDisabled) {
  5065. moveTeleport(
  5066. n2,
  5067. container,
  5068. mainAnchor,
  5069. internals,
  5070. 1
  5071. );
  5072. } else {
  5073. if (n2.props && n1.props && n2.props.to !== n1.props.to) {
  5074. n2.props.to = n1.props.to;
  5075. }
  5076. }
  5077. } else {
  5078. if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
  5079. const nextTarget = n2.target = resolveTarget(
  5080. n2.props,
  5081. querySelector
  5082. );
  5083. if (nextTarget) {
  5084. moveTeleport(
  5085. n2,
  5086. nextTarget,
  5087. null,
  5088. internals,
  5089. 0
  5090. );
  5091. }
  5092. } else if (wasDisabled) {
  5093. moveTeleport(
  5094. n2,
  5095. target,
  5096. targetAnchor,
  5097. internals,
  5098. 1
  5099. );
  5100. }
  5101. }
  5102. }
  5103. updateCssVars(n2);
  5104. },
  5105. remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
  5106. const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
  5107. if (target) {
  5108. hostRemove(targetAnchor);
  5109. }
  5110. doRemove && hostRemove(anchor);
  5111. if (shapeFlag & 16) {
  5112. const shouldRemove = doRemove || !isTeleportDisabled(props);
  5113. for (let i = 0; i < children.length; i++) {
  5114. const child = children[i];
  5115. unmount(
  5116. child,
  5117. parentComponent,
  5118. parentSuspense,
  5119. shouldRemove,
  5120. !!child.dynamicChildren
  5121. );
  5122. }
  5123. }
  5124. },
  5125. move: moveTeleport,
  5126. hydrate: hydrateTeleport
  5127. };
  5128. function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
  5129. if (moveType === 0) {
  5130. insert(vnode.targetAnchor, container, parentAnchor);
  5131. }
  5132. const { el, anchor, shapeFlag, children, props } = vnode;
  5133. const isReorder = moveType === 2;
  5134. if (isReorder) {
  5135. insert(el, container, parentAnchor);
  5136. }
  5137. if (!isReorder || isTeleportDisabled(props)) {
  5138. if (shapeFlag & 16) {
  5139. for (let i = 0; i < children.length; i++) {
  5140. move(
  5141. children[i],
  5142. container,
  5143. parentAnchor,
  5144. 2
  5145. );
  5146. }
  5147. }
  5148. }
  5149. if (isReorder) {
  5150. insert(anchor, container, parentAnchor);
  5151. }
  5152. }
  5153. function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
  5154. o: { nextSibling, parentNode, querySelector }
  5155. }, hydrateChildren) {
  5156. const target = vnode.target = resolveTarget(
  5157. vnode.props,
  5158. querySelector
  5159. );
  5160. if (target) {
  5161. const targetNode = target._lpa || target.firstChild;
  5162. if (vnode.shapeFlag & 16) {
  5163. if (isTeleportDisabled(vnode.props)) {
  5164. vnode.anchor = hydrateChildren(
  5165. nextSibling(node),
  5166. vnode,
  5167. parentNode(node),
  5168. parentComponent,
  5169. parentSuspense,
  5170. slotScopeIds,
  5171. optimized
  5172. );
  5173. vnode.targetAnchor = targetNode;
  5174. } else {
  5175. vnode.anchor = nextSibling(node);
  5176. let targetAnchor = targetNode;
  5177. while (targetAnchor) {
  5178. targetAnchor = nextSibling(targetAnchor);
  5179. if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
  5180. vnode.targetAnchor = targetAnchor;
  5181. target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
  5182. break;
  5183. }
  5184. }
  5185. hydrateChildren(
  5186. targetNode,
  5187. vnode,
  5188. target,
  5189. parentComponent,
  5190. parentSuspense,
  5191. slotScopeIds,
  5192. optimized
  5193. );
  5194. }
  5195. }
  5196. updateCssVars(vnode);
  5197. }
  5198. return vnode.anchor && nextSibling(vnode.anchor);
  5199. }
  5200. const Teleport = TeleportImpl;
  5201. function updateCssVars(vnode) {
  5202. const ctx = vnode.ctx;
  5203. if (ctx && ctx.ut) {
  5204. let node = vnode.children[0].el;
  5205. while (node && node !== vnode.targetAnchor) {
  5206. if (node.nodeType === 1)
  5207. node.setAttribute("data-v-owner", ctx.uid);
  5208. node = node.nextSibling;
  5209. }
  5210. ctx.ut();
  5211. }
  5212. }
  5213. const Fragment = Symbol.for("v-fgt");
  5214. const Text$1 = Symbol.for("v-txt");
  5215. const Comment = Symbol.for("v-cmt");
  5216. const Static = Symbol.for("v-stc");
  5217. const blockStack = [];
  5218. let currentBlock = null;
  5219. function openBlock(disableTracking = false) {
  5220. blockStack.push(currentBlock = disableTracking ? null : []);
  5221. }
  5222. function closeBlock() {
  5223. blockStack.pop();
  5224. currentBlock = blockStack[blockStack.length - 1] || null;
  5225. }
  5226. let isBlockTreeEnabled = 1;
  5227. function setBlockTracking(value) {
  5228. isBlockTreeEnabled += value;
  5229. }
  5230. function setupBlock(vnode) {
  5231. vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null;
  5232. closeBlock();
  5233. if (isBlockTreeEnabled > 0 && currentBlock) {
  5234. currentBlock.push(vnode);
  5235. }
  5236. return vnode;
  5237. }
  5238. function createElementBlock(type2, props, children, patchFlag, dynamicProps, shapeFlag) {
  5239. return setupBlock(
  5240. createBaseVNode(
  5241. type2,
  5242. props,
  5243. children,
  5244. patchFlag,
  5245. dynamicProps,
  5246. shapeFlag,
  5247. true
  5248. /* isBlock */
  5249. )
  5250. );
  5251. }
  5252. function createBlock(type2, props, children, patchFlag, dynamicProps) {
  5253. return setupBlock(
  5254. createVNode(
  5255. type2,
  5256. props,
  5257. children,
  5258. patchFlag,
  5259. dynamicProps,
  5260. true
  5261. /* isBlock: prevent a block from tracking itself */
  5262. )
  5263. );
  5264. }
  5265. function isVNode(value) {
  5266. return value ? value.__v_isVNode === true : false;
  5267. }
  5268. function isSameVNodeType(n1, n2) {
  5269. return n1.type === n2.type && n1.key === n2.key;
  5270. }
  5271. const InternalObjectKey = `__vInternal`;
  5272. const normalizeKey = ({ key }) => key != null ? key : null;
  5273. const normalizeRef = ({
  5274. ref: ref2,
  5275. ref_key,
  5276. ref_for
  5277. }) => {
  5278. if (typeof ref2 === "number") {
  5279. ref2 = "" + ref2;
  5280. }
  5281. return ref2 != null ? isString$1(ref2) || isRef(ref2) || isFunction$2(ref2) ? { i: currentRenderingInstance, r: ref2, k: ref_key, f: !!ref_for } : ref2 : null;
  5282. };
  5283. function createBaseVNode(type2, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type2 === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
  5284. const vnode = {
  5285. __v_isVNode: true,
  5286. __v_skip: true,
  5287. type: type2,
  5288. props,
  5289. key: props && normalizeKey(props),
  5290. ref: props && normalizeRef(props),
  5291. scopeId: currentScopeId,
  5292. slotScopeIds: null,
  5293. children,
  5294. component: null,
  5295. suspense: null,
  5296. ssContent: null,
  5297. ssFallback: null,
  5298. dirs: null,
  5299. transition: null,
  5300. el: null,
  5301. anchor: null,
  5302. target: null,
  5303. targetAnchor: null,
  5304. staticCount: 0,
  5305. shapeFlag,
  5306. patchFlag,
  5307. dynamicProps,
  5308. dynamicChildren: null,
  5309. appContext: null,
  5310. ctx: currentRenderingInstance
  5311. };
  5312. if (needFullChildrenNormalization) {
  5313. normalizeChildren(vnode, children);
  5314. if (shapeFlag & 128) {
  5315. type2.normalize(vnode);
  5316. }
  5317. } else if (children) {
  5318. vnode.shapeFlag |= isString$1(children) ? 8 : 16;
  5319. }
  5320. if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself
  5321. !isBlockNode && // has current parent block
  5322. currentBlock && // presence of a patch flag indicates this node needs patching on updates.
  5323. // component nodes also should always be patched, because even if the
  5324. // component doesn't need to update, it needs to persist the instance on to
  5325. // the next vnode so that it can be properly unmounted later.
  5326. (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
  5327. // vnode should not be considered dynamic due to handler caching.
  5328. vnode.patchFlag !== 32) {
  5329. currentBlock.push(vnode);
  5330. }
  5331. return vnode;
  5332. }
  5333. const createVNode = _createVNode;
  5334. function _createVNode(type2, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
  5335. if (!type2 || type2 === NULL_DYNAMIC_COMPONENT) {
  5336. type2 = Comment;
  5337. }
  5338. if (isVNode(type2)) {
  5339. const cloned = cloneVNode(
  5340. type2,
  5341. props,
  5342. true
  5343. /* mergeRef: true */
  5344. );
  5345. if (children) {
  5346. normalizeChildren(cloned, children);
  5347. }
  5348. if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
  5349. if (cloned.shapeFlag & 6) {
  5350. currentBlock[currentBlock.indexOf(type2)] = cloned;
  5351. } else {
  5352. currentBlock.push(cloned);
  5353. }
  5354. }
  5355. cloned.patchFlag |= -2;
  5356. return cloned;
  5357. }
  5358. if (isClassComponent(type2)) {
  5359. type2 = type2.__vccOpts;
  5360. }
  5361. if (props) {
  5362. props = guardReactiveProps(props);
  5363. let { class: klass, style } = props;
  5364. if (klass && !isString$1(klass)) {
  5365. props.class = normalizeClass(klass);
  5366. }
  5367. if (isObject$1(style)) {
  5368. if (isProxy(style) && !isArray$3(style)) {
  5369. style = extend({}, style);
  5370. }
  5371. props.style = normalizeStyle(style);
  5372. }
  5373. }
  5374. const shapeFlag = isString$1(type2) ? 1 : isSuspense(type2) ? 128 : isTeleport(type2) ? 64 : isObject$1(type2) ? 4 : isFunction$2(type2) ? 2 : 0;
  5375. return createBaseVNode(
  5376. type2,
  5377. props,
  5378. children,
  5379. patchFlag,
  5380. dynamicProps,
  5381. shapeFlag,
  5382. isBlockNode,
  5383. true
  5384. );
  5385. }
  5386. function guardReactiveProps(props) {
  5387. if (!props)
  5388. return null;
  5389. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  5390. }
  5391. function cloneVNode(vnode, extraProps, mergeRef = false) {
  5392. const { props, ref: ref2, patchFlag, children } = vnode;
  5393. const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
  5394. const cloned = {
  5395. __v_isVNode: true,
  5396. __v_skip: true,
  5397. type: vnode.type,
  5398. props: mergedProps,
  5399. key: mergedProps && normalizeKey(mergedProps),
  5400. ref: extraProps && extraProps.ref ? (
  5401. // #2078 in the case of <component :is="vnode" ref="extra"/>
  5402. // if the vnode itself already has a ref, cloneVNode will need to merge
  5403. // the refs so the single vnode can be set on multiple refs
  5404. mergeRef && ref2 ? isArray$3(ref2) ? ref2.concat(normalizeRef(extraProps)) : [ref2, normalizeRef(extraProps)] : normalizeRef(extraProps)
  5405. ) : ref2,
  5406. scopeId: vnode.scopeId,
  5407. slotScopeIds: vnode.slotScopeIds,
  5408. children,
  5409. target: vnode.target,
  5410. targetAnchor: vnode.targetAnchor,
  5411. staticCount: vnode.staticCount,
  5412. shapeFlag: vnode.shapeFlag,
  5413. // if the vnode is cloned with extra props, we can no longer assume its
  5414. // existing patch flag to be reliable and need to add the FULL_PROPS flag.
  5415. // note: preserve flag for fragments since they use the flag for children
  5416. // fast paths only.
  5417. patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
  5418. dynamicProps: vnode.dynamicProps,
  5419. dynamicChildren: vnode.dynamicChildren,
  5420. appContext: vnode.appContext,
  5421. dirs: vnode.dirs,
  5422. transition: vnode.transition,
  5423. // These should technically only be non-null on mounted VNodes. However,
  5424. // they *should* be copied for kept-alive vnodes. So we just always copy
  5425. // them since them being non-null during a mount doesn't affect the logic as
  5426. // they will simply be overwritten.
  5427. component: vnode.component,
  5428. suspense: vnode.suspense,
  5429. ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
  5430. ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
  5431. el: vnode.el,
  5432. anchor: vnode.anchor,
  5433. ctx: vnode.ctx,
  5434. ce: vnode.ce
  5435. };
  5436. return cloned;
  5437. }
  5438. function createTextVNode(text = " ", flag = 0) {
  5439. return createVNode(Text$1, null, text, flag);
  5440. }
  5441. function createCommentVNode(text = "", asBlock = false) {
  5442. return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text);
  5443. }
  5444. function normalizeVNode(child) {
  5445. if (child == null || typeof child === "boolean") {
  5446. return createVNode(Comment);
  5447. } else if (isArray$3(child)) {
  5448. return createVNode(
  5449. Fragment,
  5450. null,
  5451. // #3666, avoid reference pollution when reusing vnode
  5452. child.slice()
  5453. );
  5454. } else if (typeof child === "object") {
  5455. return cloneIfMounted(child);
  5456. } else {
  5457. return createVNode(Text$1, null, String(child));
  5458. }
  5459. }
  5460. function cloneIfMounted(child) {
  5461. return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child);
  5462. }
  5463. function normalizeChildren(vnode, children) {
  5464. let type2 = 0;
  5465. const { shapeFlag } = vnode;
  5466. if (children == null) {
  5467. children = null;
  5468. } else if (isArray$3(children)) {
  5469. type2 = 16;
  5470. } else if (typeof children === "object") {
  5471. if (shapeFlag & (1 | 64)) {
  5472. const slot = children.default;
  5473. if (slot) {
  5474. slot._c && (slot._d = false);
  5475. normalizeChildren(vnode, slot());
  5476. slot._c && (slot._d = true);
  5477. }
  5478. return;
  5479. } else {
  5480. type2 = 32;
  5481. const slotFlag = children._;
  5482. if (!slotFlag && !(InternalObjectKey in children)) {
  5483. children._ctx = currentRenderingInstance;
  5484. } else if (slotFlag === 3 && currentRenderingInstance) {
  5485. if (currentRenderingInstance.slots._ === 1) {
  5486. children._ = 1;
  5487. } else {
  5488. children._ = 2;
  5489. vnode.patchFlag |= 1024;
  5490. }
  5491. }
  5492. }
  5493. } else if (isFunction$2(children)) {
  5494. children = { default: children, _ctx: currentRenderingInstance };
  5495. type2 = 32;
  5496. } else {
  5497. children = String(children);
  5498. if (shapeFlag & 64) {
  5499. type2 = 16;
  5500. children = [createTextVNode(children)];
  5501. } else {
  5502. type2 = 8;
  5503. }
  5504. }
  5505. vnode.children = children;
  5506. vnode.shapeFlag |= type2;
  5507. }
  5508. function mergeProps(...args) {
  5509. const ret = {};
  5510. for (let i = 0; i < args.length; i++) {
  5511. const toMerge = args[i];
  5512. for (const key in toMerge) {
  5513. if (key === "class") {
  5514. if (ret.class !== toMerge.class) {
  5515. ret.class = normalizeClass([ret.class, toMerge.class]);
  5516. }
  5517. } else if (key === "style") {
  5518. ret.style = normalizeStyle([ret.style, toMerge.style]);
  5519. } else if (isOn(key)) {
  5520. const existing = ret[key];
  5521. const incoming = toMerge[key];
  5522. if (incoming && existing !== incoming && !(isArray$3(existing) && existing.includes(incoming))) {
  5523. ret[key] = existing ? [].concat(existing, incoming) : incoming;
  5524. }
  5525. } else if (key !== "") {
  5526. ret[key] = toMerge[key];
  5527. }
  5528. }
  5529. }
  5530. return ret;
  5531. }
  5532. function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
  5533. callWithAsyncErrorHandling(hook, instance, 7, [
  5534. vnode,
  5535. prevVNode
  5536. ]);
  5537. }
  5538. const emptyAppContext = createAppContext();
  5539. let uid$2 = 0;
  5540. function createComponentInstance(vnode, parent, suspense) {
  5541. const type2 = vnode.type;
  5542. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  5543. const instance = {
  5544. uid: uid$2++,
  5545. vnode,
  5546. type: type2,
  5547. parent,
  5548. appContext,
  5549. root: null,
  5550. // to be immediately set
  5551. next: null,
  5552. subTree: null,
  5553. // will be set synchronously right after creation
  5554. effect: null,
  5555. update: null,
  5556. // will be set synchronously right after creation
  5557. scope: new EffectScope(
  5558. true
  5559. /* detached */
  5560. ),
  5561. render: null,
  5562. proxy: null,
  5563. exposed: null,
  5564. exposeProxy: null,
  5565. withProxy: null,
  5566. provides: parent ? parent.provides : Object.create(appContext.provides),
  5567. accessCache: null,
  5568. renderCache: [],
  5569. // local resolved assets
  5570. components: null,
  5571. directives: null,
  5572. // resolved props and emits options
  5573. propsOptions: normalizePropsOptions(type2, appContext),
  5574. emitsOptions: normalizeEmitsOptions(type2, appContext),
  5575. // emit
  5576. emit: null,
  5577. // to be set immediately
  5578. emitted: null,
  5579. // props default value
  5580. propsDefaults: EMPTY_OBJ,
  5581. // inheritAttrs
  5582. inheritAttrs: type2.inheritAttrs,
  5583. // state
  5584. ctx: EMPTY_OBJ,
  5585. data: EMPTY_OBJ,
  5586. props: EMPTY_OBJ,
  5587. attrs: EMPTY_OBJ,
  5588. slots: EMPTY_OBJ,
  5589. refs: EMPTY_OBJ,
  5590. setupState: EMPTY_OBJ,
  5591. setupContext: null,
  5592. attrsProxy: null,
  5593. slotsProxy: null,
  5594. // suspense related
  5595. suspense,
  5596. suspenseId: suspense ? suspense.pendingId : 0,
  5597. asyncDep: null,
  5598. asyncResolved: false,
  5599. // lifecycle hooks
  5600. // not using enums here because it results in computed properties
  5601. isMounted: false,
  5602. isUnmounted: false,
  5603. isDeactivated: false,
  5604. bc: null,
  5605. c: null,
  5606. bm: null,
  5607. m: null,
  5608. bu: null,
  5609. u: null,
  5610. um: null,
  5611. bum: null,
  5612. da: null,
  5613. a: null,
  5614. rtg: null,
  5615. rtc: null,
  5616. ec: null,
  5617. sp: null
  5618. };
  5619. {
  5620. instance.ctx = { _: instance };
  5621. }
  5622. instance.root = parent ? parent.root : instance;
  5623. instance.emit = emit.bind(null, instance);
  5624. if (vnode.ce) {
  5625. vnode.ce(instance);
  5626. }
  5627. return instance;
  5628. }
  5629. let currentInstance = null;
  5630. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  5631. let internalSetCurrentInstance;
  5632. let globalCurrentInstanceSetters;
  5633. let settersKey = "__VUE_INSTANCE_SETTERS__";
  5634. {
  5635. if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
  5636. globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
  5637. }
  5638. globalCurrentInstanceSetters.push((i) => currentInstance = i);
  5639. internalSetCurrentInstance = (instance) => {
  5640. if (globalCurrentInstanceSetters.length > 1) {
  5641. globalCurrentInstanceSetters.forEach((s2) => s2(instance));
  5642. } else {
  5643. globalCurrentInstanceSetters[0](instance);
  5644. }
  5645. };
  5646. }
  5647. const setCurrentInstance = (instance) => {
  5648. internalSetCurrentInstance(instance);
  5649. instance.scope.on();
  5650. };
  5651. const unsetCurrentInstance = () => {
  5652. currentInstance && currentInstance.scope.off();
  5653. internalSetCurrentInstance(null);
  5654. };
  5655. function isStatefulComponent(instance) {
  5656. return instance.vnode.shapeFlag & 4;
  5657. }
  5658. let isInSSRComponentSetup = false;
  5659. function setupComponent(instance, isSSR = false) {
  5660. isInSSRComponentSetup = isSSR;
  5661. const { props, children } = instance.vnode;
  5662. const isStateful = isStatefulComponent(instance);
  5663. initProps(instance, props, isStateful, isSSR);
  5664. initSlots(instance, children);
  5665. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  5666. isInSSRComponentSetup = false;
  5667. return setupResult;
  5668. }
  5669. function setupStatefulComponent(instance, isSSR) {
  5670. const Component = instance.type;
  5671. instance.accessCache = /* @__PURE__ */ Object.create(null);
  5672. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  5673. const { setup } = Component;
  5674. if (setup) {
  5675. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  5676. setCurrentInstance(instance);
  5677. pauseTracking();
  5678. const setupResult = callWithErrorHandling(
  5679. setup,
  5680. instance,
  5681. 0,
  5682. [instance.props, setupContext]
  5683. );
  5684. resetTracking();
  5685. unsetCurrentInstance();
  5686. if (isPromise(setupResult)) {
  5687. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  5688. if (isSSR) {
  5689. return setupResult.then((resolvedResult) => {
  5690. handleSetupResult(instance, resolvedResult, isSSR);
  5691. }).catch((e) => {
  5692. handleError(e, instance, 0);
  5693. });
  5694. } else {
  5695. instance.asyncDep = setupResult;
  5696. }
  5697. } else {
  5698. handleSetupResult(instance, setupResult, isSSR);
  5699. }
  5700. } else {
  5701. finishComponentSetup(instance, isSSR);
  5702. }
  5703. }
  5704. function handleSetupResult(instance, setupResult, isSSR) {
  5705. if (isFunction$2(setupResult)) {
  5706. if (instance.type.__ssrInlineRender) {
  5707. instance.ssrRender = setupResult;
  5708. } else {
  5709. instance.render = setupResult;
  5710. }
  5711. } else if (isObject$1(setupResult)) {
  5712. instance.setupState = proxyRefs(setupResult);
  5713. } else
  5714. ;
  5715. finishComponentSetup(instance, isSSR);
  5716. }
  5717. let compile;
  5718. function finishComponentSetup(instance, isSSR, skipOptions) {
  5719. const Component = instance.type;
  5720. if (!instance.render) {
  5721. if (!isSSR && compile && !Component.render) {
  5722. const template = Component.template || resolveMergedOptions(instance).template;
  5723. if (template) {
  5724. const { isCustomElement, compilerOptions } = instance.appContext.config;
  5725. const { delimiters, compilerOptions: componentCompilerOptions } = Component;
  5726. const finalCompilerOptions = extend(
  5727. extend(
  5728. {
  5729. isCustomElement,
  5730. delimiters
  5731. },
  5732. compilerOptions
  5733. ),
  5734. componentCompilerOptions
  5735. );
  5736. Component.render = compile(template, finalCompilerOptions);
  5737. }
  5738. }
  5739. instance.render = Component.render || NOOP;
  5740. }
  5741. {
  5742. setCurrentInstance(instance);
  5743. pauseTracking();
  5744. try {
  5745. applyOptions(instance);
  5746. } finally {
  5747. resetTracking();
  5748. unsetCurrentInstance();
  5749. }
  5750. }
  5751. }
  5752. function getAttrsProxy(instance) {
  5753. return instance.attrsProxy || (instance.attrsProxy = new Proxy(
  5754. instance.attrs,
  5755. {
  5756. get(target, key) {
  5757. track(instance, "get", "$attrs");
  5758. return target[key];
  5759. }
  5760. }
  5761. ));
  5762. }
  5763. function createSetupContext(instance) {
  5764. const expose = (exposed) => {
  5765. instance.exposed = exposed || {};
  5766. };
  5767. {
  5768. return {
  5769. get attrs() {
  5770. return getAttrsProxy(instance);
  5771. },
  5772. slots: instance.slots,
  5773. emit: instance.emit,
  5774. expose
  5775. };
  5776. }
  5777. }
  5778. function getExposeProxy(instance) {
  5779. if (instance.exposed) {
  5780. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  5781. get(target, key) {
  5782. if (key in target) {
  5783. return target[key];
  5784. } else if (key in publicPropertiesMap) {
  5785. return publicPropertiesMap[key](instance);
  5786. }
  5787. },
  5788. has(target, key) {
  5789. return key in target || key in publicPropertiesMap;
  5790. }
  5791. }));
  5792. }
  5793. }
  5794. function getComponentName(Component, includeInferred = true) {
  5795. return isFunction$2(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
  5796. }
  5797. function isClassComponent(value) {
  5798. return isFunction$2(value) && "__vccOpts" in value;
  5799. }
  5800. const computed = (getterOrOptions, debugOptions) => {
  5801. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  5802. };
  5803. function h$1(type2, propsOrChildren, children) {
  5804. const l2 = arguments.length;
  5805. if (l2 === 2) {
  5806. if (isObject$1(propsOrChildren) && !isArray$3(propsOrChildren)) {
  5807. if (isVNode(propsOrChildren)) {
  5808. return createVNode(type2, null, [propsOrChildren]);
  5809. }
  5810. return createVNode(type2, propsOrChildren);
  5811. } else {
  5812. return createVNode(type2, null, propsOrChildren);
  5813. }
  5814. } else {
  5815. if (l2 > 3) {
  5816. children = Array.prototype.slice.call(arguments, 2);
  5817. } else if (l2 === 3 && isVNode(children)) {
  5818. children = [children];
  5819. }
  5820. return createVNode(type2, propsOrChildren, children);
  5821. }
  5822. }
  5823. const ssrContextKey = Symbol.for("v-scx");
  5824. const useSSRContext = () => {
  5825. {
  5826. const ctx = inject(ssrContextKey);
  5827. return ctx;
  5828. }
  5829. };
  5830. const version$1 = "3.3.9";
  5831. const svgNS = "http://www.w3.org/2000/svg";
  5832. const doc = typeof document !== "undefined" ? document : null;
  5833. const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
  5834. const nodeOps = {
  5835. insert: (child, parent, anchor) => {
  5836. parent.insertBefore(child, anchor || null);
  5837. },
  5838. remove: (child) => {
  5839. const parent = child.parentNode;
  5840. if (parent) {
  5841. parent.removeChild(child);
  5842. }
  5843. },
  5844. createElement: (tag, isSVG, is, props) => {
  5845. const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
  5846. if (tag === "select" && props && props.multiple != null) {
  5847. el.setAttribute("multiple", props.multiple);
  5848. }
  5849. return el;
  5850. },
  5851. createText: (text) => doc.createTextNode(text),
  5852. createComment: (text) => doc.createComment(text),
  5853. setText: (node, text) => {
  5854. node.nodeValue = text;
  5855. },
  5856. setElementText: (el, text) => {
  5857. el.textContent = text;
  5858. },
  5859. parentNode: (node) => node.parentNode,
  5860. nextSibling: (node) => node.nextSibling,
  5861. querySelector: (selector) => doc.querySelector(selector),
  5862. setScopeId(el, id) {
  5863. el.setAttribute(id, "");
  5864. },
  5865. // __UNSAFE__
  5866. // Reason: innerHTML.
  5867. // Static content here can only come from compiled templates.
  5868. // As long as the user only uses trusted templates, this is safe.
  5869. insertStaticContent(content, parent, anchor, isSVG, start, end2) {
  5870. const before = anchor ? anchor.previousSibling : parent.lastChild;
  5871. if (start && (start === end2 || start.nextSibling)) {
  5872. while (true) {
  5873. parent.insertBefore(start.cloneNode(true), anchor);
  5874. if (start === end2 || !(start = start.nextSibling))
  5875. break;
  5876. }
  5877. } else {
  5878. templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
  5879. const template = templateContainer.content;
  5880. if (isSVG) {
  5881. const wrapper = template.firstChild;
  5882. while (wrapper.firstChild) {
  5883. template.appendChild(wrapper.firstChild);
  5884. }
  5885. template.removeChild(wrapper);
  5886. }
  5887. parent.insertBefore(template, anchor);
  5888. }
  5889. return [
  5890. // first
  5891. before ? before.nextSibling : parent.firstChild,
  5892. // last
  5893. anchor ? anchor.previousSibling : parent.lastChild
  5894. ];
  5895. }
  5896. };
  5897. const TRANSITION = "transition";
  5898. const ANIMATION = "animation";
  5899. const vtcKey = Symbol("_vtc");
  5900. const Transition = (props, { slots }) => h$1(BaseTransition, resolveTransitionProps(props), slots);
  5901. Transition.displayName = "Transition";
  5902. const DOMTransitionPropsValidators = {
  5903. name: String,
  5904. type: String,
  5905. css: {
  5906. type: Boolean,
  5907. default: true
  5908. },
  5909. duration: [String, Number, Object],
  5910. enterFromClass: String,
  5911. enterActiveClass: String,
  5912. enterToClass: String,
  5913. appearFromClass: String,
  5914. appearActiveClass: String,
  5915. appearToClass: String,
  5916. leaveFromClass: String,
  5917. leaveActiveClass: String,
  5918. leaveToClass: String
  5919. };
  5920. const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
  5921. {},
  5922. BaseTransitionPropsValidators,
  5923. DOMTransitionPropsValidators
  5924. );
  5925. const callHook = (hook, args = []) => {
  5926. if (isArray$3(hook)) {
  5927. hook.forEach((h2) => h2(...args));
  5928. } else if (hook) {
  5929. hook(...args);
  5930. }
  5931. };
  5932. const hasExplicitCallback = (hook) => {
  5933. return hook ? isArray$3(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false;
  5934. };
  5935. function resolveTransitionProps(rawProps) {
  5936. const baseProps = {};
  5937. for (const key in rawProps) {
  5938. if (!(key in DOMTransitionPropsValidators)) {
  5939. baseProps[key] = rawProps[key];
  5940. }
  5941. }
  5942. if (rawProps.css === false) {
  5943. return baseProps;
  5944. }
  5945. const {
  5946. name = "v",
  5947. type: type2,
  5948. duration,
  5949. enterFromClass = `${name}-enter-from`,
  5950. enterActiveClass = `${name}-enter-active`,
  5951. enterToClass = `${name}-enter-to`,
  5952. appearFromClass = enterFromClass,
  5953. appearActiveClass = enterActiveClass,
  5954. appearToClass = enterToClass,
  5955. leaveFromClass = `${name}-leave-from`,
  5956. leaveActiveClass = `${name}-leave-active`,
  5957. leaveToClass = `${name}-leave-to`
  5958. } = rawProps;
  5959. const durations = normalizeDuration(duration);
  5960. const enterDuration = durations && durations[0];
  5961. const leaveDuration = durations && durations[1];
  5962. const {
  5963. onBeforeEnter,
  5964. onEnter,
  5965. onEnterCancelled,
  5966. onLeave,
  5967. onLeaveCancelled,
  5968. onBeforeAppear = onBeforeEnter,
  5969. onAppear = onEnter,
  5970. onAppearCancelled = onEnterCancelled
  5971. } = baseProps;
  5972. const finishEnter = (el, isAppear, done) => {
  5973. removeTransitionClass(el, isAppear ? appearToClass : enterToClass);
  5974. removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
  5975. done && done();
  5976. };
  5977. const finishLeave = (el, done) => {
  5978. el._isLeaving = false;
  5979. removeTransitionClass(el, leaveFromClass);
  5980. removeTransitionClass(el, leaveToClass);
  5981. removeTransitionClass(el, leaveActiveClass);
  5982. done && done();
  5983. };
  5984. const makeEnterHook = (isAppear) => {
  5985. return (el, done) => {
  5986. const hook = isAppear ? onAppear : onEnter;
  5987. const resolve2 = () => finishEnter(el, isAppear, done);
  5988. callHook(hook, [el, resolve2]);
  5989. nextFrame(() => {
  5990. removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
  5991. addTransitionClass(el, isAppear ? appearToClass : enterToClass);
  5992. if (!hasExplicitCallback(hook)) {
  5993. whenTransitionEnds(el, type2, enterDuration, resolve2);
  5994. }
  5995. });
  5996. };
  5997. };
  5998. return extend(baseProps, {
  5999. onBeforeEnter(el) {
  6000. callHook(onBeforeEnter, [el]);
  6001. addTransitionClass(el, enterFromClass);
  6002. addTransitionClass(el, enterActiveClass);
  6003. },
  6004. onBeforeAppear(el) {
  6005. callHook(onBeforeAppear, [el]);
  6006. addTransitionClass(el, appearFromClass);
  6007. addTransitionClass(el, appearActiveClass);
  6008. },
  6009. onEnter: makeEnterHook(false),
  6010. onAppear: makeEnterHook(true),
  6011. onLeave(el, done) {
  6012. el._isLeaving = true;
  6013. const resolve2 = () => finishLeave(el, done);
  6014. addTransitionClass(el, leaveFromClass);
  6015. forceReflow();
  6016. addTransitionClass(el, leaveActiveClass);
  6017. nextFrame(() => {
  6018. if (!el._isLeaving) {
  6019. return;
  6020. }
  6021. removeTransitionClass(el, leaveFromClass);
  6022. addTransitionClass(el, leaveToClass);
  6023. if (!hasExplicitCallback(onLeave)) {
  6024. whenTransitionEnds(el, type2, leaveDuration, resolve2);
  6025. }
  6026. });
  6027. callHook(onLeave, [el, resolve2]);
  6028. },
  6029. onEnterCancelled(el) {
  6030. finishEnter(el, false);
  6031. callHook(onEnterCancelled, [el]);
  6032. },
  6033. onAppearCancelled(el) {
  6034. finishEnter(el, true);
  6035. callHook(onAppearCancelled, [el]);
  6036. },
  6037. onLeaveCancelled(el) {
  6038. finishLeave(el);
  6039. callHook(onLeaveCancelled, [el]);
  6040. }
  6041. });
  6042. }
  6043. function normalizeDuration(duration) {
  6044. if (duration == null) {
  6045. return null;
  6046. } else if (isObject$1(duration)) {
  6047. return [NumberOf(duration.enter), NumberOf(duration.leave)];
  6048. } else {
  6049. const n = NumberOf(duration);
  6050. return [n, n];
  6051. }
  6052. }
  6053. function NumberOf(val) {
  6054. const res = toNumber$1(val);
  6055. return res;
  6056. }
  6057. function addTransitionClass(el, cls) {
  6058. cls.split(/\s+/).forEach((c2) => c2 && el.classList.add(c2));
  6059. (el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls);
  6060. }
  6061. function removeTransitionClass(el, cls) {
  6062. cls.split(/\s+/).forEach((c2) => c2 && el.classList.remove(c2));
  6063. const _vtc = el[vtcKey];
  6064. if (_vtc) {
  6065. _vtc.delete(cls);
  6066. if (!_vtc.size) {
  6067. el[vtcKey] = void 0;
  6068. }
  6069. }
  6070. }
  6071. function nextFrame(cb) {
  6072. requestAnimationFrame(() => {
  6073. requestAnimationFrame(cb);
  6074. });
  6075. }
  6076. let endId = 0;
  6077. function whenTransitionEnds(el, expectedType, explicitTimeout, resolve2) {
  6078. const id = el._endId = ++endId;
  6079. const resolveIfNotStale = () => {
  6080. if (id === el._endId) {
  6081. resolve2();
  6082. }
  6083. };
  6084. if (explicitTimeout) {
  6085. return setTimeout(resolveIfNotStale, explicitTimeout);
  6086. }
  6087. const { type: type2, timeout, propCount } = getTransitionInfo(el, expectedType);
  6088. if (!type2) {
  6089. return resolve2();
  6090. }
  6091. const endEvent = type2 + "end";
  6092. let ended = 0;
  6093. const end2 = () => {
  6094. el.removeEventListener(endEvent, onEnd);
  6095. resolveIfNotStale();
  6096. };
  6097. const onEnd = (e) => {
  6098. if (e.target === el && ++ended >= propCount) {
  6099. end2();
  6100. }
  6101. };
  6102. setTimeout(() => {
  6103. if (ended < propCount) {
  6104. end2();
  6105. }
  6106. }, timeout + 1);
  6107. el.addEventListener(endEvent, onEnd);
  6108. }
  6109. function getTransitionInfo(el, expectedType) {
  6110. const styles = window.getComputedStyle(el);
  6111. const getStyleProperties = (key) => (styles[key] || "").split(", ");
  6112. const transitionDelays = getStyleProperties(`${TRANSITION}Delay`);
  6113. const transitionDurations = getStyleProperties(`${TRANSITION}Duration`);
  6114. const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6115. const animationDelays = getStyleProperties(`${ANIMATION}Delay`);
  6116. const animationDurations = getStyleProperties(`${ANIMATION}Duration`);
  6117. const animationTimeout = getTimeout(animationDelays, animationDurations);
  6118. let type2 = null;
  6119. let timeout = 0;
  6120. let propCount = 0;
  6121. if (expectedType === TRANSITION) {
  6122. if (transitionTimeout > 0) {
  6123. type2 = TRANSITION;
  6124. timeout = transitionTimeout;
  6125. propCount = transitionDurations.length;
  6126. }
  6127. } else if (expectedType === ANIMATION) {
  6128. if (animationTimeout > 0) {
  6129. type2 = ANIMATION;
  6130. timeout = animationTimeout;
  6131. propCount = animationDurations.length;
  6132. }
  6133. } else {
  6134. timeout = Math.max(transitionTimeout, animationTimeout);
  6135. type2 = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
  6136. propCount = type2 ? type2 === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
  6137. }
  6138. const hasTransform = type2 === TRANSITION && /\b(transform|all)(,|$)/.test(
  6139. getStyleProperties(`${TRANSITION}Property`).toString()
  6140. );
  6141. return {
  6142. type: type2,
  6143. timeout,
  6144. propCount,
  6145. hasTransform
  6146. };
  6147. }
  6148. function getTimeout(delays, durations) {
  6149. while (delays.length < durations.length) {
  6150. delays = delays.concat(delays);
  6151. }
  6152. return Math.max(...durations.map((d2, i) => toMs(d2) + toMs(delays[i])));
  6153. }
  6154. function toMs(s2) {
  6155. if (s2 === "auto")
  6156. return 0;
  6157. return Number(s2.slice(0, -1).replace(",", ".")) * 1e3;
  6158. }
  6159. function forceReflow() {
  6160. return document.body.offsetHeight;
  6161. }
  6162. function patchClass(el, value, isSVG) {
  6163. const transitionClasses = el[vtcKey];
  6164. if (transitionClasses) {
  6165. value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" ");
  6166. }
  6167. if (value == null) {
  6168. el.removeAttribute("class");
  6169. } else if (isSVG) {
  6170. el.setAttribute("class", value);
  6171. } else {
  6172. el.className = value;
  6173. }
  6174. }
  6175. const vShowOldKey = Symbol("_vod");
  6176. const vShow = {
  6177. beforeMount(el, { value }, { transition }) {
  6178. el[vShowOldKey] = el.style.display === "none" ? "" : el.style.display;
  6179. if (transition && value) {
  6180. transition.beforeEnter(el);
  6181. } else {
  6182. setDisplay(el, value);
  6183. }
  6184. },
  6185. mounted(el, { value }, { transition }) {
  6186. if (transition && value) {
  6187. transition.enter(el);
  6188. }
  6189. },
  6190. updated(el, { value, oldValue }, { transition }) {
  6191. if (!value === !oldValue)
  6192. return;
  6193. if (transition) {
  6194. if (value) {
  6195. transition.beforeEnter(el);
  6196. setDisplay(el, true);
  6197. transition.enter(el);
  6198. } else {
  6199. transition.leave(el, () => {
  6200. setDisplay(el, false);
  6201. });
  6202. }
  6203. } else {
  6204. setDisplay(el, value);
  6205. }
  6206. },
  6207. beforeUnmount(el, { value }) {
  6208. setDisplay(el, value);
  6209. }
  6210. };
  6211. function setDisplay(el, value) {
  6212. el.style.display = value ? el[vShowOldKey] : "none";
  6213. }
  6214. function patchStyle(el, prev, next) {
  6215. const style = el.style;
  6216. const isCssString = isString$1(next);
  6217. if (next && !isCssString) {
  6218. if (prev && !isString$1(prev)) {
  6219. for (const key in prev) {
  6220. if (next[key] == null) {
  6221. setStyle(style, key, "");
  6222. }
  6223. }
  6224. }
  6225. for (const key in next) {
  6226. setStyle(style, key, next[key]);
  6227. }
  6228. } else {
  6229. const currentDisplay = style.display;
  6230. if (isCssString) {
  6231. if (prev !== next) {
  6232. style.cssText = next;
  6233. }
  6234. } else if (prev) {
  6235. el.removeAttribute("style");
  6236. }
  6237. if (vShowOldKey in el) {
  6238. style.display = currentDisplay;
  6239. }
  6240. }
  6241. }
  6242. const importantRE = /\s*!important$/;
  6243. function setStyle(style, name, val) {
  6244. if (isArray$3(val)) {
  6245. val.forEach((v2) => setStyle(style, name, v2));
  6246. } else {
  6247. if (val == null)
  6248. val = "";
  6249. if (name.startsWith("--")) {
  6250. style.setProperty(name, val);
  6251. } else {
  6252. const prefixed = autoPrefix(style, name);
  6253. if (importantRE.test(val)) {
  6254. style.setProperty(
  6255. hyphenate(prefixed),
  6256. val.replace(importantRE, ""),
  6257. "important"
  6258. );
  6259. } else {
  6260. style[prefixed] = val;
  6261. }
  6262. }
  6263. }
  6264. }
  6265. const prefixes = ["Webkit", "Moz", "ms"];
  6266. const prefixCache = {};
  6267. function autoPrefix(style, rawName) {
  6268. const cached = prefixCache[rawName];
  6269. if (cached) {
  6270. return cached;
  6271. }
  6272. let name = camelize(rawName);
  6273. if (name !== "filter" && name in style) {
  6274. return prefixCache[rawName] = name;
  6275. }
  6276. name = capitalize$1(name);
  6277. for (let i = 0; i < prefixes.length; i++) {
  6278. const prefixed = prefixes[i] + name;
  6279. if (prefixed in style) {
  6280. return prefixCache[rawName] = prefixed;
  6281. }
  6282. }
  6283. return rawName;
  6284. }
  6285. const xlinkNS = "http://www.w3.org/1999/xlink";
  6286. function patchAttr(el, key, value, isSVG, instance) {
  6287. if (isSVG && key.startsWith("xlink:")) {
  6288. if (value == null) {
  6289. el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
  6290. } else {
  6291. el.setAttributeNS(xlinkNS, key, value);
  6292. }
  6293. } else {
  6294. const isBoolean2 = isSpecialBooleanAttr(key);
  6295. if (value == null || isBoolean2 && !includeBooleanAttr(value)) {
  6296. el.removeAttribute(key);
  6297. } else {
  6298. el.setAttribute(key, isBoolean2 ? "" : value);
  6299. }
  6300. }
  6301. }
  6302. function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) {
  6303. if (key === "innerHTML" || key === "textContent") {
  6304. if (prevChildren) {
  6305. unmountChildren(prevChildren, parentComponent, parentSuspense);
  6306. }
  6307. el[key] = value == null ? "" : value;
  6308. return;
  6309. }
  6310. const tag = el.tagName;
  6311. if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
  6312. !tag.includes("-")) {
  6313. el._value = value;
  6314. const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value;
  6315. const newValue = value == null ? "" : value;
  6316. if (oldValue !== newValue) {
  6317. el.value = newValue;
  6318. }
  6319. if (value == null) {
  6320. el.removeAttribute(key);
  6321. }
  6322. return;
  6323. }
  6324. let needRemove = false;
  6325. if (value === "" || value == null) {
  6326. const type2 = typeof el[key];
  6327. if (type2 === "boolean") {
  6328. value = includeBooleanAttr(value);
  6329. } else if (value == null && type2 === "string") {
  6330. value = "";
  6331. needRemove = true;
  6332. } else if (type2 === "number") {
  6333. value = 0;
  6334. needRemove = true;
  6335. }
  6336. }
  6337. try {
  6338. el[key] = value;
  6339. } catch (e) {
  6340. }
  6341. needRemove && el.removeAttribute(key);
  6342. }
  6343. function addEventListener(el, event, handler, options) {
  6344. el.addEventListener(event, handler, options);
  6345. }
  6346. function removeEventListener(el, event, handler, options) {
  6347. el.removeEventListener(event, handler, options);
  6348. }
  6349. const veiKey = Symbol("_vei");
  6350. function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
  6351. const invokers = el[veiKey] || (el[veiKey] = {});
  6352. const existingInvoker = invokers[rawName];
  6353. if (nextValue && existingInvoker) {
  6354. existingInvoker.value = nextValue;
  6355. } else {
  6356. const [name, options] = parseName(rawName);
  6357. if (nextValue) {
  6358. const invoker = invokers[rawName] = createInvoker(nextValue, instance);
  6359. addEventListener(el, name, invoker, options);
  6360. } else if (existingInvoker) {
  6361. removeEventListener(el, name, existingInvoker, options);
  6362. invokers[rawName] = void 0;
  6363. }
  6364. }
  6365. }
  6366. const optionsModifierRE = /(?:Once|Passive|Capture)$/;
  6367. function parseName(name) {
  6368. let options;
  6369. if (optionsModifierRE.test(name)) {
  6370. options = {};
  6371. let m2;
  6372. while (m2 = name.match(optionsModifierRE)) {
  6373. name = name.slice(0, name.length - m2[0].length);
  6374. options[m2[0].toLowerCase()] = true;
  6375. }
  6376. }
  6377. const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
  6378. return [event, options];
  6379. }
  6380. let cachedNow = 0;
  6381. const p$1 = /* @__PURE__ */ Promise.resolve();
  6382. const getNow = () => cachedNow || (p$1.then(() => cachedNow = 0), cachedNow = Date.now());
  6383. function createInvoker(initialValue, instance) {
  6384. const invoker = (e) => {
  6385. if (!e._vts) {
  6386. e._vts = Date.now();
  6387. } else if (e._vts <= invoker.attached) {
  6388. return;
  6389. }
  6390. callWithAsyncErrorHandling(
  6391. patchStopImmediatePropagation(e, invoker.value),
  6392. instance,
  6393. 5,
  6394. [e]
  6395. );
  6396. };
  6397. invoker.value = initialValue;
  6398. invoker.attached = getNow();
  6399. return invoker;
  6400. }
  6401. function patchStopImmediatePropagation(e, value) {
  6402. if (isArray$3(value)) {
  6403. const originalStop = e.stopImmediatePropagation;
  6404. e.stopImmediatePropagation = () => {
  6405. originalStop.call(e);
  6406. e._stopped = true;
  6407. };
  6408. return value.map((fn2) => (e2) => !e2._stopped && fn2 && fn2(e2));
  6409. } else {
  6410. return value;
  6411. }
  6412. }
  6413. const nativeOnRE = /^on[a-z]/;
  6414. const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
  6415. if (key === "class") {
  6416. patchClass(el, nextValue, isSVG);
  6417. } else if (key === "style") {
  6418. patchStyle(el, prevValue, nextValue);
  6419. } else if (isOn(key)) {
  6420. if (!isModelListener(key)) {
  6421. patchEvent(el, key, prevValue, nextValue, parentComponent);
  6422. }
  6423. } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) {
  6424. patchDOMProp(
  6425. el,
  6426. key,
  6427. nextValue,
  6428. prevChildren,
  6429. parentComponent,
  6430. parentSuspense,
  6431. unmountChildren
  6432. );
  6433. } else {
  6434. if (key === "true-value") {
  6435. el._trueValue = nextValue;
  6436. } else if (key === "false-value") {
  6437. el._falseValue = nextValue;
  6438. }
  6439. patchAttr(el, key, nextValue, isSVG);
  6440. }
  6441. };
  6442. function shouldSetAsProp(el, key, value, isSVG) {
  6443. if (isSVG) {
  6444. if (key === "innerHTML" || key === "textContent") {
  6445. return true;
  6446. }
  6447. if (key in el && nativeOnRE.test(key) && isFunction$2(value)) {
  6448. return true;
  6449. }
  6450. return false;
  6451. }
  6452. if (key === "spellcheck" || key === "draggable" || key === "translate") {
  6453. return false;
  6454. }
  6455. if (key === "form") {
  6456. return false;
  6457. }
  6458. if (key === "list" && el.tagName === "INPUT") {
  6459. return false;
  6460. }
  6461. if (key === "type" && el.tagName === "TEXTAREA") {
  6462. return false;
  6463. }
  6464. if (nativeOnRE.test(key) && isString$1(value)) {
  6465. return false;
  6466. }
  6467. return key in el;
  6468. }
  6469. const positionMap = /* @__PURE__ */ new WeakMap();
  6470. const newPositionMap = /* @__PURE__ */ new WeakMap();
  6471. const moveCbKey = Symbol("_moveCb");
  6472. const enterCbKey = Symbol("_enterCb");
  6473. const TransitionGroupImpl = {
  6474. name: "TransitionGroup",
  6475. props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
  6476. tag: String,
  6477. moveClass: String
  6478. }),
  6479. setup(props, { slots }) {
  6480. const instance = getCurrentInstance();
  6481. const state = useTransitionState();
  6482. let prevChildren;
  6483. let children;
  6484. onUpdated(() => {
  6485. if (!prevChildren.length) {
  6486. return;
  6487. }
  6488. const moveClass = props.moveClass || `${props.name || "v"}-move`;
  6489. if (!hasCSSTransform(
  6490. prevChildren[0].el,
  6491. instance.vnode.el,
  6492. moveClass
  6493. )) {
  6494. return;
  6495. }
  6496. prevChildren.forEach(callPendingCbs);
  6497. prevChildren.forEach(recordPosition);
  6498. const movedChildren = prevChildren.filter(applyTranslation);
  6499. forceReflow();
  6500. movedChildren.forEach((c2) => {
  6501. const el = c2.el;
  6502. const style = el.style;
  6503. addTransitionClass(el, moveClass);
  6504. style.transform = style.webkitTransform = style.transitionDuration = "";
  6505. const cb = el[moveCbKey] = (e) => {
  6506. if (e && e.target !== el) {
  6507. return;
  6508. }
  6509. if (!e || /transform$/.test(e.propertyName)) {
  6510. el.removeEventListener("transitionend", cb);
  6511. el[moveCbKey] = null;
  6512. removeTransitionClass(el, moveClass);
  6513. }
  6514. };
  6515. el.addEventListener("transitionend", cb);
  6516. });
  6517. });
  6518. return () => {
  6519. const rawProps = toRaw(props);
  6520. const cssTransitionProps = resolveTransitionProps(rawProps);
  6521. let tag = rawProps.tag || Fragment;
  6522. prevChildren = children;
  6523. children = slots.default ? getTransitionRawChildren(slots.default()) : [];
  6524. for (let i = 0; i < children.length; i++) {
  6525. const child = children[i];
  6526. if (child.key != null) {
  6527. setTransitionHooks(
  6528. child,
  6529. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  6530. );
  6531. }
  6532. }
  6533. if (prevChildren) {
  6534. for (let i = 0; i < prevChildren.length; i++) {
  6535. const child = prevChildren[i];
  6536. setTransitionHooks(
  6537. child,
  6538. resolveTransitionHooks(child, cssTransitionProps, state, instance)
  6539. );
  6540. positionMap.set(child, child.el.getBoundingClientRect());
  6541. }
  6542. }
  6543. return createVNode(tag, null, children);
  6544. };
  6545. }
  6546. };
  6547. const removeMode = (props) => delete props.mode;
  6548. /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
  6549. const TransitionGroup = TransitionGroupImpl;
  6550. function callPendingCbs(c2) {
  6551. const el = c2.el;
  6552. if (el[moveCbKey]) {
  6553. el[moveCbKey]();
  6554. }
  6555. if (el[enterCbKey]) {
  6556. el[enterCbKey]();
  6557. }
  6558. }
  6559. function recordPosition(c2) {
  6560. newPositionMap.set(c2, c2.el.getBoundingClientRect());
  6561. }
  6562. function applyTranslation(c2) {
  6563. const oldPos = positionMap.get(c2);
  6564. const newPos = newPositionMap.get(c2);
  6565. const dx = oldPos.left - newPos.left;
  6566. const dy = oldPos.top - newPos.top;
  6567. if (dx || dy) {
  6568. const s2 = c2.el.style;
  6569. s2.transform = s2.webkitTransform = `translate(${dx}px,${dy}px)`;
  6570. s2.transitionDuration = "0s";
  6571. return c2;
  6572. }
  6573. }
  6574. function hasCSSTransform(el, root2, moveClass) {
  6575. const clone2 = el.cloneNode();
  6576. const _vtc = el[vtcKey];
  6577. if (_vtc) {
  6578. _vtc.forEach((cls) => {
  6579. cls.split(/\s+/).forEach((c2) => c2 && clone2.classList.remove(c2));
  6580. });
  6581. }
  6582. moveClass.split(/\s+/).forEach((c2) => c2 && clone2.classList.add(c2));
  6583. clone2.style.display = "none";
  6584. const container = root2.nodeType === 1 ? root2 : root2.parentNode;
  6585. container.appendChild(clone2);
  6586. const { hasTransform } = getTransitionInfo(clone2);
  6587. container.removeChild(clone2);
  6588. return hasTransform;
  6589. }
  6590. const getModelAssigner = (vnode) => {
  6591. const fn2 = vnode.props["onUpdate:modelValue"] || false;
  6592. return isArray$3(fn2) ? (value) => invokeArrayFns(fn2, value) : fn2;
  6593. };
  6594. function onCompositionStart(e) {
  6595. e.target.composing = true;
  6596. }
  6597. function onCompositionEnd(e) {
  6598. const target = e.target;
  6599. if (target.composing) {
  6600. target.composing = false;
  6601. target.dispatchEvent(new Event("input"));
  6602. }
  6603. }
  6604. const assignKey = Symbol("_assign");
  6605. const vModelText = {
  6606. created(el, { modifiers: { lazy, trim, number: number2 } }, vnode) {
  6607. el[assignKey] = getModelAssigner(vnode);
  6608. const castToNumber = number2 || vnode.props && vnode.props.type === "number";
  6609. addEventListener(el, lazy ? "change" : "input", (e) => {
  6610. if (e.target.composing)
  6611. return;
  6612. let domValue = el.value;
  6613. if (trim) {
  6614. domValue = domValue.trim();
  6615. }
  6616. if (castToNumber) {
  6617. domValue = looseToNumber(domValue);
  6618. }
  6619. el[assignKey](domValue);
  6620. });
  6621. if (trim) {
  6622. addEventListener(el, "change", () => {
  6623. el.value = el.value.trim();
  6624. });
  6625. }
  6626. if (!lazy) {
  6627. addEventListener(el, "compositionstart", onCompositionStart);
  6628. addEventListener(el, "compositionend", onCompositionEnd);
  6629. addEventListener(el, "change", onCompositionEnd);
  6630. }
  6631. },
  6632. // set value on mounted so it's after min/max for type="range"
  6633. mounted(el, { value }) {
  6634. el.value = value == null ? "" : value;
  6635. },
  6636. beforeUpdate(el, { value, modifiers: { lazy, trim, number: number2 } }, vnode) {
  6637. el[assignKey] = getModelAssigner(vnode);
  6638. if (el.composing)
  6639. return;
  6640. const elValue = number2 || el.type === "number" ? looseToNumber(el.value) : el.value;
  6641. const newValue = value == null ? "" : value;
  6642. if (elValue === newValue) {
  6643. return;
  6644. }
  6645. if (document.activeElement === el && el.type !== "range") {
  6646. if (lazy) {
  6647. return;
  6648. }
  6649. if (trim && el.value.trim() === newValue) {
  6650. return;
  6651. }
  6652. }
  6653. el.value = newValue;
  6654. }
  6655. };
  6656. const vModelCheckbox = {
  6657. // #4096 array checkboxes need to be deep traversed
  6658. deep: true,
  6659. created(el, _2, vnode) {
  6660. el[assignKey] = getModelAssigner(vnode);
  6661. addEventListener(el, "change", () => {
  6662. const modelValue = el._modelValue;
  6663. const elementValue = getValue$2(el);
  6664. const checked = el.checked;
  6665. const assign2 = el[assignKey];
  6666. if (isArray$3(modelValue)) {
  6667. const index2 = looseIndexOf(modelValue, elementValue);
  6668. const found = index2 !== -1;
  6669. if (checked && !found) {
  6670. assign2(modelValue.concat(elementValue));
  6671. } else if (!checked && found) {
  6672. const filtered = [...modelValue];
  6673. filtered.splice(index2, 1);
  6674. assign2(filtered);
  6675. }
  6676. } else if (isSet$2(modelValue)) {
  6677. const cloned = new Set(modelValue);
  6678. if (checked) {
  6679. cloned.add(elementValue);
  6680. } else {
  6681. cloned.delete(elementValue);
  6682. }
  6683. assign2(cloned);
  6684. } else {
  6685. assign2(getCheckboxValue(el, checked));
  6686. }
  6687. });
  6688. },
  6689. // set initial checked on mount to wait for true-value/false-value
  6690. mounted: setChecked,
  6691. beforeUpdate(el, binding, vnode) {
  6692. el[assignKey] = getModelAssigner(vnode);
  6693. setChecked(el, binding, vnode);
  6694. }
  6695. };
  6696. function setChecked(el, { value, oldValue }, vnode) {
  6697. el._modelValue = value;
  6698. if (isArray$3(value)) {
  6699. el.checked = looseIndexOf(value, vnode.props.value) > -1;
  6700. } else if (isSet$2(value)) {
  6701. el.checked = value.has(vnode.props.value);
  6702. } else if (value !== oldValue) {
  6703. el.checked = looseEqual(value, getCheckboxValue(el, true));
  6704. }
  6705. }
  6706. const vModelRadio = {
  6707. created(el, { value }, vnode) {
  6708. el.checked = looseEqual(value, vnode.props.value);
  6709. el[assignKey] = getModelAssigner(vnode);
  6710. addEventListener(el, "change", () => {
  6711. el[assignKey](getValue$2(el));
  6712. });
  6713. },
  6714. beforeUpdate(el, { value, oldValue }, vnode) {
  6715. el[assignKey] = getModelAssigner(vnode);
  6716. if (value !== oldValue) {
  6717. el.checked = looseEqual(value, vnode.props.value);
  6718. }
  6719. }
  6720. };
  6721. function getValue$2(el) {
  6722. return "_value" in el ? el._value : el.value;
  6723. }
  6724. function getCheckboxValue(el, checked) {
  6725. const key = checked ? "_trueValue" : "_falseValue";
  6726. return key in el ? el[key] : checked;
  6727. }
  6728. const systemModifiers = ["ctrl", "shift", "alt", "meta"];
  6729. const modifierGuards = {
  6730. stop: (e) => e.stopPropagation(),
  6731. prevent: (e) => e.preventDefault(),
  6732. self: (e) => e.target !== e.currentTarget,
  6733. ctrl: (e) => !e.ctrlKey,
  6734. shift: (e) => !e.shiftKey,
  6735. alt: (e) => !e.altKey,
  6736. meta: (e) => !e.metaKey,
  6737. left: (e) => "button" in e && e.button !== 0,
  6738. middle: (e) => "button" in e && e.button !== 1,
  6739. right: (e) => "button" in e && e.button !== 2,
  6740. exact: (e, modifiers) => systemModifiers.some((m2) => e[`${m2}Key`] && !modifiers.includes(m2))
  6741. };
  6742. const withModifiers = (fn2, modifiers) => {
  6743. return (event, ...args) => {
  6744. for (let i = 0; i < modifiers.length; i++) {
  6745. const guard = modifierGuards[modifiers[i]];
  6746. if (guard && guard(event, modifiers))
  6747. return;
  6748. }
  6749. return fn2(event, ...args);
  6750. };
  6751. };
  6752. const keyNames = {
  6753. esc: "escape",
  6754. space: " ",
  6755. up: "arrow-up",
  6756. left: "arrow-left",
  6757. right: "arrow-right",
  6758. down: "arrow-down",
  6759. delete: "backspace"
  6760. };
  6761. const withKeys = (fn2, modifiers) => {
  6762. return (event) => {
  6763. if (!("key" in event)) {
  6764. return;
  6765. }
  6766. const eventKey = hyphenate(event.key);
  6767. if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
  6768. return fn2(event);
  6769. }
  6770. };
  6771. };
  6772. const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
  6773. let renderer;
  6774. function ensureRenderer() {
  6775. return renderer || (renderer = createRenderer(rendererOptions));
  6776. }
  6777. const render = (...args) => {
  6778. ensureRenderer().render(...args);
  6779. };
  6780. const createApp = (...args) => {
  6781. const app = ensureRenderer().createApp(...args);
  6782. const { mount } = app;
  6783. app.mount = (containerOrSelector) => {
  6784. const container = normalizeContainer(containerOrSelector);
  6785. if (!container)
  6786. return;
  6787. const component2 = app._component;
  6788. if (!isFunction$2(component2) && !component2.render && !component2.template) {
  6789. component2.template = container.innerHTML;
  6790. }
  6791. container.innerHTML = "";
  6792. const proxy = mount(container, false, container instanceof SVGElement);
  6793. if (container instanceof Element) {
  6794. container.removeAttribute("v-cloak");
  6795. container.setAttribute("data-v-app", "");
  6796. }
  6797. return proxy;
  6798. };
  6799. return app;
  6800. };
  6801. function normalizeContainer(container) {
  6802. if (isString$1(container)) {
  6803. const res = document.querySelector(container);
  6804. return res;
  6805. }
  6806. return container;
  6807. }
  6808. var isVue2 = false;
  6809. /*!
  6810. * pinia v2.1.7
  6811. * (c) 2023 Eduardo San Martin Morote
  6812. * @license MIT
  6813. */
  6814. let activePinia;
  6815. const setActivePinia = (pinia) => activePinia = pinia;
  6816. const piniaSymbol = (
  6817. /* istanbul ignore next */
  6818. Symbol()
  6819. );
  6820. function isPlainObject$1(o2) {
  6821. return o2 && typeof o2 === "object" && Object.prototype.toString.call(o2) === "[object Object]" && typeof o2.toJSON !== "function";
  6822. }
  6823. var MutationType;
  6824. (function(MutationType2) {
  6825. MutationType2["direct"] = "direct";
  6826. MutationType2["patchObject"] = "patch object";
  6827. MutationType2["patchFunction"] = "patch function";
  6828. })(MutationType || (MutationType = {}));
  6829. function createPinia() {
  6830. const scope = effectScope(true);
  6831. const state = scope.run(() => ref({}));
  6832. let _p = [];
  6833. let toBeInstalled = [];
  6834. const pinia = markRaw({
  6835. install(app) {
  6836. setActivePinia(pinia);
  6837. {
  6838. pinia._a = app;
  6839. app.provide(piniaSymbol, pinia);
  6840. app.config.globalProperties.$pinia = pinia;
  6841. toBeInstalled.forEach((plugin) => _p.push(plugin));
  6842. toBeInstalled = [];
  6843. }
  6844. },
  6845. use(plugin) {
  6846. if (!this._a && !isVue2) {
  6847. toBeInstalled.push(plugin);
  6848. } else {
  6849. _p.push(plugin);
  6850. }
  6851. return this;
  6852. },
  6853. _p,
  6854. // it's actually undefined here
  6855. // @ts-expect-error
  6856. _a: null,
  6857. _e: scope,
  6858. _s: /* @__PURE__ */ new Map(),
  6859. state
  6860. });
  6861. return pinia;
  6862. }
  6863. const noop$3 = () => {
  6864. };
  6865. function addSubscription(subscriptions, callback, detached, onCleanup = noop$3) {
  6866. subscriptions.push(callback);
  6867. const removeSubscription = () => {
  6868. const idx = subscriptions.indexOf(callback);
  6869. if (idx > -1) {
  6870. subscriptions.splice(idx, 1);
  6871. onCleanup();
  6872. }
  6873. };
  6874. if (!detached && getCurrentScope()) {
  6875. onScopeDispose(removeSubscription);
  6876. }
  6877. return removeSubscription;
  6878. }
  6879. function triggerSubscriptions(subscriptions, ...args) {
  6880. subscriptions.slice().forEach((callback) => {
  6881. callback(...args);
  6882. });
  6883. }
  6884. const fallbackRunWithContext = (fn2) => fn2();
  6885. function mergeReactiveObjects(target, patchToApply) {
  6886. if (target instanceof Map && patchToApply instanceof Map) {
  6887. patchToApply.forEach((value, key) => target.set(key, value));
  6888. }
  6889. if (target instanceof Set && patchToApply instanceof Set) {
  6890. patchToApply.forEach(target.add, target);
  6891. }
  6892. for (const key in patchToApply) {
  6893. if (!patchToApply.hasOwnProperty(key))
  6894. continue;
  6895. const subPatch = patchToApply[key];
  6896. const targetValue = target[key];
  6897. if (isPlainObject$1(targetValue) && isPlainObject$1(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) {
  6898. target[key] = mergeReactiveObjects(targetValue, subPatch);
  6899. } else {
  6900. target[key] = subPatch;
  6901. }
  6902. }
  6903. return target;
  6904. }
  6905. const skipHydrateSymbol = (
  6906. /* istanbul ignore next */
  6907. Symbol()
  6908. );
  6909. function shouldHydrate(obj) {
  6910. return !isPlainObject$1(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
  6911. }
  6912. const { assign: assign$1 } = Object;
  6913. function isComputed(o2) {
  6914. return !!(isRef(o2) && o2.effect);
  6915. }
  6916. function createOptionsStore(id, options, pinia, hot) {
  6917. const { state, actions, getters } = options;
  6918. const initialState = pinia.state.value[id];
  6919. let store;
  6920. function setup() {
  6921. if (!initialState && true) {
  6922. {
  6923. pinia.state.value[id] = state ? state() : {};
  6924. }
  6925. }
  6926. const localState = toRefs(pinia.state.value[id]);
  6927. return assign$1(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
  6928. computedGetters[name] = markRaw(computed(() => {
  6929. setActivePinia(pinia);
  6930. const store2 = pinia._s.get(id);
  6931. return getters[name].call(store2, store2);
  6932. }));
  6933. return computedGetters;
  6934. }, {}));
  6935. }
  6936. store = createSetupStore(id, setup, options, pinia, hot, true);
  6937. return store;
  6938. }
  6939. function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
  6940. let scope;
  6941. const optionsForPlugin = assign$1({ actions: {} }, options);
  6942. const $subscribeOptions = {
  6943. deep: true
  6944. // flush: 'post',
  6945. };
  6946. let isListening;
  6947. let isSyncListening;
  6948. let subscriptions = [];
  6949. let actionSubscriptions = [];
  6950. let debuggerEvents;
  6951. const initialState = pinia.state.value[$id];
  6952. if (!isOptionsStore && !initialState && true) {
  6953. {
  6954. pinia.state.value[$id] = {};
  6955. }
  6956. }
  6957. ref({});
  6958. let activeListener;
  6959. function $patch(partialStateOrMutator) {
  6960. let subscriptionMutation;
  6961. isListening = isSyncListening = false;
  6962. if (typeof partialStateOrMutator === "function") {
  6963. partialStateOrMutator(pinia.state.value[$id]);
  6964. subscriptionMutation = {
  6965. type: MutationType.patchFunction,
  6966. storeId: $id,
  6967. events: debuggerEvents
  6968. };
  6969. } else {
  6970. mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
  6971. subscriptionMutation = {
  6972. type: MutationType.patchObject,
  6973. payload: partialStateOrMutator,
  6974. storeId: $id,
  6975. events: debuggerEvents
  6976. };
  6977. }
  6978. const myListenerId = activeListener = Symbol();
  6979. nextTick().then(() => {
  6980. if (activeListener === myListenerId) {
  6981. isListening = true;
  6982. }
  6983. });
  6984. isSyncListening = true;
  6985. triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
  6986. }
  6987. const $reset = isOptionsStore ? function $reset2() {
  6988. const { state } = options;
  6989. const newState = state ? state() : {};
  6990. this.$patch(($state) => {
  6991. assign$1($state, newState);
  6992. });
  6993. } : (
  6994. /* istanbul ignore next */
  6995. noop$3
  6996. );
  6997. function $dispose() {
  6998. scope.stop();
  6999. subscriptions = [];
  7000. actionSubscriptions = [];
  7001. pinia._s.delete($id);
  7002. }
  7003. function wrapAction(name, action) {
  7004. return function() {
  7005. setActivePinia(pinia);
  7006. const args = Array.from(arguments);
  7007. const afterCallbackList = [];
  7008. const onErrorCallbackList = [];
  7009. function after(callback) {
  7010. afterCallbackList.push(callback);
  7011. }
  7012. function onError(callback) {
  7013. onErrorCallbackList.push(callback);
  7014. }
  7015. triggerSubscriptions(actionSubscriptions, {
  7016. args,
  7017. name,
  7018. store,
  7019. after,
  7020. onError
  7021. });
  7022. let ret;
  7023. try {
  7024. ret = action.apply(this && this.$id === $id ? this : store, args);
  7025. } catch (error) {
  7026. triggerSubscriptions(onErrorCallbackList, error);
  7027. throw error;
  7028. }
  7029. if (ret instanceof Promise) {
  7030. return ret.then((value) => {
  7031. triggerSubscriptions(afterCallbackList, value);
  7032. return value;
  7033. }).catch((error) => {
  7034. triggerSubscriptions(onErrorCallbackList, error);
  7035. return Promise.reject(error);
  7036. });
  7037. }
  7038. triggerSubscriptions(afterCallbackList, ret);
  7039. return ret;
  7040. };
  7041. }
  7042. const partialStore = {
  7043. _p: pinia,
  7044. // _s: scope,
  7045. $id,
  7046. $onAction: addSubscription.bind(null, actionSubscriptions),
  7047. $patch,
  7048. $reset,
  7049. $subscribe(callback, options2 = {}) {
  7050. const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
  7051. const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
  7052. if (options2.flush === "sync" ? isSyncListening : isListening) {
  7053. callback({
  7054. storeId: $id,
  7055. type: MutationType.direct,
  7056. events: debuggerEvents
  7057. }, state);
  7058. }
  7059. }, assign$1({}, $subscribeOptions, options2)));
  7060. return removeSubscription;
  7061. },
  7062. $dispose
  7063. };
  7064. const store = reactive(partialStore);
  7065. pinia._s.set($id, store);
  7066. const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext;
  7067. const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(setup)));
  7068. for (const key in setupStore) {
  7069. const prop = setupStore[key];
  7070. if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
  7071. if (!isOptionsStore) {
  7072. if (initialState && shouldHydrate(prop)) {
  7073. if (isRef(prop)) {
  7074. prop.value = initialState[key];
  7075. } else {
  7076. mergeReactiveObjects(prop, initialState[key]);
  7077. }
  7078. }
  7079. {
  7080. pinia.state.value[$id][key] = prop;
  7081. }
  7082. }
  7083. } else if (typeof prop === "function") {
  7084. const actionValue = wrapAction(key, prop);
  7085. {
  7086. setupStore[key] = actionValue;
  7087. }
  7088. optionsForPlugin.actions[key] = prop;
  7089. } else
  7090. ;
  7091. }
  7092. {
  7093. assign$1(store, setupStore);
  7094. assign$1(toRaw(store), setupStore);
  7095. }
  7096. Object.defineProperty(store, "$state", {
  7097. get: () => pinia.state.value[$id],
  7098. set: (state) => {
  7099. $patch(($state) => {
  7100. assign$1($state, state);
  7101. });
  7102. }
  7103. });
  7104. pinia._p.forEach((extender) => {
  7105. {
  7106. assign$1(store, scope.run(() => extender({
  7107. store,
  7108. app: pinia._a,
  7109. pinia,
  7110. options: optionsForPlugin
  7111. })));
  7112. }
  7113. });
  7114. if (initialState && isOptionsStore && options.hydrate) {
  7115. options.hydrate(store.$state, initialState);
  7116. }
  7117. isListening = true;
  7118. isSyncListening = true;
  7119. return store;
  7120. }
  7121. function defineStore(idOrOptions, setup, setupOptions) {
  7122. let id;
  7123. let options;
  7124. const isSetupStore = typeof setup === "function";
  7125. if (typeof idOrOptions === "string") {
  7126. id = idOrOptions;
  7127. options = isSetupStore ? setupOptions : setup;
  7128. } else {
  7129. options = idOrOptions;
  7130. id = idOrOptions.id;
  7131. }
  7132. function useStore2(pinia, hot) {
  7133. const hasContext = hasInjectionContext();
  7134. pinia = // in test mode, ignore the argument provided as we can always retrieve a
  7135. // pinia instance with getActivePinia()
  7136. pinia || (hasContext ? inject(piniaSymbol, null) : null);
  7137. if (pinia)
  7138. setActivePinia(pinia);
  7139. pinia = activePinia;
  7140. if (!pinia._s.has(id)) {
  7141. if (isSetupStore) {
  7142. createSetupStore(id, setup, options, pinia);
  7143. } else {
  7144. createOptionsStore(id, options, pinia);
  7145. }
  7146. }
  7147. const store = pinia._s.get(id);
  7148. return store;
  7149. }
  7150. useStore2.$id = id;
  7151. return useStore2;
  7152. }
  7153. /*!
  7154. * vue-router v4.2.5
  7155. * (c) 2023 Eduardo San Martin Morote
  7156. * @license MIT
  7157. */
  7158. const isBrowser = typeof window !== "undefined";
  7159. function isESModule(obj) {
  7160. return obj.__esModule || obj[Symbol.toStringTag] === "Module";
  7161. }
  7162. const assign = Object.assign;
  7163. function applyToParams(fn2, params) {
  7164. const newParams = {};
  7165. for (const key in params) {
  7166. const value = params[key];
  7167. newParams[key] = isArray$2(value) ? value.map(fn2) : fn2(value);
  7168. }
  7169. return newParams;
  7170. }
  7171. const noop$2 = () => {
  7172. };
  7173. const isArray$2 = Array.isArray;
  7174. const TRAILING_SLASH_RE = /\/$/;
  7175. const removeTrailingSlash = (path) => path.replace(TRAILING_SLASH_RE, "");
  7176. function parseURL(parseQuery2, location2, currentLocation = "/") {
  7177. let path, query = {}, searchString = "", hash = "";
  7178. const hashPos = location2.indexOf("#");
  7179. let searchPos = location2.indexOf("?");
  7180. if (hashPos < searchPos && hashPos >= 0) {
  7181. searchPos = -1;
  7182. }
  7183. if (searchPos > -1) {
  7184. path = location2.slice(0, searchPos);
  7185. searchString = location2.slice(searchPos + 1, hashPos > -1 ? hashPos : location2.length);
  7186. query = parseQuery2(searchString);
  7187. }
  7188. if (hashPos > -1) {
  7189. path = path || location2.slice(0, hashPos);
  7190. hash = location2.slice(hashPos, location2.length);
  7191. }
  7192. path = resolveRelativePath(path != null ? path : location2, currentLocation);
  7193. return {
  7194. fullPath: path + (searchString && "?") + searchString + hash,
  7195. path,
  7196. query,
  7197. hash
  7198. };
  7199. }
  7200. function stringifyURL(stringifyQuery2, location2) {
  7201. const query = location2.query ? stringifyQuery2(location2.query) : "";
  7202. return location2.path + (query && "?") + query + (location2.hash || "");
  7203. }
  7204. function stripBase(pathname, base) {
  7205. if (!base || !pathname.toLowerCase().startsWith(base.toLowerCase()))
  7206. return pathname;
  7207. return pathname.slice(base.length) || "/";
  7208. }
  7209. function isSameRouteLocation(stringifyQuery2, a2, b2) {
  7210. const aLastIndex = a2.matched.length - 1;
  7211. const bLastIndex = b2.matched.length - 1;
  7212. return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a2.matched[aLastIndex], b2.matched[bLastIndex]) && isSameRouteLocationParams(a2.params, b2.params) && stringifyQuery2(a2.query) === stringifyQuery2(b2.query) && a2.hash === b2.hash;
  7213. }
  7214. function isSameRouteRecord(a2, b2) {
  7215. return (a2.aliasOf || a2) === (b2.aliasOf || b2);
  7216. }
  7217. function isSameRouteLocationParams(a2, b2) {
  7218. if (Object.keys(a2).length !== Object.keys(b2).length)
  7219. return false;
  7220. for (const key in a2) {
  7221. if (!isSameRouteLocationParamsValue(a2[key], b2[key]))
  7222. return false;
  7223. }
  7224. return true;
  7225. }
  7226. function isSameRouteLocationParamsValue(a2, b2) {
  7227. return isArray$2(a2) ? isEquivalentArray(a2, b2) : isArray$2(b2) ? isEquivalentArray(b2, a2) : a2 === b2;
  7228. }
  7229. function isEquivalentArray(a2, b2) {
  7230. return isArray$2(b2) ? a2.length === b2.length && a2.every((value, i) => value === b2[i]) : a2.length === 1 && a2[0] === b2;
  7231. }
  7232. function resolveRelativePath(to, from) {
  7233. if (to.startsWith("/"))
  7234. return to;
  7235. if (!to)
  7236. return from;
  7237. const fromSegments = from.split("/");
  7238. const toSegments = to.split("/");
  7239. const lastToSegment = toSegments[toSegments.length - 1];
  7240. if (lastToSegment === ".." || lastToSegment === ".") {
  7241. toSegments.push("");
  7242. }
  7243. let position = fromSegments.length - 1;
  7244. let toPosition;
  7245. let segment;
  7246. for (toPosition = 0; toPosition < toSegments.length; toPosition++) {
  7247. segment = toSegments[toPosition];
  7248. if (segment === ".")
  7249. continue;
  7250. if (segment === "..") {
  7251. if (position > 1)
  7252. position--;
  7253. } else
  7254. break;
  7255. }
  7256. return fromSegments.slice(0, position).join("/") + "/" + toSegments.slice(toPosition - (toPosition === toSegments.length ? 1 : 0)).join("/");
  7257. }
  7258. var NavigationType;
  7259. (function(NavigationType2) {
  7260. NavigationType2["pop"] = "pop";
  7261. NavigationType2["push"] = "push";
  7262. })(NavigationType || (NavigationType = {}));
  7263. var NavigationDirection;
  7264. (function(NavigationDirection2) {
  7265. NavigationDirection2["back"] = "back";
  7266. NavigationDirection2["forward"] = "forward";
  7267. NavigationDirection2["unknown"] = "";
  7268. })(NavigationDirection || (NavigationDirection = {}));
  7269. function normalizeBase(base) {
  7270. if (!base) {
  7271. if (isBrowser) {
  7272. const baseEl = document.querySelector("base");
  7273. base = baseEl && baseEl.getAttribute("href") || "/";
  7274. base = base.replace(/^\w+:\/\/[^\/]+/, "");
  7275. } else {
  7276. base = "/";
  7277. }
  7278. }
  7279. if (base[0] !== "/" && base[0] !== "#")
  7280. base = "/" + base;
  7281. return removeTrailingSlash(base);
  7282. }
  7283. const BEFORE_HASH_RE = /^[^#]+#/;
  7284. function createHref(base, location2) {
  7285. return base.replace(BEFORE_HASH_RE, "#") + location2;
  7286. }
  7287. function getElementPosition(el, offset2) {
  7288. const docRect = document.documentElement.getBoundingClientRect();
  7289. const elRect = el.getBoundingClientRect();
  7290. return {
  7291. behavior: offset2.behavior,
  7292. left: elRect.left - docRect.left - (offset2.left || 0),
  7293. top: elRect.top - docRect.top - (offset2.top || 0)
  7294. };
  7295. }
  7296. const computeScrollPosition = () => ({
  7297. left: window.pageXOffset,
  7298. top: window.pageYOffset
  7299. });
  7300. function scrollToPosition(position) {
  7301. let scrollToOptions;
  7302. if ("el" in position) {
  7303. const positionEl = position.el;
  7304. const isIdSelector = typeof positionEl === "string" && positionEl.startsWith("#");
  7305. const el = typeof positionEl === "string" ? isIdSelector ? document.getElementById(positionEl.slice(1)) : document.querySelector(positionEl) : positionEl;
  7306. if (!el) {
  7307. return;
  7308. }
  7309. scrollToOptions = getElementPosition(el, position);
  7310. } else {
  7311. scrollToOptions = position;
  7312. }
  7313. if ("scrollBehavior" in document.documentElement.style)
  7314. window.scrollTo(scrollToOptions);
  7315. else {
  7316. window.scrollTo(scrollToOptions.left != null ? scrollToOptions.left : window.pageXOffset, scrollToOptions.top != null ? scrollToOptions.top : window.pageYOffset);
  7317. }
  7318. }
  7319. function getScrollKey(path, delta) {
  7320. const position = history.state ? history.state.position - delta : -1;
  7321. return position + path;
  7322. }
  7323. const scrollPositions = /* @__PURE__ */ new Map();
  7324. function saveScrollPosition(key, scrollPosition) {
  7325. scrollPositions.set(key, scrollPosition);
  7326. }
  7327. function getSavedScrollPosition(key) {
  7328. const scroll = scrollPositions.get(key);
  7329. scrollPositions.delete(key);
  7330. return scroll;
  7331. }
  7332. let createBaseLocation = () => location.protocol + "//" + location.host;
  7333. function createCurrentLocation(base, location2) {
  7334. const { pathname, search, hash } = location2;
  7335. const hashPos = base.indexOf("#");
  7336. if (hashPos > -1) {
  7337. let slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1;
  7338. let pathFromHash = hash.slice(slicePos);
  7339. if (pathFromHash[0] !== "/")
  7340. pathFromHash = "/" + pathFromHash;
  7341. return stripBase(pathFromHash, "");
  7342. }
  7343. const path = stripBase(pathname, base);
  7344. return path + search + hash;
  7345. }
  7346. function useHistoryListeners(base, historyState, currentLocation, replace) {
  7347. let listeners = [];
  7348. let teardowns = [];
  7349. let pauseState = null;
  7350. const popStateHandler = ({ state }) => {
  7351. const to = createCurrentLocation(base, location);
  7352. const from = currentLocation.value;
  7353. const fromState = historyState.value;
  7354. let delta = 0;
  7355. if (state) {
  7356. currentLocation.value = to;
  7357. historyState.value = state;
  7358. if (pauseState && pauseState === from) {
  7359. pauseState = null;
  7360. return;
  7361. }
  7362. delta = fromState ? state.position - fromState.position : 0;
  7363. } else {
  7364. replace(to);
  7365. }
  7366. listeners.forEach((listener) => {
  7367. listener(currentLocation.value, from, {
  7368. delta,
  7369. type: NavigationType.pop,
  7370. direction: delta ? delta > 0 ? NavigationDirection.forward : NavigationDirection.back : NavigationDirection.unknown
  7371. });
  7372. });
  7373. };
  7374. function pauseListeners() {
  7375. pauseState = currentLocation.value;
  7376. }
  7377. function listen(callback) {
  7378. listeners.push(callback);
  7379. const teardown = () => {
  7380. const index2 = listeners.indexOf(callback);
  7381. if (index2 > -1)
  7382. listeners.splice(index2, 1);
  7383. };
  7384. teardowns.push(teardown);
  7385. return teardown;
  7386. }
  7387. function beforeUnloadListener() {
  7388. const { history: history2 } = window;
  7389. if (!history2.state)
  7390. return;
  7391. history2.replaceState(assign({}, history2.state, { scroll: computeScrollPosition() }), "");
  7392. }
  7393. function destroy() {
  7394. for (const teardown of teardowns)
  7395. teardown();
  7396. teardowns = [];
  7397. window.removeEventListener("popstate", popStateHandler);
  7398. window.removeEventListener("beforeunload", beforeUnloadListener);
  7399. }
  7400. window.addEventListener("popstate", popStateHandler);
  7401. window.addEventListener("beforeunload", beforeUnloadListener, {
  7402. passive: true
  7403. });
  7404. return {
  7405. pauseListeners,
  7406. listen,
  7407. destroy
  7408. };
  7409. }
  7410. function buildState(back, current, forward, replaced = false, computeScroll = false) {
  7411. return {
  7412. back,
  7413. current,
  7414. forward,
  7415. replaced,
  7416. position: window.history.length,
  7417. scroll: computeScroll ? computeScrollPosition() : null
  7418. };
  7419. }
  7420. function useHistoryStateNavigation(base) {
  7421. const { history: history2, location: location2 } = window;
  7422. const currentLocation = {
  7423. value: createCurrentLocation(base, location2)
  7424. };
  7425. const historyState = { value: history2.state };
  7426. if (!historyState.value) {
  7427. changeLocation(currentLocation.value, {
  7428. back: null,
  7429. current: currentLocation.value,
  7430. forward: null,
  7431. // the length is off by one, we need to decrease it
  7432. position: history2.length - 1,
  7433. replaced: true,
  7434. // don't add a scroll as the user may have an anchor, and we want
  7435. // scrollBehavior to be triggered without a saved position
  7436. scroll: null
  7437. }, true);
  7438. }
  7439. function changeLocation(to, state, replace2) {
  7440. const hashIndex = base.indexOf("#");
  7441. const url = hashIndex > -1 ? (location2.host && document.querySelector("base") ? base : base.slice(hashIndex)) + to : createBaseLocation() + base + to;
  7442. try {
  7443. history2[replace2 ? "replaceState" : "pushState"](state, "", url);
  7444. historyState.value = state;
  7445. } catch (err) {
  7446. {
  7447. console.error(err);
  7448. }
  7449. location2[replace2 ? "replace" : "assign"](url);
  7450. }
  7451. }
  7452. function replace(to, data) {
  7453. const state = assign({}, history2.state, buildState(
  7454. historyState.value.back,
  7455. // keep back and forward entries but override current position
  7456. to,
  7457. historyState.value.forward,
  7458. true
  7459. ), data, { position: historyState.value.position });
  7460. changeLocation(to, state, true);
  7461. currentLocation.value = to;
  7462. }
  7463. function push(to, data) {
  7464. const currentState = assign(
  7465. {},
  7466. // use current history state to gracefully handle a wrong call to
  7467. // history.replaceState
  7468. // https://github.com/vuejs/router/issues/366
  7469. historyState.value,
  7470. history2.state,
  7471. {
  7472. forward: to,
  7473. scroll: computeScrollPosition()
  7474. }
  7475. );
  7476. changeLocation(currentState.current, currentState, true);
  7477. const state = assign({}, buildState(currentLocation.value, to, null), { position: currentState.position + 1 }, data);
  7478. changeLocation(to, state, false);
  7479. currentLocation.value = to;
  7480. }
  7481. return {
  7482. location: currentLocation,
  7483. state: historyState,
  7484. push,
  7485. replace
  7486. };
  7487. }
  7488. function createWebHistory(base) {
  7489. base = normalizeBase(base);
  7490. const historyNavigation = useHistoryStateNavigation(base);
  7491. const historyListeners = useHistoryListeners(base, historyNavigation.state, historyNavigation.location, historyNavigation.replace);
  7492. function go(delta, triggerListeners = true) {
  7493. if (!triggerListeners)
  7494. historyListeners.pauseListeners();
  7495. history.go(delta);
  7496. }
  7497. const routerHistory = assign({
  7498. // it's overridden right after
  7499. location: "",
  7500. base,
  7501. go,
  7502. createHref: createHref.bind(null, base)
  7503. }, historyNavigation, historyListeners);
  7504. Object.defineProperty(routerHistory, "location", {
  7505. enumerable: true,
  7506. get: () => historyNavigation.location.value
  7507. });
  7508. Object.defineProperty(routerHistory, "state", {
  7509. enumerable: true,
  7510. get: () => historyNavigation.state.value
  7511. });
  7512. return routerHistory;
  7513. }
  7514. function createWebHashHistory(base) {
  7515. base = location.host ? base || location.pathname + location.search : "";
  7516. if (!base.includes("#"))
  7517. base += "#";
  7518. return createWebHistory(base);
  7519. }
  7520. function isRouteLocation(route) {
  7521. return typeof route === "string" || route && typeof route === "object";
  7522. }
  7523. function isRouteName(name) {
  7524. return typeof name === "string" || typeof name === "symbol";
  7525. }
  7526. const START_LOCATION_NORMALIZED = {
  7527. path: "/",
  7528. name: void 0,
  7529. params: {},
  7530. query: {},
  7531. hash: "",
  7532. fullPath: "/",
  7533. matched: [],
  7534. meta: {},
  7535. redirectedFrom: void 0
  7536. };
  7537. const NavigationFailureSymbol = Symbol("");
  7538. var NavigationFailureType;
  7539. (function(NavigationFailureType2) {
  7540. NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
  7541. NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
  7542. NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
  7543. })(NavigationFailureType || (NavigationFailureType = {}));
  7544. function createRouterError(type2, params) {
  7545. {
  7546. return assign(new Error(), {
  7547. type: type2,
  7548. [NavigationFailureSymbol]: true
  7549. }, params);
  7550. }
  7551. }
  7552. function isNavigationFailure(error, type2) {
  7553. return error instanceof Error && NavigationFailureSymbol in error && (type2 == null || !!(error.type & type2));
  7554. }
  7555. const BASE_PARAM_PATTERN = "[^/]+?";
  7556. const BASE_PATH_PARSER_OPTIONS = {
  7557. sensitive: false,
  7558. strict: false,
  7559. start: true,
  7560. end: true
  7561. };
  7562. const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
  7563. function tokensToParser(segments, extraOptions) {
  7564. const options = assign({}, BASE_PATH_PARSER_OPTIONS, extraOptions);
  7565. const score = [];
  7566. let pattern2 = options.start ? "^" : "";
  7567. const keys2 = [];
  7568. for (const segment of segments) {
  7569. const segmentScores = segment.length ? [] : [
  7570. 90
  7571. /* PathScore.Root */
  7572. ];
  7573. if (options.strict && !segment.length)
  7574. pattern2 += "/";
  7575. for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
  7576. const token = segment[tokenIndex];
  7577. let subSegmentScore = 40 + (options.sensitive ? 0.25 : 0);
  7578. if (token.type === 0) {
  7579. if (!tokenIndex)
  7580. pattern2 += "/";
  7581. pattern2 += token.value.replace(REGEX_CHARS_RE, "\\$&");
  7582. subSegmentScore += 40;
  7583. } else if (token.type === 1) {
  7584. const { value, repeatable, optional, regexp: regexp2 } = token;
  7585. keys2.push({
  7586. name: value,
  7587. repeatable,
  7588. optional
  7589. });
  7590. const re2 = regexp2 ? regexp2 : BASE_PARAM_PATTERN;
  7591. if (re2 !== BASE_PARAM_PATTERN) {
  7592. subSegmentScore += 10;
  7593. try {
  7594. new RegExp(`(${re2})`);
  7595. } catch (err) {
  7596. throw new Error(`Invalid custom RegExp for param "${value}" (${re2}): ` + err.message);
  7597. }
  7598. }
  7599. let subPattern = repeatable ? `((?:${re2})(?:/(?:${re2}))*)` : `(${re2})`;
  7600. if (!tokenIndex)
  7601. subPattern = // avoid an optional / if there are more segments e.g. /:p?-static
  7602. // or /:p?-:p2
  7603. optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern;
  7604. if (optional)
  7605. subPattern += "?";
  7606. pattern2 += subPattern;
  7607. subSegmentScore += 20;
  7608. if (optional)
  7609. subSegmentScore += -8;
  7610. if (repeatable)
  7611. subSegmentScore += -20;
  7612. if (re2 === ".*")
  7613. subSegmentScore += -50;
  7614. }
  7615. segmentScores.push(subSegmentScore);
  7616. }
  7617. score.push(segmentScores);
  7618. }
  7619. if (options.strict && options.end) {
  7620. const i = score.length - 1;
  7621. score[i][score[i].length - 1] += 0.7000000000000001;
  7622. }
  7623. if (!options.strict)
  7624. pattern2 += "/?";
  7625. if (options.end)
  7626. pattern2 += "$";
  7627. else if (options.strict)
  7628. pattern2 += "(?:/|$)";
  7629. const re = new RegExp(pattern2, options.sensitive ? "" : "i");
  7630. function parse(path) {
  7631. const match = path.match(re);
  7632. const params = {};
  7633. if (!match)
  7634. return null;
  7635. for (let i = 1; i < match.length; i++) {
  7636. const value = match[i] || "";
  7637. const key = keys2[i - 1];
  7638. params[key.name] = value && key.repeatable ? value.split("/") : value;
  7639. }
  7640. return params;
  7641. }
  7642. function stringify(params) {
  7643. let path = "";
  7644. let avoidDuplicatedSlash = false;
  7645. for (const segment of segments) {
  7646. if (!avoidDuplicatedSlash || !path.endsWith("/"))
  7647. path += "/";
  7648. avoidDuplicatedSlash = false;
  7649. for (const token of segment) {
  7650. if (token.type === 0) {
  7651. path += token.value;
  7652. } else if (token.type === 1) {
  7653. const { value, repeatable, optional } = token;
  7654. const param = value in params ? params[value] : "";
  7655. if (isArray$2(param) && !repeatable) {
  7656. throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`);
  7657. }
  7658. const text = isArray$2(param) ? param.join("/") : param;
  7659. if (!text) {
  7660. if (optional) {
  7661. if (segment.length < 2) {
  7662. if (path.endsWith("/"))
  7663. path = path.slice(0, -1);
  7664. else
  7665. avoidDuplicatedSlash = true;
  7666. }
  7667. } else
  7668. throw new Error(`Missing required param "${value}"`);
  7669. }
  7670. path += text;
  7671. }
  7672. }
  7673. }
  7674. return path || "/";
  7675. }
  7676. return {
  7677. re,
  7678. score,
  7679. keys: keys2,
  7680. parse,
  7681. stringify
  7682. };
  7683. }
  7684. function compareScoreArray(a2, b2) {
  7685. let i = 0;
  7686. while (i < a2.length && i < b2.length) {
  7687. const diff = b2[i] - a2[i];
  7688. if (diff)
  7689. return diff;
  7690. i++;
  7691. }
  7692. if (a2.length < b2.length) {
  7693. return a2.length === 1 && a2[0] === 40 + 40 ? -1 : 1;
  7694. } else if (a2.length > b2.length) {
  7695. return b2.length === 1 && b2[0] === 40 + 40 ? 1 : -1;
  7696. }
  7697. return 0;
  7698. }
  7699. function comparePathParserScore(a2, b2) {
  7700. let i = 0;
  7701. const aScore = a2.score;
  7702. const bScore = b2.score;
  7703. while (i < aScore.length && i < bScore.length) {
  7704. const comp = compareScoreArray(aScore[i], bScore[i]);
  7705. if (comp)
  7706. return comp;
  7707. i++;
  7708. }
  7709. if (Math.abs(bScore.length - aScore.length) === 1) {
  7710. if (isLastScoreNegative(aScore))
  7711. return 1;
  7712. if (isLastScoreNegative(bScore))
  7713. return -1;
  7714. }
  7715. return bScore.length - aScore.length;
  7716. }
  7717. function isLastScoreNegative(score) {
  7718. const last = score[score.length - 1];
  7719. return score.length > 0 && last[last.length - 1] < 0;
  7720. }
  7721. const ROOT_TOKEN = {
  7722. type: 0,
  7723. value: ""
  7724. };
  7725. const VALID_PARAM_RE = /[a-zA-Z0-9_]/;
  7726. function tokenizePath(path) {
  7727. if (!path)
  7728. return [[]];
  7729. if (path === "/")
  7730. return [[ROOT_TOKEN]];
  7731. if (!path.startsWith("/")) {
  7732. throw new Error(`Invalid path "${path}"`);
  7733. }
  7734. function crash(message2) {
  7735. throw new Error(`ERR (${state})/"${buffer}": ${message2}`);
  7736. }
  7737. let state = 0;
  7738. let previousState = state;
  7739. const tokens = [];
  7740. let segment;
  7741. function finalizeSegment() {
  7742. if (segment)
  7743. tokens.push(segment);
  7744. segment = [];
  7745. }
  7746. let i = 0;
  7747. let char;
  7748. let buffer = "";
  7749. let customRe = "";
  7750. function consumeBuffer() {
  7751. if (!buffer)
  7752. return;
  7753. if (state === 0) {
  7754. segment.push({
  7755. type: 0,
  7756. value: buffer
  7757. });
  7758. } else if (state === 1 || state === 2 || state === 3) {
  7759. if (segment.length > 1 && (char === "*" || char === "+"))
  7760. crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);
  7761. segment.push({
  7762. type: 1,
  7763. value: buffer,
  7764. regexp: customRe,
  7765. repeatable: char === "*" || char === "+",
  7766. optional: char === "*" || char === "?"
  7767. });
  7768. } else {
  7769. crash("Invalid state to consume buffer");
  7770. }
  7771. buffer = "";
  7772. }
  7773. function addCharToBuffer() {
  7774. buffer += char;
  7775. }
  7776. while (i < path.length) {
  7777. char = path[i++];
  7778. if (char === "\\" && state !== 2) {
  7779. previousState = state;
  7780. state = 4;
  7781. continue;
  7782. }
  7783. switch (state) {
  7784. case 0:
  7785. if (char === "/") {
  7786. if (buffer) {
  7787. consumeBuffer();
  7788. }
  7789. finalizeSegment();
  7790. } else if (char === ":") {
  7791. consumeBuffer();
  7792. state = 1;
  7793. } else {
  7794. addCharToBuffer();
  7795. }
  7796. break;
  7797. case 4:
  7798. addCharToBuffer();
  7799. state = previousState;
  7800. break;
  7801. case 1:
  7802. if (char === "(") {
  7803. state = 2;
  7804. } else if (VALID_PARAM_RE.test(char)) {
  7805. addCharToBuffer();
  7806. } else {
  7807. consumeBuffer();
  7808. state = 0;
  7809. if (char !== "*" && char !== "?" && char !== "+")
  7810. i--;
  7811. }
  7812. break;
  7813. case 2:
  7814. if (char === ")") {
  7815. if (customRe[customRe.length - 1] == "\\")
  7816. customRe = customRe.slice(0, -1) + char;
  7817. else
  7818. state = 3;
  7819. } else {
  7820. customRe += char;
  7821. }
  7822. break;
  7823. case 3:
  7824. consumeBuffer();
  7825. state = 0;
  7826. if (char !== "*" && char !== "?" && char !== "+")
  7827. i--;
  7828. customRe = "";
  7829. break;
  7830. default:
  7831. crash("Unknown state");
  7832. break;
  7833. }
  7834. }
  7835. if (state === 2)
  7836. crash(`Unfinished custom RegExp for param "${buffer}"`);
  7837. consumeBuffer();
  7838. finalizeSegment();
  7839. return tokens;
  7840. }
  7841. function createRouteRecordMatcher(record, parent, options) {
  7842. const parser = tokensToParser(tokenizePath(record.path), options);
  7843. const matcher = assign(parser, {
  7844. record,
  7845. parent,
  7846. // these needs to be populated by the parent
  7847. children: [],
  7848. alias: []
  7849. });
  7850. if (parent) {
  7851. if (!matcher.record.aliasOf === !parent.record.aliasOf)
  7852. parent.children.push(matcher);
  7853. }
  7854. return matcher;
  7855. }
  7856. function createRouterMatcher(routes, globalOptions) {
  7857. const matchers2 = [];
  7858. const matcherMap = /* @__PURE__ */ new Map();
  7859. globalOptions = mergeOptions$1({ strict: false, end: true, sensitive: false }, globalOptions);
  7860. function getRecordMatcher(name) {
  7861. return matcherMap.get(name);
  7862. }
  7863. function addRoute(record, parent, originalRecord) {
  7864. const isRootAdd = !originalRecord;
  7865. const mainNormalizedRecord = normalizeRouteRecord(record);
  7866. mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
  7867. const options = mergeOptions$1(globalOptions, record);
  7868. const normalizedRecords = [
  7869. mainNormalizedRecord
  7870. ];
  7871. if ("alias" in record) {
  7872. const aliases = typeof record.alias === "string" ? [record.alias] : record.alias;
  7873. for (const alias of aliases) {
  7874. normalizedRecords.push(assign({}, mainNormalizedRecord, {
  7875. // this allows us to hold a copy of the `components` option
  7876. // so that async components cache is hold on the original record
  7877. components: originalRecord ? originalRecord.record.components : mainNormalizedRecord.components,
  7878. path: alias,
  7879. // we might be the child of an alias
  7880. aliasOf: originalRecord ? originalRecord.record : mainNormalizedRecord
  7881. // the aliases are always of the same kind as the original since they
  7882. // are defined on the same record
  7883. }));
  7884. }
  7885. }
  7886. let matcher;
  7887. let originalMatcher;
  7888. for (const normalizedRecord of normalizedRecords) {
  7889. const { path } = normalizedRecord;
  7890. if (parent && path[0] !== "/") {
  7891. const parentPath = parent.record.path;
  7892. const connectingSlash = parentPath[parentPath.length - 1] === "/" ? "" : "/";
  7893. normalizedRecord.path = parent.record.path + (path && connectingSlash + path);
  7894. }
  7895. matcher = createRouteRecordMatcher(normalizedRecord, parent, options);
  7896. if (originalRecord) {
  7897. originalRecord.alias.push(matcher);
  7898. } else {
  7899. originalMatcher = originalMatcher || matcher;
  7900. if (originalMatcher !== matcher)
  7901. originalMatcher.alias.push(matcher);
  7902. if (isRootAdd && record.name && !isAliasRecord(matcher))
  7903. removeRoute(record.name);
  7904. }
  7905. if (mainNormalizedRecord.children) {
  7906. const children = mainNormalizedRecord.children;
  7907. for (let i = 0; i < children.length; i++) {
  7908. addRoute(children[i], matcher, originalRecord && originalRecord.children[i]);
  7909. }
  7910. }
  7911. originalRecord = originalRecord || matcher;
  7912. if (matcher.record.components && Object.keys(matcher.record.components).length || matcher.record.name || matcher.record.redirect) {
  7913. insertMatcher(matcher);
  7914. }
  7915. }
  7916. return originalMatcher ? () => {
  7917. removeRoute(originalMatcher);
  7918. } : noop$2;
  7919. }
  7920. function removeRoute(matcherRef) {
  7921. if (isRouteName(matcherRef)) {
  7922. const matcher = matcherMap.get(matcherRef);
  7923. if (matcher) {
  7924. matcherMap.delete(matcherRef);
  7925. matchers2.splice(matchers2.indexOf(matcher), 1);
  7926. matcher.children.forEach(removeRoute);
  7927. matcher.alias.forEach(removeRoute);
  7928. }
  7929. } else {
  7930. const index2 = matchers2.indexOf(matcherRef);
  7931. if (index2 > -1) {
  7932. matchers2.splice(index2, 1);
  7933. if (matcherRef.record.name)
  7934. matcherMap.delete(matcherRef.record.name);
  7935. matcherRef.children.forEach(removeRoute);
  7936. matcherRef.alias.forEach(removeRoute);
  7937. }
  7938. }
  7939. }
  7940. function getRoutes() {
  7941. return matchers2;
  7942. }
  7943. function insertMatcher(matcher) {
  7944. let i = 0;
  7945. while (i < matchers2.length && comparePathParserScore(matcher, matchers2[i]) >= 0 && // Adding children with empty path should still appear before the parent
  7946. // https://github.com/vuejs/router/issues/1124
  7947. (matcher.record.path !== matchers2[i].record.path || !isRecordChildOf(matcher, matchers2[i])))
  7948. i++;
  7949. matchers2.splice(i, 0, matcher);
  7950. if (matcher.record.name && !isAliasRecord(matcher))
  7951. matcherMap.set(matcher.record.name, matcher);
  7952. }
  7953. function resolve2(location2, currentLocation) {
  7954. let matcher;
  7955. let params = {};
  7956. let path;
  7957. let name;
  7958. if ("name" in location2 && location2.name) {
  7959. matcher = matcherMap.get(location2.name);
  7960. if (!matcher)
  7961. throw createRouterError(1, {
  7962. location: location2
  7963. });
  7964. name = matcher.record.name;
  7965. params = assign(
  7966. // paramsFromLocation is a new object
  7967. paramsFromLocation(
  7968. currentLocation.params,
  7969. // only keep params that exist in the resolved location
  7970. // TODO: only keep optional params coming from a parent record
  7971. matcher.keys.filter((k) => !k.optional).map((k) => k.name)
  7972. ),
  7973. // discard any existing params in the current location that do not exist here
  7974. // #1497 this ensures better active/exact matching
  7975. location2.params && paramsFromLocation(location2.params, matcher.keys.map((k) => k.name))
  7976. );
  7977. path = matcher.stringify(params);
  7978. } else if ("path" in location2) {
  7979. path = location2.path;
  7980. matcher = matchers2.find((m2) => m2.re.test(path));
  7981. if (matcher) {
  7982. params = matcher.parse(path);
  7983. name = matcher.record.name;
  7984. }
  7985. } else {
  7986. matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers2.find((m2) => m2.re.test(currentLocation.path));
  7987. if (!matcher)
  7988. throw createRouterError(1, {
  7989. location: location2,
  7990. currentLocation
  7991. });
  7992. name = matcher.record.name;
  7993. params = assign({}, currentLocation.params, location2.params);
  7994. path = matcher.stringify(params);
  7995. }
  7996. const matched = [];
  7997. let parentMatcher = matcher;
  7998. while (parentMatcher) {
  7999. matched.unshift(parentMatcher.record);
  8000. parentMatcher = parentMatcher.parent;
  8001. }
  8002. return {
  8003. name,
  8004. path,
  8005. params,
  8006. matched,
  8007. meta: mergeMetaFields(matched)
  8008. };
  8009. }
  8010. routes.forEach((route) => addRoute(route));
  8011. return { addRoute, resolve: resolve2, removeRoute, getRoutes, getRecordMatcher };
  8012. }
  8013. function paramsFromLocation(params, keys2) {
  8014. const newParams = {};
  8015. for (const key of keys2) {
  8016. if (key in params)
  8017. newParams[key] = params[key];
  8018. }
  8019. return newParams;
  8020. }
  8021. function normalizeRouteRecord(record) {
  8022. return {
  8023. path: record.path,
  8024. redirect: record.redirect,
  8025. name: record.name,
  8026. meta: record.meta || {},
  8027. aliasOf: void 0,
  8028. beforeEnter: record.beforeEnter,
  8029. props: normalizeRecordProps(record),
  8030. children: record.children || [],
  8031. instances: {},
  8032. leaveGuards: /* @__PURE__ */ new Set(),
  8033. updateGuards: /* @__PURE__ */ new Set(),
  8034. enterCallbacks: {},
  8035. components: "components" in record ? record.components || null : record.component && { default: record.component }
  8036. };
  8037. }
  8038. function normalizeRecordProps(record) {
  8039. const propsObject = {};
  8040. const props = record.props || false;
  8041. if ("component" in record) {
  8042. propsObject.default = props;
  8043. } else {
  8044. for (const name in record.components)
  8045. propsObject[name] = typeof props === "object" ? props[name] : props;
  8046. }
  8047. return propsObject;
  8048. }
  8049. function isAliasRecord(record) {
  8050. while (record) {
  8051. if (record.record.aliasOf)
  8052. return true;
  8053. record = record.parent;
  8054. }
  8055. return false;
  8056. }
  8057. function mergeMetaFields(matched) {
  8058. return matched.reduce((meta, record) => assign(meta, record.meta), {});
  8059. }
  8060. function mergeOptions$1(defaults, partialOptions) {
  8061. const options = {};
  8062. for (const key in defaults) {
  8063. options[key] = key in partialOptions ? partialOptions[key] : defaults[key];
  8064. }
  8065. return options;
  8066. }
  8067. function isRecordChildOf(record, parent) {
  8068. return parent.children.some((child) => child === record || isRecordChildOf(record, child));
  8069. }
  8070. const HASH_RE = /#/g;
  8071. const AMPERSAND_RE = /&/g;
  8072. const SLASH_RE = /\//g;
  8073. const EQUAL_RE = /=/g;
  8074. const IM_RE = /\?/g;
  8075. const PLUS_RE = /\+/g;
  8076. const ENC_BRACKET_OPEN_RE = /%5B/g;
  8077. const ENC_BRACKET_CLOSE_RE = /%5D/g;
  8078. const ENC_CARET_RE = /%5E/g;
  8079. const ENC_BACKTICK_RE = /%60/g;
  8080. const ENC_CURLY_OPEN_RE = /%7B/g;
  8081. const ENC_PIPE_RE = /%7C/g;
  8082. const ENC_CURLY_CLOSE_RE = /%7D/g;
  8083. const ENC_SPACE_RE = /%20/g;
  8084. function commonEncode(text) {
  8085. return encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
  8086. }
  8087. function encodeHash(text) {
  8088. return commonEncode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
  8089. }
  8090. function encodeQueryValue(text) {
  8091. return commonEncode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
  8092. }
  8093. function encodeQueryKey(text) {
  8094. return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
  8095. }
  8096. function encodePath(text) {
  8097. return commonEncode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F");
  8098. }
  8099. function encodeParam(text) {
  8100. return text == null ? "" : encodePath(text).replace(SLASH_RE, "%2F");
  8101. }
  8102. function decode(text) {
  8103. try {
  8104. return decodeURIComponent("" + text);
  8105. } catch (err) {
  8106. }
  8107. return "" + text;
  8108. }
  8109. function parseQuery(search) {
  8110. const query = {};
  8111. if (search === "" || search === "?")
  8112. return query;
  8113. const hasLeadingIM = search[0] === "?";
  8114. const searchParams = (hasLeadingIM ? search.slice(1) : search).split("&");
  8115. for (let i = 0; i < searchParams.length; ++i) {
  8116. const searchParam = searchParams[i].replace(PLUS_RE, " ");
  8117. const eqPos = searchParam.indexOf("=");
  8118. const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
  8119. const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
  8120. if (key in query) {
  8121. let currentValue = query[key];
  8122. if (!isArray$2(currentValue)) {
  8123. currentValue = query[key] = [currentValue];
  8124. }
  8125. currentValue.push(value);
  8126. } else {
  8127. query[key] = value;
  8128. }
  8129. }
  8130. return query;
  8131. }
  8132. function stringifyQuery(query) {
  8133. let search = "";
  8134. for (let key in query) {
  8135. const value = query[key];
  8136. key = encodeQueryKey(key);
  8137. if (value == null) {
  8138. if (value !== void 0) {
  8139. search += (search.length ? "&" : "") + key;
  8140. }
  8141. continue;
  8142. }
  8143. const values = isArray$2(value) ? value.map((v2) => v2 && encodeQueryValue(v2)) : [value && encodeQueryValue(value)];
  8144. values.forEach((value2) => {
  8145. if (value2 !== void 0) {
  8146. search += (search.length ? "&" : "") + key;
  8147. if (value2 != null)
  8148. search += "=" + value2;
  8149. }
  8150. });
  8151. }
  8152. return search;
  8153. }
  8154. function normalizeQuery(query) {
  8155. const normalizedQuery = {};
  8156. for (const key in query) {
  8157. const value = query[key];
  8158. if (value !== void 0) {
  8159. normalizedQuery[key] = isArray$2(value) ? value.map((v2) => v2 == null ? null : "" + v2) : value == null ? value : "" + value;
  8160. }
  8161. }
  8162. return normalizedQuery;
  8163. }
  8164. const matchedRouteKey = Symbol("");
  8165. const viewDepthKey = Symbol("");
  8166. const routerKey = Symbol("");
  8167. const routeLocationKey = Symbol("");
  8168. const routerViewLocationKey = Symbol("");
  8169. function useCallbacks() {
  8170. let handlers = [];
  8171. function add2(handler) {
  8172. handlers.push(handler);
  8173. return () => {
  8174. const i = handlers.indexOf(handler);
  8175. if (i > -1)
  8176. handlers.splice(i, 1);
  8177. };
  8178. }
  8179. function reset() {
  8180. handlers = [];
  8181. }
  8182. return {
  8183. add: add2,
  8184. list: () => handlers.slice(),
  8185. reset
  8186. };
  8187. }
  8188. function guardToPromiseFn(guard, to, from, record, name) {
  8189. const enterCallbackArray = record && // name is defined if record is because of the function overload
  8190. (record.enterCallbacks[name] = record.enterCallbacks[name] || []);
  8191. return () => new Promise((resolve2, reject) => {
  8192. const next = (valid) => {
  8193. if (valid === false) {
  8194. reject(createRouterError(4, {
  8195. from,
  8196. to
  8197. }));
  8198. } else if (valid instanceof Error) {
  8199. reject(valid);
  8200. } else if (isRouteLocation(valid)) {
  8201. reject(createRouterError(2, {
  8202. from: to,
  8203. to: valid
  8204. }));
  8205. } else {
  8206. if (enterCallbackArray && // since enterCallbackArray is truthy, both record and name also are
  8207. record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") {
  8208. enterCallbackArray.push(valid);
  8209. }
  8210. resolve2();
  8211. }
  8212. };
  8213. const guardReturn = guard.call(record && record.instances[name], to, from, next);
  8214. let guardCall = Promise.resolve(guardReturn);
  8215. if (guard.length < 3)
  8216. guardCall = guardCall.then(next);
  8217. guardCall.catch((err) => reject(err));
  8218. });
  8219. }
  8220. function extractComponentsGuards(matched, guardType, to, from) {
  8221. const guards = [];
  8222. for (const record of matched) {
  8223. for (const name in record.components) {
  8224. let rawComponent = record.components[name];
  8225. if (guardType !== "beforeRouteEnter" && !record.instances[name])
  8226. continue;
  8227. if (isRouteComponent(rawComponent)) {
  8228. const options = rawComponent.__vccOpts || rawComponent;
  8229. const guard = options[guardType];
  8230. guard && guards.push(guardToPromiseFn(guard, to, from, record, name));
  8231. } else {
  8232. let componentPromise = rawComponent();
  8233. guards.push(() => componentPromise.then((resolved) => {
  8234. if (!resolved)
  8235. return Promise.reject(new Error(`Couldn't resolve component "${name}" at "${record.path}"`));
  8236. const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
  8237. record.components[name] = resolvedComponent;
  8238. const options = resolvedComponent.__vccOpts || resolvedComponent;
  8239. const guard = options[guardType];
  8240. return guard && guardToPromiseFn(guard, to, from, record, name)();
  8241. }));
  8242. }
  8243. }
  8244. }
  8245. return guards;
  8246. }
  8247. function isRouteComponent(component2) {
  8248. return typeof component2 === "object" || "displayName" in component2 || "props" in component2 || "__vccOpts" in component2;
  8249. }
  8250. function useLink(props) {
  8251. const router2 = inject(routerKey);
  8252. const currentRoute = inject(routeLocationKey);
  8253. const route = computed(() => router2.resolve(unref(props.to)));
  8254. const activeRecordIndex = computed(() => {
  8255. const { matched } = route.value;
  8256. const { length } = matched;
  8257. const routeMatched = matched[length - 1];
  8258. const currentMatched = currentRoute.matched;
  8259. if (!routeMatched || !currentMatched.length)
  8260. return -1;
  8261. const index2 = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
  8262. if (index2 > -1)
  8263. return index2;
  8264. const parentRecordPath = getOriginalPath(matched[length - 2]);
  8265. return (
  8266. // we are dealing with nested routes
  8267. length > 1 && // if the parent and matched route have the same path, this link is
  8268. // referring to the empty child. Or we currently are on a different
  8269. // child of the same parent
  8270. getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
  8271. currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index2
  8272. );
  8273. });
  8274. const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
  8275. const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
  8276. function navigate(e = {}) {
  8277. if (guardEvent(e)) {
  8278. return router2[unref(props.replace) ? "replace" : "push"](
  8279. unref(props.to)
  8280. // avoid uncaught errors are they are logged anyway
  8281. ).catch(noop$2);
  8282. }
  8283. return Promise.resolve();
  8284. }
  8285. return {
  8286. route,
  8287. href: computed(() => route.value.href),
  8288. isActive,
  8289. isExactActive,
  8290. navigate
  8291. };
  8292. }
  8293. const RouterLinkImpl = /* @__PURE__ */ defineComponent({
  8294. name: "RouterLink",
  8295. compatConfig: { MODE: 3 },
  8296. props: {
  8297. to: {
  8298. type: [String, Object],
  8299. required: true
  8300. },
  8301. replace: Boolean,
  8302. activeClass: String,
  8303. // inactiveClass: String,
  8304. exactActiveClass: String,
  8305. custom: Boolean,
  8306. ariaCurrentValue: {
  8307. type: String,
  8308. default: "page"
  8309. }
  8310. },
  8311. useLink,
  8312. setup(props, { slots }) {
  8313. const link = reactive(useLink(props));
  8314. const { options } = inject(routerKey);
  8315. const elClass = computed(() => ({
  8316. [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
  8317. // [getLinkClass(
  8318. // props.inactiveClass,
  8319. // options.linkInactiveClass,
  8320. // 'router-link-inactive'
  8321. // )]: !link.isExactActive,
  8322. [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
  8323. }));
  8324. return () => {
  8325. const children = slots.default && slots.default(link);
  8326. return props.custom ? children : h$1("a", {
  8327. "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
  8328. href: link.href,
  8329. // this would override user added attrs but Vue will still add
  8330. // the listener, so we end up triggering both
  8331. onClick: link.navigate,
  8332. class: elClass.value
  8333. }, children);
  8334. };
  8335. }
  8336. });
  8337. const RouterLink = RouterLinkImpl;
  8338. function guardEvent(e) {
  8339. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
  8340. return;
  8341. if (e.defaultPrevented)
  8342. return;
  8343. if (e.button !== void 0 && e.button !== 0)
  8344. return;
  8345. if (e.currentTarget && e.currentTarget.getAttribute) {
  8346. const target = e.currentTarget.getAttribute("target");
  8347. if (/\b_blank\b/i.test(target))
  8348. return;
  8349. }
  8350. if (e.preventDefault)
  8351. e.preventDefault();
  8352. return true;
  8353. }
  8354. function includesParams(outer, inner) {
  8355. for (const key in inner) {
  8356. const innerValue = inner[key];
  8357. const outerValue = outer[key];
  8358. if (typeof innerValue === "string") {
  8359. if (innerValue !== outerValue)
  8360. return false;
  8361. } else {
  8362. if (!isArray$2(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
  8363. return false;
  8364. }
  8365. }
  8366. return true;
  8367. }
  8368. function getOriginalPath(record) {
  8369. return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
  8370. }
  8371. const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
  8372. const RouterViewImpl = /* @__PURE__ */ defineComponent({
  8373. name: "RouterView",
  8374. // #674 we manually inherit them
  8375. inheritAttrs: false,
  8376. props: {
  8377. name: {
  8378. type: String,
  8379. default: "default"
  8380. },
  8381. route: Object
  8382. },
  8383. // Better compat for @vue/compat users
  8384. // https://github.com/vuejs/router/issues/1315
  8385. compatConfig: { MODE: 3 },
  8386. setup(props, { attrs, slots }) {
  8387. const injectedRoute = inject(routerViewLocationKey);
  8388. const routeToDisplay = computed(() => props.route || injectedRoute.value);
  8389. const injectedDepth = inject(viewDepthKey, 0);
  8390. const depth = computed(() => {
  8391. let initialDepth = unref(injectedDepth);
  8392. const { matched } = routeToDisplay.value;
  8393. let matchedRoute;
  8394. while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) {
  8395. initialDepth++;
  8396. }
  8397. return initialDepth;
  8398. });
  8399. const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]);
  8400. provide(viewDepthKey, computed(() => depth.value + 1));
  8401. provide(matchedRouteKey, matchedRouteRef);
  8402. provide(routerViewLocationKey, routeToDisplay);
  8403. const viewRef = ref();
  8404. watch(() => [viewRef.value, matchedRouteRef.value, props.name], ([instance, to, name], [oldInstance, from, oldName]) => {
  8405. if (to) {
  8406. to.instances[name] = instance;
  8407. if (from && from !== to && instance && instance === oldInstance) {
  8408. if (!to.leaveGuards.size) {
  8409. to.leaveGuards = from.leaveGuards;
  8410. }
  8411. if (!to.updateGuards.size) {
  8412. to.updateGuards = from.updateGuards;
  8413. }
  8414. }
  8415. }
  8416. if (instance && to && // if there is no instance but to and from are the same this might be
  8417. // the first visit
  8418. (!from || !isSameRouteRecord(to, from) || !oldInstance)) {
  8419. (to.enterCallbacks[name] || []).forEach((callback) => callback(instance));
  8420. }
  8421. }, { flush: "post" });
  8422. return () => {
  8423. const route = routeToDisplay.value;
  8424. const currentName = props.name;
  8425. const matchedRoute = matchedRouteRef.value;
  8426. const ViewComponent = matchedRoute && matchedRoute.components[currentName];
  8427. if (!ViewComponent) {
  8428. return normalizeSlot(slots.default, { Component: ViewComponent, route });
  8429. }
  8430. const routePropsOption = matchedRoute.props[currentName];
  8431. const routeProps = routePropsOption ? routePropsOption === true ? route.params : typeof routePropsOption === "function" ? routePropsOption(route) : routePropsOption : null;
  8432. const onVnodeUnmounted = (vnode) => {
  8433. if (vnode.component.isUnmounted) {
  8434. matchedRoute.instances[currentName] = null;
  8435. }
  8436. };
  8437. const component2 = h$1(ViewComponent, assign({}, routeProps, attrs, {
  8438. onVnodeUnmounted,
  8439. ref: viewRef
  8440. }));
  8441. return (
  8442. // pass the vnode to the slot as a prop.
  8443. // h and <component :is="..."> both accept vnodes
  8444. normalizeSlot(slots.default, { Component: component2, route }) || component2
  8445. );
  8446. };
  8447. }
  8448. });
  8449. function normalizeSlot(slot, data) {
  8450. if (!slot)
  8451. return null;
  8452. const slotContent = slot(data);
  8453. return slotContent.length === 1 ? slotContent[0] : slotContent;
  8454. }
  8455. const RouterView = RouterViewImpl;
  8456. function createRouter(options) {
  8457. const matcher = createRouterMatcher(options.routes, options);
  8458. const parseQuery$1 = options.parseQuery || parseQuery;
  8459. const stringifyQuery$1 = options.stringifyQuery || stringifyQuery;
  8460. const routerHistory = options.history;
  8461. const beforeGuards = useCallbacks();
  8462. const beforeResolveGuards = useCallbacks();
  8463. const afterGuards = useCallbacks();
  8464. const currentRoute = shallowRef(START_LOCATION_NORMALIZED);
  8465. let pendingLocation = START_LOCATION_NORMALIZED;
  8466. if (isBrowser && options.scrollBehavior && "scrollRestoration" in history) {
  8467. history.scrollRestoration = "manual";
  8468. }
  8469. const normalizeParams = applyToParams.bind(null, (paramValue) => "" + paramValue);
  8470. const encodeParams = applyToParams.bind(null, encodeParam);
  8471. const decodeParams = (
  8472. // @ts-expect-error: intentionally avoid the type check
  8473. applyToParams.bind(null, decode)
  8474. );
  8475. function addRoute(parentOrRoute, route) {
  8476. let parent;
  8477. let record;
  8478. if (isRouteName(parentOrRoute)) {
  8479. parent = matcher.getRecordMatcher(parentOrRoute);
  8480. record = route;
  8481. } else {
  8482. record = parentOrRoute;
  8483. }
  8484. return matcher.addRoute(record, parent);
  8485. }
  8486. function removeRoute(name) {
  8487. const recordMatcher = matcher.getRecordMatcher(name);
  8488. if (recordMatcher) {
  8489. matcher.removeRoute(recordMatcher);
  8490. }
  8491. }
  8492. function getRoutes() {
  8493. return matcher.getRoutes().map((routeMatcher) => routeMatcher.record);
  8494. }
  8495. function hasRoute(name) {
  8496. return !!matcher.getRecordMatcher(name);
  8497. }
  8498. function resolve2(rawLocation, currentLocation) {
  8499. currentLocation = assign({}, currentLocation || currentRoute.value);
  8500. if (typeof rawLocation === "string") {
  8501. const locationNormalized = parseURL(parseQuery$1, rawLocation, currentLocation.path);
  8502. const matchedRoute2 = matcher.resolve({ path: locationNormalized.path }, currentLocation);
  8503. const href2 = routerHistory.createHref(locationNormalized.fullPath);
  8504. return assign(locationNormalized, matchedRoute2, {
  8505. params: decodeParams(matchedRoute2.params),
  8506. hash: decode(locationNormalized.hash),
  8507. redirectedFrom: void 0,
  8508. href: href2
  8509. });
  8510. }
  8511. let matcherLocation;
  8512. if ("path" in rawLocation) {
  8513. matcherLocation = assign({}, rawLocation, {
  8514. path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path
  8515. });
  8516. } else {
  8517. const targetParams = assign({}, rawLocation.params);
  8518. for (const key in targetParams) {
  8519. if (targetParams[key] == null) {
  8520. delete targetParams[key];
  8521. }
  8522. }
  8523. matcherLocation = assign({}, rawLocation, {
  8524. params: encodeParams(targetParams)
  8525. });
  8526. currentLocation.params = encodeParams(currentLocation.params);
  8527. }
  8528. const matchedRoute = matcher.resolve(matcherLocation, currentLocation);
  8529. const hash = rawLocation.hash || "";
  8530. matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));
  8531. const fullPath = stringifyURL(stringifyQuery$1, assign({}, rawLocation, {
  8532. hash: encodeHash(hash),
  8533. path: matchedRoute.path
  8534. }));
  8535. const href = routerHistory.createHref(fullPath);
  8536. return assign({
  8537. fullPath,
  8538. // keep the hash encoded so fullPath is effectively path + encodedQuery +
  8539. // hash
  8540. hash,
  8541. query: (
  8542. // if the user is using a custom query lib like qs, we might have
  8543. // nested objects, so we keep the query as is, meaning it can contain
  8544. // numbers at `$route.query`, but at the point, the user will have to
  8545. // use their own type anyway.
  8546. // https://github.com/vuejs/router/issues/328#issuecomment-649481567
  8547. stringifyQuery$1 === stringifyQuery ? normalizeQuery(rawLocation.query) : rawLocation.query || {}
  8548. )
  8549. }, matchedRoute, {
  8550. redirectedFrom: void 0,
  8551. href
  8552. });
  8553. }
  8554. function locationAsObject(to) {
  8555. return typeof to === "string" ? parseURL(parseQuery$1, to, currentRoute.value.path) : assign({}, to);
  8556. }
  8557. function checkCanceledNavigation(to, from) {
  8558. if (pendingLocation !== to) {
  8559. return createRouterError(8, {
  8560. from,
  8561. to
  8562. });
  8563. }
  8564. }
  8565. function push(to) {
  8566. return pushWithRedirect(to);
  8567. }
  8568. function replace(to) {
  8569. return push(assign(locationAsObject(to), { replace: true }));
  8570. }
  8571. function handleRedirectRecord(to) {
  8572. const lastMatched = to.matched[to.matched.length - 1];
  8573. if (lastMatched && lastMatched.redirect) {
  8574. const { redirect } = lastMatched;
  8575. let newTargetLocation = typeof redirect === "function" ? redirect(to) : redirect;
  8576. if (typeof newTargetLocation === "string") {
  8577. newTargetLocation = newTargetLocation.includes("?") || newTargetLocation.includes("#") ? newTargetLocation = locationAsObject(newTargetLocation) : (
  8578. // force empty params
  8579. { path: newTargetLocation }
  8580. );
  8581. newTargetLocation.params = {};
  8582. }
  8583. return assign({
  8584. query: to.query,
  8585. hash: to.hash,
  8586. // avoid transferring params if the redirect has a path
  8587. params: "path" in newTargetLocation ? {} : to.params
  8588. }, newTargetLocation);
  8589. }
  8590. }
  8591. function pushWithRedirect(to, redirectedFrom) {
  8592. const targetLocation = pendingLocation = resolve2(to);
  8593. const from = currentRoute.value;
  8594. const data = to.state;
  8595. const force = to.force;
  8596. const replace2 = to.replace === true;
  8597. const shouldRedirect = handleRedirectRecord(targetLocation);
  8598. if (shouldRedirect)
  8599. return pushWithRedirect(
  8600. assign(locationAsObject(shouldRedirect), {
  8601. state: typeof shouldRedirect === "object" ? assign({}, data, shouldRedirect.state) : data,
  8602. force,
  8603. replace: replace2
  8604. }),
  8605. // keep original redirectedFrom if it exists
  8606. redirectedFrom || targetLocation
  8607. );
  8608. const toLocation = targetLocation;
  8609. toLocation.redirectedFrom = redirectedFrom;
  8610. let failure;
  8611. if (!force && isSameRouteLocation(stringifyQuery$1, from, targetLocation)) {
  8612. failure = createRouterError(16, { to: toLocation, from });
  8613. handleScroll2(
  8614. from,
  8615. from,
  8616. // this is a push, the only way for it to be triggered from a
  8617. // history.listen is with a redirect, which makes it become a push
  8618. true,
  8619. // This cannot be the first navigation because the initial location
  8620. // cannot be manually navigated to
  8621. false
  8622. );
  8623. }
  8624. return (failure ? Promise.resolve(failure) : navigate(toLocation, from)).catch((error) => isNavigationFailure(error) ? (
  8625. // navigation redirects still mark the router as ready
  8626. isNavigationFailure(
  8627. error,
  8628. 2
  8629. /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
  8630. ) ? error : markAsReady(error)
  8631. ) : (
  8632. // reject any unknown error
  8633. triggerError(error, toLocation, from)
  8634. )).then((failure2) => {
  8635. if (failure2) {
  8636. if (isNavigationFailure(
  8637. failure2,
  8638. 2
  8639. /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
  8640. )) {
  8641. return pushWithRedirect(
  8642. // keep options
  8643. assign({
  8644. // preserve an existing replacement but allow the redirect to override it
  8645. replace: replace2
  8646. }, locationAsObject(failure2.to), {
  8647. state: typeof failure2.to === "object" ? assign({}, data, failure2.to.state) : data,
  8648. force
  8649. }),
  8650. // preserve the original redirectedFrom if any
  8651. redirectedFrom || toLocation
  8652. );
  8653. }
  8654. } else {
  8655. failure2 = finalizeNavigation(toLocation, from, true, replace2, data);
  8656. }
  8657. triggerAfterEach(toLocation, from, failure2);
  8658. return failure2;
  8659. });
  8660. }
  8661. function checkCanceledNavigationAndReject(to, from) {
  8662. const error = checkCanceledNavigation(to, from);
  8663. return error ? Promise.reject(error) : Promise.resolve();
  8664. }
  8665. function runWithContext(fn2) {
  8666. const app = installedApps.values().next().value;
  8667. return app && typeof app.runWithContext === "function" ? app.runWithContext(fn2) : fn2();
  8668. }
  8669. function navigate(to, from) {
  8670. let guards;
  8671. const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from);
  8672. guards = extractComponentsGuards(leavingRecords.reverse(), "beforeRouteLeave", to, from);
  8673. for (const record of leavingRecords) {
  8674. record.leaveGuards.forEach((guard) => {
  8675. guards.push(guardToPromiseFn(guard, to, from));
  8676. });
  8677. }
  8678. const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from);
  8679. guards.push(canceledNavigationCheck);
  8680. return runGuardQueue(guards).then(() => {
  8681. guards = [];
  8682. for (const guard of beforeGuards.list()) {
  8683. guards.push(guardToPromiseFn(guard, to, from));
  8684. }
  8685. guards.push(canceledNavigationCheck);
  8686. return runGuardQueue(guards);
  8687. }).then(() => {
  8688. guards = extractComponentsGuards(updatingRecords, "beforeRouteUpdate", to, from);
  8689. for (const record of updatingRecords) {
  8690. record.updateGuards.forEach((guard) => {
  8691. guards.push(guardToPromiseFn(guard, to, from));
  8692. });
  8693. }
  8694. guards.push(canceledNavigationCheck);
  8695. return runGuardQueue(guards);
  8696. }).then(() => {
  8697. guards = [];
  8698. for (const record of enteringRecords) {
  8699. if (record.beforeEnter) {
  8700. if (isArray$2(record.beforeEnter)) {
  8701. for (const beforeEnter of record.beforeEnter)
  8702. guards.push(guardToPromiseFn(beforeEnter, to, from));
  8703. } else {
  8704. guards.push(guardToPromiseFn(record.beforeEnter, to, from));
  8705. }
  8706. }
  8707. }
  8708. guards.push(canceledNavigationCheck);
  8709. return runGuardQueue(guards);
  8710. }).then(() => {
  8711. to.matched.forEach((record) => record.enterCallbacks = {});
  8712. guards = extractComponentsGuards(enteringRecords, "beforeRouteEnter", to, from);
  8713. guards.push(canceledNavigationCheck);
  8714. return runGuardQueue(guards);
  8715. }).then(() => {
  8716. guards = [];
  8717. for (const guard of beforeResolveGuards.list()) {
  8718. guards.push(guardToPromiseFn(guard, to, from));
  8719. }
  8720. guards.push(canceledNavigationCheck);
  8721. return runGuardQueue(guards);
  8722. }).catch((err) => isNavigationFailure(
  8723. err,
  8724. 8
  8725. /* ErrorTypes.NAVIGATION_CANCELLED */
  8726. ) ? err : Promise.reject(err));
  8727. }
  8728. function triggerAfterEach(to, from, failure) {
  8729. afterGuards.list().forEach((guard) => runWithContext(() => guard(to, from, failure)));
  8730. }
  8731. function finalizeNavigation(toLocation, from, isPush, replace2, data) {
  8732. const error = checkCanceledNavigation(toLocation, from);
  8733. if (error)
  8734. return error;
  8735. const isFirstNavigation = from === START_LOCATION_NORMALIZED;
  8736. const state = !isBrowser ? {} : history.state;
  8737. if (isPush) {
  8738. if (replace2 || isFirstNavigation)
  8739. routerHistory.replace(toLocation.fullPath, assign({
  8740. scroll: isFirstNavigation && state && state.scroll
  8741. }, data));
  8742. else
  8743. routerHistory.push(toLocation.fullPath, data);
  8744. }
  8745. currentRoute.value = toLocation;
  8746. handleScroll2(toLocation, from, isPush, isFirstNavigation);
  8747. markAsReady();
  8748. }
  8749. let removeHistoryListener;
  8750. function setupListeners() {
  8751. if (removeHistoryListener)
  8752. return;
  8753. removeHistoryListener = routerHistory.listen((to, _from, info) => {
  8754. if (!router2.listening)
  8755. return;
  8756. const toLocation = resolve2(to);
  8757. const shouldRedirect = handleRedirectRecord(toLocation);
  8758. if (shouldRedirect) {
  8759. pushWithRedirect(assign(shouldRedirect, { replace: true }), toLocation).catch(noop$2);
  8760. return;
  8761. }
  8762. pendingLocation = toLocation;
  8763. const from = currentRoute.value;
  8764. if (isBrowser) {
  8765. saveScrollPosition(getScrollKey(from.fullPath, info.delta), computeScrollPosition());
  8766. }
  8767. navigate(toLocation, from).catch((error) => {
  8768. if (isNavigationFailure(
  8769. error,
  8770. 4 | 8
  8771. /* ErrorTypes.NAVIGATION_CANCELLED */
  8772. )) {
  8773. return error;
  8774. }
  8775. if (isNavigationFailure(
  8776. error,
  8777. 2
  8778. /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
  8779. )) {
  8780. pushWithRedirect(
  8781. error.to,
  8782. toLocation
  8783. // avoid an uncaught rejection, let push call triggerError
  8784. ).then((failure) => {
  8785. if (isNavigationFailure(
  8786. failure,
  8787. 4 | 16
  8788. /* ErrorTypes.NAVIGATION_DUPLICATED */
  8789. ) && !info.delta && info.type === NavigationType.pop) {
  8790. routerHistory.go(-1, false);
  8791. }
  8792. }).catch(noop$2);
  8793. return Promise.reject();
  8794. }
  8795. if (info.delta) {
  8796. routerHistory.go(-info.delta, false);
  8797. }
  8798. return triggerError(error, toLocation, from);
  8799. }).then((failure) => {
  8800. failure = failure || finalizeNavigation(
  8801. // after navigation, all matched components are resolved
  8802. toLocation,
  8803. from,
  8804. false
  8805. );
  8806. if (failure) {
  8807. if (info.delta && // a new navigation has been triggered, so we do not want to revert, that will change the current history
  8808. // entry while a different route is displayed
  8809. !isNavigationFailure(
  8810. failure,
  8811. 8
  8812. /* ErrorTypes.NAVIGATION_CANCELLED */
  8813. )) {
  8814. routerHistory.go(-info.delta, false);
  8815. } else if (info.type === NavigationType.pop && isNavigationFailure(
  8816. failure,
  8817. 4 | 16
  8818. /* ErrorTypes.NAVIGATION_DUPLICATED */
  8819. )) {
  8820. routerHistory.go(-1, false);
  8821. }
  8822. }
  8823. triggerAfterEach(toLocation, from, failure);
  8824. }).catch(noop$2);
  8825. });
  8826. }
  8827. let readyHandlers = useCallbacks();
  8828. let errorListeners = useCallbacks();
  8829. let ready;
  8830. function triggerError(error, to, from) {
  8831. markAsReady(error);
  8832. const list = errorListeners.list();
  8833. if (list.length) {
  8834. list.forEach((handler) => handler(error, to, from));
  8835. } else {
  8836. console.error(error);
  8837. }
  8838. return Promise.reject(error);
  8839. }
  8840. function isReady() {
  8841. if (ready && currentRoute.value !== START_LOCATION_NORMALIZED)
  8842. return Promise.resolve();
  8843. return new Promise((resolve3, reject) => {
  8844. readyHandlers.add([resolve3, reject]);
  8845. });
  8846. }
  8847. function markAsReady(err) {
  8848. if (!ready) {
  8849. ready = !err;
  8850. setupListeners();
  8851. readyHandlers.list().forEach(([resolve3, reject]) => err ? reject(err) : resolve3());
  8852. readyHandlers.reset();
  8853. }
  8854. return err;
  8855. }
  8856. function handleScroll2(to, from, isPush, isFirstNavigation) {
  8857. const { scrollBehavior } = options;
  8858. if (!isBrowser || !scrollBehavior)
  8859. return Promise.resolve();
  8860. const scrollPosition = !isPush && getSavedScrollPosition(getScrollKey(to.fullPath, 0)) || (isFirstNavigation || !isPush) && history.state && history.state.scroll || null;
  8861. return nextTick().then(() => scrollBehavior(to, from, scrollPosition)).then((position) => position && scrollToPosition(position)).catch((err) => triggerError(err, to, from));
  8862. }
  8863. const go = (delta) => routerHistory.go(delta);
  8864. let started;
  8865. const installedApps = /* @__PURE__ */ new Set();
  8866. const router2 = {
  8867. currentRoute,
  8868. listening: true,
  8869. addRoute,
  8870. removeRoute,
  8871. hasRoute,
  8872. getRoutes,
  8873. resolve: resolve2,
  8874. options,
  8875. push,
  8876. replace,
  8877. go,
  8878. back: () => go(-1),
  8879. forward: () => go(1),
  8880. beforeEach: beforeGuards.add,
  8881. beforeResolve: beforeResolveGuards.add,
  8882. afterEach: afterGuards.add,
  8883. onError: errorListeners.add,
  8884. isReady,
  8885. install(app) {
  8886. const router3 = this;
  8887. app.component("RouterLink", RouterLink);
  8888. app.component("RouterView", RouterView);
  8889. app.config.globalProperties.$router = router3;
  8890. Object.defineProperty(app.config.globalProperties, "$route", {
  8891. enumerable: true,
  8892. get: () => unref(currentRoute)
  8893. });
  8894. if (isBrowser && // used for the initial navigation client side to avoid pushing
  8895. // multiple times when the router is used in multiple apps
  8896. !started && currentRoute.value === START_LOCATION_NORMALIZED) {
  8897. started = true;
  8898. push(routerHistory.location).catch((err) => {
  8899. });
  8900. }
  8901. const reactiveRoute = {};
  8902. for (const key in START_LOCATION_NORMALIZED) {
  8903. Object.defineProperty(reactiveRoute, key, {
  8904. get: () => currentRoute.value[key],
  8905. enumerable: true
  8906. });
  8907. }
  8908. app.provide(routerKey, router3);
  8909. app.provide(routeLocationKey, shallowReactive(reactiveRoute));
  8910. app.provide(routerViewLocationKey, currentRoute);
  8911. const unmountApp = app.unmount;
  8912. installedApps.add(app);
  8913. app.unmount = function() {
  8914. installedApps.delete(app);
  8915. if (installedApps.size < 1) {
  8916. pendingLocation = START_LOCATION_NORMALIZED;
  8917. removeHistoryListener && removeHistoryListener();
  8918. removeHistoryListener = null;
  8919. currentRoute.value = START_LOCATION_NORMALIZED;
  8920. started = false;
  8921. ready = false;
  8922. }
  8923. unmountApp();
  8924. };
  8925. }
  8926. };
  8927. function runGuardQueue(guards) {
  8928. return guards.reduce((promise, guard) => promise.then(() => runWithContext(guard)), Promise.resolve());
  8929. }
  8930. return router2;
  8931. }
  8932. function extractChangingRecords(to, from) {
  8933. const leavingRecords = [];
  8934. const updatingRecords = [];
  8935. const enteringRecords = [];
  8936. const len = Math.max(from.matched.length, to.matched.length);
  8937. for (let i = 0; i < len; i++) {
  8938. const recordFrom = from.matched[i];
  8939. if (recordFrom) {
  8940. if (to.matched.find((record) => isSameRouteRecord(record, recordFrom)))
  8941. updatingRecords.push(recordFrom);
  8942. else
  8943. leavingRecords.push(recordFrom);
  8944. }
  8945. const recordTo = to.matched[i];
  8946. if (recordTo) {
  8947. if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) {
  8948. enteringRecords.push(recordTo);
  8949. }
  8950. }
  8951. }
  8952. return [leavingRecords, updatingRecords, enteringRecords];
  8953. }
  8954. function useRouter() {
  8955. return inject(routerKey);
  8956. }
  8957. const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`;
  8958. const isVisible = (element) => {
  8959. const computed2 = getComputedStyle(element);
  8960. return computed2.position === "fixed" ? false : element.offsetParent !== null;
  8961. };
  8962. const obtainAllFocusableElements$1 = (element) => {
  8963. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  8964. };
  8965. const isFocusable = (element) => {
  8966. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  8967. return true;
  8968. }
  8969. if (element.disabled) {
  8970. return false;
  8971. }
  8972. switch (element.nodeName) {
  8973. case "A": {
  8974. return !!element.href && element.rel !== "ignore";
  8975. }
  8976. case "INPUT": {
  8977. return !(element.type === "hidden" || element.type === "file");
  8978. }
  8979. case "BUTTON":
  8980. case "SELECT":
  8981. case "TEXTAREA": {
  8982. return true;
  8983. }
  8984. default: {
  8985. return false;
  8986. }
  8987. }
  8988. };
  8989. const triggerEvent = function(elm, name, ...opts) {
  8990. let eventName;
  8991. if (name.includes("mouse") || name.includes("click")) {
  8992. eventName = "MouseEvents";
  8993. } else if (name.includes("key")) {
  8994. eventName = "KeyboardEvent";
  8995. } else {
  8996. eventName = "HTMLEvents";
  8997. }
  8998. const evt = document.createEvent(eventName);
  8999. evt.initEvent(name, ...opts);
  9000. elm.dispatchEvent(evt);
  9001. return elm;
  9002. };
  9003. const isLeaf = (el) => !el.getAttribute("aria-owns");
  9004. const getSibling = (el, distance, elClass) => {
  9005. const { parentNode } = el;
  9006. if (!parentNode)
  9007. return null;
  9008. const siblings = parentNode.querySelectorAll(elClass);
  9009. const index2 = Array.prototype.indexOf.call(siblings, el);
  9010. return siblings[index2 + distance] || null;
  9011. };
  9012. const focusNode = (el) => {
  9013. if (!el)
  9014. return;
  9015. el.focus();
  9016. !isLeaf(el) && el.click();
  9017. };
  9018. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  9019. const handleEvent = (event) => {
  9020. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  9021. if (checkForDefaultPrevented === false || !shouldPrevent) {
  9022. return oursHandler == null ? void 0 : oursHandler(event);
  9023. }
  9024. };
  9025. return handleEvent;
  9026. };
  9027. const whenMouse = (handler) => {
  9028. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  9029. };
  9030. var __defProp$9 = Object.defineProperty;
  9031. var __defProps$6 = Object.defineProperties;
  9032. var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
  9033. var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
  9034. var __hasOwnProp$b = Object.prototype.hasOwnProperty;
  9035. var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
  9036. var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  9037. var __spreadValues$9 = (a2, b2) => {
  9038. for (var prop in b2 || (b2 = {}))
  9039. if (__hasOwnProp$b.call(b2, prop))
  9040. __defNormalProp$9(a2, prop, b2[prop]);
  9041. if (__getOwnPropSymbols$b)
  9042. for (var prop of __getOwnPropSymbols$b(b2)) {
  9043. if (__propIsEnum$b.call(b2, prop))
  9044. __defNormalProp$9(a2, prop, b2[prop]);
  9045. }
  9046. return a2;
  9047. };
  9048. var __spreadProps$6 = (a2, b2) => __defProps$6(a2, __getOwnPropDescs$6(b2));
  9049. function computedEager(fn2, options) {
  9050. var _a2;
  9051. const result = shallowRef();
  9052. watchEffect(() => {
  9053. result.value = fn2();
  9054. }, __spreadProps$6(__spreadValues$9({}, options), {
  9055. flush: (_a2 = options == null ? void 0 : options.flush) != null ? _a2 : "sync"
  9056. }));
  9057. return readonly(result);
  9058. }
  9059. var _a;
  9060. const isClient = typeof window !== "undefined";
  9061. const isDef = (val) => typeof val !== "undefined";
  9062. const isFunction$1 = (val) => typeof val === "function";
  9063. const isString = (val) => typeof val === "string";
  9064. const noop$1 = () => {
  9065. };
  9066. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  9067. function resolveUnref(r) {
  9068. return typeof r === "function" ? r() : unref(r);
  9069. }
  9070. function createFilterWrapper(filter, fn2) {
  9071. function wrapper(...args) {
  9072. return new Promise((resolve2, reject) => {
  9073. Promise.resolve(filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args })).then(resolve2).catch(reject);
  9074. });
  9075. }
  9076. return wrapper;
  9077. }
  9078. function debounceFilter(ms, options = {}) {
  9079. let timer;
  9080. let maxTimer;
  9081. let lastRejector = noop$1;
  9082. const _clearTimeout = (timer2) => {
  9083. clearTimeout(timer2);
  9084. lastRejector();
  9085. lastRejector = noop$1;
  9086. };
  9087. const filter = (invoke) => {
  9088. const duration = resolveUnref(ms);
  9089. const maxDuration = resolveUnref(options.maxWait);
  9090. if (timer)
  9091. _clearTimeout(timer);
  9092. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  9093. if (maxTimer) {
  9094. _clearTimeout(maxTimer);
  9095. maxTimer = null;
  9096. }
  9097. return Promise.resolve(invoke());
  9098. }
  9099. return new Promise((resolve2, reject) => {
  9100. lastRejector = options.rejectOnCancel ? reject : resolve2;
  9101. if (maxDuration && !maxTimer) {
  9102. maxTimer = setTimeout(() => {
  9103. if (timer)
  9104. _clearTimeout(timer);
  9105. maxTimer = null;
  9106. resolve2(invoke());
  9107. }, maxDuration);
  9108. }
  9109. timer = setTimeout(() => {
  9110. if (maxTimer)
  9111. _clearTimeout(maxTimer);
  9112. maxTimer = null;
  9113. resolve2(invoke());
  9114. }, duration);
  9115. });
  9116. };
  9117. return filter;
  9118. }
  9119. function throttleFilter(ms, trailing = true, leading = true, rejectOnCancel = false) {
  9120. let lastExec = 0;
  9121. let timer;
  9122. let isLeading = true;
  9123. let lastRejector = noop$1;
  9124. let lastValue;
  9125. const clear2 = () => {
  9126. if (timer) {
  9127. clearTimeout(timer);
  9128. timer = void 0;
  9129. lastRejector();
  9130. lastRejector = noop$1;
  9131. }
  9132. };
  9133. const filter = (_invoke) => {
  9134. const duration = resolveUnref(ms);
  9135. const elapsed = Date.now() - lastExec;
  9136. const invoke = () => {
  9137. return lastValue = _invoke();
  9138. };
  9139. clear2();
  9140. if (duration <= 0) {
  9141. lastExec = Date.now();
  9142. return invoke();
  9143. }
  9144. if (elapsed > duration && (leading || !isLeading)) {
  9145. lastExec = Date.now();
  9146. invoke();
  9147. } else if (trailing) {
  9148. lastValue = new Promise((resolve2, reject) => {
  9149. lastRejector = rejectOnCancel ? reject : resolve2;
  9150. timer = setTimeout(() => {
  9151. lastExec = Date.now();
  9152. isLeading = true;
  9153. resolve2(invoke());
  9154. clear2();
  9155. }, Math.max(0, duration - elapsed));
  9156. });
  9157. }
  9158. if (!leading && !timer)
  9159. timer = setTimeout(() => isLeading = true, duration);
  9160. isLeading = false;
  9161. return lastValue;
  9162. };
  9163. return filter;
  9164. }
  9165. function identity$1(arg) {
  9166. return arg;
  9167. }
  9168. function tryOnScopeDispose(fn2) {
  9169. if (getCurrentScope()) {
  9170. onScopeDispose(fn2);
  9171. return true;
  9172. }
  9173. return false;
  9174. }
  9175. function useDebounceFn(fn2, ms = 200, options = {}) {
  9176. return createFilterWrapper(debounceFilter(ms, options), fn2);
  9177. }
  9178. function refDebounced(value, ms = 200, options = {}) {
  9179. const debounced = ref(value.value);
  9180. const updater = useDebounceFn(() => {
  9181. debounced.value = value.value;
  9182. }, ms, options);
  9183. watch(value, () => updater());
  9184. return debounced;
  9185. }
  9186. function useThrottleFn(fn2, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
  9187. return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn2);
  9188. }
  9189. function tryOnMounted(fn2, sync = true) {
  9190. if (getCurrentInstance())
  9191. onMounted(fn2);
  9192. else if (sync)
  9193. fn2();
  9194. else
  9195. nextTick(fn2);
  9196. }
  9197. function useTimeoutFn(cb, interval, options = {}) {
  9198. const {
  9199. immediate = true
  9200. } = options;
  9201. const isPending = ref(false);
  9202. let timer = null;
  9203. function clear2() {
  9204. if (timer) {
  9205. clearTimeout(timer);
  9206. timer = null;
  9207. }
  9208. }
  9209. function stop() {
  9210. isPending.value = false;
  9211. clear2();
  9212. }
  9213. function start(...args) {
  9214. clear2();
  9215. isPending.value = true;
  9216. timer = setTimeout(() => {
  9217. isPending.value = false;
  9218. timer = null;
  9219. cb(...args);
  9220. }, resolveUnref(interval));
  9221. }
  9222. if (immediate) {
  9223. isPending.value = true;
  9224. if (isClient)
  9225. start();
  9226. }
  9227. tryOnScopeDispose(stop);
  9228. return {
  9229. isPending: readonly(isPending),
  9230. start,
  9231. stop
  9232. };
  9233. }
  9234. function unrefElement(elRef) {
  9235. var _a2;
  9236. const plain = resolveUnref(elRef);
  9237. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  9238. }
  9239. const defaultWindow = isClient ? window : void 0;
  9240. const defaultDocument = isClient ? window.document : void 0;
  9241. function useEventListener(...args) {
  9242. let target;
  9243. let events;
  9244. let listeners;
  9245. let options;
  9246. if (isString(args[0]) || Array.isArray(args[0])) {
  9247. [events, listeners, options] = args;
  9248. target = defaultWindow;
  9249. } else {
  9250. [target, events, listeners, options] = args;
  9251. }
  9252. if (!target)
  9253. return noop$1;
  9254. if (!Array.isArray(events))
  9255. events = [events];
  9256. if (!Array.isArray(listeners))
  9257. listeners = [listeners];
  9258. const cleanups = [];
  9259. const cleanup = () => {
  9260. cleanups.forEach((fn2) => fn2());
  9261. cleanups.length = 0;
  9262. };
  9263. const register = (el, event, listener, options2) => {
  9264. el.addEventListener(event, listener, options2);
  9265. return () => el.removeEventListener(event, listener, options2);
  9266. };
  9267. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
  9268. cleanup();
  9269. if (!el)
  9270. return;
  9271. cleanups.push(...events.flatMap((event) => {
  9272. return listeners.map((listener) => register(el, event, listener, options2));
  9273. }));
  9274. }, { immediate: true, flush: "post" });
  9275. const stop = () => {
  9276. stopWatch();
  9277. cleanup();
  9278. };
  9279. tryOnScopeDispose(stop);
  9280. return stop;
  9281. }
  9282. let _iOSWorkaround = false;
  9283. function onClickOutside(target, handler, options = {}) {
  9284. const { window: window2 = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
  9285. if (!window2)
  9286. return;
  9287. if (isIOS && !_iOSWorkaround) {
  9288. _iOSWorkaround = true;
  9289. Array.from(window2.document.body.children).forEach((el) => el.addEventListener("click", noop$1));
  9290. }
  9291. let shouldListen = true;
  9292. const shouldIgnore = (event) => {
  9293. return ignore.some((target2) => {
  9294. if (typeof target2 === "string") {
  9295. return Array.from(window2.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
  9296. } else {
  9297. const el = unrefElement(target2);
  9298. return el && (event.target === el || event.composedPath().includes(el));
  9299. }
  9300. });
  9301. };
  9302. const listener = (event) => {
  9303. const el = unrefElement(target);
  9304. if (!el || el === event.target || event.composedPath().includes(el))
  9305. return;
  9306. if (event.detail === 0)
  9307. shouldListen = !shouldIgnore(event);
  9308. if (!shouldListen) {
  9309. shouldListen = true;
  9310. return;
  9311. }
  9312. handler(event);
  9313. };
  9314. const cleanup = [
  9315. useEventListener(window2, "click", listener, { passive: true, capture }),
  9316. useEventListener(window2, "pointerdown", (e) => {
  9317. const el = unrefElement(target);
  9318. if (el)
  9319. shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
  9320. }, { passive: true }),
  9321. detectIframe && useEventListener(window2, "blur", (event) => {
  9322. var _a2;
  9323. const el = unrefElement(target);
  9324. if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window2.document.activeElement)))
  9325. handler(event);
  9326. })
  9327. ].filter(Boolean);
  9328. const stop = () => cleanup.forEach((fn2) => fn2());
  9329. return stop;
  9330. }
  9331. function useSupported(callback, sync = false) {
  9332. const isSupported = ref();
  9333. const update = () => isSupported.value = Boolean(callback());
  9334. update();
  9335. tryOnMounted(update, sync);
  9336. return isSupported;
  9337. }
  9338. function cloneFnJSON(source) {
  9339. return JSON.parse(JSON.stringify(source));
  9340. }
  9341. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  9342. const globalKey = "__vueuse_ssr_handlers__";
  9343. _global[globalKey] = _global[globalKey] || {};
  9344. function useCssVar(prop, target, { window: window2 = defaultWindow, initialValue = "" } = {}) {
  9345. const variable = ref(initialValue);
  9346. const elRef = computed(() => {
  9347. var _a2;
  9348. return unrefElement(target) || ((_a2 = window2 == null ? void 0 : window2.document) == null ? void 0 : _a2.documentElement);
  9349. });
  9350. watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  9351. var _a2;
  9352. if (el && window2) {
  9353. const value = (_a2 = window2.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a2.trim();
  9354. variable.value = value || initialValue;
  9355. }
  9356. }, { immediate: true });
  9357. watch(variable, (val) => {
  9358. var _a2;
  9359. if ((_a2 = elRef.value) == null ? void 0 : _a2.style)
  9360. elRef.value.style.setProperty(resolveUnref(prop), val);
  9361. });
  9362. return variable;
  9363. }
  9364. function useDocumentVisibility({ document: document2 = defaultDocument } = {}) {
  9365. if (!document2)
  9366. return ref("visible");
  9367. const visibility = ref(document2.visibilityState);
  9368. useEventListener(document2, "visibilitychange", () => {
  9369. visibility.value = document2.visibilityState;
  9370. });
  9371. return visibility;
  9372. }
  9373. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  9374. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  9375. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  9376. var __objRest$2 = (source, exclude) => {
  9377. var target = {};
  9378. for (var prop in source)
  9379. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  9380. target[prop] = source[prop];
  9381. if (source != null && __getOwnPropSymbols$g)
  9382. for (var prop of __getOwnPropSymbols$g(source)) {
  9383. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  9384. target[prop] = source[prop];
  9385. }
  9386. return target;
  9387. };
  9388. function useResizeObserver(target, callback, options = {}) {
  9389. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  9390. let observer;
  9391. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  9392. const cleanup = () => {
  9393. if (observer) {
  9394. observer.disconnect();
  9395. observer = void 0;
  9396. }
  9397. };
  9398. const stopWatch = watch(() => unrefElement(target), (el) => {
  9399. cleanup();
  9400. if (isSupported.value && window2 && el) {
  9401. observer = new ResizeObserver(callback);
  9402. observer.observe(el, observerOptions);
  9403. }
  9404. }, { immediate: true, flush: "post" });
  9405. const stop = () => {
  9406. cleanup();
  9407. stopWatch();
  9408. };
  9409. tryOnScopeDispose(stop);
  9410. return {
  9411. isSupported,
  9412. stop
  9413. };
  9414. }
  9415. function useElementBounding(target, options = {}) {
  9416. const {
  9417. reset = true,
  9418. windowResize = true,
  9419. windowScroll = true,
  9420. immediate = true
  9421. } = options;
  9422. const height = ref(0);
  9423. const bottom = ref(0);
  9424. const left2 = ref(0);
  9425. const right2 = ref(0);
  9426. const top = ref(0);
  9427. const width = ref(0);
  9428. const x2 = ref(0);
  9429. const y = ref(0);
  9430. function update() {
  9431. const el = unrefElement(target);
  9432. if (!el) {
  9433. if (reset) {
  9434. height.value = 0;
  9435. bottom.value = 0;
  9436. left2.value = 0;
  9437. right2.value = 0;
  9438. top.value = 0;
  9439. width.value = 0;
  9440. x2.value = 0;
  9441. y.value = 0;
  9442. }
  9443. return;
  9444. }
  9445. const rect = el.getBoundingClientRect();
  9446. height.value = rect.height;
  9447. bottom.value = rect.bottom;
  9448. left2.value = rect.left;
  9449. right2.value = rect.right;
  9450. top.value = rect.top;
  9451. width.value = rect.width;
  9452. x2.value = rect.x;
  9453. y.value = rect.y;
  9454. }
  9455. useResizeObserver(target, update);
  9456. watch(() => unrefElement(target), (ele) => !ele && update());
  9457. if (windowScroll)
  9458. useEventListener("scroll", update, { capture: true, passive: true });
  9459. if (windowResize)
  9460. useEventListener("resize", update, { passive: true });
  9461. tryOnMounted(() => {
  9462. if (immediate)
  9463. update();
  9464. });
  9465. return {
  9466. height,
  9467. bottom,
  9468. left: left2,
  9469. right: right2,
  9470. top,
  9471. width,
  9472. x: x2,
  9473. y,
  9474. update
  9475. };
  9476. }
  9477. var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
  9478. var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
  9479. var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
  9480. var __objRest$1 = (source, exclude) => {
  9481. var target = {};
  9482. for (var prop in source)
  9483. if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
  9484. target[prop] = source[prop];
  9485. if (source != null && __getOwnPropSymbols$8)
  9486. for (var prop of __getOwnPropSymbols$8(source)) {
  9487. if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
  9488. target[prop] = source[prop];
  9489. }
  9490. return target;
  9491. };
  9492. function useMutationObserver(target, callback, options = {}) {
  9493. const _a2 = options, { window: window2 = defaultWindow } = _a2, mutationOptions = __objRest$1(_a2, ["window"]);
  9494. let observer;
  9495. const isSupported = useSupported(() => window2 && "MutationObserver" in window2);
  9496. const cleanup = () => {
  9497. if (observer) {
  9498. observer.disconnect();
  9499. observer = void 0;
  9500. }
  9501. };
  9502. const stopWatch = watch(() => unrefElement(target), (el) => {
  9503. cleanup();
  9504. if (isSupported.value && window2 && el) {
  9505. observer = new MutationObserver(callback);
  9506. observer.observe(el, mutationOptions);
  9507. }
  9508. }, { immediate: true });
  9509. const stop = () => {
  9510. cleanup();
  9511. stopWatch();
  9512. };
  9513. tryOnScopeDispose(stop);
  9514. return {
  9515. isSupported,
  9516. stop
  9517. };
  9518. }
  9519. var SwipeDirection;
  9520. (function(SwipeDirection2) {
  9521. SwipeDirection2["UP"] = "UP";
  9522. SwipeDirection2["RIGHT"] = "RIGHT";
  9523. SwipeDirection2["DOWN"] = "DOWN";
  9524. SwipeDirection2["LEFT"] = "LEFT";
  9525. SwipeDirection2["NONE"] = "NONE";
  9526. })(SwipeDirection || (SwipeDirection = {}));
  9527. var __defProp = Object.defineProperty;
  9528. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  9529. var __hasOwnProp = Object.prototype.hasOwnProperty;
  9530. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  9531. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  9532. var __spreadValues = (a2, b2) => {
  9533. for (var prop in b2 || (b2 = {}))
  9534. if (__hasOwnProp.call(b2, prop))
  9535. __defNormalProp(a2, prop, b2[prop]);
  9536. if (__getOwnPropSymbols)
  9537. for (var prop of __getOwnPropSymbols(b2)) {
  9538. if (__propIsEnum.call(b2, prop))
  9539. __defNormalProp(a2, prop, b2[prop]);
  9540. }
  9541. return a2;
  9542. };
  9543. const _TransitionPresets = {
  9544. easeInSine: [0.12, 0, 0.39, 0],
  9545. easeOutSine: [0.61, 1, 0.88, 1],
  9546. easeInOutSine: [0.37, 0, 0.63, 1],
  9547. easeInQuad: [0.11, 0, 0.5, 0],
  9548. easeOutQuad: [0.5, 1, 0.89, 1],
  9549. easeInOutQuad: [0.45, 0, 0.55, 1],
  9550. easeInCubic: [0.32, 0, 0.67, 0],
  9551. easeOutCubic: [0.33, 1, 0.68, 1],
  9552. easeInOutCubic: [0.65, 0, 0.35, 1],
  9553. easeInQuart: [0.5, 0, 0.75, 0],
  9554. easeOutQuart: [0.25, 1, 0.5, 1],
  9555. easeInOutQuart: [0.76, 0, 0.24, 1],
  9556. easeInQuint: [0.64, 0, 0.78, 0],
  9557. easeOutQuint: [0.22, 1, 0.36, 1],
  9558. easeInOutQuint: [0.83, 0, 0.17, 1],
  9559. easeInExpo: [0.7, 0, 0.84, 0],
  9560. easeOutExpo: [0.16, 1, 0.3, 1],
  9561. easeInOutExpo: [0.87, 0, 0.13, 1],
  9562. easeInCirc: [0.55, 0, 1, 0.45],
  9563. easeOutCirc: [0, 0.55, 0.45, 1],
  9564. easeInOutCirc: [0.85, 0, 0.15, 1],
  9565. easeInBack: [0.36, 0, 0.66, -0.56],
  9566. easeOutBack: [0.34, 1.56, 0.64, 1],
  9567. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  9568. };
  9569. __spreadValues({
  9570. linear: identity$1
  9571. }, _TransitionPresets);
  9572. function useVModel(props, key, emit2, options = {}) {
  9573. var _a2, _b, _c;
  9574. const {
  9575. clone: clone2 = false,
  9576. passive = false,
  9577. eventName,
  9578. deep = false,
  9579. defaultValue
  9580. } = options;
  9581. const vm = getCurrentInstance();
  9582. const _emit = emit2 || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy));
  9583. let event = eventName;
  9584. if (!key) {
  9585. {
  9586. key = "modelValue";
  9587. }
  9588. }
  9589. event = eventName || event || `update:${key.toString()}`;
  9590. const cloneFn = (val) => !clone2 ? val : isFunction$1(clone2) ? clone2(val) : cloneFnJSON(val);
  9591. const getValue2 = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;
  9592. if (passive) {
  9593. const initialValue = getValue2();
  9594. const proxy = ref(initialValue);
  9595. watch(() => props[key], (v2) => proxy.value = cloneFn(v2));
  9596. watch(proxy, (v2) => {
  9597. if (v2 !== props[key] || deep)
  9598. _emit(event, v2);
  9599. }, { deep });
  9600. return proxy;
  9601. } else {
  9602. return computed({
  9603. get() {
  9604. return getValue2();
  9605. },
  9606. set(value) {
  9607. _emit(event, value);
  9608. }
  9609. });
  9610. }
  9611. }
  9612. function useWindowFocus({ window: window2 = defaultWindow } = {}) {
  9613. if (!window2)
  9614. return ref(false);
  9615. const focused = ref(window2.document.hasFocus());
  9616. useEventListener(window2, "blur", () => {
  9617. focused.value = false;
  9618. });
  9619. useEventListener(window2, "focus", () => {
  9620. focused.value = true;
  9621. });
  9622. return focused;
  9623. }
  9624. function useWindowSize(options = {}) {
  9625. const {
  9626. window: window2 = defaultWindow,
  9627. initialWidth = Infinity,
  9628. initialHeight = Infinity,
  9629. listenOrientation = true,
  9630. includeScrollbar = true
  9631. } = options;
  9632. const width = ref(initialWidth);
  9633. const height = ref(initialHeight);
  9634. const update = () => {
  9635. if (window2) {
  9636. if (includeScrollbar) {
  9637. width.value = window2.innerWidth;
  9638. height.value = window2.innerHeight;
  9639. } else {
  9640. width.value = window2.document.documentElement.clientWidth;
  9641. height.value = window2.document.documentElement.clientHeight;
  9642. }
  9643. }
  9644. };
  9645. update();
  9646. tryOnMounted(update);
  9647. useEventListener("resize", update, { passive: true });
  9648. if (listenOrientation)
  9649. useEventListener("orientationchange", update, { passive: true });
  9650. return { width, height };
  9651. }
  9652. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  9653. const isInContainer = (el, container) => {
  9654. if (!isClient || !el || !container)
  9655. return false;
  9656. const elRect = el.getBoundingClientRect();
  9657. let containerRect;
  9658. if (container instanceof Element) {
  9659. containerRect = container.getBoundingClientRect();
  9660. } else {
  9661. containerRect = {
  9662. top: 0,
  9663. right: window.innerWidth,
  9664. bottom: window.innerHeight,
  9665. left: 0
  9666. };
  9667. }
  9668. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  9669. };
  9670. const getOffsetTop = (el) => {
  9671. let offset2 = 0;
  9672. let parent = el;
  9673. while (parent) {
  9674. offset2 += parent.offsetTop;
  9675. parent = parent.offsetParent;
  9676. }
  9677. return offset2;
  9678. };
  9679. const getOffsetTopDistance = (el, containerEl) => {
  9680. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  9681. };
  9682. const getClientXY = (event) => {
  9683. let clientX;
  9684. let clientY;
  9685. if (event.type === "touchend") {
  9686. clientY = event.changedTouches[0].clientY;
  9687. clientX = event.changedTouches[0].clientX;
  9688. } else if (event.type.startsWith("touch")) {
  9689. clientY = event.touches[0].clientY;
  9690. clientX = event.touches[0].clientX;
  9691. } else {
  9692. clientY = event.clientY;
  9693. clientX = event.clientX;
  9694. }
  9695. return {
  9696. clientX,
  9697. clientY
  9698. };
  9699. };
  9700. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  9701. const freeGlobal$1 = freeGlobal;
  9702. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  9703. var root = freeGlobal$1 || freeSelf || Function("return this")();
  9704. const root$1 = root;
  9705. var Symbol$1 = root$1.Symbol;
  9706. const Symbol$2 = Symbol$1;
  9707. var objectProto$f = Object.prototype;
  9708. var hasOwnProperty$c = objectProto$f.hasOwnProperty;
  9709. var nativeObjectToString$1 = objectProto$f.toString;
  9710. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  9711. function getRawTag(value) {
  9712. var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  9713. try {
  9714. value[symToStringTag$1] = void 0;
  9715. var unmasked = true;
  9716. } catch (e) {
  9717. }
  9718. var result = nativeObjectToString$1.call(value);
  9719. if (unmasked) {
  9720. if (isOwn) {
  9721. value[symToStringTag$1] = tag;
  9722. } else {
  9723. delete value[symToStringTag$1];
  9724. }
  9725. }
  9726. return result;
  9727. }
  9728. var objectProto$e = Object.prototype;
  9729. var nativeObjectToString = objectProto$e.toString;
  9730. function objectToString(value) {
  9731. return nativeObjectToString.call(value);
  9732. }
  9733. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  9734. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  9735. function baseGetTag(value) {
  9736. if (value == null) {
  9737. return value === void 0 ? undefinedTag : nullTag;
  9738. }
  9739. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  9740. }
  9741. function isObjectLike(value) {
  9742. return value != null && typeof value == "object";
  9743. }
  9744. var symbolTag$3 = "[object Symbol]";
  9745. function isSymbol(value) {
  9746. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  9747. }
  9748. function arrayMap(array2, iteratee) {
  9749. var index2 = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
  9750. while (++index2 < length) {
  9751. result[index2] = iteratee(array2[index2], index2, array2);
  9752. }
  9753. return result;
  9754. }
  9755. var isArray = Array.isArray;
  9756. const isArray$1 = isArray;
  9757. var INFINITY$4 = 1 / 0;
  9758. var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  9759. function baseToString(value) {
  9760. if (typeof value == "string") {
  9761. return value;
  9762. }
  9763. if (isArray$1(value)) {
  9764. return arrayMap(value, baseToString) + "";
  9765. }
  9766. if (isSymbol(value)) {
  9767. return symbolToString ? symbolToString.call(value) : "";
  9768. }
  9769. var result = value + "";
  9770. return result == "0" && 1 / value == -INFINITY$4 ? "-0" : result;
  9771. }
  9772. var reWhitespace = /\s/;
  9773. function trimmedEndIndex(string2) {
  9774. var index2 = string2.length;
  9775. while (index2-- && reWhitespace.test(string2.charAt(index2))) {
  9776. }
  9777. return index2;
  9778. }
  9779. var reTrimStart = /^\s+/;
  9780. function baseTrim(string2) {
  9781. return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
  9782. }
  9783. function isObject(value) {
  9784. var type2 = typeof value;
  9785. return value != null && (type2 == "object" || type2 == "function");
  9786. }
  9787. var NAN = 0 / 0;
  9788. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  9789. var reIsBinary = /^0b[01]+$/i;
  9790. var reIsOctal = /^0o[0-7]+$/i;
  9791. var freeParseInt = parseInt;
  9792. function toNumber(value) {
  9793. if (typeof value == "number") {
  9794. return value;
  9795. }
  9796. if (isSymbol(value)) {
  9797. return NAN;
  9798. }
  9799. if (isObject(value)) {
  9800. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  9801. value = isObject(other) ? other + "" : other;
  9802. }
  9803. if (typeof value != "string") {
  9804. return value === 0 ? value : +value;
  9805. }
  9806. value = baseTrim(value);
  9807. var isBinary = reIsBinary.test(value);
  9808. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  9809. }
  9810. var INFINITY$3 = 1 / 0, MAX_INTEGER = 17976931348623157e292;
  9811. function toFinite(value) {
  9812. if (!value) {
  9813. return value === 0 ? value : 0;
  9814. }
  9815. value = toNumber(value);
  9816. if (value === INFINITY$3 || value === -INFINITY$3) {
  9817. var sign = value < 0 ? -1 : 1;
  9818. return sign * MAX_INTEGER;
  9819. }
  9820. return value === value ? value : 0;
  9821. }
  9822. function toInteger(value) {
  9823. var result = toFinite(value), remainder = result % 1;
  9824. return result === result ? remainder ? result - remainder : result : 0;
  9825. }
  9826. function identity(value) {
  9827. return value;
  9828. }
  9829. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  9830. function isFunction(value) {
  9831. if (!isObject(value)) {
  9832. return false;
  9833. }
  9834. var tag = baseGetTag(value);
  9835. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  9836. }
  9837. var coreJsData = root$1["__core-js_shared__"];
  9838. const coreJsData$1 = coreJsData;
  9839. var maskSrcKey = function() {
  9840. var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  9841. return uid2 ? "Symbol(src)_1." + uid2 : "";
  9842. }();
  9843. function isMasked(func) {
  9844. return !!maskSrcKey && maskSrcKey in func;
  9845. }
  9846. var funcProto$2 = Function.prototype;
  9847. var funcToString$2 = funcProto$2.toString;
  9848. function toSource(func) {
  9849. if (func != null) {
  9850. try {
  9851. return funcToString$2.call(func);
  9852. } catch (e) {
  9853. }
  9854. try {
  9855. return func + "";
  9856. } catch (e) {
  9857. }
  9858. }
  9859. return "";
  9860. }
  9861. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  9862. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  9863. var funcProto$1 = Function.prototype, objectProto$d = Object.prototype;
  9864. var funcToString$1 = funcProto$1.toString;
  9865. var hasOwnProperty$b = objectProto$d.hasOwnProperty;
  9866. var reIsNative = RegExp(
  9867. "^" + funcToString$1.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  9868. );
  9869. function baseIsNative(value) {
  9870. if (!isObject(value) || isMasked(value)) {
  9871. return false;
  9872. }
  9873. var pattern2 = isFunction(value) ? reIsNative : reIsHostCtor;
  9874. return pattern2.test(toSource(value));
  9875. }
  9876. function getValue$1(object2, key) {
  9877. return object2 == null ? void 0 : object2[key];
  9878. }
  9879. function getNative(object2, key) {
  9880. var value = getValue$1(object2, key);
  9881. return baseIsNative(value) ? value : void 0;
  9882. }
  9883. var WeakMap$1 = getNative(root$1, "WeakMap");
  9884. const WeakMap$2 = WeakMap$1;
  9885. var objectCreate = Object.create;
  9886. var baseCreate = function() {
  9887. function object2() {
  9888. }
  9889. return function(proto) {
  9890. if (!isObject(proto)) {
  9891. return {};
  9892. }
  9893. if (objectCreate) {
  9894. return objectCreate(proto);
  9895. }
  9896. object2.prototype = proto;
  9897. var result = new object2();
  9898. object2.prototype = void 0;
  9899. return result;
  9900. };
  9901. }();
  9902. const baseCreate$1 = baseCreate;
  9903. function apply(func, thisArg, args) {
  9904. switch (args.length) {
  9905. case 0:
  9906. return func.call(thisArg);
  9907. case 1:
  9908. return func.call(thisArg, args[0]);
  9909. case 2:
  9910. return func.call(thisArg, args[0], args[1]);
  9911. case 3:
  9912. return func.call(thisArg, args[0], args[1], args[2]);
  9913. }
  9914. return func.apply(thisArg, args);
  9915. }
  9916. function noop() {
  9917. }
  9918. function copyArray(source, array2) {
  9919. var index2 = -1, length = source.length;
  9920. array2 || (array2 = Array(length));
  9921. while (++index2 < length) {
  9922. array2[index2] = source[index2];
  9923. }
  9924. return array2;
  9925. }
  9926. var HOT_COUNT = 800, HOT_SPAN = 16;
  9927. var nativeNow = Date.now;
  9928. function shortOut(func) {
  9929. var count = 0, lastCalled = 0;
  9930. return function() {
  9931. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  9932. lastCalled = stamp;
  9933. if (remaining > 0) {
  9934. if (++count >= HOT_COUNT) {
  9935. return arguments[0];
  9936. }
  9937. } else {
  9938. count = 0;
  9939. }
  9940. return func.apply(void 0, arguments);
  9941. };
  9942. }
  9943. function constant(value) {
  9944. return function() {
  9945. return value;
  9946. };
  9947. }
  9948. var defineProperty = function() {
  9949. try {
  9950. var func = getNative(Object, "defineProperty");
  9951. func({}, "", {});
  9952. return func;
  9953. } catch (e) {
  9954. }
  9955. }();
  9956. const defineProperty$1 = defineProperty;
  9957. var baseSetToString = !defineProperty$1 ? identity : function(func, string2) {
  9958. return defineProperty$1(func, "toString", {
  9959. "configurable": true,
  9960. "enumerable": false,
  9961. "value": constant(string2),
  9962. "writable": true
  9963. });
  9964. };
  9965. const baseSetToString$1 = baseSetToString;
  9966. var setToString = shortOut(baseSetToString$1);
  9967. const setToString$1 = setToString;
  9968. function arrayEach(array2, iteratee) {
  9969. var index2 = -1, length = array2 == null ? 0 : array2.length;
  9970. while (++index2 < length) {
  9971. if (iteratee(array2[index2], index2, array2) === false) {
  9972. break;
  9973. }
  9974. }
  9975. return array2;
  9976. }
  9977. function baseFindIndex(array2, predicate, fromIndex, fromRight) {
  9978. var length = array2.length, index2 = fromIndex + (fromRight ? 1 : -1);
  9979. while (fromRight ? index2-- : ++index2 < length) {
  9980. if (predicate(array2[index2], index2, array2)) {
  9981. return index2;
  9982. }
  9983. }
  9984. return -1;
  9985. }
  9986. function baseIsNaN(value) {
  9987. return value !== value;
  9988. }
  9989. function strictIndexOf(array2, value, fromIndex) {
  9990. var index2 = fromIndex - 1, length = array2.length;
  9991. while (++index2 < length) {
  9992. if (array2[index2] === value) {
  9993. return index2;
  9994. }
  9995. }
  9996. return -1;
  9997. }
  9998. function baseIndexOf(array2, value, fromIndex) {
  9999. return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
  10000. }
  10001. function arrayIncludes(array2, value) {
  10002. var length = array2 == null ? 0 : array2.length;
  10003. return !!length && baseIndexOf(array2, value, 0) > -1;
  10004. }
  10005. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  10006. var reIsUint = /^(?:0|[1-9]\d*)$/;
  10007. function isIndex(value, length) {
  10008. var type2 = typeof value;
  10009. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  10010. return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  10011. }
  10012. function baseAssignValue(object2, key, value) {
  10013. if (key == "__proto__" && defineProperty$1) {
  10014. defineProperty$1(object2, key, {
  10015. "configurable": true,
  10016. "enumerable": true,
  10017. "value": value,
  10018. "writable": true
  10019. });
  10020. } else {
  10021. object2[key] = value;
  10022. }
  10023. }
  10024. function eq(value, other) {
  10025. return value === other || value !== value && other !== other;
  10026. }
  10027. var objectProto$c = Object.prototype;
  10028. var hasOwnProperty$a = objectProto$c.hasOwnProperty;
  10029. function assignValue(object2, key, value) {
  10030. var objValue = object2[key];
  10031. if (!(hasOwnProperty$a.call(object2, key) && eq(objValue, value)) || value === void 0 && !(key in object2)) {
  10032. baseAssignValue(object2, key, value);
  10033. }
  10034. }
  10035. function copyObject(source, props, object2, customizer) {
  10036. var isNew = !object2;
  10037. object2 || (object2 = {});
  10038. var index2 = -1, length = props.length;
  10039. while (++index2 < length) {
  10040. var key = props[index2];
  10041. var newValue = customizer ? customizer(object2[key], source[key], key, object2, source) : void 0;
  10042. if (newValue === void 0) {
  10043. newValue = source[key];
  10044. }
  10045. if (isNew) {
  10046. baseAssignValue(object2, key, newValue);
  10047. } else {
  10048. assignValue(object2, key, newValue);
  10049. }
  10050. }
  10051. return object2;
  10052. }
  10053. var nativeMax$2 = Math.max;
  10054. function overRest(func, start, transform) {
  10055. start = nativeMax$2(start === void 0 ? func.length - 1 : start, 0);
  10056. return function() {
  10057. var args = arguments, index2 = -1, length = nativeMax$2(args.length - start, 0), array2 = Array(length);
  10058. while (++index2 < length) {
  10059. array2[index2] = args[start + index2];
  10060. }
  10061. index2 = -1;
  10062. var otherArgs = Array(start + 1);
  10063. while (++index2 < start) {
  10064. otherArgs[index2] = args[index2];
  10065. }
  10066. otherArgs[start] = transform(array2);
  10067. return apply(func, this, otherArgs);
  10068. };
  10069. }
  10070. function baseRest(func, start) {
  10071. return setToString$1(overRest(func, start, identity), func + "");
  10072. }
  10073. var MAX_SAFE_INTEGER = 9007199254740991;
  10074. function isLength(value) {
  10075. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  10076. }
  10077. function isArrayLike(value) {
  10078. return value != null && isLength(value.length) && !isFunction(value);
  10079. }
  10080. function isIterateeCall(value, index2, object2) {
  10081. if (!isObject(object2)) {
  10082. return false;
  10083. }
  10084. var type2 = typeof index2;
  10085. if (type2 == "number" ? isArrayLike(object2) && isIndex(index2, object2.length) : type2 == "string" && index2 in object2) {
  10086. return eq(object2[index2], value);
  10087. }
  10088. return false;
  10089. }
  10090. function createAssigner(assigner) {
  10091. return baseRest(function(object2, sources) {
  10092. var index2 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  10093. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  10094. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  10095. customizer = length < 3 ? void 0 : customizer;
  10096. length = 1;
  10097. }
  10098. object2 = Object(object2);
  10099. while (++index2 < length) {
  10100. var source = sources[index2];
  10101. if (source) {
  10102. assigner(object2, source, index2, customizer);
  10103. }
  10104. }
  10105. return object2;
  10106. });
  10107. }
  10108. var objectProto$b = Object.prototype;
  10109. function isPrototype(value) {
  10110. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$b;
  10111. return value === proto;
  10112. }
  10113. function baseTimes(n, iteratee) {
  10114. var index2 = -1, result = Array(n);
  10115. while (++index2 < n) {
  10116. result[index2] = iteratee(index2);
  10117. }
  10118. return result;
  10119. }
  10120. var argsTag$3 = "[object Arguments]";
  10121. function baseIsArguments(value) {
  10122. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  10123. }
  10124. var objectProto$a = Object.prototype;
  10125. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  10126. var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;
  10127. var isArguments = baseIsArguments(function() {
  10128. return arguments;
  10129. }()) ? baseIsArguments : function(value) {
  10130. return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  10131. };
  10132. const isArguments$1 = isArguments;
  10133. function stubFalse() {
  10134. return false;
  10135. }
  10136. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  10137. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  10138. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  10139. var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
  10140. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  10141. var isBuffer = nativeIsBuffer || stubFalse;
  10142. const isBuffer$1 = isBuffer;
  10143. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  10144. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  10145. var typedArrayTags = {};
  10146. typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
  10147. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  10148. function baseIsTypedArray(value) {
  10149. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  10150. }
  10151. function baseUnary(func) {
  10152. return function(value) {
  10153. return func(value);
  10154. };
  10155. }
  10156. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  10157. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  10158. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  10159. var freeProcess = moduleExports$1 && freeGlobal$1.process;
  10160. var nodeUtil = function() {
  10161. try {
  10162. var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  10163. if (types2) {
  10164. return types2;
  10165. }
  10166. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  10167. } catch (e) {
  10168. }
  10169. }();
  10170. const nodeUtil$1 = nodeUtil;
  10171. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  10172. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  10173. const isTypedArray$1 = isTypedArray;
  10174. var objectProto$9 = Object.prototype;
  10175. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  10176. function arrayLikeKeys(value, inherited) {
  10177. var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  10178. for (var key in value) {
  10179. if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
  10180. (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
  10181. isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
  10182. isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
  10183. isIndex(key, length)))) {
  10184. result.push(key);
  10185. }
  10186. }
  10187. return result;
  10188. }
  10189. function overArg(func, transform) {
  10190. return function(arg) {
  10191. return func(transform(arg));
  10192. };
  10193. }
  10194. var nativeKeys = overArg(Object.keys, Object);
  10195. const nativeKeys$1 = nativeKeys;
  10196. var objectProto$8 = Object.prototype;
  10197. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  10198. function baseKeys(object2) {
  10199. if (!isPrototype(object2)) {
  10200. return nativeKeys$1(object2);
  10201. }
  10202. var result = [];
  10203. for (var key in Object(object2)) {
  10204. if (hasOwnProperty$7.call(object2, key) && key != "constructor") {
  10205. result.push(key);
  10206. }
  10207. }
  10208. return result;
  10209. }
  10210. function keys(object2) {
  10211. return isArrayLike(object2) ? arrayLikeKeys(object2) : baseKeys(object2);
  10212. }
  10213. function nativeKeysIn(object2) {
  10214. var result = [];
  10215. if (object2 != null) {
  10216. for (var key in Object(object2)) {
  10217. result.push(key);
  10218. }
  10219. }
  10220. return result;
  10221. }
  10222. var objectProto$7 = Object.prototype;
  10223. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  10224. function baseKeysIn(object2) {
  10225. if (!isObject(object2)) {
  10226. return nativeKeysIn(object2);
  10227. }
  10228. var isProto = isPrototype(object2), result = [];
  10229. for (var key in object2) {
  10230. if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object2, key)))) {
  10231. result.push(key);
  10232. }
  10233. }
  10234. return result;
  10235. }
  10236. function keysIn(object2) {
  10237. return isArrayLike(object2) ? arrayLikeKeys(object2, true) : baseKeysIn(object2);
  10238. }
  10239. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  10240. function isKey(value, object2) {
  10241. if (isArray$1(value)) {
  10242. return false;
  10243. }
  10244. var type2 = typeof value;
  10245. if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol(value)) {
  10246. return true;
  10247. }
  10248. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object2 != null && value in Object(object2);
  10249. }
  10250. var nativeCreate = getNative(Object, "create");
  10251. const nativeCreate$1 = nativeCreate;
  10252. function hashClear() {
  10253. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  10254. this.size = 0;
  10255. }
  10256. function hashDelete(key) {
  10257. var result = this.has(key) && delete this.__data__[key];
  10258. this.size -= result ? 1 : 0;
  10259. return result;
  10260. }
  10261. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  10262. var objectProto$6 = Object.prototype;
  10263. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  10264. function hashGet(key) {
  10265. var data = this.__data__;
  10266. if (nativeCreate$1) {
  10267. var result = data[key];
  10268. return result === HASH_UNDEFINED$2 ? void 0 : result;
  10269. }
  10270. return hasOwnProperty$5.call(data, key) ? data[key] : void 0;
  10271. }
  10272. var objectProto$5 = Object.prototype;
  10273. var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
  10274. function hashHas(key) {
  10275. var data = this.__data__;
  10276. return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$4.call(data, key);
  10277. }
  10278. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  10279. function hashSet(key, value) {
  10280. var data = this.__data__;
  10281. this.size += this.has(key) ? 0 : 1;
  10282. data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  10283. return this;
  10284. }
  10285. function Hash(entries) {
  10286. var index2 = -1, length = entries == null ? 0 : entries.length;
  10287. this.clear();
  10288. while (++index2 < length) {
  10289. var entry = entries[index2];
  10290. this.set(entry[0], entry[1]);
  10291. }
  10292. }
  10293. Hash.prototype.clear = hashClear;
  10294. Hash.prototype["delete"] = hashDelete;
  10295. Hash.prototype.get = hashGet;
  10296. Hash.prototype.has = hashHas;
  10297. Hash.prototype.set = hashSet;
  10298. function listCacheClear() {
  10299. this.__data__ = [];
  10300. this.size = 0;
  10301. }
  10302. function assocIndexOf(array2, key) {
  10303. var length = array2.length;
  10304. while (length--) {
  10305. if (eq(array2[length][0], key)) {
  10306. return length;
  10307. }
  10308. }
  10309. return -1;
  10310. }
  10311. var arrayProto = Array.prototype;
  10312. var splice = arrayProto.splice;
  10313. function listCacheDelete(key) {
  10314. var data = this.__data__, index2 = assocIndexOf(data, key);
  10315. if (index2 < 0) {
  10316. return false;
  10317. }
  10318. var lastIndex = data.length - 1;
  10319. if (index2 == lastIndex) {
  10320. data.pop();
  10321. } else {
  10322. splice.call(data, index2, 1);
  10323. }
  10324. --this.size;
  10325. return true;
  10326. }
  10327. function listCacheGet(key) {
  10328. var data = this.__data__, index2 = assocIndexOf(data, key);
  10329. return index2 < 0 ? void 0 : data[index2][1];
  10330. }
  10331. function listCacheHas(key) {
  10332. return assocIndexOf(this.__data__, key) > -1;
  10333. }
  10334. function listCacheSet(key, value) {
  10335. var data = this.__data__, index2 = assocIndexOf(data, key);
  10336. if (index2 < 0) {
  10337. ++this.size;
  10338. data.push([key, value]);
  10339. } else {
  10340. data[index2][1] = value;
  10341. }
  10342. return this;
  10343. }
  10344. function ListCache(entries) {
  10345. var index2 = -1, length = entries == null ? 0 : entries.length;
  10346. this.clear();
  10347. while (++index2 < length) {
  10348. var entry = entries[index2];
  10349. this.set(entry[0], entry[1]);
  10350. }
  10351. }
  10352. ListCache.prototype.clear = listCacheClear;
  10353. ListCache.prototype["delete"] = listCacheDelete;
  10354. ListCache.prototype.get = listCacheGet;
  10355. ListCache.prototype.has = listCacheHas;
  10356. ListCache.prototype.set = listCacheSet;
  10357. var Map$1 = getNative(root$1, "Map");
  10358. const Map$2 = Map$1;
  10359. function mapCacheClear() {
  10360. this.size = 0;
  10361. this.__data__ = {
  10362. "hash": new Hash(),
  10363. "map": new (Map$2 || ListCache)(),
  10364. "string": new Hash()
  10365. };
  10366. }
  10367. function isKeyable(value) {
  10368. var type2 = typeof value;
  10369. return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
  10370. }
  10371. function getMapData(map2, key) {
  10372. var data = map2.__data__;
  10373. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  10374. }
  10375. function mapCacheDelete(key) {
  10376. var result = getMapData(this, key)["delete"](key);
  10377. this.size -= result ? 1 : 0;
  10378. return result;
  10379. }
  10380. function mapCacheGet(key) {
  10381. return getMapData(this, key).get(key);
  10382. }
  10383. function mapCacheHas(key) {
  10384. return getMapData(this, key).has(key);
  10385. }
  10386. function mapCacheSet(key, value) {
  10387. var data = getMapData(this, key), size2 = data.size;
  10388. data.set(key, value);
  10389. this.size += data.size == size2 ? 0 : 1;
  10390. return this;
  10391. }
  10392. function MapCache(entries) {
  10393. var index2 = -1, length = entries == null ? 0 : entries.length;
  10394. this.clear();
  10395. while (++index2 < length) {
  10396. var entry = entries[index2];
  10397. this.set(entry[0], entry[1]);
  10398. }
  10399. }
  10400. MapCache.prototype.clear = mapCacheClear;
  10401. MapCache.prototype["delete"] = mapCacheDelete;
  10402. MapCache.prototype.get = mapCacheGet;
  10403. MapCache.prototype.has = mapCacheHas;
  10404. MapCache.prototype.set = mapCacheSet;
  10405. var FUNC_ERROR_TEXT$2 = "Expected a function";
  10406. function memoize(func, resolver) {
  10407. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  10408. throw new TypeError(FUNC_ERROR_TEXT$2);
  10409. }
  10410. var memoized = function() {
  10411. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache;
  10412. if (cache2.has(key)) {
  10413. return cache2.get(key);
  10414. }
  10415. var result = func.apply(this, args);
  10416. memoized.cache = cache2.set(key, result) || cache2;
  10417. return result;
  10418. };
  10419. memoized.cache = new (memoize.Cache || MapCache)();
  10420. return memoized;
  10421. }
  10422. memoize.Cache = MapCache;
  10423. var MAX_MEMOIZE_SIZE = 500;
  10424. function memoizeCapped(func) {
  10425. var result = memoize(func, function(key) {
  10426. if (cache2.size === MAX_MEMOIZE_SIZE) {
  10427. cache2.clear();
  10428. }
  10429. return key;
  10430. });
  10431. var cache2 = result.cache;
  10432. return result;
  10433. }
  10434. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  10435. var reEscapeChar = /\\(\\)?/g;
  10436. var stringToPath = memoizeCapped(function(string2) {
  10437. var result = [];
  10438. if (string2.charCodeAt(0) === 46) {
  10439. result.push("");
  10440. }
  10441. string2.replace(rePropName, function(match, number2, quote, subString) {
  10442. result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match);
  10443. });
  10444. return result;
  10445. });
  10446. const stringToPath$1 = stringToPath;
  10447. function toString(value) {
  10448. return value == null ? "" : baseToString(value);
  10449. }
  10450. function castPath(value, object2) {
  10451. if (isArray$1(value)) {
  10452. return value;
  10453. }
  10454. return isKey(value, object2) ? [value] : stringToPath$1(toString(value));
  10455. }
  10456. var INFINITY$2 = 1 / 0;
  10457. function toKey(value) {
  10458. if (typeof value == "string" || isSymbol(value)) {
  10459. return value;
  10460. }
  10461. var result = value + "";
  10462. return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
  10463. }
  10464. function baseGet(object2, path) {
  10465. path = castPath(path, object2);
  10466. var index2 = 0, length = path.length;
  10467. while (object2 != null && index2 < length) {
  10468. object2 = object2[toKey(path[index2++])];
  10469. }
  10470. return index2 && index2 == length ? object2 : void 0;
  10471. }
  10472. function get(object2, path, defaultValue) {
  10473. var result = object2 == null ? void 0 : baseGet(object2, path);
  10474. return result === void 0 ? defaultValue : result;
  10475. }
  10476. function arrayPush(array2, values) {
  10477. var index2 = -1, length = values.length, offset2 = array2.length;
  10478. while (++index2 < length) {
  10479. array2[offset2 + index2] = values[index2];
  10480. }
  10481. return array2;
  10482. }
  10483. var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
  10484. function isFlattenable(value) {
  10485. return isArray$1(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  10486. }
  10487. function baseFlatten(array2, depth, predicate, isStrict, result) {
  10488. var index2 = -1, length = array2.length;
  10489. predicate || (predicate = isFlattenable);
  10490. result || (result = []);
  10491. while (++index2 < length) {
  10492. var value = array2[index2];
  10493. if (depth > 0 && predicate(value)) {
  10494. if (depth > 1) {
  10495. baseFlatten(value, depth - 1, predicate, isStrict, result);
  10496. } else {
  10497. arrayPush(result, value);
  10498. }
  10499. } else if (!isStrict) {
  10500. result[result.length] = value;
  10501. }
  10502. }
  10503. return result;
  10504. }
  10505. function flatten(array2) {
  10506. var length = array2 == null ? 0 : array2.length;
  10507. return length ? baseFlatten(array2, 1) : [];
  10508. }
  10509. function flatRest(func) {
  10510. return setToString$1(overRest(func, void 0, flatten), func + "");
  10511. }
  10512. var getPrototype = overArg(Object.getPrototypeOf, Object);
  10513. const getPrototype$1 = getPrototype;
  10514. var objectTag$3 = "[object Object]";
  10515. var funcProto = Function.prototype, objectProto$4 = Object.prototype;
  10516. var funcToString = funcProto.toString;
  10517. var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
  10518. var objectCtorString = funcToString.call(Object);
  10519. function isPlainObject(value) {
  10520. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  10521. return false;
  10522. }
  10523. var proto = getPrototype$1(value);
  10524. if (proto === null) {
  10525. return true;
  10526. }
  10527. var Ctor = hasOwnProperty$3.call(proto, "constructor") && proto.constructor;
  10528. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  10529. }
  10530. function castArray$1() {
  10531. if (!arguments.length) {
  10532. return [];
  10533. }
  10534. var value = arguments[0];
  10535. return isArray$1(value) ? value : [value];
  10536. }
  10537. function stackClear() {
  10538. this.__data__ = new ListCache();
  10539. this.size = 0;
  10540. }
  10541. function stackDelete(key) {
  10542. var data = this.__data__, result = data["delete"](key);
  10543. this.size = data.size;
  10544. return result;
  10545. }
  10546. function stackGet(key) {
  10547. return this.__data__.get(key);
  10548. }
  10549. function stackHas(key) {
  10550. return this.__data__.has(key);
  10551. }
  10552. var LARGE_ARRAY_SIZE$1 = 200;
  10553. function stackSet(key, value) {
  10554. var data = this.__data__;
  10555. if (data instanceof ListCache) {
  10556. var pairs = data.__data__;
  10557. if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
  10558. pairs.push([key, value]);
  10559. this.size = ++data.size;
  10560. return this;
  10561. }
  10562. data = this.__data__ = new MapCache(pairs);
  10563. }
  10564. data.set(key, value);
  10565. this.size = data.size;
  10566. return this;
  10567. }
  10568. function Stack(entries) {
  10569. var data = this.__data__ = new ListCache(entries);
  10570. this.size = data.size;
  10571. }
  10572. Stack.prototype.clear = stackClear;
  10573. Stack.prototype["delete"] = stackDelete;
  10574. Stack.prototype.get = stackGet;
  10575. Stack.prototype.has = stackHas;
  10576. Stack.prototype.set = stackSet;
  10577. function baseAssign(object2, source) {
  10578. return object2 && copyObject(source, keys(source), object2);
  10579. }
  10580. function baseAssignIn(object2, source) {
  10581. return object2 && copyObject(source, keysIn(source), object2);
  10582. }
  10583. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  10584. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  10585. var moduleExports = freeModule && freeModule.exports === freeExports;
  10586. var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
  10587. function cloneBuffer(buffer, isDeep) {
  10588. if (isDeep) {
  10589. return buffer.slice();
  10590. }
  10591. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  10592. buffer.copy(result);
  10593. return result;
  10594. }
  10595. function arrayFilter(array2, predicate) {
  10596. var index2 = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
  10597. while (++index2 < length) {
  10598. var value = array2[index2];
  10599. if (predicate(value, index2, array2)) {
  10600. result[resIndex++] = value;
  10601. }
  10602. }
  10603. return result;
  10604. }
  10605. function stubArray() {
  10606. return [];
  10607. }
  10608. var objectProto$3 = Object.prototype;
  10609. var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
  10610. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  10611. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object2) {
  10612. if (object2 == null) {
  10613. return [];
  10614. }
  10615. object2 = Object(object2);
  10616. return arrayFilter(nativeGetSymbols$1(object2), function(symbol) {
  10617. return propertyIsEnumerable.call(object2, symbol);
  10618. });
  10619. };
  10620. const getSymbols$1 = getSymbols;
  10621. function copySymbols(source, object2) {
  10622. return copyObject(source, getSymbols$1(source), object2);
  10623. }
  10624. var nativeGetSymbols = Object.getOwnPropertySymbols;
  10625. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object2) {
  10626. var result = [];
  10627. while (object2) {
  10628. arrayPush(result, getSymbols$1(object2));
  10629. object2 = getPrototype$1(object2);
  10630. }
  10631. return result;
  10632. };
  10633. const getSymbolsIn$1 = getSymbolsIn;
  10634. function copySymbolsIn(source, object2) {
  10635. return copyObject(source, getSymbolsIn$1(source), object2);
  10636. }
  10637. function baseGetAllKeys(object2, keysFunc, symbolsFunc) {
  10638. var result = keysFunc(object2);
  10639. return isArray$1(object2) ? result : arrayPush(result, symbolsFunc(object2));
  10640. }
  10641. function getAllKeys(object2) {
  10642. return baseGetAllKeys(object2, keys, getSymbols$1);
  10643. }
  10644. function getAllKeysIn(object2) {
  10645. return baseGetAllKeys(object2, keysIn, getSymbolsIn$1);
  10646. }
  10647. var DataView = getNative(root$1, "DataView");
  10648. const DataView$1 = DataView;
  10649. var Promise$1 = getNative(root$1, "Promise");
  10650. const Promise$2 = Promise$1;
  10651. var Set$1 = getNative(root$1, "Set");
  10652. const Set$2 = Set$1;
  10653. var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
  10654. var dataViewTag$3 = "[object DataView]";
  10655. var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$2);
  10656. var getTag = baseGetTag;
  10657. if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$2 && getTag(new Map$2()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$4 || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag$1) {
  10658. getTag = function(value) {
  10659. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  10660. if (ctorString) {
  10661. switch (ctorString) {
  10662. case dataViewCtorString:
  10663. return dataViewTag$3;
  10664. case mapCtorString:
  10665. return mapTag$4;
  10666. case promiseCtorString:
  10667. return promiseTag;
  10668. case setCtorString:
  10669. return setTag$4;
  10670. case weakMapCtorString:
  10671. return weakMapTag$1;
  10672. }
  10673. }
  10674. return result;
  10675. };
  10676. }
  10677. const getTag$1 = getTag;
  10678. var objectProto$2 = Object.prototype;
  10679. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  10680. function initCloneArray(array2) {
  10681. var length = array2.length, result = new array2.constructor(length);
  10682. if (length && typeof array2[0] == "string" && hasOwnProperty$2.call(array2, "index")) {
  10683. result.index = array2.index;
  10684. result.input = array2.input;
  10685. }
  10686. return result;
  10687. }
  10688. var Uint8Array2 = root$1.Uint8Array;
  10689. const Uint8Array$1 = Uint8Array2;
  10690. function cloneArrayBuffer(arrayBuffer) {
  10691. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  10692. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  10693. return result;
  10694. }
  10695. function cloneDataView(dataView, isDeep) {
  10696. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  10697. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  10698. }
  10699. var reFlags = /\w*$/;
  10700. function cloneRegExp(regexp2) {
  10701. var result = new regexp2.constructor(regexp2.source, reFlags.exec(regexp2));
  10702. result.lastIndex = regexp2.lastIndex;
  10703. return result;
  10704. }
  10705. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  10706. function cloneSymbol(symbol) {
  10707. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  10708. }
  10709. function cloneTypedArray(typedArray, isDeep) {
  10710. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  10711. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  10712. }
  10713. var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
  10714. var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
  10715. function initCloneByTag(object2, tag, isDeep) {
  10716. var Ctor = object2.constructor;
  10717. switch (tag) {
  10718. case arrayBufferTag$2:
  10719. return cloneArrayBuffer(object2);
  10720. case boolTag$2:
  10721. case dateTag$2:
  10722. return new Ctor(+object2);
  10723. case dataViewTag$2:
  10724. return cloneDataView(object2, isDeep);
  10725. case float32Tag$1:
  10726. case float64Tag$1:
  10727. case int8Tag$1:
  10728. case int16Tag$1:
  10729. case int32Tag$1:
  10730. case uint8Tag$1:
  10731. case uint8ClampedTag$1:
  10732. case uint16Tag$1:
  10733. case uint32Tag$1:
  10734. return cloneTypedArray(object2, isDeep);
  10735. case mapTag$3:
  10736. return new Ctor();
  10737. case numberTag$2:
  10738. case stringTag$2:
  10739. return new Ctor(object2);
  10740. case regexpTag$2:
  10741. return cloneRegExp(object2);
  10742. case setTag$3:
  10743. return new Ctor();
  10744. case symbolTag$2:
  10745. return cloneSymbol(object2);
  10746. }
  10747. }
  10748. function initCloneObject(object2) {
  10749. return typeof object2.constructor == "function" && !isPrototype(object2) ? baseCreate$1(getPrototype$1(object2)) : {};
  10750. }
  10751. var mapTag$2 = "[object Map]";
  10752. function baseIsMap(value) {
  10753. return isObjectLike(value) && getTag$1(value) == mapTag$2;
  10754. }
  10755. var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
  10756. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  10757. const isMap$1 = isMap;
  10758. var setTag$2 = "[object Set]";
  10759. function baseIsSet(value) {
  10760. return isObjectLike(value) && getTag$1(value) == setTag$2;
  10761. }
  10762. var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
  10763. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  10764. const isSet$1 = isSet;
  10765. var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$2 = 4;
  10766. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
  10767. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  10768. var cloneableTags = {};
  10769. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  10770. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
  10771. function baseClone(value, bitmask, customizer, key, object2, stack) {
  10772. var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
  10773. if (customizer) {
  10774. result = object2 ? customizer(value, key, object2, stack) : customizer(value);
  10775. }
  10776. if (result !== void 0) {
  10777. return result;
  10778. }
  10779. if (!isObject(value)) {
  10780. return value;
  10781. }
  10782. var isArr = isArray$1(value);
  10783. if (isArr) {
  10784. result = initCloneArray(value);
  10785. if (!isDeep) {
  10786. return copyArray(value, result);
  10787. }
  10788. } else {
  10789. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  10790. if (isBuffer$1(value)) {
  10791. return cloneBuffer(value, isDeep);
  10792. }
  10793. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object2) {
  10794. result = isFlat || isFunc ? {} : initCloneObject(value);
  10795. if (!isDeep) {
  10796. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  10797. }
  10798. } else {
  10799. if (!cloneableTags[tag]) {
  10800. return object2 ? value : {};
  10801. }
  10802. result = initCloneByTag(value, tag, isDeep);
  10803. }
  10804. }
  10805. stack || (stack = new Stack());
  10806. var stacked = stack.get(value);
  10807. if (stacked) {
  10808. return stacked;
  10809. }
  10810. stack.set(value, result);
  10811. if (isSet$1(value)) {
  10812. value.forEach(function(subValue) {
  10813. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  10814. });
  10815. } else if (isMap$1(value)) {
  10816. value.forEach(function(subValue, key2) {
  10817. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  10818. });
  10819. }
  10820. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  10821. var props = isArr ? void 0 : keysFunc(value);
  10822. arrayEach(props || value, function(subValue, key2) {
  10823. if (props) {
  10824. key2 = subValue;
  10825. subValue = value[key2];
  10826. }
  10827. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  10828. });
  10829. return result;
  10830. }
  10831. var CLONE_SYMBOLS_FLAG$1 = 4;
  10832. function clone(value) {
  10833. return baseClone(value, CLONE_SYMBOLS_FLAG$1);
  10834. }
  10835. var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
  10836. function cloneDeep(value) {
  10837. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  10838. }
  10839. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  10840. function setCacheAdd(value) {
  10841. this.__data__.set(value, HASH_UNDEFINED);
  10842. return this;
  10843. }
  10844. function setCacheHas(value) {
  10845. return this.__data__.has(value);
  10846. }
  10847. function SetCache(values) {
  10848. var index2 = -1, length = values == null ? 0 : values.length;
  10849. this.__data__ = new MapCache();
  10850. while (++index2 < length) {
  10851. this.add(values[index2]);
  10852. }
  10853. }
  10854. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  10855. SetCache.prototype.has = setCacheHas;
  10856. function arraySome(array2, predicate) {
  10857. var index2 = -1, length = array2 == null ? 0 : array2.length;
  10858. while (++index2 < length) {
  10859. if (predicate(array2[index2], index2, array2)) {
  10860. return true;
  10861. }
  10862. }
  10863. return false;
  10864. }
  10865. function cacheHas(cache2, key) {
  10866. return cache2.has(key);
  10867. }
  10868. var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
  10869. function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
  10870. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array2.length, othLength = other.length;
  10871. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  10872. return false;
  10873. }
  10874. var arrStacked = stack.get(array2);
  10875. var othStacked = stack.get(other);
  10876. if (arrStacked && othStacked) {
  10877. return arrStacked == other && othStacked == array2;
  10878. }
  10879. var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  10880. stack.set(array2, other);
  10881. stack.set(other, array2);
  10882. while (++index2 < arrLength) {
  10883. var arrValue = array2[index2], othValue = other[index2];
  10884. if (customizer) {
  10885. var compared = isPartial ? customizer(othValue, arrValue, index2, other, array2, stack) : customizer(arrValue, othValue, index2, array2, other, stack);
  10886. }
  10887. if (compared !== void 0) {
  10888. if (compared) {
  10889. continue;
  10890. }
  10891. result = false;
  10892. break;
  10893. }
  10894. if (seen) {
  10895. if (!arraySome(other, function(othValue2, othIndex) {
  10896. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  10897. return seen.push(othIndex);
  10898. }
  10899. })) {
  10900. result = false;
  10901. break;
  10902. }
  10903. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  10904. result = false;
  10905. break;
  10906. }
  10907. }
  10908. stack["delete"](array2);
  10909. stack["delete"](other);
  10910. return result;
  10911. }
  10912. function mapToArray(map2) {
  10913. var index2 = -1, result = Array(map2.size);
  10914. map2.forEach(function(value, key) {
  10915. result[++index2] = [key, value];
  10916. });
  10917. return result;
  10918. }
  10919. function setToArray(set2) {
  10920. var index2 = -1, result = Array(set2.size);
  10921. set2.forEach(function(value) {
  10922. result[++index2] = value;
  10923. });
  10924. return result;
  10925. }
  10926. var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
  10927. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  10928. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  10929. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  10930. function equalByTag(object2, other, tag, bitmask, customizer, equalFunc, stack) {
  10931. switch (tag) {
  10932. case dataViewTag:
  10933. if (object2.byteLength != other.byteLength || object2.byteOffset != other.byteOffset) {
  10934. return false;
  10935. }
  10936. object2 = object2.buffer;
  10937. other = other.buffer;
  10938. case arrayBufferTag:
  10939. if (object2.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object2), new Uint8Array$1(other))) {
  10940. return false;
  10941. }
  10942. return true;
  10943. case boolTag:
  10944. case dateTag:
  10945. case numberTag:
  10946. return eq(+object2, +other);
  10947. case errorTag:
  10948. return object2.name == other.name && object2.message == other.message;
  10949. case regexpTag:
  10950. case stringTag:
  10951. return object2 == other + "";
  10952. case mapTag:
  10953. var convert = mapToArray;
  10954. case setTag:
  10955. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  10956. convert || (convert = setToArray);
  10957. if (object2.size != other.size && !isPartial) {
  10958. return false;
  10959. }
  10960. var stacked = stack.get(object2);
  10961. if (stacked) {
  10962. return stacked == other;
  10963. }
  10964. bitmask |= COMPARE_UNORDERED_FLAG$2;
  10965. stack.set(object2, other);
  10966. var result = equalArrays(convert(object2), convert(other), bitmask, customizer, equalFunc, stack);
  10967. stack["delete"](object2);
  10968. return result;
  10969. case symbolTag:
  10970. if (symbolValueOf) {
  10971. return symbolValueOf.call(object2) == symbolValueOf.call(other);
  10972. }
  10973. }
  10974. return false;
  10975. }
  10976. var COMPARE_PARTIAL_FLAG$3 = 1;
  10977. var objectProto$1 = Object.prototype;
  10978. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  10979. function equalObjects(object2, other, bitmask, customizer, equalFunc, stack) {
  10980. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object2), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  10981. if (objLength != othLength && !isPartial) {
  10982. return false;
  10983. }
  10984. var index2 = objLength;
  10985. while (index2--) {
  10986. var key = objProps[index2];
  10987. if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
  10988. return false;
  10989. }
  10990. }
  10991. var objStacked = stack.get(object2);
  10992. var othStacked = stack.get(other);
  10993. if (objStacked && othStacked) {
  10994. return objStacked == other && othStacked == object2;
  10995. }
  10996. var result = true;
  10997. stack.set(object2, other);
  10998. stack.set(other, object2);
  10999. var skipCtor = isPartial;
  11000. while (++index2 < objLength) {
  11001. key = objProps[index2];
  11002. var objValue = object2[key], othValue = other[key];
  11003. if (customizer) {
  11004. var compared = isPartial ? customizer(othValue, objValue, key, other, object2, stack) : customizer(objValue, othValue, key, object2, other, stack);
  11005. }
  11006. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  11007. result = false;
  11008. break;
  11009. }
  11010. skipCtor || (skipCtor = key == "constructor");
  11011. }
  11012. if (result && !skipCtor) {
  11013. var objCtor = object2.constructor, othCtor = other.constructor;
  11014. if (objCtor != othCtor && ("constructor" in object2 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  11015. result = false;
  11016. }
  11017. }
  11018. stack["delete"](object2);
  11019. stack["delete"](other);
  11020. return result;
  11021. }
  11022. var COMPARE_PARTIAL_FLAG$2 = 1;
  11023. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  11024. var objectProto = Object.prototype;
  11025. var hasOwnProperty = objectProto.hasOwnProperty;
  11026. function baseIsEqualDeep(object2, other, bitmask, customizer, equalFunc, stack) {
  11027. var objIsArr = isArray$1(object2), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object2), othTag = othIsArr ? arrayTag : getTag$1(other);
  11028. objTag = objTag == argsTag ? objectTag : objTag;
  11029. othTag = othTag == argsTag ? objectTag : othTag;
  11030. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  11031. if (isSameTag && isBuffer$1(object2)) {
  11032. if (!isBuffer$1(other)) {
  11033. return false;
  11034. }
  11035. objIsArr = true;
  11036. objIsObj = false;
  11037. }
  11038. if (isSameTag && !objIsObj) {
  11039. stack || (stack = new Stack());
  11040. return objIsArr || isTypedArray$1(object2) ? equalArrays(object2, other, bitmask, customizer, equalFunc, stack) : equalByTag(object2, other, objTag, bitmask, customizer, equalFunc, stack);
  11041. }
  11042. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  11043. var objIsWrapped = objIsObj && hasOwnProperty.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
  11044. if (objIsWrapped || othIsWrapped) {
  11045. var objUnwrapped = objIsWrapped ? object2.value() : object2, othUnwrapped = othIsWrapped ? other.value() : other;
  11046. stack || (stack = new Stack());
  11047. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  11048. }
  11049. }
  11050. if (!isSameTag) {
  11051. return false;
  11052. }
  11053. stack || (stack = new Stack());
  11054. return equalObjects(object2, other, bitmask, customizer, equalFunc, stack);
  11055. }
  11056. function baseIsEqual(value, other, bitmask, customizer, stack) {
  11057. if (value === other) {
  11058. return true;
  11059. }
  11060. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  11061. return value !== value && other !== other;
  11062. }
  11063. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  11064. }
  11065. var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  11066. function baseIsMatch(object2, source, matchData, customizer) {
  11067. var index2 = matchData.length, length = index2, noCustomizer = !customizer;
  11068. if (object2 == null) {
  11069. return !length;
  11070. }
  11071. object2 = Object(object2);
  11072. while (index2--) {
  11073. var data = matchData[index2];
  11074. if (noCustomizer && data[2] ? data[1] !== object2[data[0]] : !(data[0] in object2)) {
  11075. return false;
  11076. }
  11077. }
  11078. while (++index2 < length) {
  11079. data = matchData[index2];
  11080. var key = data[0], objValue = object2[key], srcValue = data[1];
  11081. if (noCustomizer && data[2]) {
  11082. if (objValue === void 0 && !(key in object2)) {
  11083. return false;
  11084. }
  11085. } else {
  11086. var stack = new Stack();
  11087. if (customizer) {
  11088. var result = customizer(objValue, srcValue, key, object2, source, stack);
  11089. }
  11090. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  11091. return false;
  11092. }
  11093. }
  11094. }
  11095. return true;
  11096. }
  11097. function isStrictComparable(value) {
  11098. return value === value && !isObject(value);
  11099. }
  11100. function getMatchData(object2) {
  11101. var result = keys(object2), length = result.length;
  11102. while (length--) {
  11103. var key = result[length], value = object2[key];
  11104. result[length] = [key, value, isStrictComparable(value)];
  11105. }
  11106. return result;
  11107. }
  11108. function matchesStrictComparable(key, srcValue) {
  11109. return function(object2) {
  11110. if (object2 == null) {
  11111. return false;
  11112. }
  11113. return object2[key] === srcValue && (srcValue !== void 0 || key in Object(object2));
  11114. };
  11115. }
  11116. function baseMatches(source) {
  11117. var matchData = getMatchData(source);
  11118. if (matchData.length == 1 && matchData[0][2]) {
  11119. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  11120. }
  11121. return function(object2) {
  11122. return object2 === source || baseIsMatch(object2, source, matchData);
  11123. };
  11124. }
  11125. function baseHasIn(object2, key) {
  11126. return object2 != null && key in Object(object2);
  11127. }
  11128. function hasPath(object2, path, hasFunc) {
  11129. path = castPath(path, object2);
  11130. var index2 = -1, length = path.length, result = false;
  11131. while (++index2 < length) {
  11132. var key = toKey(path[index2]);
  11133. if (!(result = object2 != null && hasFunc(object2, key))) {
  11134. break;
  11135. }
  11136. object2 = object2[key];
  11137. }
  11138. if (result || ++index2 != length) {
  11139. return result;
  11140. }
  11141. length = object2 == null ? 0 : object2.length;
  11142. return !!length && isLength(length) && isIndex(key, length) && (isArray$1(object2) || isArguments$1(object2));
  11143. }
  11144. function hasIn(object2, path) {
  11145. return object2 != null && hasPath(object2, path, baseHasIn);
  11146. }
  11147. var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
  11148. function baseMatchesProperty(path, srcValue) {
  11149. if (isKey(path) && isStrictComparable(srcValue)) {
  11150. return matchesStrictComparable(toKey(path), srcValue);
  11151. }
  11152. return function(object2) {
  11153. var objValue = get(object2, path);
  11154. return objValue === void 0 && objValue === srcValue ? hasIn(object2, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  11155. };
  11156. }
  11157. function baseProperty(key) {
  11158. return function(object2) {
  11159. return object2 == null ? void 0 : object2[key];
  11160. };
  11161. }
  11162. function basePropertyDeep(path) {
  11163. return function(object2) {
  11164. return baseGet(object2, path);
  11165. };
  11166. }
  11167. function property(path) {
  11168. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  11169. }
  11170. function baseIteratee(value) {
  11171. if (typeof value == "function") {
  11172. return value;
  11173. }
  11174. if (value == null) {
  11175. return identity;
  11176. }
  11177. if (typeof value == "object") {
  11178. return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  11179. }
  11180. return property(value);
  11181. }
  11182. function createBaseFor(fromRight) {
  11183. return function(object2, iteratee, keysFunc) {
  11184. var index2 = -1, iterable = Object(object2), props = keysFunc(object2), length = props.length;
  11185. while (length--) {
  11186. var key = props[fromRight ? length : ++index2];
  11187. if (iteratee(iterable[key], key, iterable) === false) {
  11188. break;
  11189. }
  11190. }
  11191. return object2;
  11192. };
  11193. }
  11194. var baseFor = createBaseFor();
  11195. const baseFor$1 = baseFor;
  11196. function baseForOwn(object2, iteratee) {
  11197. return object2 && baseFor$1(object2, iteratee, keys);
  11198. }
  11199. function createBaseEach(eachFunc, fromRight) {
  11200. return function(collection, iteratee) {
  11201. if (collection == null) {
  11202. return collection;
  11203. }
  11204. if (!isArrayLike(collection)) {
  11205. return eachFunc(collection, iteratee);
  11206. }
  11207. var length = collection.length, index2 = fromRight ? length : -1, iterable = Object(collection);
  11208. while (fromRight ? index2-- : ++index2 < length) {
  11209. if (iteratee(iterable[index2], index2, iterable) === false) {
  11210. break;
  11211. }
  11212. }
  11213. return collection;
  11214. };
  11215. }
  11216. var baseEach = createBaseEach(baseForOwn);
  11217. const baseEach$1 = baseEach;
  11218. var now = function() {
  11219. return root$1.Date.now();
  11220. };
  11221. const now$1 = now;
  11222. var FUNC_ERROR_TEXT$1 = "Expected a function";
  11223. var nativeMax$1 = Math.max, nativeMin$1 = Math.min;
  11224. function debounce(func, wait, options) {
  11225. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  11226. if (typeof func != "function") {
  11227. throw new TypeError(FUNC_ERROR_TEXT$1);
  11228. }
  11229. wait = toNumber(wait) || 0;
  11230. if (isObject(options)) {
  11231. leading = !!options.leading;
  11232. maxing = "maxWait" in options;
  11233. maxWait = maxing ? nativeMax$1(toNumber(options.maxWait) || 0, wait) : maxWait;
  11234. trailing = "trailing" in options ? !!options.trailing : trailing;
  11235. }
  11236. function invokeFunc(time) {
  11237. var args = lastArgs, thisArg = lastThis;
  11238. lastArgs = lastThis = void 0;
  11239. lastInvokeTime = time;
  11240. result = func.apply(thisArg, args);
  11241. return result;
  11242. }
  11243. function leadingEdge(time) {
  11244. lastInvokeTime = time;
  11245. timerId = setTimeout(timerExpired, wait);
  11246. return leading ? invokeFunc(time) : result;
  11247. }
  11248. function remainingWait(time) {
  11249. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  11250. return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  11251. }
  11252. function shouldInvoke(time) {
  11253. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  11254. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  11255. }
  11256. function timerExpired() {
  11257. var time = now$1();
  11258. if (shouldInvoke(time)) {
  11259. return trailingEdge(time);
  11260. }
  11261. timerId = setTimeout(timerExpired, remainingWait(time));
  11262. }
  11263. function trailingEdge(time) {
  11264. timerId = void 0;
  11265. if (trailing && lastArgs) {
  11266. return invokeFunc(time);
  11267. }
  11268. lastArgs = lastThis = void 0;
  11269. return result;
  11270. }
  11271. function cancel() {
  11272. if (timerId !== void 0) {
  11273. clearTimeout(timerId);
  11274. }
  11275. lastInvokeTime = 0;
  11276. lastArgs = lastCallTime = lastThis = timerId = void 0;
  11277. }
  11278. function flush() {
  11279. return timerId === void 0 ? result : trailingEdge(now$1());
  11280. }
  11281. function debounced() {
  11282. var time = now$1(), isInvoking = shouldInvoke(time);
  11283. lastArgs = arguments;
  11284. lastThis = this;
  11285. lastCallTime = time;
  11286. if (isInvoking) {
  11287. if (timerId === void 0) {
  11288. return leadingEdge(lastCallTime);
  11289. }
  11290. if (maxing) {
  11291. clearTimeout(timerId);
  11292. timerId = setTimeout(timerExpired, wait);
  11293. return invokeFunc(lastCallTime);
  11294. }
  11295. }
  11296. if (timerId === void 0) {
  11297. timerId = setTimeout(timerExpired, wait);
  11298. }
  11299. return result;
  11300. }
  11301. debounced.cancel = cancel;
  11302. debounced.flush = flush;
  11303. return debounced;
  11304. }
  11305. function assignMergeValue(object2, key, value) {
  11306. if (value !== void 0 && !eq(object2[key], value) || value === void 0 && !(key in object2)) {
  11307. baseAssignValue(object2, key, value);
  11308. }
  11309. }
  11310. function isArrayLikeObject(value) {
  11311. return isObjectLike(value) && isArrayLike(value);
  11312. }
  11313. function safeGet(object2, key) {
  11314. if (key === "constructor" && typeof object2[key] === "function") {
  11315. return;
  11316. }
  11317. if (key == "__proto__") {
  11318. return;
  11319. }
  11320. return object2[key];
  11321. }
  11322. function toPlainObject(value) {
  11323. return copyObject(value, keysIn(value));
  11324. }
  11325. function baseMergeDeep(object2, source, key, srcIndex, mergeFunc, customizer, stack) {
  11326. var objValue = safeGet(object2, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  11327. if (stacked) {
  11328. assignMergeValue(object2, key, stacked);
  11329. return;
  11330. }
  11331. var newValue = customizer ? customizer(objValue, srcValue, key + "", object2, source, stack) : void 0;
  11332. var isCommon = newValue === void 0;
  11333. if (isCommon) {
  11334. var isArr = isArray$1(srcValue), isBuff = !isArr && isBuffer$1(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
  11335. newValue = srcValue;
  11336. if (isArr || isBuff || isTyped) {
  11337. if (isArray$1(objValue)) {
  11338. newValue = objValue;
  11339. } else if (isArrayLikeObject(objValue)) {
  11340. newValue = copyArray(objValue);
  11341. } else if (isBuff) {
  11342. isCommon = false;
  11343. newValue = cloneBuffer(srcValue, true);
  11344. } else if (isTyped) {
  11345. isCommon = false;
  11346. newValue = cloneTypedArray(srcValue, true);
  11347. } else {
  11348. newValue = [];
  11349. }
  11350. } else if (isPlainObject(srcValue) || isArguments$1(srcValue)) {
  11351. newValue = objValue;
  11352. if (isArguments$1(objValue)) {
  11353. newValue = toPlainObject(objValue);
  11354. } else if (!isObject(objValue) || isFunction(objValue)) {
  11355. newValue = initCloneObject(srcValue);
  11356. }
  11357. } else {
  11358. isCommon = false;
  11359. }
  11360. }
  11361. if (isCommon) {
  11362. stack.set(srcValue, newValue);
  11363. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  11364. stack["delete"](srcValue);
  11365. }
  11366. assignMergeValue(object2, key, newValue);
  11367. }
  11368. function baseMerge(object2, source, srcIndex, customizer, stack) {
  11369. if (object2 === source) {
  11370. return;
  11371. }
  11372. baseFor$1(source, function(srcValue, key) {
  11373. stack || (stack = new Stack());
  11374. if (isObject(srcValue)) {
  11375. baseMergeDeep(object2, source, key, srcIndex, baseMerge, customizer, stack);
  11376. } else {
  11377. var newValue = customizer ? customizer(safeGet(object2, key), srcValue, key + "", object2, source, stack) : void 0;
  11378. if (newValue === void 0) {
  11379. newValue = srcValue;
  11380. }
  11381. assignMergeValue(object2, key, newValue);
  11382. }
  11383. }, keysIn);
  11384. }
  11385. function arrayIncludesWith(array2, value, comparator2) {
  11386. var index2 = -1, length = array2 == null ? 0 : array2.length;
  11387. while (++index2 < length) {
  11388. if (comparator2(value, array2[index2])) {
  11389. return true;
  11390. }
  11391. }
  11392. return false;
  11393. }
  11394. var nativeMax = Math.max, nativeMin = Math.min;
  11395. function findLastIndex(array2, predicate, fromIndex) {
  11396. var length = array2 == null ? 0 : array2.length;
  11397. if (!length) {
  11398. return -1;
  11399. }
  11400. var index2 = length - 1;
  11401. if (fromIndex !== void 0) {
  11402. index2 = toInteger(fromIndex);
  11403. index2 = fromIndex < 0 ? nativeMax(length + index2, 0) : nativeMin(index2, length - 1);
  11404. }
  11405. return baseFindIndex(array2, baseIteratee(predicate), index2, true);
  11406. }
  11407. function baseMap(collection, iteratee) {
  11408. var index2 = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  11409. baseEach$1(collection, function(value, key, collection2) {
  11410. result[++index2] = iteratee(value, key, collection2);
  11411. });
  11412. return result;
  11413. }
  11414. function map(collection, iteratee) {
  11415. var func = isArray$1(collection) ? arrayMap : baseMap;
  11416. return func(collection, baseIteratee(iteratee));
  11417. }
  11418. function flatMap(collection, iteratee) {
  11419. return baseFlatten(map(collection, iteratee), 1);
  11420. }
  11421. var INFINITY$1 = 1 / 0;
  11422. function flattenDeep(array2) {
  11423. var length = array2 == null ? 0 : array2.length;
  11424. return length ? baseFlatten(array2, INFINITY$1) : [];
  11425. }
  11426. function fromPairs(pairs) {
  11427. var index2 = -1, length = pairs == null ? 0 : pairs.length, result = {};
  11428. while (++index2 < length) {
  11429. var pair = pairs[index2];
  11430. result[pair[0]] = pair[1];
  11431. }
  11432. return result;
  11433. }
  11434. function isEqual$1(value, other) {
  11435. return baseIsEqual(value, other);
  11436. }
  11437. function isNil(value) {
  11438. return value == null;
  11439. }
  11440. function isUndefined$1(value) {
  11441. return value === void 0;
  11442. }
  11443. var merge = createAssigner(function(object2, source, srcIndex) {
  11444. baseMerge(object2, source, srcIndex);
  11445. });
  11446. const merge$1 = merge;
  11447. function baseSet(object2, path, value, customizer) {
  11448. if (!isObject(object2)) {
  11449. return object2;
  11450. }
  11451. path = castPath(path, object2);
  11452. var index2 = -1, length = path.length, lastIndex = length - 1, nested = object2;
  11453. while (nested != null && ++index2 < length) {
  11454. var key = toKey(path[index2]), newValue = value;
  11455. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  11456. return object2;
  11457. }
  11458. if (index2 != lastIndex) {
  11459. var objValue = nested[key];
  11460. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  11461. if (newValue === void 0) {
  11462. newValue = isObject(objValue) ? objValue : isIndex(path[index2 + 1]) ? [] : {};
  11463. }
  11464. }
  11465. assignValue(nested, key, newValue);
  11466. nested = nested[key];
  11467. }
  11468. return object2;
  11469. }
  11470. function basePickBy(object2, paths, predicate) {
  11471. var index2 = -1, length = paths.length, result = {};
  11472. while (++index2 < length) {
  11473. var path = paths[index2], value = baseGet(object2, path);
  11474. if (predicate(value, path)) {
  11475. baseSet(result, castPath(path, object2), value);
  11476. }
  11477. }
  11478. return result;
  11479. }
  11480. function basePick(object2, paths) {
  11481. return basePickBy(object2, paths, function(value, path) {
  11482. return hasIn(object2, path);
  11483. });
  11484. }
  11485. var pick = flatRest(function(object2, paths) {
  11486. return object2 == null ? {} : basePick(object2, paths);
  11487. });
  11488. const pick$1 = pick;
  11489. function set(object2, path, value) {
  11490. return object2 == null ? object2 : baseSet(object2, path, value);
  11491. }
  11492. var FUNC_ERROR_TEXT = "Expected a function";
  11493. function throttle(func, wait, options) {
  11494. var leading = true, trailing = true;
  11495. if (typeof func != "function") {
  11496. throw new TypeError(FUNC_ERROR_TEXT);
  11497. }
  11498. if (isObject(options)) {
  11499. leading = "leading" in options ? !!options.leading : leading;
  11500. trailing = "trailing" in options ? !!options.trailing : trailing;
  11501. }
  11502. return debounce(func, wait, {
  11503. "leading": leading,
  11504. "maxWait": wait,
  11505. "trailing": trailing
  11506. });
  11507. }
  11508. var INFINITY = 1 / 0;
  11509. var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop : function(values) {
  11510. return new Set$2(values);
  11511. };
  11512. const createSet$1 = createSet;
  11513. var LARGE_ARRAY_SIZE = 200;
  11514. function baseUniq(array2, iteratee, comparator2) {
  11515. var index2 = -1, includes = arrayIncludes, length = array2.length, isCommon = true, result = [], seen = result;
  11516. if (comparator2) {
  11517. isCommon = false;
  11518. includes = arrayIncludesWith;
  11519. } else if (length >= LARGE_ARRAY_SIZE) {
  11520. var set2 = iteratee ? null : createSet$1(array2);
  11521. if (set2) {
  11522. return setToArray(set2);
  11523. }
  11524. isCommon = false;
  11525. includes = cacheHas;
  11526. seen = new SetCache();
  11527. } else {
  11528. seen = iteratee ? [] : result;
  11529. }
  11530. outer:
  11531. while (++index2 < length) {
  11532. var value = array2[index2], computed2 = iteratee ? iteratee(value) : value;
  11533. value = comparator2 || value !== 0 ? value : 0;
  11534. if (isCommon && computed2 === computed2) {
  11535. var seenIndex = seen.length;
  11536. while (seenIndex--) {
  11537. if (seen[seenIndex] === computed2) {
  11538. continue outer;
  11539. }
  11540. }
  11541. if (iteratee) {
  11542. seen.push(computed2);
  11543. }
  11544. result.push(value);
  11545. } else if (!includes(seen, computed2, comparator2)) {
  11546. if (seen !== result) {
  11547. seen.push(computed2);
  11548. }
  11549. result.push(value);
  11550. }
  11551. }
  11552. return result;
  11553. }
  11554. var union = baseRest(function(arrays) {
  11555. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  11556. });
  11557. const union$1 = union;
  11558. const isUndefined = (val) => val === void 0;
  11559. const isBoolean = (val) => typeof val === "boolean";
  11560. const isNumber = (val) => typeof val === "number";
  11561. const isEmpty = (val) => !val && val !== 0 || isArray$3(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  11562. const isElement$1 = (e) => {
  11563. if (typeof Element === "undefined")
  11564. return false;
  11565. return e instanceof Element;
  11566. };
  11567. const isPropAbsent = (prop) => {
  11568. return isNil(prop);
  11569. };
  11570. const isStringNumber = (val) => {
  11571. if (!isString$1(val)) {
  11572. return false;
  11573. }
  11574. return !Number.isNaN(Number(val));
  11575. };
  11576. const escapeStringRegexp = (string2 = "") => string2.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  11577. const capitalize = (str) => capitalize$1(str);
  11578. const keysOf = (arr) => Object.keys(arr);
  11579. const entriesOf = (arr) => Object.entries(arr);
  11580. const getProp = (obj, path, defaultValue) => {
  11581. return {
  11582. get value() {
  11583. return get(obj, path, defaultValue);
  11584. },
  11585. set value(val) {
  11586. set(obj, path, val);
  11587. }
  11588. };
  11589. };
  11590. class ElementPlusError extends Error {
  11591. constructor(m2) {
  11592. super(m2);
  11593. this.name = "ElementPlusError";
  11594. }
  11595. }
  11596. function throwError(scope, m2) {
  11597. throw new ElementPlusError(`[${scope}] ${m2}`);
  11598. }
  11599. function debugWarn(scope, message2) {
  11600. }
  11601. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  11602. const hasClass = (el, cls) => {
  11603. if (!el || !cls)
  11604. return false;
  11605. if (cls.includes(" "))
  11606. throw new Error("className should not contain space.");
  11607. return el.classList.contains(cls);
  11608. };
  11609. const addClass = (el, cls) => {
  11610. if (!el || !cls.trim())
  11611. return;
  11612. el.classList.add(...classNameToArray(cls));
  11613. };
  11614. const removeClass = (el, cls) => {
  11615. if (!el || !cls.trim())
  11616. return;
  11617. el.classList.remove(...classNameToArray(cls));
  11618. };
  11619. const getStyle = (element, styleName) => {
  11620. var _a2;
  11621. if (!isClient || !element || !styleName)
  11622. return "";
  11623. let key = camelize(styleName);
  11624. if (key === "float")
  11625. key = "cssFloat";
  11626. try {
  11627. const style = element.style[key];
  11628. if (style)
  11629. return style;
  11630. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  11631. return computed2 ? computed2[key] : "";
  11632. } catch (e) {
  11633. return element.style[key];
  11634. }
  11635. };
  11636. function addUnit(value, defaultUnit = "px") {
  11637. if (!value)
  11638. return "";
  11639. if (isNumber(value) || isStringNumber(value)) {
  11640. return `${value}${defaultUnit}`;
  11641. } else if (isString$1(value)) {
  11642. return value;
  11643. }
  11644. }
  11645. const isScroll = (el, isVertical) => {
  11646. if (!isClient)
  11647. return false;
  11648. const key = {
  11649. undefined: "overflow",
  11650. true: "overflow-y",
  11651. false: "overflow-x"
  11652. }[String(isVertical)];
  11653. const overflow = getStyle(el, key);
  11654. return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
  11655. };
  11656. const getScrollContainer = (el, isVertical) => {
  11657. if (!isClient)
  11658. return;
  11659. let parent = el;
  11660. while (parent) {
  11661. if ([window, document, document.documentElement].includes(parent))
  11662. return window;
  11663. if (isScroll(parent, isVertical))
  11664. return parent;
  11665. parent = parent.parentNode;
  11666. }
  11667. return parent;
  11668. };
  11669. let scrollBarWidth;
  11670. const getScrollBarWidth = (namespace) => {
  11671. var _a2;
  11672. if (!isClient)
  11673. return 0;
  11674. if (scrollBarWidth !== void 0)
  11675. return scrollBarWidth;
  11676. const outer = document.createElement("div");
  11677. outer.className = `${namespace}-scrollbar__wrap`;
  11678. outer.style.visibility = "hidden";
  11679. outer.style.width = "100px";
  11680. outer.style.position = "absolute";
  11681. outer.style.top = "-9999px";
  11682. document.body.appendChild(outer);
  11683. const widthNoScroll = outer.offsetWidth;
  11684. outer.style.overflow = "scroll";
  11685. const inner = document.createElement("div");
  11686. inner.style.width = "100%";
  11687. outer.appendChild(inner);
  11688. const widthWithScroll = inner.offsetWidth;
  11689. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  11690. scrollBarWidth = widthNoScroll - widthWithScroll;
  11691. return scrollBarWidth;
  11692. };
  11693. function scrollIntoView(container, selected) {
  11694. if (!isClient)
  11695. return;
  11696. if (!selected) {
  11697. container.scrollTop = 0;
  11698. return;
  11699. }
  11700. const offsetParents = [];
  11701. let pointer = selected.offsetParent;
  11702. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  11703. offsetParents.push(pointer);
  11704. pointer = pointer.offsetParent;
  11705. }
  11706. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  11707. const bottom = top + selected.offsetHeight;
  11708. const viewRectTop = container.scrollTop;
  11709. const viewRectBottom = viewRectTop + container.clientHeight;
  11710. if (top < viewRectTop) {
  11711. container.scrollTop = top;
  11712. } else if (bottom > viewRectBottom) {
  11713. container.scrollTop = bottom - container.clientHeight;
  11714. }
  11715. }
  11716. /*! Element Plus Icons Vue v2.3.1 */
  11717. var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11718. name: "ArrowDown",
  11719. __name: "arrow-down",
  11720. setup(__props) {
  11721. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11722. xmlns: "http://www.w3.org/2000/svg",
  11723. viewBox: "0 0 1024 1024"
  11724. }, [
  11725. createBaseVNode("path", {
  11726. fill: "currentColor",
  11727. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  11728. })
  11729. ]));
  11730. }
  11731. });
  11732. var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
  11733. var arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11734. name: "ArrowLeft",
  11735. __name: "arrow-left",
  11736. setup(__props) {
  11737. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11738. xmlns: "http://www.w3.org/2000/svg",
  11739. viewBox: "0 0 1024 1024"
  11740. }, [
  11741. createBaseVNode("path", {
  11742. fill: "currentColor",
  11743. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  11744. })
  11745. ]));
  11746. }
  11747. });
  11748. var arrow_left_default = arrow_left_vue_vue_type_script_setup_true_lang_default;
  11749. var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11750. name: "ArrowRight",
  11751. __name: "arrow-right",
  11752. setup(__props) {
  11753. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11754. xmlns: "http://www.w3.org/2000/svg",
  11755. viewBox: "0 0 1024 1024"
  11756. }, [
  11757. createBaseVNode("path", {
  11758. fill: "currentColor",
  11759. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  11760. })
  11761. ]));
  11762. }
  11763. });
  11764. var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
  11765. var arrow_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11766. name: "ArrowUp",
  11767. __name: "arrow-up",
  11768. setup(__props) {
  11769. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11770. xmlns: "http://www.w3.org/2000/svg",
  11771. viewBox: "0 0 1024 1024"
  11772. }, [
  11773. createBaseVNode("path", {
  11774. fill: "currentColor",
  11775. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
  11776. })
  11777. ]));
  11778. }
  11779. });
  11780. var arrow_up_default = arrow_up_vue_vue_type_script_setup_true_lang_default;
  11781. var back_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11782. name: "Back",
  11783. __name: "back",
  11784. setup(__props) {
  11785. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11786. xmlns: "http://www.w3.org/2000/svg",
  11787. viewBox: "0 0 1024 1024"
  11788. }, [
  11789. createBaseVNode("path", {
  11790. fill: "currentColor",
  11791. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  11792. }),
  11793. createBaseVNode("path", {
  11794. fill: "currentColor",
  11795. d: "m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312z"
  11796. })
  11797. ]));
  11798. }
  11799. });
  11800. var back_default = back_vue_vue_type_script_setup_true_lang_default;
  11801. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11802. name: "Calendar",
  11803. __name: "calendar",
  11804. setup(__props) {
  11805. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11806. xmlns: "http://www.w3.org/2000/svg",
  11807. viewBox: "0 0 1024 1024"
  11808. }, [
  11809. createBaseVNode("path", {
  11810. fill: "currentColor",
  11811. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64"
  11812. })
  11813. ]));
  11814. }
  11815. });
  11816. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  11817. var caret_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11818. name: "CaretRight",
  11819. __name: "caret-right",
  11820. setup(__props) {
  11821. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11822. xmlns: "http://www.w3.org/2000/svg",
  11823. viewBox: "0 0 1024 1024"
  11824. }, [
  11825. createBaseVNode("path", {
  11826. fill: "currentColor",
  11827. d: "M384 192v640l384-320.064z"
  11828. })
  11829. ]));
  11830. }
  11831. });
  11832. var caret_right_default = caret_right_vue_vue_type_script_setup_true_lang_default;
  11833. var caret_top_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11834. name: "CaretTop",
  11835. __name: "caret-top",
  11836. setup(__props) {
  11837. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11838. xmlns: "http://www.w3.org/2000/svg",
  11839. viewBox: "0 0 1024 1024"
  11840. }, [
  11841. createBaseVNode("path", {
  11842. fill: "currentColor",
  11843. d: "M512 320 192 704h639.936z"
  11844. })
  11845. ]));
  11846. }
  11847. });
  11848. var caret_top_default = caret_top_vue_vue_type_script_setup_true_lang_default;
  11849. var check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11850. name: "Check",
  11851. __name: "check",
  11852. setup(__props) {
  11853. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11854. xmlns: "http://www.w3.org/2000/svg",
  11855. viewBox: "0 0 1024 1024"
  11856. }, [
  11857. createBaseVNode("path", {
  11858. fill: "currentColor",
  11859. d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
  11860. })
  11861. ]));
  11862. }
  11863. });
  11864. var check_default = check_vue_vue_type_script_setup_true_lang_default;
  11865. var circle_check_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11866. name: "CircleCheckFilled",
  11867. __name: "circle-check-filled",
  11868. setup(__props) {
  11869. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11870. xmlns: "http://www.w3.org/2000/svg",
  11871. viewBox: "0 0 1024 1024"
  11872. }, [
  11873. createBaseVNode("path", {
  11874. fill: "currentColor",
  11875. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  11876. })
  11877. ]));
  11878. }
  11879. });
  11880. var circle_check_filled_default = circle_check_filled_vue_vue_type_script_setup_true_lang_default;
  11881. var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11882. name: "CircleCheck",
  11883. __name: "circle-check",
  11884. setup(__props) {
  11885. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11886. xmlns: "http://www.w3.org/2000/svg",
  11887. viewBox: "0 0 1024 1024"
  11888. }, [
  11889. createBaseVNode("path", {
  11890. fill: "currentColor",
  11891. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  11892. }),
  11893. createBaseVNode("path", {
  11894. fill: "currentColor",
  11895. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  11896. })
  11897. ]));
  11898. }
  11899. });
  11900. var circle_check_default = circle_check_vue_vue_type_script_setup_true_lang_default;
  11901. var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11902. name: "CircleCloseFilled",
  11903. __name: "circle-close-filled",
  11904. setup(__props) {
  11905. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11906. xmlns: "http://www.w3.org/2000/svg",
  11907. viewBox: "0 0 1024 1024"
  11908. }, [
  11909. createBaseVNode("path", {
  11910. fill: "currentColor",
  11911. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
  11912. })
  11913. ]));
  11914. }
  11915. });
  11916. var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
  11917. var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11918. name: "CircleClose",
  11919. __name: "circle-close",
  11920. setup(__props) {
  11921. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11922. xmlns: "http://www.w3.org/2000/svg",
  11923. viewBox: "0 0 1024 1024"
  11924. }, [
  11925. createBaseVNode("path", {
  11926. fill: "currentColor",
  11927. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
  11928. }),
  11929. createBaseVNode("path", {
  11930. fill: "currentColor",
  11931. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  11932. })
  11933. ]));
  11934. }
  11935. });
  11936. var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
  11937. var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11938. name: "Clock",
  11939. __name: "clock",
  11940. setup(__props) {
  11941. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11942. xmlns: "http://www.w3.org/2000/svg",
  11943. viewBox: "0 0 1024 1024"
  11944. }, [
  11945. createBaseVNode("path", {
  11946. fill: "currentColor",
  11947. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  11948. }),
  11949. createBaseVNode("path", {
  11950. fill: "currentColor",
  11951. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  11952. }),
  11953. createBaseVNode("path", {
  11954. fill: "currentColor",
  11955. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  11956. })
  11957. ]));
  11958. }
  11959. });
  11960. var clock_default = clock_vue_vue_type_script_setup_true_lang_default;
  11961. var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11962. name: "Close",
  11963. __name: "close",
  11964. setup(__props) {
  11965. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11966. xmlns: "http://www.w3.org/2000/svg",
  11967. viewBox: "0 0 1024 1024"
  11968. }, [
  11969. createBaseVNode("path", {
  11970. fill: "currentColor",
  11971. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  11972. })
  11973. ]));
  11974. }
  11975. });
  11976. var close_default = close_vue_vue_type_script_setup_true_lang_default;
  11977. var d_arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11978. name: "DArrowLeft",
  11979. __name: "d-arrow-left",
  11980. setup(__props) {
  11981. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11982. xmlns: "http://www.w3.org/2000/svg",
  11983. viewBox: "0 0 1024 1024"
  11984. }, [
  11985. createBaseVNode("path", {
  11986. fill: "currentColor",
  11987. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  11988. })
  11989. ]));
  11990. }
  11991. });
  11992. var d_arrow_left_default = d_arrow_left_vue_vue_type_script_setup_true_lang_default;
  11993. var d_arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11994. name: "DArrowRight",
  11995. __name: "d-arrow-right",
  11996. setup(__props) {
  11997. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  11998. xmlns: "http://www.w3.org/2000/svg",
  11999. viewBox: "0 0 1024 1024"
  12000. }, [
  12001. createBaseVNode("path", {
  12002. fill: "currentColor",
  12003. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  12004. })
  12005. ]));
  12006. }
  12007. });
  12008. var d_arrow_right_default = d_arrow_right_vue_vue_type_script_setup_true_lang_default;
  12009. var delete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12010. name: "Delete",
  12011. __name: "delete",
  12012. setup(__props) {
  12013. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12014. xmlns: "http://www.w3.org/2000/svg",
  12015. viewBox: "0 0 1024 1024"
  12016. }, [
  12017. createBaseVNode("path", {
  12018. fill: "currentColor",
  12019. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
  12020. })
  12021. ]));
  12022. }
  12023. });
  12024. var delete_default = delete_vue_vue_type_script_setup_true_lang_default;
  12025. var document_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12026. name: "Document",
  12027. __name: "document",
  12028. setup(__props) {
  12029. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12030. xmlns: "http://www.w3.org/2000/svg",
  12031. viewBox: "0 0 1024 1024"
  12032. }, [
  12033. createBaseVNode("path", {
  12034. fill: "currentColor",
  12035. d: "M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"
  12036. })
  12037. ]));
  12038. }
  12039. });
  12040. var document_default = document_vue_vue_type_script_setup_true_lang_default;
  12041. var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12042. name: "FullScreen",
  12043. __name: "full-screen",
  12044. setup(__props) {
  12045. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12046. xmlns: "http://www.w3.org/2000/svg",
  12047. viewBox: "0 0 1024 1024"
  12048. }, [
  12049. createBaseVNode("path", {
  12050. fill: "currentColor",
  12051. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
  12052. })
  12053. ]));
  12054. }
  12055. });
  12056. var full_screen_default = full_screen_vue_vue_type_script_setup_true_lang_default;
  12057. var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12058. name: "Hide",
  12059. __name: "hide",
  12060. setup(__props) {
  12061. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12062. xmlns: "http://www.w3.org/2000/svg",
  12063. viewBox: "0 0 1024 1024"
  12064. }, [
  12065. createBaseVNode("path", {
  12066. fill: "currentColor",
  12067. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
  12068. }),
  12069. createBaseVNode("path", {
  12070. fill: "currentColor",
  12071. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
  12072. })
  12073. ]));
  12074. }
  12075. });
  12076. var hide_default = hide_vue_vue_type_script_setup_true_lang_default;
  12077. var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12078. name: "InfoFilled",
  12079. __name: "info-filled",
  12080. setup(__props) {
  12081. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12082. xmlns: "http://www.w3.org/2000/svg",
  12083. viewBox: "0 0 1024 1024"
  12084. }, [
  12085. createBaseVNode("path", {
  12086. fill: "currentColor",
  12087. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
  12088. })
  12089. ]));
  12090. }
  12091. });
  12092. var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
  12093. var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12094. name: "Loading",
  12095. __name: "loading",
  12096. setup(__props) {
  12097. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12098. xmlns: "http://www.w3.org/2000/svg",
  12099. viewBox: "0 0 1024 1024"
  12100. }, [
  12101. createBaseVNode("path", {
  12102. fill: "currentColor",
  12103. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  12104. })
  12105. ]));
  12106. }
  12107. });
  12108. var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
  12109. var minus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12110. name: "Minus",
  12111. __name: "minus",
  12112. setup(__props) {
  12113. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12114. xmlns: "http://www.w3.org/2000/svg",
  12115. viewBox: "0 0 1024 1024"
  12116. }, [
  12117. createBaseVNode("path", {
  12118. fill: "currentColor",
  12119. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  12120. })
  12121. ]));
  12122. }
  12123. });
  12124. var minus_default = minus_vue_vue_type_script_setup_true_lang_default;
  12125. var more_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12126. name: "MoreFilled",
  12127. __name: "more-filled",
  12128. setup(__props) {
  12129. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12130. xmlns: "http://www.w3.org/2000/svg",
  12131. viewBox: "0 0 1024 1024"
  12132. }, [
  12133. createBaseVNode("path", {
  12134. fill: "currentColor",
  12135. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"
  12136. })
  12137. ]));
  12138. }
  12139. });
  12140. var more_filled_default = more_filled_vue_vue_type_script_setup_true_lang_default;
  12141. var more_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12142. name: "More",
  12143. __name: "more",
  12144. setup(__props) {
  12145. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12146. xmlns: "http://www.w3.org/2000/svg",
  12147. viewBox: "0 0 1024 1024"
  12148. }, [
  12149. createBaseVNode("path", {
  12150. fill: "currentColor",
  12151. d: "M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96"
  12152. })
  12153. ]));
  12154. }
  12155. });
  12156. var more_default = more_vue_vue_type_script_setup_true_lang_default;
  12157. var picture_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12158. name: "PictureFilled",
  12159. __name: "picture-filled",
  12160. setup(__props) {
  12161. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12162. xmlns: "http://www.w3.org/2000/svg",
  12163. viewBox: "0 0 1024 1024"
  12164. }, [
  12165. createBaseVNode("path", {
  12166. fill: "currentColor",
  12167. d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112M256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384"
  12168. })
  12169. ]));
  12170. }
  12171. });
  12172. var picture_filled_default = picture_filled_vue_vue_type_script_setup_true_lang_default;
  12173. var plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12174. name: "Plus",
  12175. __name: "plus",
  12176. setup(__props) {
  12177. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12178. xmlns: "http://www.w3.org/2000/svg",
  12179. viewBox: "0 0 1024 1024"
  12180. }, [
  12181. createBaseVNode("path", {
  12182. fill: "currentColor",
  12183. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
  12184. })
  12185. ]));
  12186. }
  12187. });
  12188. var plus_default = plus_vue_vue_type_script_setup_true_lang_default;
  12189. var question_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12190. name: "QuestionFilled",
  12191. __name: "question-filled",
  12192. setup(__props) {
  12193. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12194. xmlns: "http://www.w3.org/2000/svg",
  12195. viewBox: "0 0 1024 1024"
  12196. }, [
  12197. createBaseVNode("path", {
  12198. fill: "currentColor",
  12199. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z"
  12200. })
  12201. ]));
  12202. }
  12203. });
  12204. var question_filled_default = question_filled_vue_vue_type_script_setup_true_lang_default;
  12205. var refresh_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12206. name: "RefreshLeft",
  12207. __name: "refresh-left",
  12208. setup(__props) {
  12209. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12210. xmlns: "http://www.w3.org/2000/svg",
  12211. viewBox: "0 0 1024 1024"
  12212. }, [
  12213. createBaseVNode("path", {
  12214. fill: "currentColor",
  12215. d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"
  12216. })
  12217. ]));
  12218. }
  12219. });
  12220. var refresh_left_default = refresh_left_vue_vue_type_script_setup_true_lang_default;
  12221. var refresh_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12222. name: "RefreshRight",
  12223. __name: "refresh-right",
  12224. setup(__props) {
  12225. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12226. xmlns: "http://www.w3.org/2000/svg",
  12227. viewBox: "0 0 1024 1024"
  12228. }, [
  12229. createBaseVNode("path", {
  12230. fill: "currentColor",
  12231. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  12232. })
  12233. ]));
  12234. }
  12235. });
  12236. var refresh_right_default = refresh_right_vue_vue_type_script_setup_true_lang_default;
  12237. var scale_to_original_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12238. name: "ScaleToOriginal",
  12239. __name: "scale-to-original",
  12240. setup(__props) {
  12241. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12242. xmlns: "http://www.w3.org/2000/svg",
  12243. viewBox: "0 0 1024 1024"
  12244. }, [
  12245. createBaseVNode("path", {
  12246. fill: "currentColor",
  12247. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118M512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412M512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512"
  12248. })
  12249. ]));
  12250. }
  12251. });
  12252. var scale_to_original_default = scale_to_original_vue_vue_type_script_setup_true_lang_default;
  12253. var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12254. name: "Search",
  12255. __name: "search",
  12256. setup(__props) {
  12257. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12258. xmlns: "http://www.w3.org/2000/svg",
  12259. viewBox: "0 0 1024 1024"
  12260. }, [
  12261. createBaseVNode("path", {
  12262. fill: "currentColor",
  12263. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
  12264. })
  12265. ]));
  12266. }
  12267. });
  12268. var search_default = search_vue_vue_type_script_setup_true_lang_default;
  12269. var sort_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12270. name: "SortDown",
  12271. __name: "sort-down",
  12272. setup(__props) {
  12273. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12274. xmlns: "http://www.w3.org/2000/svg",
  12275. viewBox: "0 0 1024 1024"
  12276. }, [
  12277. createBaseVNode("path", {
  12278. fill: "currentColor",
  12279. d: "M576 96v709.568L333.312 562.816A32 32 0 1 0 288 608l297.408 297.344A32 32 0 0 0 640 882.688V96a32 32 0 0 0-64 0"
  12280. })
  12281. ]));
  12282. }
  12283. });
  12284. var sort_down_default = sort_down_vue_vue_type_script_setup_true_lang_default;
  12285. var sort_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12286. name: "SortUp",
  12287. __name: "sort-up",
  12288. setup(__props) {
  12289. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12290. xmlns: "http://www.w3.org/2000/svg",
  12291. viewBox: "0 0 1024 1024"
  12292. }, [
  12293. createBaseVNode("path", {
  12294. fill: "currentColor",
  12295. d: "M384 141.248V928a32 32 0 1 0 64 0V218.56l242.688 242.688A32 32 0 1 0 736 416L438.592 118.656A32 32 0 0 0 384 141.248"
  12296. })
  12297. ]));
  12298. }
  12299. });
  12300. var sort_up_default = sort_up_vue_vue_type_script_setup_true_lang_default;
  12301. var star_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12302. name: "StarFilled",
  12303. __name: "star-filled",
  12304. setup(__props) {
  12305. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12306. xmlns: "http://www.w3.org/2000/svg",
  12307. viewBox: "0 0 1024 1024"
  12308. }, [
  12309. createBaseVNode("path", {
  12310. fill: "currentColor",
  12311. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  12312. })
  12313. ]));
  12314. }
  12315. });
  12316. var star_filled_default = star_filled_vue_vue_type_script_setup_true_lang_default;
  12317. var star_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12318. name: "Star",
  12319. __name: "star",
  12320. setup(__props) {
  12321. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12322. xmlns: "http://www.w3.org/2000/svg",
  12323. viewBox: "0 0 1024 1024"
  12324. }, [
  12325. createBaseVNode("path", {
  12326. fill: "currentColor",
  12327. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  12328. })
  12329. ]));
  12330. }
  12331. });
  12332. var star_default = star_vue_vue_type_script_setup_true_lang_default;
  12333. var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12334. name: "SuccessFilled",
  12335. __name: "success-filled",
  12336. setup(__props) {
  12337. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12338. xmlns: "http://www.w3.org/2000/svg",
  12339. viewBox: "0 0 1024 1024"
  12340. }, [
  12341. createBaseVNode("path", {
  12342. fill: "currentColor",
  12343. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  12344. })
  12345. ]));
  12346. }
  12347. });
  12348. var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
  12349. var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12350. name: "View",
  12351. __name: "view",
  12352. setup(__props) {
  12353. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12354. xmlns: "http://www.w3.org/2000/svg",
  12355. viewBox: "0 0 1024 1024"
  12356. }, [
  12357. createBaseVNode("path", {
  12358. fill: "currentColor",
  12359. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
  12360. })
  12361. ]));
  12362. }
  12363. });
  12364. var view_default = view_vue_vue_type_script_setup_true_lang_default;
  12365. var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12366. name: "WarningFilled",
  12367. __name: "warning-filled",
  12368. setup(__props) {
  12369. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12370. xmlns: "http://www.w3.org/2000/svg",
  12371. viewBox: "0 0 1024 1024"
  12372. }, [
  12373. createBaseVNode("path", {
  12374. fill: "currentColor",
  12375. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
  12376. })
  12377. ]));
  12378. }
  12379. });
  12380. var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
  12381. var zoom_in_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12382. name: "ZoomIn",
  12383. __name: "zoom-in",
  12384. setup(__props) {
  12385. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12386. xmlns: "http://www.w3.org/2000/svg",
  12387. viewBox: "0 0 1024 1024"
  12388. }, [
  12389. createBaseVNode("path", {
  12390. fill: "currentColor",
  12391. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"
  12392. })
  12393. ]));
  12394. }
  12395. });
  12396. var zoom_in_default = zoom_in_vue_vue_type_script_setup_true_lang_default;
  12397. var zoom_out_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12398. name: "ZoomOut",
  12399. __name: "zoom-out",
  12400. setup(__props) {
  12401. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  12402. xmlns: "http://www.w3.org/2000/svg",
  12403. viewBox: "0 0 1024 1024"
  12404. }, [
  12405. createBaseVNode("path", {
  12406. fill: "currentColor",
  12407. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"
  12408. })
  12409. ]));
  12410. }
  12411. });
  12412. var zoom_out_default = zoom_out_vue_vue_type_script_setup_true_lang_default;
  12413. const epPropKey = "__epPropKey";
  12414. const definePropType = (val) => val;
  12415. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  12416. const buildProp = (prop, key) => {
  12417. if (!isObject$1(prop) || isEpProp(prop))
  12418. return prop;
  12419. const { values, required: required2, default: defaultValue, type: type2, validator } = prop;
  12420. const _validator = values || validator ? (val) => {
  12421. let valid = false;
  12422. let allowedValues = [];
  12423. if (values) {
  12424. allowedValues = Array.from(values);
  12425. if (hasOwn(prop, "default")) {
  12426. allowedValues.push(defaultValue);
  12427. }
  12428. valid || (valid = allowedValues.includes(val));
  12429. }
  12430. if (validator)
  12431. valid || (valid = validator(val));
  12432. if (!valid && allowedValues.length > 0) {
  12433. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  12434. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  12435. }
  12436. return valid;
  12437. } : void 0;
  12438. const epProp = {
  12439. type: type2,
  12440. required: !!required2,
  12441. validator: _validator,
  12442. [epPropKey]: true
  12443. };
  12444. if (hasOwn(prop, "default"))
  12445. epProp.default = defaultValue;
  12446. return epProp;
  12447. };
  12448. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  12449. key,
  12450. buildProp(option, key)
  12451. ]));
  12452. const iconPropType = definePropType([
  12453. String,
  12454. Object,
  12455. Function
  12456. ]);
  12457. const CloseComponents = {
  12458. Close: close_default
  12459. };
  12460. const TypeComponents = {
  12461. Close: close_default,
  12462. SuccessFilled: success_filled_default,
  12463. InfoFilled: info_filled_default,
  12464. WarningFilled: warning_filled_default,
  12465. CircleCloseFilled: circle_close_filled_default
  12466. };
  12467. const TypeComponentsMap = {
  12468. success: success_filled_default,
  12469. warning: warning_filled_default,
  12470. error: circle_close_filled_default,
  12471. info: info_filled_default
  12472. };
  12473. const ValidateComponentsMap = {
  12474. validating: loading_default,
  12475. success: circle_check_default,
  12476. error: circle_close_default
  12477. };
  12478. const withInstall = (main, extra) => {
  12479. main.install = (app) => {
  12480. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  12481. app.component(comp.name, comp);
  12482. }
  12483. };
  12484. if (extra) {
  12485. for (const [key, comp] of Object.entries(extra)) {
  12486. main[key] = comp;
  12487. }
  12488. }
  12489. return main;
  12490. };
  12491. const withInstallFunction = (fn2, name) => {
  12492. fn2.install = (app) => {
  12493. fn2._context = app._context;
  12494. app.config.globalProperties[name] = fn2;
  12495. };
  12496. return fn2;
  12497. };
  12498. const withInstallDirective = (directive, name) => {
  12499. directive.install = (app) => {
  12500. app.directive(name, directive);
  12501. };
  12502. return directive;
  12503. };
  12504. const withNoopInstall = (component2) => {
  12505. component2.install = NOOP;
  12506. return component2;
  12507. };
  12508. const composeRefs = (...refs) => {
  12509. return (el) => {
  12510. refs.forEach((ref2) => {
  12511. if (isFunction$2(ref2)) {
  12512. ref2(el);
  12513. } else {
  12514. ref2.value = el;
  12515. }
  12516. });
  12517. };
  12518. };
  12519. const EVENT_CODE = {
  12520. tab: "Tab",
  12521. enter: "Enter",
  12522. space: "Space",
  12523. left: "ArrowLeft",
  12524. up: "ArrowUp",
  12525. right: "ArrowRight",
  12526. down: "ArrowDown",
  12527. esc: "Escape",
  12528. delete: "Delete",
  12529. backspace: "Backspace",
  12530. numpadEnter: "NumpadEnter",
  12531. pageUp: "PageUp",
  12532. pageDown: "PageDown",
  12533. home: "Home",
  12534. end: "End"
  12535. };
  12536. const datePickTypes = [
  12537. "year",
  12538. "month",
  12539. "date",
  12540. "dates",
  12541. "week",
  12542. "datetime",
  12543. "datetimerange",
  12544. "daterange",
  12545. "monthrange"
  12546. ];
  12547. const WEEK_DAYS = [
  12548. "sun",
  12549. "mon",
  12550. "tue",
  12551. "wed",
  12552. "thu",
  12553. "fri",
  12554. "sat"
  12555. ];
  12556. const UPDATE_MODEL_EVENT = "update:modelValue";
  12557. const CHANGE_EVENT = "change";
  12558. const INPUT_EVENT = "input";
  12559. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  12560. const componentSizes = ["", "default", "small", "large"];
  12561. const componentSizeMap = {
  12562. large: 40,
  12563. default: 32,
  12564. small: 24
  12565. };
  12566. const getComponentSize = (size2) => {
  12567. return componentSizeMap[size2 || "default"];
  12568. };
  12569. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  12570. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  12571. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  12572. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  12573. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  12574. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  12575. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  12576. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  12577. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  12578. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  12579. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  12580. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  12581. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  12582. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  12583. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  12584. return PatchFlags2;
  12585. })(PatchFlags || {});
  12586. function isFragment(node) {
  12587. return isVNode(node) && node.type === Fragment;
  12588. }
  12589. function isComment(node) {
  12590. return isVNode(node) && node.type === Comment;
  12591. }
  12592. function isValidElementNode(node) {
  12593. return isVNode(node) && !isFragment(node) && !isComment(node);
  12594. }
  12595. const getNormalizedProps = (node) => {
  12596. if (!isVNode(node)) {
  12597. return {};
  12598. }
  12599. const raw = node.props || {};
  12600. const type2 = (isVNode(node.type) ? node.type.props : void 0) || {};
  12601. const props = {};
  12602. Object.keys(type2).forEach((key) => {
  12603. if (hasOwn(type2[key], "default")) {
  12604. props[key] = type2[key].default;
  12605. }
  12606. });
  12607. Object.keys(raw).forEach((key) => {
  12608. props[camelize(key)] = raw[key];
  12609. });
  12610. return props;
  12611. };
  12612. const ensureOnlyChild = (children) => {
  12613. if (!isArray$3(children) || children.length > 1) {
  12614. throw new Error("expect to receive a single Vue element child");
  12615. }
  12616. return children[0];
  12617. };
  12618. const flattedChildren = (children) => {
  12619. const vNodes = isArray$3(children) ? children : [children];
  12620. const result = [];
  12621. vNodes.forEach((child) => {
  12622. var _a2;
  12623. if (isArray$3(child)) {
  12624. result.push(...flattedChildren(child));
  12625. } else if (isVNode(child) && isArray$3(child.children)) {
  12626. result.push(...flattedChildren(child.children));
  12627. } else {
  12628. result.push(child);
  12629. if (isVNode(child) && ((_a2 = child.component) == null ? void 0 : _a2.subTree)) {
  12630. result.push(...flattedChildren(child.component.subTree));
  12631. }
  12632. }
  12633. });
  12634. return result;
  12635. };
  12636. const unique = (arr) => [...new Set(arr)];
  12637. const castArray = (arr) => {
  12638. if (!arr && arr !== 0)
  12639. return [];
  12640. return Array.isArray(arr) ? arr : [arr];
  12641. };
  12642. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  12643. const rAF = (fn2) => isClient ? window.requestAnimationFrame(fn2) : setTimeout(fn2, 16);
  12644. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  12645. const generateId = () => Math.floor(Math.random() * 1e4);
  12646. const mutable = (val) => val;
  12647. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  12648. const LISTENER_PREFIX = /^on[A-Z]/;
  12649. const useAttrs = (params = {}) => {
  12650. const { excludeListeners = false, excludeKeys } = params;
  12651. const allExcludeKeys = computed(() => {
  12652. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  12653. });
  12654. const instance = getCurrentInstance();
  12655. if (!instance) {
  12656. return computed(() => ({}));
  12657. }
  12658. return computed(() => {
  12659. var _a2;
  12660. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  12661. });
  12662. };
  12663. const useDeprecated = ({ from, replacement, scope, version: version2, ref: ref2, type: type2 = "API" }, condition) => {
  12664. watch(() => unref(condition), (val) => {
  12665. }, {
  12666. immediate: true
  12667. });
  12668. };
  12669. const useDraggable = (targetRef, dragRef, draggable2) => {
  12670. let transform = {
  12671. offsetX: 0,
  12672. offsetY: 0
  12673. };
  12674. const onMousedown = (e) => {
  12675. const downX = e.clientX;
  12676. const downY = e.clientY;
  12677. const { offsetX, offsetY } = transform;
  12678. const targetRect = targetRef.value.getBoundingClientRect();
  12679. const targetLeft = targetRect.left;
  12680. const targetTop = targetRect.top;
  12681. const targetWidth = targetRect.width;
  12682. const targetHeight = targetRect.height;
  12683. const clientWidth = document.documentElement.clientWidth;
  12684. const clientHeight = document.documentElement.clientHeight;
  12685. const minLeft = -targetLeft + offsetX;
  12686. const minTop = -targetTop + offsetY;
  12687. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  12688. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  12689. const onMousemove = (e2) => {
  12690. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  12691. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  12692. transform = {
  12693. offsetX: moveX,
  12694. offsetY: moveY
  12695. };
  12696. if (targetRef.value) {
  12697. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  12698. }
  12699. };
  12700. const onMouseup = () => {
  12701. document.removeEventListener("mousemove", onMousemove);
  12702. document.removeEventListener("mouseup", onMouseup);
  12703. };
  12704. document.addEventListener("mousemove", onMousemove);
  12705. document.addEventListener("mouseup", onMouseup);
  12706. };
  12707. const onDraggable = () => {
  12708. if (dragRef.value && targetRef.value) {
  12709. dragRef.value.addEventListener("mousedown", onMousedown);
  12710. }
  12711. };
  12712. const offDraggable = () => {
  12713. if (dragRef.value && targetRef.value) {
  12714. dragRef.value.removeEventListener("mousedown", onMousedown);
  12715. }
  12716. };
  12717. onMounted(() => {
  12718. watchEffect(() => {
  12719. if (draggable2.value) {
  12720. onDraggable();
  12721. } else {
  12722. offDraggable();
  12723. }
  12724. });
  12725. });
  12726. onBeforeUnmount(() => {
  12727. offDraggable();
  12728. });
  12729. };
  12730. var English = {
  12731. name: "en",
  12732. el: {
  12733. colorpicker: {
  12734. confirm: "OK",
  12735. clear: "Clear",
  12736. defaultLabel: "color picker",
  12737. description: "current color is {color}. press enter to select a new color."
  12738. },
  12739. datepicker: {
  12740. now: "Now",
  12741. today: "Today",
  12742. cancel: "Cancel",
  12743. clear: "Clear",
  12744. confirm: "OK",
  12745. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  12746. monthTablePrompt: "Use the arrow keys and enter to select the month",
  12747. yearTablePrompt: "Use the arrow keys and enter to select the year",
  12748. selectedDate: "Selected date",
  12749. selectDate: "Select date",
  12750. selectTime: "Select time",
  12751. startDate: "Start Date",
  12752. startTime: "Start Time",
  12753. endDate: "End Date",
  12754. endTime: "End Time",
  12755. prevYear: "Previous Year",
  12756. nextYear: "Next Year",
  12757. prevMonth: "Previous Month",
  12758. nextMonth: "Next Month",
  12759. year: "",
  12760. month1: "January",
  12761. month2: "February",
  12762. month3: "March",
  12763. month4: "April",
  12764. month5: "May",
  12765. month6: "June",
  12766. month7: "July",
  12767. month8: "August",
  12768. month9: "September",
  12769. month10: "October",
  12770. month11: "November",
  12771. month12: "December",
  12772. week: "week",
  12773. weeks: {
  12774. sun: "Sun",
  12775. mon: "Mon",
  12776. tue: "Tue",
  12777. wed: "Wed",
  12778. thu: "Thu",
  12779. fri: "Fri",
  12780. sat: "Sat"
  12781. },
  12782. weeksFull: {
  12783. sun: "Sunday",
  12784. mon: "Monday",
  12785. tue: "Tuesday",
  12786. wed: "Wednesday",
  12787. thu: "Thursday",
  12788. fri: "Friday",
  12789. sat: "Saturday"
  12790. },
  12791. months: {
  12792. jan: "Jan",
  12793. feb: "Feb",
  12794. mar: "Mar",
  12795. apr: "Apr",
  12796. may: "May",
  12797. jun: "Jun",
  12798. jul: "Jul",
  12799. aug: "Aug",
  12800. sep: "Sep",
  12801. oct: "Oct",
  12802. nov: "Nov",
  12803. dec: "Dec"
  12804. }
  12805. },
  12806. inputNumber: {
  12807. decrease: "decrease number",
  12808. increase: "increase number"
  12809. },
  12810. select: {
  12811. loading: "Loading",
  12812. noMatch: "No matching data",
  12813. noData: "No data",
  12814. placeholder: "Select"
  12815. },
  12816. dropdown: {
  12817. toggleDropdown: "Toggle Dropdown"
  12818. },
  12819. cascader: {
  12820. noMatch: "No matching data",
  12821. loading: "Loading",
  12822. placeholder: "Select",
  12823. noData: "No data"
  12824. },
  12825. pagination: {
  12826. goto: "Go to",
  12827. pagesize: "/page",
  12828. total: "Total {total}",
  12829. pageClassifier: "",
  12830. page: "Page",
  12831. prev: "Go to previous page",
  12832. next: "Go to next page",
  12833. currentPage: "page {pager}",
  12834. prevPages: "Previous {pager} pages",
  12835. nextPages: "Next {pager} pages",
  12836. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  12837. },
  12838. dialog: {
  12839. close: "Close this dialog"
  12840. },
  12841. drawer: {
  12842. close: "Close this dialog"
  12843. },
  12844. messagebox: {
  12845. title: "Message",
  12846. confirm: "OK",
  12847. cancel: "Cancel",
  12848. error: "Illegal input",
  12849. close: "Close this dialog"
  12850. },
  12851. upload: {
  12852. deleteTip: "press delete to remove",
  12853. delete: "Delete",
  12854. preview: "Preview",
  12855. continue: "Continue"
  12856. },
  12857. slider: {
  12858. defaultLabel: "slider between {min} and {max}",
  12859. defaultRangeStartLabel: "pick start value",
  12860. defaultRangeEndLabel: "pick end value"
  12861. },
  12862. table: {
  12863. emptyText: "No Data",
  12864. confirmFilter: "Confirm",
  12865. resetFilter: "Reset",
  12866. clearFilter: "All",
  12867. sumText: "Sum"
  12868. },
  12869. tree: {
  12870. emptyText: "No Data"
  12871. },
  12872. transfer: {
  12873. noMatch: "No matching data",
  12874. noData: "No data",
  12875. titles: ["List 1", "List 2"],
  12876. filterPlaceholder: "Enter keyword",
  12877. noCheckedFormat: "{total} items",
  12878. hasCheckedFormat: "{checked}/{total} checked"
  12879. },
  12880. image: {
  12881. error: "FAILED"
  12882. },
  12883. pageHeader: {
  12884. title: "Back"
  12885. },
  12886. popconfirm: {
  12887. confirmButtonText: "Yes",
  12888. cancelButtonText: "No"
  12889. }
  12890. }
  12891. };
  12892. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  12893. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  12894. var _a2;
  12895. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  12896. });
  12897. const buildLocaleContext = (locale) => {
  12898. const lang = computed(() => unref(locale).name);
  12899. const localeRef = isRef(locale) ? locale : ref(locale);
  12900. return {
  12901. lang,
  12902. locale: localeRef,
  12903. t: buildTranslator(locale)
  12904. };
  12905. };
  12906. const localeContextKey = Symbol("localeContextKey");
  12907. const useLocale = (localeOverrides) => {
  12908. const locale = localeOverrides || inject(localeContextKey, ref());
  12909. return buildLocaleContext(computed(() => locale.value || English));
  12910. };
  12911. const defaultNamespace = "el";
  12912. const statePrefix = "is-";
  12913. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  12914. let cls = `${namespace}-${block}`;
  12915. if (blockSuffix) {
  12916. cls += `-${blockSuffix}`;
  12917. }
  12918. if (element) {
  12919. cls += `__${element}`;
  12920. }
  12921. if (modifier) {
  12922. cls += `--${modifier}`;
  12923. }
  12924. return cls;
  12925. };
  12926. const namespaceContextKey = Symbol("namespaceContextKey");
  12927. const useGetDerivedNamespace = (namespaceOverrides) => {
  12928. const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
  12929. const namespace = computed(() => {
  12930. return unref(derivedNamespace) || defaultNamespace;
  12931. });
  12932. return namespace;
  12933. };
  12934. const useNamespace = (block, namespaceOverrides) => {
  12935. const namespace = useGetDerivedNamespace(namespaceOverrides);
  12936. const b2 = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  12937. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  12938. const m2 = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  12939. const be2 = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  12940. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  12941. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  12942. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  12943. const is = (name, ...args) => {
  12944. const state = args.length >= 1 ? args[0] : true;
  12945. return name && state ? `${statePrefix}${name}` : "";
  12946. };
  12947. const cssVar = (object2) => {
  12948. const styles = {};
  12949. for (const key in object2) {
  12950. if (object2[key]) {
  12951. styles[`--${namespace.value}-${key}`] = object2[key];
  12952. }
  12953. }
  12954. return styles;
  12955. };
  12956. const cssVarBlock = (object2) => {
  12957. const styles = {};
  12958. for (const key in object2) {
  12959. if (object2[key]) {
  12960. styles[`--${namespace.value}-${block}-${key}`] = object2[key];
  12961. }
  12962. }
  12963. return styles;
  12964. };
  12965. const cssVarName = (name) => `--${namespace.value}-${name}`;
  12966. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  12967. return {
  12968. namespace,
  12969. b: b2,
  12970. e,
  12971. m: m2,
  12972. be: be2,
  12973. em,
  12974. bm,
  12975. bem,
  12976. is,
  12977. cssVar,
  12978. cssVarName,
  12979. cssVarBlock,
  12980. cssVarBlockName
  12981. };
  12982. };
  12983. const useLockscreen = (trigger2, options = {}) => {
  12984. if (!isRef(trigger2)) {
  12985. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  12986. }
  12987. const ns = options.ns || useNamespace("popup");
  12988. const hiddenCls = computed$1(() => ns.bm("parent", "hidden"));
  12989. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  12990. return;
  12991. }
  12992. let scrollBarWidth2 = 0;
  12993. let withoutHiddenClass = false;
  12994. let bodyWidth = "0";
  12995. const cleanup = () => {
  12996. setTimeout(() => {
  12997. removeClass(document == null ? void 0 : document.body, hiddenCls.value);
  12998. if (withoutHiddenClass && document) {
  12999. document.body.style.width = bodyWidth;
  13000. }
  13001. }, 200);
  13002. };
  13003. watch(trigger2, (val) => {
  13004. if (!val) {
  13005. cleanup();
  13006. return;
  13007. }
  13008. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  13009. if (withoutHiddenClass) {
  13010. bodyWidth = document.body.style.width;
  13011. }
  13012. scrollBarWidth2 = getScrollBarWidth(ns.namespace.value);
  13013. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  13014. const bodyOverflowY = getStyle(document.body, "overflowY");
  13015. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  13016. document.body.style.width = `calc(100% - ${scrollBarWidth2}px)`;
  13017. }
  13018. addClass(document.body, hiddenCls.value);
  13019. });
  13020. onScopeDispose(() => cleanup());
  13021. };
  13022. const _prop = buildProp({
  13023. type: definePropType(Boolean),
  13024. default: null
  13025. });
  13026. const _event = buildProp({
  13027. type: definePropType(Function)
  13028. });
  13029. const createModelToggleComposable = (name) => {
  13030. const updateEventKey = `update:${name}`;
  13031. const updateEventKeyRaw2 = `onUpdate:${name}`;
  13032. const useModelToggleEmits2 = [updateEventKey];
  13033. const useModelToggleProps2 = {
  13034. [name]: _prop,
  13035. [updateEventKeyRaw2]: _event
  13036. };
  13037. const useModelToggle2 = ({
  13038. indicator,
  13039. toggleReason,
  13040. shouldHideWhenRouteChanges,
  13041. shouldProceed,
  13042. onShow,
  13043. onHide
  13044. }) => {
  13045. const instance = getCurrentInstance();
  13046. const { emit: emit2 } = instance;
  13047. const props = instance.props;
  13048. const hasUpdateHandler = computed(() => isFunction$2(props[updateEventKeyRaw2]));
  13049. const isModelBindingAbsent = computed(() => props[name] === null);
  13050. const doShow = (event) => {
  13051. if (indicator.value === true) {
  13052. return;
  13053. }
  13054. indicator.value = true;
  13055. if (toggleReason) {
  13056. toggleReason.value = event;
  13057. }
  13058. if (isFunction$2(onShow)) {
  13059. onShow(event);
  13060. }
  13061. };
  13062. const doHide = (event) => {
  13063. if (indicator.value === false) {
  13064. return;
  13065. }
  13066. indicator.value = false;
  13067. if (toggleReason) {
  13068. toggleReason.value = event;
  13069. }
  13070. if (isFunction$2(onHide)) {
  13071. onHide(event);
  13072. }
  13073. };
  13074. const show = (event) => {
  13075. if (props.disabled === true || isFunction$2(shouldProceed) && !shouldProceed())
  13076. return;
  13077. const shouldEmit = hasUpdateHandler.value && isClient;
  13078. if (shouldEmit) {
  13079. emit2(updateEventKey, true);
  13080. }
  13081. if (isModelBindingAbsent.value || !shouldEmit) {
  13082. doShow(event);
  13083. }
  13084. };
  13085. const hide = (event) => {
  13086. if (props.disabled === true || !isClient)
  13087. return;
  13088. const shouldEmit = hasUpdateHandler.value && isClient;
  13089. if (shouldEmit) {
  13090. emit2(updateEventKey, false);
  13091. }
  13092. if (isModelBindingAbsent.value || !shouldEmit) {
  13093. doHide(event);
  13094. }
  13095. };
  13096. const onChange = (val) => {
  13097. if (!isBoolean(val))
  13098. return;
  13099. if (props.disabled && val) {
  13100. if (hasUpdateHandler.value) {
  13101. emit2(updateEventKey, false);
  13102. }
  13103. } else if (indicator.value !== val) {
  13104. if (val) {
  13105. doShow();
  13106. } else {
  13107. doHide();
  13108. }
  13109. }
  13110. };
  13111. const toggle = () => {
  13112. if (indicator.value) {
  13113. hide();
  13114. } else {
  13115. show();
  13116. }
  13117. };
  13118. watch(() => props[name], onChange);
  13119. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  13120. watch(() => ({
  13121. ...instance.proxy.$route
  13122. }), () => {
  13123. if (shouldHideWhenRouteChanges.value && indicator.value) {
  13124. hide();
  13125. }
  13126. });
  13127. }
  13128. onMounted(() => {
  13129. onChange(props[name]);
  13130. });
  13131. return {
  13132. hide,
  13133. show,
  13134. toggle,
  13135. hasUpdateHandler
  13136. };
  13137. };
  13138. return {
  13139. useModelToggle: useModelToggle2,
  13140. useModelToggleProps: useModelToggleProps2,
  13141. useModelToggleEmits: useModelToggleEmits2
  13142. };
  13143. };
  13144. createModelToggleComposable("modelValue");
  13145. const useProp = (name) => {
  13146. const vm = getCurrentInstance();
  13147. return computed(() => {
  13148. var _a2, _b;
  13149. return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
  13150. });
  13151. };
  13152. var E$1 = "top", R = "bottom", W = "right", P$1 = "left", me = "auto", G = [E$1, R, W, P$1], U$1 = "start", J = "end", Xe = "clippingParents", je = "viewport", K = "popper", Ye = "reference", De = G.reduce(function(t, e) {
  13153. return t.concat([e + "-" + U$1, e + "-" + J]);
  13154. }, []), Ee = [].concat(G, [me]).reduce(function(t, e) {
  13155. return t.concat([e, e + "-" + U$1, e + "-" + J]);
  13156. }, []), Ge = "beforeRead", Je = "read", Ke = "afterRead", Qe = "beforeMain", Ze = "main", et = "afterMain", tt = "beforeWrite", nt = "write", rt = "afterWrite", ot = [Ge, Je, Ke, Qe, Ze, et, tt, nt, rt];
  13157. function C(t) {
  13158. return t ? (t.nodeName || "").toLowerCase() : null;
  13159. }
  13160. function H(t) {
  13161. if (t == null)
  13162. return window;
  13163. if (t.toString() !== "[object Window]") {
  13164. var e = t.ownerDocument;
  13165. return e && e.defaultView || window;
  13166. }
  13167. return t;
  13168. }
  13169. function Q(t) {
  13170. var e = H(t).Element;
  13171. return t instanceof e || t instanceof Element;
  13172. }
  13173. function B(t) {
  13174. var e = H(t).HTMLElement;
  13175. return t instanceof e || t instanceof HTMLElement;
  13176. }
  13177. function Pe(t) {
  13178. if (typeof ShadowRoot == "undefined")
  13179. return false;
  13180. var e = H(t).ShadowRoot;
  13181. return t instanceof e || t instanceof ShadowRoot;
  13182. }
  13183. function Mt(t) {
  13184. var e = t.state;
  13185. Object.keys(e.elements).forEach(function(n) {
  13186. var r = e.styles[n] || {}, o2 = e.attributes[n] || {}, i = e.elements[n];
  13187. !B(i) || !C(i) || (Object.assign(i.style, r), Object.keys(o2).forEach(function(a2) {
  13188. var s2 = o2[a2];
  13189. s2 === false ? i.removeAttribute(a2) : i.setAttribute(a2, s2 === true ? "" : s2);
  13190. }));
  13191. });
  13192. }
  13193. function Rt(t) {
  13194. var e = t.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
  13195. return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
  13196. Object.keys(e.elements).forEach(function(r) {
  13197. var o2 = e.elements[r], i = e.attributes[r] || {}, a2 = Object.keys(e.styles.hasOwnProperty(r) ? e.styles[r] : n[r]), s2 = a2.reduce(function(f2, c2) {
  13198. return f2[c2] = "", f2;
  13199. }, {});
  13200. !B(o2) || !C(o2) || (Object.assign(o2.style, s2), Object.keys(i).forEach(function(f2) {
  13201. o2.removeAttribute(f2);
  13202. }));
  13203. });
  13204. };
  13205. }
  13206. var Ae = { name: "applyStyles", enabled: true, phase: "write", fn: Mt, effect: Rt, requires: ["computeStyles"] };
  13207. function q(t) {
  13208. return t.split("-")[0];
  13209. }
  13210. var X$1 = Math.max, ve = Math.min, Z = Math.round;
  13211. function ee(t, e) {
  13212. e === void 0 && (e = false);
  13213. var n = t.getBoundingClientRect(), r = 1, o2 = 1;
  13214. if (B(t) && e) {
  13215. var i = t.offsetHeight, a2 = t.offsetWidth;
  13216. a2 > 0 && (r = Z(n.width) / a2 || 1), i > 0 && (o2 = Z(n.height) / i || 1);
  13217. }
  13218. return { width: n.width / r, height: n.height / o2, top: n.top / o2, right: n.right / r, bottom: n.bottom / o2, left: n.left / r, x: n.left / r, y: n.top / o2 };
  13219. }
  13220. function ke(t) {
  13221. var e = ee(t), n = t.offsetWidth, r = t.offsetHeight;
  13222. return Math.abs(e.width - n) <= 1 && (n = e.width), Math.abs(e.height - r) <= 1 && (r = e.height), { x: t.offsetLeft, y: t.offsetTop, width: n, height: r };
  13223. }
  13224. function it(t, e) {
  13225. var n = e.getRootNode && e.getRootNode();
  13226. if (t.contains(e))
  13227. return true;
  13228. if (n && Pe(n)) {
  13229. var r = e;
  13230. do {
  13231. if (r && t.isSameNode(r))
  13232. return true;
  13233. r = r.parentNode || r.host;
  13234. } while (r);
  13235. }
  13236. return false;
  13237. }
  13238. function N$1(t) {
  13239. return H(t).getComputedStyle(t);
  13240. }
  13241. function Wt(t) {
  13242. return ["table", "td", "th"].indexOf(C(t)) >= 0;
  13243. }
  13244. function I$1(t) {
  13245. return ((Q(t) ? t.ownerDocument : t.document) || window.document).documentElement;
  13246. }
  13247. function ge(t) {
  13248. return C(t) === "html" ? t : t.assignedSlot || t.parentNode || (Pe(t) ? t.host : null) || I$1(t);
  13249. }
  13250. function at(t) {
  13251. return !B(t) || N$1(t).position === "fixed" ? null : t.offsetParent;
  13252. }
  13253. function Bt(t) {
  13254. var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1;
  13255. if (n && B(t)) {
  13256. var r = N$1(t);
  13257. if (r.position === "fixed")
  13258. return null;
  13259. }
  13260. var o2 = ge(t);
  13261. for (Pe(o2) && (o2 = o2.host); B(o2) && ["html", "body"].indexOf(C(o2)) < 0; ) {
  13262. var i = N$1(o2);
  13263. if (i.transform !== "none" || i.perspective !== "none" || i.contain === "paint" || ["transform", "perspective"].indexOf(i.willChange) !== -1 || e && i.willChange === "filter" || e && i.filter && i.filter !== "none")
  13264. return o2;
  13265. o2 = o2.parentNode;
  13266. }
  13267. return null;
  13268. }
  13269. function se(t) {
  13270. for (var e = H(t), n = at(t); n && Wt(n) && N$1(n).position === "static"; )
  13271. n = at(n);
  13272. return n && (C(n) === "html" || C(n) === "body" && N$1(n).position === "static") ? e : n || Bt(t) || e;
  13273. }
  13274. function Le(t) {
  13275. return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
  13276. }
  13277. function fe(t, e, n) {
  13278. return X$1(t, ve(e, n));
  13279. }
  13280. function St(t, e, n) {
  13281. var r = fe(t, e, n);
  13282. return r > n ? n : r;
  13283. }
  13284. function st() {
  13285. return { top: 0, right: 0, bottom: 0, left: 0 };
  13286. }
  13287. function ft(t) {
  13288. return Object.assign({}, st(), t);
  13289. }
  13290. function ct(t, e) {
  13291. return e.reduce(function(n, r) {
  13292. return n[r] = t, n;
  13293. }, {});
  13294. }
  13295. var Tt = function(t, e) {
  13296. return t = typeof t == "function" ? t(Object.assign({}, e.rects, { placement: e.placement })) : t, ft(typeof t != "number" ? t : ct(t, G));
  13297. };
  13298. function Ht(t) {
  13299. var e, n = t.state, r = t.name, o2 = t.options, i = n.elements.arrow, a2 = n.modifiersData.popperOffsets, s2 = q(n.placement), f2 = Le(s2), c2 = [P$1, W].indexOf(s2) >= 0, u2 = c2 ? "height" : "width";
  13300. if (!(!i || !a2)) {
  13301. var m2 = Tt(o2.padding, n), v2 = ke(i), l2 = f2 === "y" ? E$1 : P$1, h2 = f2 === "y" ? R : W, p2 = n.rects.reference[u2] + n.rects.reference[f2] - a2[f2] - n.rects.popper[u2], g = a2[f2] - n.rects.reference[f2], x2 = se(i), y = x2 ? f2 === "y" ? x2.clientHeight || 0 : x2.clientWidth || 0 : 0, $ = p2 / 2 - g / 2, d2 = m2[l2], b2 = y - v2[u2] - m2[h2], w2 = y / 2 - v2[u2] / 2 + $, O2 = fe(d2, w2, b2), j = f2;
  13302. n.modifiersData[r] = (e = {}, e[j] = O2, e.centerOffset = O2 - w2, e);
  13303. }
  13304. }
  13305. function Ct(t) {
  13306. var e = t.state, n = t.options, r = n.element, o2 = r === void 0 ? "[data-popper-arrow]" : r;
  13307. o2 != null && (typeof o2 == "string" && (o2 = e.elements.popper.querySelector(o2), !o2) || !it(e.elements.popper, o2) || (e.elements.arrow = o2));
  13308. }
  13309. var pt = { name: "arrow", enabled: true, phase: "main", fn: Ht, effect: Ct, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
  13310. function te(t) {
  13311. return t.split("-")[1];
  13312. }
  13313. var qt = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
  13314. function Vt(t) {
  13315. var e = t.x, n = t.y, r = window, o2 = r.devicePixelRatio || 1;
  13316. return { x: Z(e * o2) / o2 || 0, y: Z(n * o2) / o2 || 0 };
  13317. }
  13318. function ut(t) {
  13319. var e, n = t.popper, r = t.popperRect, o2 = t.placement, i = t.variation, a2 = t.offsets, s2 = t.position, f2 = t.gpuAcceleration, c2 = t.adaptive, u2 = t.roundOffsets, m2 = t.isFixed, v2 = a2.x, l2 = v2 === void 0 ? 0 : v2, h2 = a2.y, p2 = h2 === void 0 ? 0 : h2, g = typeof u2 == "function" ? u2({ x: l2, y: p2 }) : { x: l2, y: p2 };
  13320. l2 = g.x, p2 = g.y;
  13321. var x2 = a2.hasOwnProperty("x"), y = a2.hasOwnProperty("y"), $ = P$1, d2 = E$1, b2 = window;
  13322. if (c2) {
  13323. var w2 = se(n), O2 = "clientHeight", j = "clientWidth";
  13324. if (w2 === H(n) && (w2 = I$1(n), N$1(w2).position !== "static" && s2 === "absolute" && (O2 = "scrollHeight", j = "scrollWidth")), w2 = w2, o2 === E$1 || (o2 === P$1 || o2 === W) && i === J) {
  13325. d2 = R;
  13326. var A2 = m2 && w2 === b2 && b2.visualViewport ? b2.visualViewport.height : w2[O2];
  13327. p2 -= A2 - r.height, p2 *= f2 ? 1 : -1;
  13328. }
  13329. if (o2 === P$1 || (o2 === E$1 || o2 === R) && i === J) {
  13330. $ = W;
  13331. var k = m2 && w2 === b2 && b2.visualViewport ? b2.visualViewport.width : w2[j];
  13332. l2 -= k - r.width, l2 *= f2 ? 1 : -1;
  13333. }
  13334. }
  13335. var D2 = Object.assign({ position: s2 }, c2 && qt), S2 = u2 === true ? Vt({ x: l2, y: p2 }) : { x: l2, y: p2 };
  13336. if (l2 = S2.x, p2 = S2.y, f2) {
  13337. var L;
  13338. return Object.assign({}, D2, (L = {}, L[d2] = y ? "0" : "", L[$] = x2 ? "0" : "", L.transform = (b2.devicePixelRatio || 1) <= 1 ? "translate(" + l2 + "px, " + p2 + "px)" : "translate3d(" + l2 + "px, " + p2 + "px, 0)", L));
  13339. }
  13340. return Object.assign({}, D2, (e = {}, e[d2] = y ? p2 + "px" : "", e[$] = x2 ? l2 + "px" : "", e.transform = "", e));
  13341. }
  13342. function Nt(t) {
  13343. var e = t.state, n = t.options, r = n.gpuAcceleration, o2 = r === void 0 ? true : r, i = n.adaptive, a2 = i === void 0 ? true : i, s2 = n.roundOffsets, f2 = s2 === void 0 ? true : s2, c2 = { placement: q(e.placement), variation: te(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: o2, isFixed: e.options.strategy === "fixed" };
  13344. e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, ut(Object.assign({}, c2, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: a2, roundOffsets: f2 })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, ut(Object.assign({}, c2, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: f2 })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
  13345. }
  13346. var Me = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Nt, data: {} }, ye = { passive: true };
  13347. function It(t) {
  13348. var e = t.state, n = t.instance, r = t.options, o2 = r.scroll, i = o2 === void 0 ? true : o2, a2 = r.resize, s2 = a2 === void 0 ? true : a2, f2 = H(e.elements.popper), c2 = [].concat(e.scrollParents.reference, e.scrollParents.popper);
  13349. return i && c2.forEach(function(u2) {
  13350. u2.addEventListener("scroll", n.update, ye);
  13351. }), s2 && f2.addEventListener("resize", n.update, ye), function() {
  13352. i && c2.forEach(function(u2) {
  13353. u2.removeEventListener("scroll", n.update, ye);
  13354. }), s2 && f2.removeEventListener("resize", n.update, ye);
  13355. };
  13356. }
  13357. var Re = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
  13358. }, effect: It, data: {} }, _t = { left: "right", right: "left", bottom: "top", top: "bottom" };
  13359. function be(t) {
  13360. return t.replace(/left|right|bottom|top/g, function(e) {
  13361. return _t[e];
  13362. });
  13363. }
  13364. var zt = { start: "end", end: "start" };
  13365. function lt(t) {
  13366. return t.replace(/start|end/g, function(e) {
  13367. return zt[e];
  13368. });
  13369. }
  13370. function We(t) {
  13371. var e = H(t), n = e.pageXOffset, r = e.pageYOffset;
  13372. return { scrollLeft: n, scrollTop: r };
  13373. }
  13374. function Be(t) {
  13375. return ee(I$1(t)).left + We(t).scrollLeft;
  13376. }
  13377. function Ft(t) {
  13378. var e = H(t), n = I$1(t), r = e.visualViewport, o2 = n.clientWidth, i = n.clientHeight, a2 = 0, s2 = 0;
  13379. return r && (o2 = r.width, i = r.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (a2 = r.offsetLeft, s2 = r.offsetTop)), { width: o2, height: i, x: a2 + Be(t), y: s2 };
  13380. }
  13381. function Ut(t) {
  13382. var e, n = I$1(t), r = We(t), o2 = (e = t.ownerDocument) == null ? void 0 : e.body, i = X$1(n.scrollWidth, n.clientWidth, o2 ? o2.scrollWidth : 0, o2 ? o2.clientWidth : 0), a2 = X$1(n.scrollHeight, n.clientHeight, o2 ? o2.scrollHeight : 0, o2 ? o2.clientHeight : 0), s2 = -r.scrollLeft + Be(t), f2 = -r.scrollTop;
  13383. return N$1(o2 || n).direction === "rtl" && (s2 += X$1(n.clientWidth, o2 ? o2.clientWidth : 0) - i), { width: i, height: a2, x: s2, y: f2 };
  13384. }
  13385. function Se(t) {
  13386. var e = N$1(t), n = e.overflow, r = e.overflowX, o2 = e.overflowY;
  13387. return /auto|scroll|overlay|hidden/.test(n + o2 + r);
  13388. }
  13389. function dt(t) {
  13390. return ["html", "body", "#document"].indexOf(C(t)) >= 0 ? t.ownerDocument.body : B(t) && Se(t) ? t : dt(ge(t));
  13391. }
  13392. function ce(t, e) {
  13393. var n;
  13394. e === void 0 && (e = []);
  13395. var r = dt(t), o2 = r === ((n = t.ownerDocument) == null ? void 0 : n.body), i = H(r), a2 = o2 ? [i].concat(i.visualViewport || [], Se(r) ? r : []) : r, s2 = e.concat(a2);
  13396. return o2 ? s2 : s2.concat(ce(ge(a2)));
  13397. }
  13398. function Te(t) {
  13399. return Object.assign({}, t, { left: t.x, top: t.y, right: t.x + t.width, bottom: t.y + t.height });
  13400. }
  13401. function Xt(t) {
  13402. var e = ee(t);
  13403. return e.top = e.top + t.clientTop, e.left = e.left + t.clientLeft, e.bottom = e.top + t.clientHeight, e.right = e.left + t.clientWidth, e.width = t.clientWidth, e.height = t.clientHeight, e.x = e.left, e.y = e.top, e;
  13404. }
  13405. function ht(t, e) {
  13406. return e === je ? Te(Ft(t)) : Q(e) ? Xt(e) : Te(Ut(I$1(t)));
  13407. }
  13408. function Yt(t) {
  13409. var e = ce(ge(t)), n = ["absolute", "fixed"].indexOf(N$1(t).position) >= 0, r = n && B(t) ? se(t) : t;
  13410. return Q(r) ? e.filter(function(o2) {
  13411. return Q(o2) && it(o2, r) && C(o2) !== "body";
  13412. }) : [];
  13413. }
  13414. function Gt(t, e, n) {
  13415. var r = e === "clippingParents" ? Yt(t) : [].concat(e), o2 = [].concat(r, [n]), i = o2[0], a2 = o2.reduce(function(s2, f2) {
  13416. var c2 = ht(t, f2);
  13417. return s2.top = X$1(c2.top, s2.top), s2.right = ve(c2.right, s2.right), s2.bottom = ve(c2.bottom, s2.bottom), s2.left = X$1(c2.left, s2.left), s2;
  13418. }, ht(t, i));
  13419. return a2.width = a2.right - a2.left, a2.height = a2.bottom - a2.top, a2.x = a2.left, a2.y = a2.top, a2;
  13420. }
  13421. function mt(t) {
  13422. var e = t.reference, n = t.element, r = t.placement, o2 = r ? q(r) : null, i = r ? te(r) : null, a2 = e.x + e.width / 2 - n.width / 2, s2 = e.y + e.height / 2 - n.height / 2, f2;
  13423. switch (o2) {
  13424. case E$1:
  13425. f2 = { x: a2, y: e.y - n.height };
  13426. break;
  13427. case R:
  13428. f2 = { x: a2, y: e.y + e.height };
  13429. break;
  13430. case W:
  13431. f2 = { x: e.x + e.width, y: s2 };
  13432. break;
  13433. case P$1:
  13434. f2 = { x: e.x - n.width, y: s2 };
  13435. break;
  13436. default:
  13437. f2 = { x: e.x, y: e.y };
  13438. }
  13439. var c2 = o2 ? Le(o2) : null;
  13440. if (c2 != null) {
  13441. var u2 = c2 === "y" ? "height" : "width";
  13442. switch (i) {
  13443. case U$1:
  13444. f2[c2] = f2[c2] - (e[u2] / 2 - n[u2] / 2);
  13445. break;
  13446. case J:
  13447. f2[c2] = f2[c2] + (e[u2] / 2 - n[u2] / 2);
  13448. break;
  13449. }
  13450. }
  13451. return f2;
  13452. }
  13453. function ne(t, e) {
  13454. e === void 0 && (e = {});
  13455. var n = e, r = n.placement, o2 = r === void 0 ? t.placement : r, i = n.boundary, a2 = i === void 0 ? Xe : i, s2 = n.rootBoundary, f2 = s2 === void 0 ? je : s2, c2 = n.elementContext, u2 = c2 === void 0 ? K : c2, m2 = n.altBoundary, v2 = m2 === void 0 ? false : m2, l2 = n.padding, h2 = l2 === void 0 ? 0 : l2, p2 = ft(typeof h2 != "number" ? h2 : ct(h2, G)), g = u2 === K ? Ye : K, x2 = t.rects.popper, y = t.elements[v2 ? g : u2], $ = Gt(Q(y) ? y : y.contextElement || I$1(t.elements.popper), a2, f2), d2 = ee(t.elements.reference), b2 = mt({ reference: d2, element: x2, strategy: "absolute", placement: o2 }), w2 = Te(Object.assign({}, x2, b2)), O2 = u2 === K ? w2 : d2, j = { top: $.top - O2.top + p2.top, bottom: O2.bottom - $.bottom + p2.bottom, left: $.left - O2.left + p2.left, right: O2.right - $.right + p2.right }, A2 = t.modifiersData.offset;
  13456. if (u2 === K && A2) {
  13457. var k = A2[o2];
  13458. Object.keys(j).forEach(function(D2) {
  13459. var S2 = [W, R].indexOf(D2) >= 0 ? 1 : -1, L = [E$1, R].indexOf(D2) >= 0 ? "y" : "x";
  13460. j[D2] += k[L] * S2;
  13461. });
  13462. }
  13463. return j;
  13464. }
  13465. function Jt(t, e) {
  13466. e === void 0 && (e = {});
  13467. var n = e, r = n.placement, o2 = n.boundary, i = n.rootBoundary, a2 = n.padding, s2 = n.flipVariations, f2 = n.allowedAutoPlacements, c2 = f2 === void 0 ? Ee : f2, u2 = te(r), m2 = u2 ? s2 ? De : De.filter(function(h2) {
  13468. return te(h2) === u2;
  13469. }) : G, v2 = m2.filter(function(h2) {
  13470. return c2.indexOf(h2) >= 0;
  13471. });
  13472. v2.length === 0 && (v2 = m2);
  13473. var l2 = v2.reduce(function(h2, p2) {
  13474. return h2[p2] = ne(t, { placement: p2, boundary: o2, rootBoundary: i, padding: a2 })[q(p2)], h2;
  13475. }, {});
  13476. return Object.keys(l2).sort(function(h2, p2) {
  13477. return l2[h2] - l2[p2];
  13478. });
  13479. }
  13480. function Kt(t) {
  13481. if (q(t) === me)
  13482. return [];
  13483. var e = be(t);
  13484. return [lt(t), e, lt(e)];
  13485. }
  13486. function Qt(t) {
  13487. var e = t.state, n = t.options, r = t.name;
  13488. if (!e.modifiersData[r]._skip) {
  13489. for (var o2 = n.mainAxis, i = o2 === void 0 ? true : o2, a2 = n.altAxis, s2 = a2 === void 0 ? true : a2, f2 = n.fallbackPlacements, c2 = n.padding, u2 = n.boundary, m2 = n.rootBoundary, v2 = n.altBoundary, l2 = n.flipVariations, h2 = l2 === void 0 ? true : l2, p2 = n.allowedAutoPlacements, g = e.options.placement, x2 = q(g), y = x2 === g, $ = f2 || (y || !h2 ? [be(g)] : Kt(g)), d2 = [g].concat($).reduce(function(z, V) {
  13490. return z.concat(q(V) === me ? Jt(e, { placement: V, boundary: u2, rootBoundary: m2, padding: c2, flipVariations: h2, allowedAutoPlacements: p2 }) : V);
  13491. }, []), b2 = e.rects.reference, w2 = e.rects.popper, O2 = /* @__PURE__ */ new Map(), j = true, A2 = d2[0], k = 0; k < d2.length; k++) {
  13492. var D2 = d2[k], S2 = q(D2), L = te(D2) === U$1, re = [E$1, R].indexOf(S2) >= 0, oe = re ? "width" : "height", M2 = ne(e, { placement: D2, boundary: u2, rootBoundary: m2, altBoundary: v2, padding: c2 }), T2 = re ? L ? W : P$1 : L ? R : E$1;
  13493. b2[oe] > w2[oe] && (T2 = be(T2));
  13494. var pe = be(T2), _2 = [];
  13495. if (i && _2.push(M2[S2] <= 0), s2 && _2.push(M2[T2] <= 0, M2[pe] <= 0), _2.every(function(z) {
  13496. return z;
  13497. })) {
  13498. A2 = D2, j = false;
  13499. break;
  13500. }
  13501. O2.set(D2, _2);
  13502. }
  13503. if (j)
  13504. for (var ue = h2 ? 3 : 1, xe = function(z) {
  13505. var V = d2.find(function(de) {
  13506. var ae = O2.get(de);
  13507. if (ae)
  13508. return ae.slice(0, z).every(function(Y2) {
  13509. return Y2;
  13510. });
  13511. });
  13512. if (V)
  13513. return A2 = V, "break";
  13514. }, ie = ue; ie > 0; ie--) {
  13515. var le = xe(ie);
  13516. if (le === "break")
  13517. break;
  13518. }
  13519. e.placement !== A2 && (e.modifiersData[r]._skip = true, e.placement = A2, e.reset = true);
  13520. }
  13521. }
  13522. var vt = { name: "flip", enabled: true, phase: "main", fn: Qt, requiresIfExists: ["offset"], data: { _skip: false } };
  13523. function gt(t, e, n) {
  13524. return n === void 0 && (n = { x: 0, y: 0 }), { top: t.top - e.height - n.y, right: t.right - e.width + n.x, bottom: t.bottom - e.height + n.y, left: t.left - e.width - n.x };
  13525. }
  13526. function yt(t) {
  13527. return [E$1, W, R, P$1].some(function(e) {
  13528. return t[e] >= 0;
  13529. });
  13530. }
  13531. function Zt(t) {
  13532. var e = t.state, n = t.name, r = e.rects.reference, o2 = e.rects.popper, i = e.modifiersData.preventOverflow, a2 = ne(e, { elementContext: "reference" }), s2 = ne(e, { altBoundary: true }), f2 = gt(a2, r), c2 = gt(s2, o2, i), u2 = yt(f2), m2 = yt(c2);
  13533. e.modifiersData[n] = { referenceClippingOffsets: f2, popperEscapeOffsets: c2, isReferenceHidden: u2, hasPopperEscaped: m2 }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": u2, "data-popper-escaped": m2 });
  13534. }
  13535. var bt = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: Zt };
  13536. function en(t, e, n) {
  13537. var r = q(t), o2 = [P$1, E$1].indexOf(r) >= 0 ? -1 : 1, i = typeof n == "function" ? n(Object.assign({}, e, { placement: t })) : n, a2 = i[0], s2 = i[1];
  13538. return a2 = a2 || 0, s2 = (s2 || 0) * o2, [P$1, W].indexOf(r) >= 0 ? { x: s2, y: a2 } : { x: a2, y: s2 };
  13539. }
  13540. function tn(t) {
  13541. var e = t.state, n = t.options, r = t.name, o2 = n.offset, i = o2 === void 0 ? [0, 0] : o2, a2 = Ee.reduce(function(u2, m2) {
  13542. return u2[m2] = en(m2, e.rects, i), u2;
  13543. }, {}), s2 = a2[e.placement], f2 = s2.x, c2 = s2.y;
  13544. e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += f2, e.modifiersData.popperOffsets.y += c2), e.modifiersData[r] = a2;
  13545. }
  13546. var wt = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: tn };
  13547. function nn(t) {
  13548. var e = t.state, n = t.name;
  13549. e.modifiersData[n] = mt({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
  13550. }
  13551. var He = { name: "popperOffsets", enabled: true, phase: "read", fn: nn, data: {} };
  13552. function rn(t) {
  13553. return t === "x" ? "y" : "x";
  13554. }
  13555. function on(t) {
  13556. var e = t.state, n = t.options, r = t.name, o2 = n.mainAxis, i = o2 === void 0 ? true : o2, a2 = n.altAxis, s2 = a2 === void 0 ? false : a2, f2 = n.boundary, c2 = n.rootBoundary, u2 = n.altBoundary, m2 = n.padding, v2 = n.tether, l2 = v2 === void 0 ? true : v2, h2 = n.tetherOffset, p2 = h2 === void 0 ? 0 : h2, g = ne(e, { boundary: f2, rootBoundary: c2, padding: m2, altBoundary: u2 }), x2 = q(e.placement), y = te(e.placement), $ = !y, d2 = Le(x2), b2 = rn(d2), w2 = e.modifiersData.popperOffsets, O2 = e.rects.reference, j = e.rects.popper, A2 = typeof p2 == "function" ? p2(Object.assign({}, e.rects, { placement: e.placement })) : p2, k = typeof A2 == "number" ? { mainAxis: A2, altAxis: A2 } : Object.assign({ mainAxis: 0, altAxis: 0 }, A2), D2 = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, S2 = { x: 0, y: 0 };
  13557. if (w2) {
  13558. if (i) {
  13559. var L, re = d2 === "y" ? E$1 : P$1, oe = d2 === "y" ? R : W, M2 = d2 === "y" ? "height" : "width", T2 = w2[d2], pe = T2 + g[re], _2 = T2 - g[oe], ue = l2 ? -j[M2] / 2 : 0, xe = y === U$1 ? O2[M2] : j[M2], ie = y === U$1 ? -j[M2] : -O2[M2], le = e.elements.arrow, z = l2 && le ? ke(le) : { width: 0, height: 0 }, V = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : st(), de = V[re], ae = V[oe], Y2 = fe(0, O2[M2], z[M2]), jt = $ ? O2[M2] / 2 - ue - Y2 - de - k.mainAxis : xe - Y2 - de - k.mainAxis, Dt = $ ? -O2[M2] / 2 + ue + Y2 + ae + k.mainAxis : ie + Y2 + ae + k.mainAxis, Oe = e.elements.arrow && se(e.elements.arrow), Et = Oe ? d2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (L = D2 == null ? void 0 : D2[d2]) != null ? L : 0, Pt = T2 + jt - Ce - Et, At = T2 + Dt - Ce, qe = fe(l2 ? ve(pe, Pt) : pe, T2, l2 ? X$1(_2, At) : _2);
  13560. w2[d2] = qe, S2[d2] = qe - T2;
  13561. }
  13562. if (s2) {
  13563. var Ve, kt = d2 === "x" ? E$1 : P$1, Lt = d2 === "x" ? R : W, F2 = w2[b2], he = b2 === "y" ? "height" : "width", Ne = F2 + g[kt], Ie = F2 - g[Lt], $e = [E$1, P$1].indexOf(x2) !== -1, _e = (Ve = D2 == null ? void 0 : D2[b2]) != null ? Ve : 0, ze = $e ? Ne : F2 - O2[he] - j[he] - _e + k.altAxis, Fe = $e ? F2 + O2[he] + j[he] - _e - k.altAxis : Ie, Ue = l2 && $e ? St(ze, F2, Fe) : fe(l2 ? ze : Ne, F2, l2 ? Fe : Ie);
  13564. w2[b2] = Ue, S2[b2] = Ue - F2;
  13565. }
  13566. e.modifiersData[r] = S2;
  13567. }
  13568. }
  13569. var xt = { name: "preventOverflow", enabled: true, phase: "main", fn: on, requiresIfExists: ["offset"] };
  13570. function an(t) {
  13571. return { scrollLeft: t.scrollLeft, scrollTop: t.scrollTop };
  13572. }
  13573. function sn(t) {
  13574. return t === H(t) || !B(t) ? We(t) : an(t);
  13575. }
  13576. function fn(t) {
  13577. var e = t.getBoundingClientRect(), n = Z(e.width) / t.offsetWidth || 1, r = Z(e.height) / t.offsetHeight || 1;
  13578. return n !== 1 || r !== 1;
  13579. }
  13580. function cn(t, e, n) {
  13581. n === void 0 && (n = false);
  13582. var r = B(e), o2 = B(e) && fn(e), i = I$1(e), a2 = ee(t, o2), s2 = { scrollLeft: 0, scrollTop: 0 }, f2 = { x: 0, y: 0 };
  13583. return (r || !r && !n) && ((C(e) !== "body" || Se(i)) && (s2 = sn(e)), B(e) ? (f2 = ee(e, true), f2.x += e.clientLeft, f2.y += e.clientTop) : i && (f2.x = Be(i))), { x: a2.left + s2.scrollLeft - f2.x, y: a2.top + s2.scrollTop - f2.y, width: a2.width, height: a2.height };
  13584. }
  13585. function pn(t) {
  13586. var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [];
  13587. t.forEach(function(i) {
  13588. e.set(i.name, i);
  13589. });
  13590. function o2(i) {
  13591. n.add(i.name);
  13592. var a2 = [].concat(i.requires || [], i.requiresIfExists || []);
  13593. a2.forEach(function(s2) {
  13594. if (!n.has(s2)) {
  13595. var f2 = e.get(s2);
  13596. f2 && o2(f2);
  13597. }
  13598. }), r.push(i);
  13599. }
  13600. return t.forEach(function(i) {
  13601. n.has(i.name) || o2(i);
  13602. }), r;
  13603. }
  13604. function un(t) {
  13605. var e = pn(t);
  13606. return ot.reduce(function(n, r) {
  13607. return n.concat(e.filter(function(o2) {
  13608. return o2.phase === r;
  13609. }));
  13610. }, []);
  13611. }
  13612. function ln(t) {
  13613. var e;
  13614. return function() {
  13615. return e || (e = new Promise(function(n) {
  13616. Promise.resolve().then(function() {
  13617. e = void 0, n(t());
  13618. });
  13619. })), e;
  13620. };
  13621. }
  13622. function dn(t) {
  13623. var e = t.reduce(function(n, r) {
  13624. var o2 = n[r.name];
  13625. return n[r.name] = o2 ? Object.assign({}, o2, r, { options: Object.assign({}, o2.options, r.options), data: Object.assign({}, o2.data, r.data) }) : r, n;
  13626. }, {});
  13627. return Object.keys(e).map(function(n) {
  13628. return e[n];
  13629. });
  13630. }
  13631. var Ot = { placement: "bottom", modifiers: [], strategy: "absolute" };
  13632. function $t() {
  13633. for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
  13634. e[n] = arguments[n];
  13635. return !e.some(function(r) {
  13636. return !(r && typeof r.getBoundingClientRect == "function");
  13637. });
  13638. }
  13639. function we(t) {
  13640. t === void 0 && (t = {});
  13641. var e = t, n = e.defaultModifiers, r = n === void 0 ? [] : n, o2 = e.defaultOptions, i = o2 === void 0 ? Ot : o2;
  13642. return function(a2, s2, f2) {
  13643. f2 === void 0 && (f2 = i);
  13644. var c2 = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Ot, i), modifiersData: {}, elements: { reference: a2, popper: s2 }, attributes: {}, styles: {} }, u2 = [], m2 = false, v2 = { state: c2, setOptions: function(p2) {
  13645. var g = typeof p2 == "function" ? p2(c2.options) : p2;
  13646. h2(), c2.options = Object.assign({}, i, c2.options, g), c2.scrollParents = { reference: Q(a2) ? ce(a2) : a2.contextElement ? ce(a2.contextElement) : [], popper: ce(s2) };
  13647. var x2 = un(dn([].concat(r, c2.options.modifiers)));
  13648. return c2.orderedModifiers = x2.filter(function(y) {
  13649. return y.enabled;
  13650. }), l2(), v2.update();
  13651. }, forceUpdate: function() {
  13652. if (!m2) {
  13653. var p2 = c2.elements, g = p2.reference, x2 = p2.popper;
  13654. if ($t(g, x2)) {
  13655. c2.rects = { reference: cn(g, se(x2), c2.options.strategy === "fixed"), popper: ke(x2) }, c2.reset = false, c2.placement = c2.options.placement, c2.orderedModifiers.forEach(function(j) {
  13656. return c2.modifiersData[j.name] = Object.assign({}, j.data);
  13657. });
  13658. for (var y = 0; y < c2.orderedModifiers.length; y++) {
  13659. if (c2.reset === true) {
  13660. c2.reset = false, y = -1;
  13661. continue;
  13662. }
  13663. var $ = c2.orderedModifiers[y], d2 = $.fn, b2 = $.options, w2 = b2 === void 0 ? {} : b2, O2 = $.name;
  13664. typeof d2 == "function" && (c2 = d2({ state: c2, options: w2, name: O2, instance: v2 }) || c2);
  13665. }
  13666. }
  13667. }
  13668. }, update: ln(function() {
  13669. return new Promise(function(p2) {
  13670. v2.forceUpdate(), p2(c2);
  13671. });
  13672. }), destroy: function() {
  13673. h2(), m2 = true;
  13674. } };
  13675. if (!$t(a2, s2))
  13676. return v2;
  13677. v2.setOptions(f2).then(function(p2) {
  13678. !m2 && f2.onFirstUpdate && f2.onFirstUpdate(p2);
  13679. });
  13680. function l2() {
  13681. c2.orderedModifiers.forEach(function(p2) {
  13682. var g = p2.name, x2 = p2.options, y = x2 === void 0 ? {} : x2, $ = p2.effect;
  13683. if (typeof $ == "function") {
  13684. var d2 = $({ state: c2, name: g, instance: v2, options: y }), b2 = function() {
  13685. };
  13686. u2.push(d2 || b2);
  13687. }
  13688. });
  13689. }
  13690. function h2() {
  13691. u2.forEach(function(p2) {
  13692. return p2();
  13693. }), u2 = [];
  13694. }
  13695. return v2;
  13696. };
  13697. }
  13698. we();
  13699. var mn = [Re, He, Me, Ae];
  13700. we({ defaultModifiers: mn });
  13701. var gn = [Re, He, Me, Ae, wt, vt, xt, pt, bt], yn = we({ defaultModifiers: gn });
  13702. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  13703. const stateUpdater = {
  13704. name: "updateState",
  13705. enabled: true,
  13706. phase: "write",
  13707. fn: ({ state }) => {
  13708. const derivedState = deriveState(state);
  13709. Object.assign(states.value, derivedState);
  13710. },
  13711. requires: ["computeStyles"]
  13712. };
  13713. const options = computed(() => {
  13714. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  13715. return {
  13716. onFirstUpdate,
  13717. placement: placement || "bottom",
  13718. strategy: strategy || "absolute",
  13719. modifiers: [
  13720. ...modifiers || [],
  13721. stateUpdater,
  13722. { name: "applyStyles", enabled: false }
  13723. ]
  13724. };
  13725. });
  13726. const instanceRef = shallowRef();
  13727. const states = ref({
  13728. styles: {
  13729. popper: {
  13730. position: unref(options).strategy,
  13731. left: "0",
  13732. top: "0"
  13733. },
  13734. arrow: {
  13735. position: "absolute"
  13736. }
  13737. },
  13738. attributes: {}
  13739. });
  13740. const destroy = () => {
  13741. if (!instanceRef.value)
  13742. return;
  13743. instanceRef.value.destroy();
  13744. instanceRef.value = void 0;
  13745. };
  13746. watch(options, (newOptions) => {
  13747. const instance = unref(instanceRef);
  13748. if (instance) {
  13749. instance.setOptions(newOptions);
  13750. }
  13751. }, {
  13752. deep: true
  13753. });
  13754. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  13755. destroy();
  13756. if (!referenceElement || !popperElement)
  13757. return;
  13758. instanceRef.value = yn(referenceElement, popperElement, unref(options));
  13759. });
  13760. onBeforeUnmount(() => {
  13761. destroy();
  13762. });
  13763. return {
  13764. state: computed(() => {
  13765. var _a2;
  13766. return { ...((_a2 = unref(instanceRef)) == null ? void 0 : _a2.state) || {} };
  13767. }),
  13768. styles: computed(() => unref(states).styles),
  13769. attributes: computed(() => unref(states).attributes),
  13770. update: () => {
  13771. var _a2;
  13772. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.update();
  13773. },
  13774. forceUpdate: () => {
  13775. var _a2;
  13776. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.forceUpdate();
  13777. },
  13778. instanceRef: computed(() => unref(instanceRef))
  13779. };
  13780. };
  13781. function deriveState(state) {
  13782. const elements = Object.keys(state.elements);
  13783. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  13784. const attributes2 = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  13785. return {
  13786. styles,
  13787. attributes: attributes2
  13788. };
  13789. }
  13790. const useSameTarget = (handleClick) => {
  13791. if (!handleClick) {
  13792. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  13793. }
  13794. let mousedownTarget = false;
  13795. let mouseupTarget = false;
  13796. const onClick = (e) => {
  13797. if (mousedownTarget && mouseupTarget) {
  13798. handleClick(e);
  13799. }
  13800. mousedownTarget = mouseupTarget = false;
  13801. };
  13802. const onMousedown = (e) => {
  13803. mousedownTarget = e.target === e.currentTarget;
  13804. };
  13805. const onMouseup = (e) => {
  13806. mouseupTarget = e.target === e.currentTarget;
  13807. };
  13808. return { onClick, onMousedown, onMouseup };
  13809. };
  13810. const useThrottleRender = (loading, throttle2 = 0) => {
  13811. if (throttle2 === 0)
  13812. return loading;
  13813. const throttled = ref(false);
  13814. let timeoutHandle = 0;
  13815. const dispatchThrottling = () => {
  13816. if (timeoutHandle) {
  13817. clearTimeout(timeoutHandle);
  13818. }
  13819. timeoutHandle = window.setTimeout(() => {
  13820. throttled.value = loading.value;
  13821. }, throttle2);
  13822. };
  13823. onMounted(dispatchThrottling);
  13824. watch(() => loading.value, (val) => {
  13825. if (val) {
  13826. dispatchThrottling();
  13827. } else {
  13828. throttled.value = val;
  13829. }
  13830. });
  13831. return throttled;
  13832. };
  13833. function useTimeout() {
  13834. let timeoutHandle;
  13835. const registerTimeout = (fn2, delay) => {
  13836. cancelTimeout();
  13837. timeoutHandle = window.setTimeout(fn2, delay);
  13838. };
  13839. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  13840. tryOnScopeDispose(() => cancelTimeout());
  13841. return {
  13842. registerTimeout,
  13843. cancelTimeout
  13844. };
  13845. }
  13846. const defaultIdInjection = {
  13847. prefix: Math.floor(Math.random() * 1e4),
  13848. current: 0
  13849. };
  13850. const ID_INJECTION_KEY = Symbol("elIdInjection");
  13851. const useIdInjection = () => {
  13852. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  13853. };
  13854. const useId = (deterministicId) => {
  13855. const idInjection = useIdInjection();
  13856. const namespace = useGetDerivedNamespace();
  13857. const idRef = computed(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  13858. return idRef;
  13859. };
  13860. let registeredEscapeHandlers = [];
  13861. const cachedHandler = (e) => {
  13862. const event = e;
  13863. if (event.key === EVENT_CODE.esc) {
  13864. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  13865. }
  13866. };
  13867. const useEscapeKeydown = (handler) => {
  13868. onMounted(() => {
  13869. if (registeredEscapeHandlers.length === 0) {
  13870. document.addEventListener("keydown", cachedHandler);
  13871. }
  13872. if (isClient)
  13873. registeredEscapeHandlers.push(handler);
  13874. });
  13875. onBeforeUnmount(() => {
  13876. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  13877. if (registeredEscapeHandlers.length === 0) {
  13878. if (isClient)
  13879. document.removeEventListener("keydown", cachedHandler);
  13880. }
  13881. });
  13882. };
  13883. let cachedContainer;
  13884. const usePopperContainerId = () => {
  13885. const namespace = useGetDerivedNamespace();
  13886. const idInjection = useIdInjection();
  13887. const id = computed(() => {
  13888. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  13889. });
  13890. const selector = computed(() => `#${id.value}`);
  13891. return {
  13892. id,
  13893. selector
  13894. };
  13895. };
  13896. const createContainer = (id) => {
  13897. const container = document.createElement("div");
  13898. container.id = id;
  13899. document.body.appendChild(container);
  13900. return container;
  13901. };
  13902. const usePopperContainer = () => {
  13903. const { id, selector } = usePopperContainerId();
  13904. onBeforeMount(() => {
  13905. if (!isClient)
  13906. return;
  13907. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  13908. cachedContainer = createContainer(id.value);
  13909. }
  13910. });
  13911. return {
  13912. id,
  13913. selector
  13914. };
  13915. };
  13916. const useDelayedToggleProps = buildProps({
  13917. showAfter: {
  13918. type: Number,
  13919. default: 0
  13920. },
  13921. hideAfter: {
  13922. type: Number,
  13923. default: 200
  13924. },
  13925. autoClose: {
  13926. type: Number,
  13927. default: 0
  13928. }
  13929. });
  13930. const useDelayedToggle = ({
  13931. showAfter,
  13932. hideAfter,
  13933. autoClose,
  13934. open,
  13935. close: close2
  13936. }) => {
  13937. const { registerTimeout } = useTimeout();
  13938. const {
  13939. registerTimeout: registerTimeoutForAutoClose,
  13940. cancelTimeout: cancelTimeoutForAutoClose
  13941. } = useTimeout();
  13942. const onOpen = (event) => {
  13943. registerTimeout(() => {
  13944. open(event);
  13945. const _autoClose = unref(autoClose);
  13946. if (isNumber(_autoClose) && _autoClose > 0) {
  13947. registerTimeoutForAutoClose(() => {
  13948. close2(event);
  13949. }, _autoClose);
  13950. }
  13951. }, unref(showAfter));
  13952. };
  13953. const onClose = (event) => {
  13954. cancelTimeoutForAutoClose();
  13955. registerTimeout(() => {
  13956. close2(event);
  13957. }, unref(hideAfter));
  13958. };
  13959. return {
  13960. onOpen,
  13961. onClose
  13962. };
  13963. };
  13964. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  13965. const useForwardRef = (forwardRef) => {
  13966. const setForwardRef = (el) => {
  13967. forwardRef.value = el;
  13968. };
  13969. provide(FORWARD_REF_INJECTION_KEY, {
  13970. setForwardRef
  13971. });
  13972. };
  13973. const useForwardRefDirective = (setForwardRef) => {
  13974. return {
  13975. mounted(el) {
  13976. setForwardRef(el);
  13977. },
  13978. updated(el) {
  13979. setForwardRef(el);
  13980. },
  13981. unmounted() {
  13982. setForwardRef(null);
  13983. }
  13984. };
  13985. };
  13986. const zIndex = ref(0);
  13987. const defaultInitialZIndex = 2e3;
  13988. const zIndexContextKey = Symbol("zIndexContextKey");
  13989. const useZIndex = (zIndexOverrides) => {
  13990. const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
  13991. const initialZIndex = computed(() => {
  13992. const zIndexFromInjection = unref(zIndexInjection);
  13993. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  13994. });
  13995. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  13996. const nextZIndex = () => {
  13997. zIndex.value++;
  13998. return currentZIndex.value;
  13999. };
  14000. return {
  14001. initialZIndex,
  14002. currentZIndex,
  14003. nextZIndex
  14004. };
  14005. };
  14006. const min$1 = Math.min;
  14007. const max$1 = Math.max;
  14008. const round = Math.round;
  14009. const createCoords = (v2) => ({
  14010. x: v2,
  14011. y: v2
  14012. });
  14013. function clamp(start, value, end2) {
  14014. return max$1(start, min$1(value, end2));
  14015. }
  14016. function evaluate(value, param) {
  14017. return typeof value === "function" ? value(param) : value;
  14018. }
  14019. function getSide(placement) {
  14020. return placement.split("-")[0];
  14021. }
  14022. function getAlignment(placement) {
  14023. return placement.split("-")[1];
  14024. }
  14025. function getOppositeAxis(axis) {
  14026. return axis === "x" ? "y" : "x";
  14027. }
  14028. function getAxisLength(axis) {
  14029. return axis === "y" ? "height" : "width";
  14030. }
  14031. function getSideAxis(placement) {
  14032. return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
  14033. }
  14034. function getAlignmentAxis(placement) {
  14035. return getOppositeAxis(getSideAxis(placement));
  14036. }
  14037. function expandPaddingObject(padding) {
  14038. return {
  14039. top: 0,
  14040. right: 0,
  14041. bottom: 0,
  14042. left: 0,
  14043. ...padding
  14044. };
  14045. }
  14046. function getPaddingObject(padding) {
  14047. return typeof padding !== "number" ? expandPaddingObject(padding) : {
  14048. top: padding,
  14049. right: padding,
  14050. bottom: padding,
  14051. left: padding
  14052. };
  14053. }
  14054. function rectToClientRect(rect) {
  14055. return {
  14056. ...rect,
  14057. top: rect.y,
  14058. left: rect.x,
  14059. right: rect.x + rect.width,
  14060. bottom: rect.y + rect.height
  14061. };
  14062. }
  14063. function computeCoordsFromPlacement(_ref, placement, rtl) {
  14064. let {
  14065. reference,
  14066. floating
  14067. } = _ref;
  14068. const sideAxis = getSideAxis(placement);
  14069. const alignmentAxis = getAlignmentAxis(placement);
  14070. const alignLength = getAxisLength(alignmentAxis);
  14071. const side = getSide(placement);
  14072. const isVertical = sideAxis === "y";
  14073. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  14074. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  14075. const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  14076. let coords;
  14077. switch (side) {
  14078. case "top":
  14079. coords = {
  14080. x: commonX,
  14081. y: reference.y - floating.height
  14082. };
  14083. break;
  14084. case "bottom":
  14085. coords = {
  14086. x: commonX,
  14087. y: reference.y + reference.height
  14088. };
  14089. break;
  14090. case "right":
  14091. coords = {
  14092. x: reference.x + reference.width,
  14093. y: commonY
  14094. };
  14095. break;
  14096. case "left":
  14097. coords = {
  14098. x: reference.x - floating.width,
  14099. y: commonY
  14100. };
  14101. break;
  14102. default:
  14103. coords = {
  14104. x: reference.x,
  14105. y: reference.y
  14106. };
  14107. }
  14108. switch (getAlignment(placement)) {
  14109. case "start":
  14110. coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  14111. break;
  14112. case "end":
  14113. coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  14114. break;
  14115. }
  14116. return coords;
  14117. }
  14118. const computePosition$1 = async (reference, floating, config) => {
  14119. const {
  14120. placement = "bottom",
  14121. strategy = "absolute",
  14122. middleware = [],
  14123. platform: platform2
  14124. } = config;
  14125. const validMiddleware = middleware.filter(Boolean);
  14126. const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
  14127. let rects = await platform2.getElementRects({
  14128. reference,
  14129. floating,
  14130. strategy
  14131. });
  14132. let {
  14133. x: x2,
  14134. y
  14135. } = computeCoordsFromPlacement(rects, placement, rtl);
  14136. let statefulPlacement = placement;
  14137. let middlewareData = {};
  14138. let resetCount = 0;
  14139. for (let i = 0; i < validMiddleware.length; i++) {
  14140. const {
  14141. name,
  14142. fn: fn2
  14143. } = validMiddleware[i];
  14144. const {
  14145. x: nextX,
  14146. y: nextY,
  14147. data,
  14148. reset
  14149. } = await fn2({
  14150. x: x2,
  14151. y,
  14152. initialPlacement: placement,
  14153. placement: statefulPlacement,
  14154. strategy,
  14155. middlewareData,
  14156. rects,
  14157. platform: platform2,
  14158. elements: {
  14159. reference,
  14160. floating
  14161. }
  14162. });
  14163. x2 = nextX != null ? nextX : x2;
  14164. y = nextY != null ? nextY : y;
  14165. middlewareData = {
  14166. ...middlewareData,
  14167. [name]: {
  14168. ...middlewareData[name],
  14169. ...data
  14170. }
  14171. };
  14172. if (reset && resetCount <= 50) {
  14173. resetCount++;
  14174. if (typeof reset === "object") {
  14175. if (reset.placement) {
  14176. statefulPlacement = reset.placement;
  14177. }
  14178. if (reset.rects) {
  14179. rects = reset.rects === true ? await platform2.getElementRects({
  14180. reference,
  14181. floating,
  14182. strategy
  14183. }) : reset.rects;
  14184. }
  14185. ({
  14186. x: x2,
  14187. y
  14188. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  14189. }
  14190. i = -1;
  14191. continue;
  14192. }
  14193. }
  14194. return {
  14195. x: x2,
  14196. y,
  14197. placement: statefulPlacement,
  14198. strategy,
  14199. middlewareData
  14200. };
  14201. };
  14202. const arrow = (options) => ({
  14203. name: "arrow",
  14204. options,
  14205. async fn(state) {
  14206. const {
  14207. x: x2,
  14208. y,
  14209. placement,
  14210. rects,
  14211. platform: platform2,
  14212. elements,
  14213. middlewareData
  14214. } = state;
  14215. const {
  14216. element,
  14217. padding = 0
  14218. } = evaluate(options, state) || {};
  14219. if (element == null) {
  14220. return {};
  14221. }
  14222. const paddingObject = getPaddingObject(padding);
  14223. const coords = {
  14224. x: x2,
  14225. y
  14226. };
  14227. const axis = getAlignmentAxis(placement);
  14228. const length = getAxisLength(axis);
  14229. const arrowDimensions = await platform2.getDimensions(element);
  14230. const isYAxis = axis === "y";
  14231. const minProp = isYAxis ? "top" : "left";
  14232. const maxProp = isYAxis ? "bottom" : "right";
  14233. const clientProp = isYAxis ? "clientHeight" : "clientWidth";
  14234. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  14235. const startDiff = coords[axis] - rects.reference[axis];
  14236. const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
  14237. let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
  14238. if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
  14239. clientSize = elements.floating[clientProp] || rects.floating[length];
  14240. }
  14241. const centerToReference = endDiff / 2 - startDiff / 2;
  14242. const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
  14243. const minPadding = min$1(paddingObject[minProp], largestPossiblePadding);
  14244. const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding);
  14245. const min$1$1 = minPadding;
  14246. const max2 = clientSize - arrowDimensions[length] - maxPadding;
  14247. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  14248. const offset2 = clamp(min$1$1, center, max2);
  14249. const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center != offset2 && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
  14250. const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max2 : 0;
  14251. return {
  14252. [axis]: coords[axis] + alignmentOffset,
  14253. data: {
  14254. [axis]: offset2,
  14255. centerOffset: center - offset2 - alignmentOffset,
  14256. ...shouldAddOffset && {
  14257. alignmentOffset
  14258. }
  14259. },
  14260. reset: shouldAddOffset
  14261. };
  14262. }
  14263. });
  14264. async function convertValueToCoords(state, options) {
  14265. const {
  14266. placement,
  14267. platform: platform2,
  14268. elements
  14269. } = state;
  14270. const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
  14271. const side = getSide(placement);
  14272. const alignment = getAlignment(placement);
  14273. const isVertical = getSideAxis(placement) === "y";
  14274. const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
  14275. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  14276. const rawValue = evaluate(options, state);
  14277. let {
  14278. mainAxis,
  14279. crossAxis,
  14280. alignmentAxis
  14281. } = typeof rawValue === "number" ? {
  14282. mainAxis: rawValue,
  14283. crossAxis: 0,
  14284. alignmentAxis: null
  14285. } : {
  14286. mainAxis: 0,
  14287. crossAxis: 0,
  14288. alignmentAxis: null,
  14289. ...rawValue
  14290. };
  14291. if (alignment && typeof alignmentAxis === "number") {
  14292. crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
  14293. }
  14294. return isVertical ? {
  14295. x: crossAxis * crossAxisMulti,
  14296. y: mainAxis * mainAxisMulti
  14297. } : {
  14298. x: mainAxis * mainAxisMulti,
  14299. y: crossAxis * crossAxisMulti
  14300. };
  14301. }
  14302. const offset = function(options) {
  14303. if (options === void 0) {
  14304. options = 0;
  14305. }
  14306. return {
  14307. name: "offset",
  14308. options,
  14309. async fn(state) {
  14310. var _middlewareData$offse, _middlewareData$arrow;
  14311. const {
  14312. x: x2,
  14313. y,
  14314. placement,
  14315. middlewareData
  14316. } = state;
  14317. const diffCoords = await convertValueToCoords(state, options);
  14318. if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
  14319. return {};
  14320. }
  14321. return {
  14322. x: x2 + diffCoords.x,
  14323. y: y + diffCoords.y,
  14324. data: {
  14325. ...diffCoords,
  14326. placement
  14327. }
  14328. };
  14329. }
  14330. };
  14331. };
  14332. function getNodeName(node) {
  14333. if (isNode(node)) {
  14334. return (node.nodeName || "").toLowerCase();
  14335. }
  14336. return "#document";
  14337. }
  14338. function getWindow(node) {
  14339. var _node$ownerDocument;
  14340. return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
  14341. }
  14342. function getDocumentElement(node) {
  14343. var _ref;
  14344. return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
  14345. }
  14346. function isNode(value) {
  14347. return value instanceof Node || value instanceof getWindow(value).Node;
  14348. }
  14349. function isElement(value) {
  14350. return value instanceof Element || value instanceof getWindow(value).Element;
  14351. }
  14352. function isHTMLElement(value) {
  14353. return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
  14354. }
  14355. function isShadowRoot(value) {
  14356. if (typeof ShadowRoot === "undefined") {
  14357. return false;
  14358. }
  14359. return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
  14360. }
  14361. function isOverflowElement(element) {
  14362. const {
  14363. overflow,
  14364. overflowX,
  14365. overflowY,
  14366. display
  14367. } = getComputedStyle$1(element);
  14368. return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
  14369. }
  14370. function isTableElement(element) {
  14371. return ["table", "td", "th"].includes(getNodeName(element));
  14372. }
  14373. function isContainingBlock(element) {
  14374. const webkit = isWebKit();
  14375. const css = getComputedStyle$1(element);
  14376. return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
  14377. }
  14378. function getContainingBlock(element) {
  14379. let currentNode = getParentNode(element);
  14380. while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
  14381. if (isContainingBlock(currentNode)) {
  14382. return currentNode;
  14383. } else {
  14384. currentNode = getParentNode(currentNode);
  14385. }
  14386. }
  14387. return null;
  14388. }
  14389. function isWebKit() {
  14390. if (typeof CSS === "undefined" || !CSS.supports)
  14391. return false;
  14392. return CSS.supports("-webkit-backdrop-filter", "none");
  14393. }
  14394. function isLastTraversableNode(node) {
  14395. return ["html", "body", "#document"].includes(getNodeName(node));
  14396. }
  14397. function getComputedStyle$1(element) {
  14398. return getWindow(element).getComputedStyle(element);
  14399. }
  14400. function getNodeScroll(element) {
  14401. if (isElement(element)) {
  14402. return {
  14403. scrollLeft: element.scrollLeft,
  14404. scrollTop: element.scrollTop
  14405. };
  14406. }
  14407. return {
  14408. scrollLeft: element.pageXOffset,
  14409. scrollTop: element.pageYOffset
  14410. };
  14411. }
  14412. function getParentNode(node) {
  14413. if (getNodeName(node) === "html") {
  14414. return node;
  14415. }
  14416. const result = (
  14417. // Step into the shadow DOM of the parent of a slotted node.
  14418. node.assignedSlot || // DOM Element detected.
  14419. node.parentNode || // ShadowRoot detected.
  14420. isShadowRoot(node) && node.host || // Fallback.
  14421. getDocumentElement(node)
  14422. );
  14423. return isShadowRoot(result) ? result.host : result;
  14424. }
  14425. function getNearestOverflowAncestor(node) {
  14426. const parentNode = getParentNode(node);
  14427. if (isLastTraversableNode(parentNode)) {
  14428. return node.ownerDocument ? node.ownerDocument.body : node.body;
  14429. }
  14430. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  14431. return parentNode;
  14432. }
  14433. return getNearestOverflowAncestor(parentNode);
  14434. }
  14435. function getOverflowAncestors(node, list, traverseIframes) {
  14436. var _node$ownerDocument2;
  14437. if (list === void 0) {
  14438. list = [];
  14439. }
  14440. if (traverseIframes === void 0) {
  14441. traverseIframes = true;
  14442. }
  14443. const scrollableAncestor = getNearestOverflowAncestor(node);
  14444. const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  14445. const win = getWindow(scrollableAncestor);
  14446. if (isBody) {
  14447. return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
  14448. }
  14449. return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
  14450. }
  14451. function getCssDimensions(element) {
  14452. const css = getComputedStyle$1(element);
  14453. let width = parseFloat(css.width) || 0;
  14454. let height = parseFloat(css.height) || 0;
  14455. const hasOffset = isHTMLElement(element);
  14456. const offsetWidth = hasOffset ? element.offsetWidth : width;
  14457. const offsetHeight = hasOffset ? element.offsetHeight : height;
  14458. const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
  14459. if (shouldFallback) {
  14460. width = offsetWidth;
  14461. height = offsetHeight;
  14462. }
  14463. return {
  14464. width,
  14465. height,
  14466. $: shouldFallback
  14467. };
  14468. }
  14469. function unwrapElement(element) {
  14470. return !isElement(element) ? element.contextElement : element;
  14471. }
  14472. function getScale(element) {
  14473. const domElement = unwrapElement(element);
  14474. if (!isHTMLElement(domElement)) {
  14475. return createCoords(1);
  14476. }
  14477. const rect = domElement.getBoundingClientRect();
  14478. const {
  14479. width,
  14480. height,
  14481. $
  14482. } = getCssDimensions(domElement);
  14483. let x2 = ($ ? round(rect.width) : rect.width) / width;
  14484. let y = ($ ? round(rect.height) : rect.height) / height;
  14485. if (!x2 || !Number.isFinite(x2)) {
  14486. x2 = 1;
  14487. }
  14488. if (!y || !Number.isFinite(y)) {
  14489. y = 1;
  14490. }
  14491. return {
  14492. x: x2,
  14493. y
  14494. };
  14495. }
  14496. const noOffsets = /* @__PURE__ */ createCoords(0);
  14497. function getVisualOffsets(element) {
  14498. const win = getWindow(element);
  14499. if (!isWebKit() || !win.visualViewport) {
  14500. return noOffsets;
  14501. }
  14502. return {
  14503. x: win.visualViewport.offsetLeft,
  14504. y: win.visualViewport.offsetTop
  14505. };
  14506. }
  14507. function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  14508. if (isFixed === void 0) {
  14509. isFixed = false;
  14510. }
  14511. if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
  14512. return false;
  14513. }
  14514. return isFixed;
  14515. }
  14516. function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
  14517. if (includeScale === void 0) {
  14518. includeScale = false;
  14519. }
  14520. if (isFixedStrategy === void 0) {
  14521. isFixedStrategy = false;
  14522. }
  14523. const clientRect = element.getBoundingClientRect();
  14524. const domElement = unwrapElement(element);
  14525. let scale = createCoords(1);
  14526. if (includeScale) {
  14527. if (offsetParent) {
  14528. if (isElement(offsetParent)) {
  14529. scale = getScale(offsetParent);
  14530. }
  14531. } else {
  14532. scale = getScale(element);
  14533. }
  14534. }
  14535. const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  14536. let x2 = (clientRect.left + visualOffsets.x) / scale.x;
  14537. let y = (clientRect.top + visualOffsets.y) / scale.y;
  14538. let width = clientRect.width / scale.x;
  14539. let height = clientRect.height / scale.y;
  14540. if (domElement) {
  14541. const win = getWindow(domElement);
  14542. const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
  14543. let currentIFrame = win.frameElement;
  14544. while (currentIFrame && offsetParent && offsetWin !== win) {
  14545. const iframeScale = getScale(currentIFrame);
  14546. const iframeRect = currentIFrame.getBoundingClientRect();
  14547. const css = getComputedStyle$1(currentIFrame);
  14548. const left2 = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
  14549. const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
  14550. x2 *= iframeScale.x;
  14551. y *= iframeScale.y;
  14552. width *= iframeScale.x;
  14553. height *= iframeScale.y;
  14554. x2 += left2;
  14555. y += top;
  14556. currentIFrame = getWindow(currentIFrame).frameElement;
  14557. }
  14558. }
  14559. return rectToClientRect({
  14560. width,
  14561. height,
  14562. x: x2,
  14563. y
  14564. });
  14565. }
  14566. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  14567. let {
  14568. rect,
  14569. offsetParent,
  14570. strategy
  14571. } = _ref;
  14572. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  14573. const documentElement = getDocumentElement(offsetParent);
  14574. if (offsetParent === documentElement) {
  14575. return rect;
  14576. }
  14577. let scroll = {
  14578. scrollLeft: 0,
  14579. scrollTop: 0
  14580. };
  14581. let scale = createCoords(1);
  14582. const offsets = createCoords(0);
  14583. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
  14584. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
  14585. scroll = getNodeScroll(offsetParent);
  14586. }
  14587. if (isHTMLElement(offsetParent)) {
  14588. const offsetRect = getBoundingClientRect(offsetParent);
  14589. scale = getScale(offsetParent);
  14590. offsets.x = offsetRect.x + offsetParent.clientLeft;
  14591. offsets.y = offsetRect.y + offsetParent.clientTop;
  14592. }
  14593. }
  14594. return {
  14595. width: rect.width * scale.x,
  14596. height: rect.height * scale.y,
  14597. x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
  14598. y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
  14599. };
  14600. }
  14601. function getClientRects(element) {
  14602. return Array.from(element.getClientRects());
  14603. }
  14604. function getWindowScrollBarX(element) {
  14605. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  14606. }
  14607. function getDocumentRect(element) {
  14608. const html = getDocumentElement(element);
  14609. const scroll = getNodeScroll(element);
  14610. const body = element.ownerDocument.body;
  14611. const width = max$1(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  14612. const height = max$1(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  14613. let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
  14614. const y = -scroll.scrollTop;
  14615. if (getComputedStyle$1(body).direction === "rtl") {
  14616. x2 += max$1(html.clientWidth, body.clientWidth) - width;
  14617. }
  14618. return {
  14619. width,
  14620. height,
  14621. x: x2,
  14622. y
  14623. };
  14624. }
  14625. function getViewportRect(element, strategy) {
  14626. const win = getWindow(element);
  14627. const html = getDocumentElement(element);
  14628. const visualViewport = win.visualViewport;
  14629. let width = html.clientWidth;
  14630. let height = html.clientHeight;
  14631. let x2 = 0;
  14632. let y = 0;
  14633. if (visualViewport) {
  14634. width = visualViewport.width;
  14635. height = visualViewport.height;
  14636. const visualViewportBased = isWebKit();
  14637. if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
  14638. x2 = visualViewport.offsetLeft;
  14639. y = visualViewport.offsetTop;
  14640. }
  14641. }
  14642. return {
  14643. width,
  14644. height,
  14645. x: x2,
  14646. y
  14647. };
  14648. }
  14649. function getInnerBoundingClientRect(element, strategy) {
  14650. const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
  14651. const top = clientRect.top + element.clientTop;
  14652. const left2 = clientRect.left + element.clientLeft;
  14653. const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
  14654. const width = element.clientWidth * scale.x;
  14655. const height = element.clientHeight * scale.y;
  14656. const x2 = left2 * scale.x;
  14657. const y = top * scale.y;
  14658. return {
  14659. width,
  14660. height,
  14661. x: x2,
  14662. y
  14663. };
  14664. }
  14665. function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
  14666. let rect;
  14667. if (clippingAncestor === "viewport") {
  14668. rect = getViewportRect(element, strategy);
  14669. } else if (clippingAncestor === "document") {
  14670. rect = getDocumentRect(getDocumentElement(element));
  14671. } else if (isElement(clippingAncestor)) {
  14672. rect = getInnerBoundingClientRect(clippingAncestor, strategy);
  14673. } else {
  14674. const visualOffsets = getVisualOffsets(element);
  14675. rect = {
  14676. ...clippingAncestor,
  14677. x: clippingAncestor.x - visualOffsets.x,
  14678. y: clippingAncestor.y - visualOffsets.y
  14679. };
  14680. }
  14681. return rectToClientRect(rect);
  14682. }
  14683. function hasFixedPositionAncestor(element, stopNode) {
  14684. const parentNode = getParentNode(element);
  14685. if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
  14686. return false;
  14687. }
  14688. return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
  14689. }
  14690. function getClippingElementAncestors(element, cache2) {
  14691. const cachedResult = cache2.get(element);
  14692. if (cachedResult) {
  14693. return cachedResult;
  14694. }
  14695. let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
  14696. let currentContainingBlockComputedStyle = null;
  14697. const elementIsFixed = getComputedStyle$1(element).position === "fixed";
  14698. let currentNode = elementIsFixed ? getParentNode(element) : element;
  14699. while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
  14700. const computedStyle = getComputedStyle$1(currentNode);
  14701. const currentNodeIsContaining = isContainingBlock(currentNode);
  14702. if (!currentNodeIsContaining && computedStyle.position === "fixed") {
  14703. currentContainingBlockComputedStyle = null;
  14704. }
  14705. const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
  14706. if (shouldDropCurrentNode) {
  14707. result = result.filter((ancestor) => ancestor !== currentNode);
  14708. } else {
  14709. currentContainingBlockComputedStyle = computedStyle;
  14710. }
  14711. currentNode = getParentNode(currentNode);
  14712. }
  14713. cache2.set(element, result);
  14714. return result;
  14715. }
  14716. function getClippingRect(_ref) {
  14717. let {
  14718. element,
  14719. boundary,
  14720. rootBoundary,
  14721. strategy
  14722. } = _ref;
  14723. const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
  14724. const clippingAncestors = [...elementClippingAncestors, rootBoundary];
  14725. const firstClippingAncestor = clippingAncestors[0];
  14726. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  14727. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  14728. accRect.top = max$1(rect.top, accRect.top);
  14729. accRect.right = min$1(rect.right, accRect.right);
  14730. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  14731. accRect.left = max$1(rect.left, accRect.left);
  14732. return accRect;
  14733. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  14734. return {
  14735. width: clippingRect.right - clippingRect.left,
  14736. height: clippingRect.bottom - clippingRect.top,
  14737. x: clippingRect.left,
  14738. y: clippingRect.top
  14739. };
  14740. }
  14741. function getDimensions(element) {
  14742. return getCssDimensions(element);
  14743. }
  14744. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  14745. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  14746. const documentElement = getDocumentElement(offsetParent);
  14747. const isFixed = strategy === "fixed";
  14748. const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
  14749. let scroll = {
  14750. scrollLeft: 0,
  14751. scrollTop: 0
  14752. };
  14753. const offsets = createCoords(0);
  14754. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  14755. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
  14756. scroll = getNodeScroll(offsetParent);
  14757. }
  14758. if (isOffsetParentAnElement) {
  14759. const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
  14760. offsets.x = offsetRect.x + offsetParent.clientLeft;
  14761. offsets.y = offsetRect.y + offsetParent.clientTop;
  14762. } else if (documentElement) {
  14763. offsets.x = getWindowScrollBarX(documentElement);
  14764. }
  14765. }
  14766. return {
  14767. x: rect.left + scroll.scrollLeft - offsets.x,
  14768. y: rect.top + scroll.scrollTop - offsets.y,
  14769. width: rect.width,
  14770. height: rect.height
  14771. };
  14772. }
  14773. function getTrueOffsetParent(element, polyfill) {
  14774. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
  14775. return null;
  14776. }
  14777. if (polyfill) {
  14778. return polyfill(element);
  14779. }
  14780. return element.offsetParent;
  14781. }
  14782. function getOffsetParent(element, polyfill) {
  14783. const window2 = getWindow(element);
  14784. if (!isHTMLElement(element)) {
  14785. return window2;
  14786. }
  14787. let offsetParent = getTrueOffsetParent(element, polyfill);
  14788. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
  14789. offsetParent = getTrueOffsetParent(offsetParent, polyfill);
  14790. }
  14791. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
  14792. return window2;
  14793. }
  14794. return offsetParent || getContainingBlock(element) || window2;
  14795. }
  14796. const getElementRects = async function(_ref) {
  14797. let {
  14798. reference,
  14799. floating,
  14800. strategy
  14801. } = _ref;
  14802. const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
  14803. const getDimensionsFn = this.getDimensions;
  14804. return {
  14805. reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
  14806. floating: {
  14807. x: 0,
  14808. y: 0,
  14809. ...await getDimensionsFn(floating)
  14810. }
  14811. };
  14812. };
  14813. function isRTL$1(element) {
  14814. return getComputedStyle$1(element).direction === "rtl";
  14815. }
  14816. const platform = {
  14817. convertOffsetParentRelativeRectToViewportRelativeRect,
  14818. getDocumentElement,
  14819. getClippingRect,
  14820. getOffsetParent,
  14821. getElementRects,
  14822. getClientRects,
  14823. getDimensions,
  14824. getScale,
  14825. isElement,
  14826. isRTL: isRTL$1
  14827. };
  14828. const computePosition = (reference, floating, options) => {
  14829. const cache2 = /* @__PURE__ */ new Map();
  14830. const mergedOptions = {
  14831. platform,
  14832. ...options
  14833. };
  14834. const platformWithCache = {
  14835. ...mergedOptions.platform,
  14836. _c: cache2
  14837. };
  14838. return computePosition$1(reference, floating, {
  14839. ...mergedOptions,
  14840. platform: platformWithCache
  14841. });
  14842. };
  14843. buildProps({});
  14844. const unrefReference = (elRef) => {
  14845. if (!isClient)
  14846. return;
  14847. if (!elRef)
  14848. return elRef;
  14849. const unrefEl = unrefElement(elRef);
  14850. if (unrefEl)
  14851. return unrefEl;
  14852. return isRef(elRef) ? unrefEl : elRef;
  14853. };
  14854. const useFloating = ({
  14855. middleware,
  14856. placement,
  14857. strategy
  14858. }) => {
  14859. const referenceRef = ref();
  14860. const contentRef = ref();
  14861. const x2 = ref();
  14862. const y = ref();
  14863. const middlewareData = ref({});
  14864. const states = {
  14865. x: x2,
  14866. y,
  14867. placement,
  14868. strategy,
  14869. middlewareData
  14870. };
  14871. const update = async () => {
  14872. if (!isClient)
  14873. return;
  14874. const referenceEl = unrefReference(referenceRef);
  14875. const contentEl = unrefElement(contentRef);
  14876. if (!referenceEl || !contentEl)
  14877. return;
  14878. const data = await computePosition(referenceEl, contentEl, {
  14879. placement: unref(placement),
  14880. strategy: unref(strategy),
  14881. middleware: unref(middleware)
  14882. });
  14883. keysOf(states).forEach((key) => {
  14884. states[key].value = data[key];
  14885. });
  14886. };
  14887. onMounted(() => {
  14888. watchEffect(() => {
  14889. update();
  14890. });
  14891. });
  14892. return {
  14893. ...states,
  14894. update,
  14895. referenceRef,
  14896. contentRef
  14897. };
  14898. };
  14899. const arrowMiddleware = ({
  14900. arrowRef,
  14901. padding
  14902. }) => {
  14903. return {
  14904. name: "arrow",
  14905. options: {
  14906. element: arrowRef,
  14907. padding
  14908. },
  14909. fn(args) {
  14910. const arrowEl = unref(arrowRef);
  14911. if (!arrowEl)
  14912. return {};
  14913. return arrow({
  14914. element: arrowEl,
  14915. padding
  14916. }).fn(args);
  14917. }
  14918. };
  14919. };
  14920. function useCursor(input) {
  14921. const selectionRef = ref();
  14922. function recordCursor() {
  14923. if (input.value == void 0)
  14924. return;
  14925. const { selectionStart, selectionEnd, value } = input.value;
  14926. if (selectionStart == null || selectionEnd == null)
  14927. return;
  14928. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  14929. const afterTxt = value.slice(Math.max(0, selectionEnd));
  14930. selectionRef.value = {
  14931. selectionStart,
  14932. selectionEnd,
  14933. value,
  14934. beforeTxt,
  14935. afterTxt
  14936. };
  14937. }
  14938. function setCursor() {
  14939. if (input.value == void 0 || selectionRef.value == void 0)
  14940. return;
  14941. const { value } = input.value;
  14942. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  14943. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  14944. return;
  14945. let startPos = value.length;
  14946. if (value.endsWith(afterTxt)) {
  14947. startPos = value.length - afterTxt.length;
  14948. } else if (value.startsWith(beforeTxt)) {
  14949. startPos = beforeTxt.length;
  14950. } else {
  14951. const beforeLastChar = beforeTxt[selectionStart - 1];
  14952. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  14953. if (newIndex !== -1) {
  14954. startPos = newIndex + 1;
  14955. }
  14956. }
  14957. input.value.setSelectionRange(startPos, startPos);
  14958. }
  14959. return [recordCursor, setCursor];
  14960. }
  14961. const getOrderedChildren = (vm, childComponentName, children) => {
  14962. const nodes = flattedChildren(vm.subTree).filter((n) => {
  14963. var _a2;
  14964. return isVNode(n) && ((_a2 = n.type) == null ? void 0 : _a2.name) === childComponentName && !!n.component;
  14965. });
  14966. const uids = nodes.map((n) => n.component.uid);
  14967. return uids.map((uid2) => children[uid2]).filter((p2) => !!p2);
  14968. };
  14969. const useOrderedChildren = (vm, childComponentName) => {
  14970. const children = {};
  14971. const orderedChildren = shallowRef([]);
  14972. const addChild = (child) => {
  14973. children[child.uid] = child;
  14974. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  14975. };
  14976. const removeChild = (uid2) => {
  14977. delete children[uid2];
  14978. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid2);
  14979. };
  14980. return {
  14981. children: orderedChildren,
  14982. addChild,
  14983. removeChild
  14984. };
  14985. };
  14986. const useSizeProp = buildProp({
  14987. type: String,
  14988. values: componentSizes,
  14989. required: false
  14990. });
  14991. const SIZE_INJECTION_KEY = Symbol("size");
  14992. const useGlobalSize = () => {
  14993. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  14994. return computed(() => {
  14995. return unref(injectedSize.size) || "";
  14996. });
  14997. };
  14998. function useFocusController(target, { afterFocus, beforeBlur, afterBlur } = {}) {
  14999. const instance = getCurrentInstance();
  15000. const { emit: emit2 } = instance;
  15001. const wrapperRef = shallowRef();
  15002. const isFocused = ref(false);
  15003. const handleFocus = (event) => {
  15004. if (isFocused.value)
  15005. return;
  15006. isFocused.value = true;
  15007. emit2("focus", event);
  15008. afterFocus == null ? void 0 : afterFocus();
  15009. };
  15010. const handleBlur = (event) => {
  15011. var _a2;
  15012. const cancelBlur = isFunction$2(beforeBlur) ? beforeBlur(event) : false;
  15013. if (cancelBlur || event.relatedTarget && ((_a2 = wrapperRef.value) == null ? void 0 : _a2.contains(event.relatedTarget)))
  15014. return;
  15015. isFocused.value = false;
  15016. emit2("blur", event);
  15017. afterBlur == null ? void 0 : afterBlur();
  15018. };
  15019. const handleClick = () => {
  15020. var _a2;
  15021. (_a2 = target.value) == null ? void 0 : _a2.focus();
  15022. };
  15023. watch(wrapperRef, (el) => {
  15024. if (el) {
  15025. el.setAttribute("tabindex", "-1");
  15026. }
  15027. });
  15028. useEventListener(wrapperRef, "click", handleClick);
  15029. return {
  15030. wrapperRef,
  15031. isFocused,
  15032. handleFocus,
  15033. handleBlur
  15034. };
  15035. }
  15036. const configProviderContextKey = Symbol();
  15037. const globalConfig = ref();
  15038. function useGlobalConfig(key, defaultValue = void 0) {
  15039. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  15040. if (key) {
  15041. return computed(() => {
  15042. var _a2, _b;
  15043. return (_b = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b : defaultValue;
  15044. });
  15045. } else {
  15046. return config;
  15047. }
  15048. }
  15049. function useGlobalComponentSettings(block, sizeFallback) {
  15050. const config = useGlobalConfig();
  15051. const ns = useNamespace(block, computed(() => {
  15052. var _a2;
  15053. return ((_a2 = config.value) == null ? void 0 : _a2.namespace) || defaultNamespace;
  15054. }));
  15055. const locale = useLocale(computed(() => {
  15056. var _a2;
  15057. return (_a2 = config.value) == null ? void 0 : _a2.locale;
  15058. }));
  15059. const zIndex2 = useZIndex(computed(() => {
  15060. var _a2;
  15061. return ((_a2 = config.value) == null ? void 0 : _a2.zIndex) || defaultInitialZIndex;
  15062. }));
  15063. const size2 = computed(() => {
  15064. var _a2;
  15065. return unref(sizeFallback) || ((_a2 = config.value) == null ? void 0 : _a2.size) || "";
  15066. });
  15067. provideGlobalConfig(computed(() => unref(config) || {}));
  15068. return {
  15069. ns,
  15070. locale,
  15071. zIndex: zIndex2,
  15072. size: size2
  15073. };
  15074. }
  15075. const provideGlobalConfig = (config, app, global2 = false) => {
  15076. var _a2;
  15077. const inSetup = !!getCurrentInstance();
  15078. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  15079. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  15080. if (!provideFn) {
  15081. return;
  15082. }
  15083. const context = computed(() => {
  15084. const cfg = unref(config);
  15085. if (!(oldConfig == null ? void 0 : oldConfig.value))
  15086. return cfg;
  15087. return mergeConfig(oldConfig.value, cfg);
  15088. });
  15089. provideFn(configProviderContextKey, context);
  15090. provideFn(localeContextKey, computed(() => context.value.locale));
  15091. provideFn(namespaceContextKey, computed(() => context.value.namespace));
  15092. provideFn(zIndexContextKey, computed(() => context.value.zIndex));
  15093. provideFn(SIZE_INJECTION_KEY, {
  15094. size: computed(() => context.value.size || "")
  15095. });
  15096. if (global2 || !globalConfig.value) {
  15097. globalConfig.value = context.value;
  15098. }
  15099. return context;
  15100. };
  15101. const mergeConfig = (a2, b2) => {
  15102. var _a2;
  15103. const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
  15104. const obj = {};
  15105. for (const key of keys2) {
  15106. obj[key] = (_a2 = b2[key]) != null ? _a2 : a2[key];
  15107. }
  15108. return obj;
  15109. };
  15110. const configProviderProps = buildProps({
  15111. a11y: {
  15112. type: Boolean,
  15113. default: true
  15114. },
  15115. locale: {
  15116. type: definePropType(Object)
  15117. },
  15118. size: useSizeProp,
  15119. button: {
  15120. type: definePropType(Object)
  15121. },
  15122. experimentalFeatures: {
  15123. type: definePropType(Object)
  15124. },
  15125. keyboardNavigation: {
  15126. type: Boolean,
  15127. default: true
  15128. },
  15129. message: {
  15130. type: definePropType(Object)
  15131. },
  15132. zIndex: Number,
  15133. namespace: {
  15134. type: String,
  15135. default: "el"
  15136. }
  15137. });
  15138. const messageConfig = {};
  15139. const ConfigProvider = /* @__PURE__ */ defineComponent({
  15140. name: "ElConfigProvider",
  15141. props: configProviderProps,
  15142. setup(props, { slots }) {
  15143. watch(() => props.message, (val) => {
  15144. Object.assign(messageConfig, val != null ? val : {});
  15145. }, { immediate: true, deep: true });
  15146. const config = provideGlobalConfig(props);
  15147. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  15148. }
  15149. });
  15150. const ElConfigProvider = withInstall(ConfigProvider);
  15151. const version = "2.4.3";
  15152. const makeInstaller = (components = []) => {
  15153. const install = (app, options) => {
  15154. if (app[INSTALLED_KEY])
  15155. return;
  15156. app[INSTALLED_KEY] = true;
  15157. components.forEach((c2) => app.use(c2));
  15158. if (options)
  15159. provideGlobalConfig(options, app, true);
  15160. };
  15161. return {
  15162. version,
  15163. install
  15164. };
  15165. };
  15166. const affixProps = buildProps({
  15167. zIndex: {
  15168. type: definePropType([Number, String]),
  15169. default: 100
  15170. },
  15171. target: {
  15172. type: String,
  15173. default: ""
  15174. },
  15175. offset: {
  15176. type: Number,
  15177. default: 0
  15178. },
  15179. position: {
  15180. type: String,
  15181. values: ["top", "bottom"],
  15182. default: "top"
  15183. }
  15184. });
  15185. const affixEmits = {
  15186. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  15187. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  15188. };
  15189. var _export_sfc$1 = (sfc, props) => {
  15190. const target = sfc.__vccOpts || sfc;
  15191. for (const [key, val] of props) {
  15192. target[key] = val;
  15193. }
  15194. return target;
  15195. };
  15196. const COMPONENT_NAME$n = "ElAffix";
  15197. const __default__$1D = /* @__PURE__ */ defineComponent({
  15198. name: COMPONENT_NAME$n
  15199. });
  15200. const _sfc_main$2n = /* @__PURE__ */ defineComponent({
  15201. ...__default__$1D,
  15202. props: affixProps,
  15203. emits: affixEmits,
  15204. setup(__props, { expose, emit: emit2 }) {
  15205. const props = __props;
  15206. const ns = useNamespace("affix");
  15207. const target = shallowRef();
  15208. const root2 = shallowRef();
  15209. const scrollContainer = shallowRef();
  15210. const { height: windowHeight } = useWindowSize();
  15211. const {
  15212. height: rootHeight,
  15213. width: rootWidth,
  15214. top: rootTop,
  15215. bottom: rootBottom,
  15216. update: updateRoot
  15217. } = useElementBounding(root2, { windowScroll: false });
  15218. const targetRect = useElementBounding(target);
  15219. const fixed = ref(false);
  15220. const scrollTop = ref(0);
  15221. const transform = ref(0);
  15222. const rootStyle = computed(() => {
  15223. return {
  15224. height: fixed.value ? `${rootHeight.value}px` : "",
  15225. width: fixed.value ? `${rootWidth.value}px` : ""
  15226. };
  15227. });
  15228. const affixStyle = computed(() => {
  15229. if (!fixed.value)
  15230. return {};
  15231. const offset2 = props.offset ? addUnit(props.offset) : 0;
  15232. return {
  15233. height: `${rootHeight.value}px`,
  15234. width: `${rootWidth.value}px`,
  15235. top: props.position === "top" ? offset2 : "",
  15236. bottom: props.position === "bottom" ? offset2 : "",
  15237. transform: transform.value ? `translateY(${transform.value}px)` : "",
  15238. zIndex: props.zIndex
  15239. };
  15240. });
  15241. const update = () => {
  15242. if (!scrollContainer.value)
  15243. return;
  15244. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  15245. if (props.position === "top") {
  15246. if (props.target) {
  15247. const difference = targetRect.bottom.value - props.offset - rootHeight.value;
  15248. fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
  15249. transform.value = difference < 0 ? difference : 0;
  15250. } else {
  15251. fixed.value = props.offset > rootTop.value;
  15252. }
  15253. } else if (props.target) {
  15254. const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
  15255. fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  15256. transform.value = difference < 0 ? -difference : 0;
  15257. } else {
  15258. fixed.value = windowHeight.value - props.offset < rootBottom.value;
  15259. }
  15260. };
  15261. const handleScroll2 = () => {
  15262. updateRoot();
  15263. emit2("scroll", {
  15264. scrollTop: scrollTop.value,
  15265. fixed: fixed.value
  15266. });
  15267. };
  15268. watch(fixed, (val) => emit2("change", val));
  15269. onMounted(() => {
  15270. var _a2;
  15271. if (props.target) {
  15272. target.value = (_a2 = document.querySelector(props.target)) != null ? _a2 : void 0;
  15273. if (!target.value)
  15274. throwError(COMPONENT_NAME$n, `Target is not existed: ${props.target}`);
  15275. } else {
  15276. target.value = document.documentElement;
  15277. }
  15278. scrollContainer.value = getScrollContainer(root2.value, true);
  15279. updateRoot();
  15280. });
  15281. useEventListener(scrollContainer, "scroll", handleScroll2);
  15282. watchEffect(update);
  15283. expose({
  15284. update,
  15285. updateRoot
  15286. });
  15287. return (_ctx, _cache) => {
  15288. return openBlock(), createElementBlock("div", {
  15289. ref_key: "root",
  15290. ref: root2,
  15291. class: normalizeClass(unref(ns).b()),
  15292. style: normalizeStyle(unref(rootStyle))
  15293. }, [
  15294. createBaseVNode("div", {
  15295. class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
  15296. style: normalizeStyle(unref(affixStyle))
  15297. }, [
  15298. renderSlot(_ctx.$slots, "default")
  15299. ], 6)
  15300. ], 6);
  15301. };
  15302. }
  15303. });
  15304. var Affix = /* @__PURE__ */ _export_sfc$1(_sfc_main$2n, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/affix/src/affix.vue"]]);
  15305. const ElAffix = withInstall(Affix);
  15306. const iconProps = buildProps({
  15307. size: {
  15308. type: definePropType([Number, String])
  15309. },
  15310. color: {
  15311. type: String
  15312. }
  15313. });
  15314. const __default__$1C = /* @__PURE__ */ defineComponent({
  15315. name: "ElIcon",
  15316. inheritAttrs: false
  15317. });
  15318. const _sfc_main$2m = /* @__PURE__ */ defineComponent({
  15319. ...__default__$1C,
  15320. props: iconProps,
  15321. setup(__props) {
  15322. const props = __props;
  15323. const ns = useNamespace("icon");
  15324. const style = computed(() => {
  15325. const { size: size2, color } = props;
  15326. if (!size2 && !color)
  15327. return {};
  15328. return {
  15329. fontSize: isUndefined(size2) ? void 0 : addUnit(size2),
  15330. "--color": color
  15331. };
  15332. });
  15333. return (_ctx, _cache) => {
  15334. return openBlock(), createElementBlock("i", mergeProps({
  15335. class: unref(ns).b(),
  15336. style: unref(style)
  15337. }, _ctx.$attrs), [
  15338. renderSlot(_ctx.$slots, "default")
  15339. ], 16);
  15340. };
  15341. }
  15342. });
  15343. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$2m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  15344. const ElIcon = withInstall(Icon);
  15345. const alertEffects = ["light", "dark"];
  15346. const alertProps = buildProps({
  15347. title: {
  15348. type: String,
  15349. default: ""
  15350. },
  15351. description: {
  15352. type: String,
  15353. default: ""
  15354. },
  15355. type: {
  15356. type: String,
  15357. values: keysOf(TypeComponentsMap),
  15358. default: "info"
  15359. },
  15360. closable: {
  15361. type: Boolean,
  15362. default: true
  15363. },
  15364. closeText: {
  15365. type: String,
  15366. default: ""
  15367. },
  15368. showIcon: Boolean,
  15369. center: Boolean,
  15370. effect: {
  15371. type: String,
  15372. values: alertEffects,
  15373. default: "light"
  15374. }
  15375. });
  15376. const alertEmits = {
  15377. close: (evt) => evt instanceof MouseEvent
  15378. };
  15379. const __default__$1B = /* @__PURE__ */ defineComponent({
  15380. name: "ElAlert"
  15381. });
  15382. const _sfc_main$2l = /* @__PURE__ */ defineComponent({
  15383. ...__default__$1B,
  15384. props: alertProps,
  15385. emits: alertEmits,
  15386. setup(__props, { emit: emit2 }) {
  15387. const props = __props;
  15388. const { Close } = TypeComponents;
  15389. const slots = useSlots();
  15390. const ns = useNamespace("alert");
  15391. const visible = ref(true);
  15392. const iconComponent = computed(() => TypeComponentsMap[props.type]);
  15393. const iconClass = computed(() => [
  15394. ns.e("icon"),
  15395. { [ns.is("big")]: !!props.description || !!slots.default }
  15396. ]);
  15397. const isBoldTitle = computed(() => {
  15398. return { [ns.is("bold")]: props.description || slots.default };
  15399. });
  15400. const close2 = (evt) => {
  15401. visible.value = false;
  15402. emit2("close", evt);
  15403. };
  15404. return (_ctx, _cache) => {
  15405. return openBlock(), createBlock(Transition, {
  15406. name: unref(ns).b("fade"),
  15407. persisted: ""
  15408. }, {
  15409. default: withCtx(() => [
  15410. withDirectives(createBaseVNode("div", {
  15411. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.type), unref(ns).is("center", _ctx.center), unref(ns).is(_ctx.effect)]),
  15412. role: "alert"
  15413. }, [
  15414. _ctx.showIcon && unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  15415. key: 0,
  15416. class: normalizeClass(unref(iconClass))
  15417. }, {
  15418. default: withCtx(() => [
  15419. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  15420. ]),
  15421. _: 1
  15422. }, 8, ["class"])) : createCommentVNode("v-if", true),
  15423. createBaseVNode("div", {
  15424. class: normalizeClass(unref(ns).e("content"))
  15425. }, [
  15426. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  15427. key: 0,
  15428. class: normalizeClass([unref(ns).e("title"), unref(isBoldTitle)])
  15429. }, [
  15430. renderSlot(_ctx.$slots, "title", {}, () => [
  15431. createTextVNode(toDisplayString(_ctx.title), 1)
  15432. ])
  15433. ], 2)) : createCommentVNode("v-if", true),
  15434. _ctx.$slots.default || _ctx.description ? (openBlock(), createElementBlock("p", {
  15435. key: 1,
  15436. class: normalizeClass(unref(ns).e("description"))
  15437. }, [
  15438. renderSlot(_ctx.$slots, "default", {}, () => [
  15439. createTextVNode(toDisplayString(_ctx.description), 1)
  15440. ])
  15441. ], 2)) : createCommentVNode("v-if", true),
  15442. _ctx.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  15443. _ctx.closeText ? (openBlock(), createElementBlock("div", {
  15444. key: 0,
  15445. class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
  15446. onClick: close2
  15447. }, toDisplayString(_ctx.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
  15448. key: 1,
  15449. class: normalizeClass(unref(ns).e("close-btn")),
  15450. onClick: close2
  15451. }, {
  15452. default: withCtx(() => [
  15453. createVNode(unref(Close))
  15454. ]),
  15455. _: 1
  15456. }, 8, ["class"]))
  15457. ], 64)) : createCommentVNode("v-if", true)
  15458. ], 2)
  15459. ], 2), [
  15460. [vShow, visible.value]
  15461. ])
  15462. ]),
  15463. _: 3
  15464. }, 8, ["name"]);
  15465. };
  15466. }
  15467. });
  15468. var Alert = /* @__PURE__ */ _export_sfc$1(_sfc_main$2l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/alert/src/alert.vue"]]);
  15469. const ElAlert = withInstall(Alert);
  15470. const formContextKey = Symbol("formContextKey");
  15471. const formItemContextKey = Symbol("formItemContextKey");
  15472. const useFormSize = (fallback, ignore = {}) => {
  15473. const emptyRef = ref(void 0);
  15474. const size2 = ignore.prop ? emptyRef : useProp("size");
  15475. const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
  15476. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  15477. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  15478. return computed(() => size2.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  15479. };
  15480. const useFormDisabled = (fallback) => {
  15481. const disabled = useProp("disabled");
  15482. const form = inject(formContextKey, void 0);
  15483. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  15484. };
  15485. const useFormItem = () => {
  15486. const form = inject(formContextKey, void 0);
  15487. const formItem = inject(formItemContextKey, void 0);
  15488. return {
  15489. form,
  15490. formItem
  15491. };
  15492. };
  15493. const useFormItemInputId = (props, {
  15494. formItemContext,
  15495. disableIdGeneration,
  15496. disableIdManagement
  15497. }) => {
  15498. if (!disableIdGeneration) {
  15499. disableIdGeneration = ref(false);
  15500. }
  15501. if (!disableIdManagement) {
  15502. disableIdManagement = ref(false);
  15503. }
  15504. const inputId = ref();
  15505. let idUnwatch = void 0;
  15506. const isLabeledByFormItem = computed(() => {
  15507. var _a2;
  15508. return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
  15509. });
  15510. onMounted(() => {
  15511. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  15512. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  15513. if (newId !== inputId.value) {
  15514. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  15515. inputId.value && formItemContext.removeInputId(inputId.value);
  15516. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  15517. formItemContext.addInputId(newId);
  15518. }
  15519. }
  15520. inputId.value = newId;
  15521. }
  15522. }, { immediate: true });
  15523. });
  15524. onUnmounted(() => {
  15525. idUnwatch && idUnwatch();
  15526. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  15527. inputId.value && formItemContext.removeInputId(inputId.value);
  15528. }
  15529. });
  15530. return {
  15531. isLabeledByFormItem,
  15532. inputId
  15533. };
  15534. };
  15535. const formMetaProps = buildProps({
  15536. size: {
  15537. type: String,
  15538. values: componentSizes
  15539. },
  15540. disabled: Boolean
  15541. });
  15542. const formProps = buildProps({
  15543. ...formMetaProps,
  15544. model: Object,
  15545. rules: {
  15546. type: definePropType(Object)
  15547. },
  15548. labelPosition: {
  15549. type: String,
  15550. values: ["left", "right", "top"],
  15551. default: "right"
  15552. },
  15553. requireAsteriskPosition: {
  15554. type: String,
  15555. values: ["left", "right"],
  15556. default: "left"
  15557. },
  15558. labelWidth: {
  15559. type: [String, Number],
  15560. default: ""
  15561. },
  15562. labelSuffix: {
  15563. type: String,
  15564. default: ""
  15565. },
  15566. inline: Boolean,
  15567. inlineMessage: Boolean,
  15568. statusIcon: Boolean,
  15569. showMessage: {
  15570. type: Boolean,
  15571. default: true
  15572. },
  15573. validateOnRuleChange: {
  15574. type: Boolean,
  15575. default: true
  15576. },
  15577. hideRequiredAsterisk: Boolean,
  15578. scrollToError: Boolean,
  15579. scrollIntoViewOptions: {
  15580. type: [Object, Boolean]
  15581. }
  15582. });
  15583. const formEmits = {
  15584. validate: (prop, isValid, message2) => (isArray$3(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message2)
  15585. };
  15586. function useFormLabelWidth() {
  15587. const potentialLabelWidthArr = ref([]);
  15588. const autoLabelWidth = computed(() => {
  15589. if (!potentialLabelWidthArr.value.length)
  15590. return "0";
  15591. const max2 = Math.max(...potentialLabelWidthArr.value);
  15592. return max2 ? `${max2}px` : "";
  15593. });
  15594. function getLabelWidthIndex(width) {
  15595. const index2 = potentialLabelWidthArr.value.indexOf(width);
  15596. if (index2 === -1 && autoLabelWidth.value === "0")
  15597. ;
  15598. return index2;
  15599. }
  15600. function registerLabelWidth(val, oldVal) {
  15601. if (val && oldVal) {
  15602. const index2 = getLabelWidthIndex(oldVal);
  15603. potentialLabelWidthArr.value.splice(index2, 1, val);
  15604. } else if (val) {
  15605. potentialLabelWidthArr.value.push(val);
  15606. }
  15607. }
  15608. function deregisterLabelWidth(val) {
  15609. const index2 = getLabelWidthIndex(val);
  15610. if (index2 > -1) {
  15611. potentialLabelWidthArr.value.splice(index2, 1);
  15612. }
  15613. }
  15614. return {
  15615. autoLabelWidth,
  15616. registerLabelWidth,
  15617. deregisterLabelWidth
  15618. };
  15619. }
  15620. const filterFields = (fields, props) => {
  15621. const normalized = castArray$1(props);
  15622. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  15623. };
  15624. const COMPONENT_NAME$m = "ElForm";
  15625. const __default__$1A = /* @__PURE__ */ defineComponent({
  15626. name: COMPONENT_NAME$m
  15627. });
  15628. const _sfc_main$2k = /* @__PURE__ */ defineComponent({
  15629. ...__default__$1A,
  15630. props: formProps,
  15631. emits: formEmits,
  15632. setup(__props, { expose, emit: emit2 }) {
  15633. const props = __props;
  15634. const fields = [];
  15635. const formSize = useFormSize();
  15636. const ns = useNamespace("form");
  15637. const formClasses = computed(() => {
  15638. const { labelPosition, inline } = props;
  15639. return [
  15640. ns.b(),
  15641. ns.m(formSize.value || "default"),
  15642. {
  15643. [ns.m(`label-${labelPosition}`)]: labelPosition,
  15644. [ns.m("inline")]: inline
  15645. }
  15646. ];
  15647. });
  15648. const addField = (field) => {
  15649. fields.push(field);
  15650. };
  15651. const removeField = (field) => {
  15652. if (field.prop) {
  15653. fields.splice(fields.indexOf(field), 1);
  15654. }
  15655. };
  15656. const resetFields = (properties = []) => {
  15657. if (!props.model) {
  15658. return;
  15659. }
  15660. filterFields(fields, properties).forEach((field) => field.resetField());
  15661. };
  15662. const clearValidate = (props2 = []) => {
  15663. filterFields(fields, props2).forEach((field) => field.clearValidate());
  15664. };
  15665. const isValidatable = computed(() => {
  15666. const hasModel = !!props.model;
  15667. return hasModel;
  15668. });
  15669. const obtainValidateFields = (props2) => {
  15670. if (fields.length === 0)
  15671. return [];
  15672. const filteredFields = filterFields(fields, props2);
  15673. if (!filteredFields.length) {
  15674. return [];
  15675. }
  15676. return filteredFields;
  15677. };
  15678. const validate = async (callback) => validateField(void 0, callback);
  15679. const doValidateField = async (props2 = []) => {
  15680. if (!isValidatable.value)
  15681. return false;
  15682. const fields2 = obtainValidateFields(props2);
  15683. if (fields2.length === 0)
  15684. return true;
  15685. let validationErrors = {};
  15686. for (const field of fields2) {
  15687. try {
  15688. await field.validate("");
  15689. } catch (fields3) {
  15690. validationErrors = {
  15691. ...validationErrors,
  15692. ...fields3
  15693. };
  15694. }
  15695. }
  15696. if (Object.keys(validationErrors).length === 0)
  15697. return true;
  15698. return Promise.reject(validationErrors);
  15699. };
  15700. const validateField = async (modelProps = [], callback) => {
  15701. const shouldThrow = !isFunction$2(callback);
  15702. try {
  15703. const result = await doValidateField(modelProps);
  15704. if (result === true) {
  15705. callback == null ? void 0 : callback(result);
  15706. }
  15707. return result;
  15708. } catch (e) {
  15709. if (e instanceof Error)
  15710. throw e;
  15711. const invalidFields = e;
  15712. if (props.scrollToError) {
  15713. scrollToField(Object.keys(invalidFields)[0]);
  15714. }
  15715. callback == null ? void 0 : callback(false, invalidFields);
  15716. return shouldThrow && Promise.reject(invalidFields);
  15717. }
  15718. };
  15719. const scrollToField = (prop) => {
  15720. var _a2;
  15721. const field = filterFields(fields, prop)[0];
  15722. if (field) {
  15723. (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView(props.scrollIntoViewOptions);
  15724. }
  15725. };
  15726. watch(() => props.rules, () => {
  15727. if (props.validateOnRuleChange) {
  15728. validate().catch((err) => debugWarn());
  15729. }
  15730. }, { deep: true });
  15731. provide(formContextKey, reactive({
  15732. ...toRefs(props),
  15733. emit: emit2,
  15734. resetFields,
  15735. clearValidate,
  15736. validateField,
  15737. addField,
  15738. removeField,
  15739. ...useFormLabelWidth()
  15740. }));
  15741. expose({
  15742. validate,
  15743. validateField,
  15744. resetFields,
  15745. clearValidate,
  15746. scrollToField
  15747. });
  15748. return (_ctx, _cache) => {
  15749. return openBlock(), createElementBlock("form", {
  15750. class: normalizeClass(unref(formClasses))
  15751. }, [
  15752. renderSlot(_ctx.$slots, "default")
  15753. ], 2);
  15754. };
  15755. }
  15756. });
  15757. var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$2k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
  15758. function _extends() {
  15759. _extends = Object.assign ? Object.assign.bind() : function(target) {
  15760. for (var i = 1; i < arguments.length; i++) {
  15761. var source = arguments[i];
  15762. for (var key in source) {
  15763. if (Object.prototype.hasOwnProperty.call(source, key)) {
  15764. target[key] = source[key];
  15765. }
  15766. }
  15767. }
  15768. return target;
  15769. };
  15770. return _extends.apply(this, arguments);
  15771. }
  15772. function _inheritsLoose(subClass, superClass) {
  15773. subClass.prototype = Object.create(superClass.prototype);
  15774. subClass.prototype.constructor = subClass;
  15775. _setPrototypeOf(subClass, superClass);
  15776. }
  15777. function _getPrototypeOf(o2) {
  15778. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
  15779. return o3.__proto__ || Object.getPrototypeOf(o3);
  15780. };
  15781. return _getPrototypeOf(o2);
  15782. }
  15783. function _setPrototypeOf(o2, p2) {
  15784. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
  15785. o3.__proto__ = p3;
  15786. return o3;
  15787. };
  15788. return _setPrototypeOf(o2, p2);
  15789. }
  15790. function _isNativeReflectConstruct() {
  15791. if (typeof Reflect === "undefined" || !Reflect.construct)
  15792. return false;
  15793. if (Reflect.construct.sham)
  15794. return false;
  15795. if (typeof Proxy === "function")
  15796. return true;
  15797. try {
  15798. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  15799. }));
  15800. return true;
  15801. } catch (e) {
  15802. return false;
  15803. }
  15804. }
  15805. function _construct(Parent, args, Class) {
  15806. if (_isNativeReflectConstruct()) {
  15807. _construct = Reflect.construct.bind();
  15808. } else {
  15809. _construct = function _construct2(Parent2, args2, Class2) {
  15810. var a2 = [null];
  15811. a2.push.apply(a2, args2);
  15812. var Constructor = Function.bind.apply(Parent2, a2);
  15813. var instance = new Constructor();
  15814. if (Class2)
  15815. _setPrototypeOf(instance, Class2.prototype);
  15816. return instance;
  15817. };
  15818. }
  15819. return _construct.apply(null, arguments);
  15820. }
  15821. function _isNativeFunction(fn2) {
  15822. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  15823. }
  15824. function _wrapNativeSuper(Class) {
  15825. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  15826. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  15827. if (Class2 === null || !_isNativeFunction(Class2))
  15828. return Class2;
  15829. if (typeof Class2 !== "function") {
  15830. throw new TypeError("Super expression must either be null or a function");
  15831. }
  15832. if (typeof _cache !== "undefined") {
  15833. if (_cache.has(Class2))
  15834. return _cache.get(Class2);
  15835. _cache.set(Class2, Wrapper);
  15836. }
  15837. function Wrapper() {
  15838. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  15839. }
  15840. Wrapper.prototype = Object.create(Class2.prototype, {
  15841. constructor: {
  15842. value: Wrapper,
  15843. enumerable: false,
  15844. writable: true,
  15845. configurable: true
  15846. }
  15847. });
  15848. return _setPrototypeOf(Wrapper, Class2);
  15849. };
  15850. return _wrapNativeSuper(Class);
  15851. }
  15852. var formatRegExp = /%[sdj%]/g;
  15853. var warning = function warning2() {
  15854. };
  15855. if (typeof process !== "undefined" && process.env && false) {
  15856. warning = function warning2(type2, errors) {
  15857. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  15858. if (errors.every(function(e) {
  15859. return typeof e === "string";
  15860. })) {
  15861. console.warn(type2, errors);
  15862. }
  15863. }
  15864. };
  15865. }
  15866. function convertFieldsError(errors) {
  15867. if (!errors || !errors.length)
  15868. return null;
  15869. var fields = {};
  15870. errors.forEach(function(error) {
  15871. var field = error.field;
  15872. fields[field] = fields[field] || [];
  15873. fields[field].push(error);
  15874. });
  15875. return fields;
  15876. }
  15877. function format(template) {
  15878. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  15879. args[_key - 1] = arguments[_key];
  15880. }
  15881. var i = 0;
  15882. var len = args.length;
  15883. if (typeof template === "function") {
  15884. return template.apply(null, args);
  15885. }
  15886. if (typeof template === "string") {
  15887. var str = template.replace(formatRegExp, function(x2) {
  15888. if (x2 === "%%") {
  15889. return "%";
  15890. }
  15891. if (i >= len) {
  15892. return x2;
  15893. }
  15894. switch (x2) {
  15895. case "%s":
  15896. return String(args[i++]);
  15897. case "%d":
  15898. return Number(args[i++]);
  15899. case "%j":
  15900. try {
  15901. return JSON.stringify(args[i++]);
  15902. } catch (_2) {
  15903. return "[Circular]";
  15904. }
  15905. break;
  15906. default:
  15907. return x2;
  15908. }
  15909. });
  15910. return str;
  15911. }
  15912. return template;
  15913. }
  15914. function isNativeStringType(type2) {
  15915. return type2 === "string" || type2 === "url" || type2 === "hex" || type2 === "email" || type2 === "date" || type2 === "pattern";
  15916. }
  15917. function isEmptyValue(value, type2) {
  15918. if (value === void 0 || value === null) {
  15919. return true;
  15920. }
  15921. if (type2 === "array" && Array.isArray(value) && !value.length) {
  15922. return true;
  15923. }
  15924. if (isNativeStringType(type2) && typeof value === "string" && !value) {
  15925. return true;
  15926. }
  15927. return false;
  15928. }
  15929. function asyncParallelArray(arr, func, callback) {
  15930. var results = [];
  15931. var total2 = 0;
  15932. var arrLength = arr.length;
  15933. function count(errors) {
  15934. results.push.apply(results, errors || []);
  15935. total2++;
  15936. if (total2 === arrLength) {
  15937. callback(results);
  15938. }
  15939. }
  15940. arr.forEach(function(a2) {
  15941. func(a2, count);
  15942. });
  15943. }
  15944. function asyncSerialArray(arr, func, callback) {
  15945. var index2 = 0;
  15946. var arrLength = arr.length;
  15947. function next(errors) {
  15948. if (errors && errors.length) {
  15949. callback(errors);
  15950. return;
  15951. }
  15952. var original = index2;
  15953. index2 = index2 + 1;
  15954. if (original < arrLength) {
  15955. func(arr[original], next);
  15956. } else {
  15957. callback([]);
  15958. }
  15959. }
  15960. next([]);
  15961. }
  15962. function flattenObjArr(objArr) {
  15963. var ret = [];
  15964. Object.keys(objArr).forEach(function(k) {
  15965. ret.push.apply(ret, objArr[k] || []);
  15966. });
  15967. return ret;
  15968. }
  15969. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  15970. _inheritsLoose(AsyncValidationError2, _Error);
  15971. function AsyncValidationError2(errors, fields) {
  15972. var _this;
  15973. _this = _Error.call(this, "Async Validation Error") || this;
  15974. _this.errors = errors;
  15975. _this.fields = fields;
  15976. return _this;
  15977. }
  15978. return AsyncValidationError2;
  15979. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  15980. function asyncMap(objArr, option, func, callback, source) {
  15981. if (option.first) {
  15982. var _pending = new Promise(function(resolve2, reject) {
  15983. var next = function next2(errors) {
  15984. callback(errors);
  15985. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve2(source);
  15986. };
  15987. var flattenArr = flattenObjArr(objArr);
  15988. asyncSerialArray(flattenArr, func, next);
  15989. });
  15990. _pending["catch"](function(e) {
  15991. return e;
  15992. });
  15993. return _pending;
  15994. }
  15995. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  15996. var objArrKeys = Object.keys(objArr);
  15997. var objArrLength = objArrKeys.length;
  15998. var total2 = 0;
  15999. var results = [];
  16000. var pending = new Promise(function(resolve2, reject) {
  16001. var next = function next2(errors) {
  16002. results.push.apply(results, errors);
  16003. total2++;
  16004. if (total2 === objArrLength) {
  16005. callback(results);
  16006. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve2(source);
  16007. }
  16008. };
  16009. if (!objArrKeys.length) {
  16010. callback(results);
  16011. resolve2(source);
  16012. }
  16013. objArrKeys.forEach(function(key) {
  16014. var arr = objArr[key];
  16015. if (firstFields.indexOf(key) !== -1) {
  16016. asyncSerialArray(arr, func, next);
  16017. } else {
  16018. asyncParallelArray(arr, func, next);
  16019. }
  16020. });
  16021. });
  16022. pending["catch"](function(e) {
  16023. return e;
  16024. });
  16025. return pending;
  16026. }
  16027. function isErrorObj(obj) {
  16028. return !!(obj && obj.message !== void 0);
  16029. }
  16030. function getValue(value, path) {
  16031. var v2 = value;
  16032. for (var i = 0; i < path.length; i++) {
  16033. if (v2 == void 0) {
  16034. return v2;
  16035. }
  16036. v2 = v2[path[i]];
  16037. }
  16038. return v2;
  16039. }
  16040. function complementError(rule, source) {
  16041. return function(oe) {
  16042. var fieldValue;
  16043. if (rule.fullFields) {
  16044. fieldValue = getValue(source, rule.fullFields);
  16045. } else {
  16046. fieldValue = source[oe.field || rule.fullField];
  16047. }
  16048. if (isErrorObj(oe)) {
  16049. oe.field = oe.field || rule.fullField;
  16050. oe.fieldValue = fieldValue;
  16051. return oe;
  16052. }
  16053. return {
  16054. message: typeof oe === "function" ? oe() : oe,
  16055. fieldValue,
  16056. field: oe.field || rule.fullField
  16057. };
  16058. };
  16059. }
  16060. function deepMerge(target, source) {
  16061. if (source) {
  16062. for (var s2 in source) {
  16063. if (source.hasOwnProperty(s2)) {
  16064. var value = source[s2];
  16065. if (typeof value === "object" && typeof target[s2] === "object") {
  16066. target[s2] = _extends({}, target[s2], value);
  16067. } else {
  16068. target[s2] = value;
  16069. }
  16070. }
  16071. }
  16072. }
  16073. return target;
  16074. }
  16075. var required$1 = function required2(rule, value, source, errors, options, type2) {
  16076. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type2 || rule.type))) {
  16077. errors.push(format(options.messages.required, rule.fullField));
  16078. }
  16079. };
  16080. var whitespace = function whitespace2(rule, value, source, errors, options) {
  16081. if (/^\s+$/.test(value) || value === "") {
  16082. errors.push(format(options.messages.whitespace, rule.fullField));
  16083. }
  16084. };
  16085. var urlReg;
  16086. var getUrlRegex = function() {
  16087. if (urlReg) {
  16088. return urlReg;
  16089. }
  16090. var word = "[a-fA-F\\d:]";
  16091. var b2 = function b3(options) {
  16092. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  16093. };
  16094. var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
  16095. var v6seg = "[a-fA-F\\d]{1,4}";
  16096. var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
  16097. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  16098. var v4exact = new RegExp("^" + v4 + "$");
  16099. var v6exact = new RegExp("^" + v6 + "$");
  16100. var ip = function ip2(options) {
  16101. return options && options.exact ? v46Exact : new RegExp("(?:" + b2(options) + v4 + b2(options) + ")|(?:" + b2(options) + v6 + b2(options) + ")", "g");
  16102. };
  16103. ip.v4 = function(options) {
  16104. return options && options.exact ? v4exact : new RegExp("" + b2(options) + v4 + b2(options), "g");
  16105. };
  16106. ip.v6 = function(options) {
  16107. return options && options.exact ? v6exact : new RegExp("" + b2(options) + v6 + b2(options), "g");
  16108. };
  16109. var protocol = "(?:(?:[a-z]+:)?//)";
  16110. var auth = "(?:\\S+(?::\\S*)?@)?";
  16111. var ipv4 = ip.v4().source;
  16112. var ipv6 = ip.v6().source;
  16113. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  16114. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  16115. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  16116. var port = "(?::\\d{2,5})?";
  16117. var path = '(?:[/?#][^\\s"]*)?';
  16118. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  16119. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  16120. return urlReg;
  16121. };
  16122. var pattern$2 = {
  16123. // http://emailregex.com/
  16124. email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
  16125. // url: new RegExp(
  16126. // '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
  16127. // 'i',
  16128. // ),
  16129. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  16130. };
  16131. var types = {
  16132. integer: function integer2(value) {
  16133. return types.number(value) && parseInt(value, 10) === value;
  16134. },
  16135. "float": function float(value) {
  16136. return types.number(value) && !types.integer(value);
  16137. },
  16138. array: function array2(value) {
  16139. return Array.isArray(value);
  16140. },
  16141. regexp: function regexp2(value) {
  16142. if (value instanceof RegExp) {
  16143. return true;
  16144. }
  16145. try {
  16146. return !!new RegExp(value);
  16147. } catch (e) {
  16148. return false;
  16149. }
  16150. },
  16151. date: function date2(value) {
  16152. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  16153. },
  16154. number: function number2(value) {
  16155. if (isNaN(value)) {
  16156. return false;
  16157. }
  16158. return typeof value === "number";
  16159. },
  16160. object: function object2(value) {
  16161. return typeof value === "object" && !types.array(value);
  16162. },
  16163. method: function method2(value) {
  16164. return typeof value === "function";
  16165. },
  16166. email: function email(value) {
  16167. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  16168. },
  16169. url: function url(value) {
  16170. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  16171. },
  16172. hex: function hex(value) {
  16173. return typeof value === "string" && !!value.match(pattern$2.hex);
  16174. }
  16175. };
  16176. var type$1 = function type2(rule, value, source, errors, options) {
  16177. if (rule.required && value === void 0) {
  16178. required$1(rule, value, source, errors, options);
  16179. return;
  16180. }
  16181. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  16182. var ruleType = rule.type;
  16183. if (custom.indexOf(ruleType) > -1) {
  16184. if (!types[ruleType](value)) {
  16185. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16186. }
  16187. } else if (ruleType && typeof value !== rule.type) {
  16188. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16189. }
  16190. };
  16191. var range = function range2(rule, value, source, errors, options) {
  16192. var len = typeof rule.len === "number";
  16193. var min2 = typeof rule.min === "number";
  16194. var max2 = typeof rule.max === "number";
  16195. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  16196. var val = value;
  16197. var key = null;
  16198. var num = typeof value === "number";
  16199. var str = typeof value === "string";
  16200. var arr = Array.isArray(value);
  16201. if (num) {
  16202. key = "number";
  16203. } else if (str) {
  16204. key = "string";
  16205. } else if (arr) {
  16206. key = "array";
  16207. }
  16208. if (!key) {
  16209. return false;
  16210. }
  16211. if (arr) {
  16212. val = value.length;
  16213. }
  16214. if (str) {
  16215. val = value.replace(spRegexp, "_").length;
  16216. }
  16217. if (len) {
  16218. if (val !== rule.len) {
  16219. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  16220. }
  16221. } else if (min2 && !max2 && val < rule.min) {
  16222. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  16223. } else if (max2 && !min2 && val > rule.max) {
  16224. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  16225. } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
  16226. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  16227. }
  16228. };
  16229. var ENUM$1 = "enum";
  16230. var enumerable$1 = function enumerable2(rule, value, source, errors, options) {
  16231. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  16232. if (rule[ENUM$1].indexOf(value) === -1) {
  16233. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  16234. }
  16235. };
  16236. var pattern$1 = function pattern2(rule, value, source, errors, options) {
  16237. if (rule.pattern) {
  16238. if (rule.pattern instanceof RegExp) {
  16239. rule.pattern.lastIndex = 0;
  16240. if (!rule.pattern.test(value)) {
  16241. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16242. }
  16243. } else if (typeof rule.pattern === "string") {
  16244. var _pattern = new RegExp(rule.pattern);
  16245. if (!_pattern.test(value)) {
  16246. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16247. }
  16248. }
  16249. }
  16250. };
  16251. var rules = {
  16252. required: required$1,
  16253. whitespace,
  16254. type: type$1,
  16255. range,
  16256. "enum": enumerable$1,
  16257. pattern: pattern$1
  16258. };
  16259. var string = function string2(rule, value, callback, source, options) {
  16260. var errors = [];
  16261. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16262. if (validate) {
  16263. if (isEmptyValue(value, "string") && !rule.required) {
  16264. return callback();
  16265. }
  16266. rules.required(rule, value, source, errors, options, "string");
  16267. if (!isEmptyValue(value, "string")) {
  16268. rules.type(rule, value, source, errors, options);
  16269. rules.range(rule, value, source, errors, options);
  16270. rules.pattern(rule, value, source, errors, options);
  16271. if (rule.whitespace === true) {
  16272. rules.whitespace(rule, value, source, errors, options);
  16273. }
  16274. }
  16275. }
  16276. callback(errors);
  16277. };
  16278. var method = function method2(rule, value, callback, source, options) {
  16279. var errors = [];
  16280. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16281. if (validate) {
  16282. if (isEmptyValue(value) && !rule.required) {
  16283. return callback();
  16284. }
  16285. rules.required(rule, value, source, errors, options);
  16286. if (value !== void 0) {
  16287. rules.type(rule, value, source, errors, options);
  16288. }
  16289. }
  16290. callback(errors);
  16291. };
  16292. var number = function number2(rule, value, callback, source, options) {
  16293. var errors = [];
  16294. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16295. if (validate) {
  16296. if (value === "") {
  16297. value = void 0;
  16298. }
  16299. if (isEmptyValue(value) && !rule.required) {
  16300. return callback();
  16301. }
  16302. rules.required(rule, value, source, errors, options);
  16303. if (value !== void 0) {
  16304. rules.type(rule, value, source, errors, options);
  16305. rules.range(rule, value, source, errors, options);
  16306. }
  16307. }
  16308. callback(errors);
  16309. };
  16310. var _boolean = function _boolean2(rule, value, callback, source, options) {
  16311. var errors = [];
  16312. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16313. if (validate) {
  16314. if (isEmptyValue(value) && !rule.required) {
  16315. return callback();
  16316. }
  16317. rules.required(rule, value, source, errors, options);
  16318. if (value !== void 0) {
  16319. rules.type(rule, value, source, errors, options);
  16320. }
  16321. }
  16322. callback(errors);
  16323. };
  16324. var regexp = function regexp2(rule, value, callback, source, options) {
  16325. var errors = [];
  16326. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16327. if (validate) {
  16328. if (isEmptyValue(value) && !rule.required) {
  16329. return callback();
  16330. }
  16331. rules.required(rule, value, source, errors, options);
  16332. if (!isEmptyValue(value)) {
  16333. rules.type(rule, value, source, errors, options);
  16334. }
  16335. }
  16336. callback(errors);
  16337. };
  16338. var integer = function integer2(rule, value, callback, source, options) {
  16339. var errors = [];
  16340. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16341. if (validate) {
  16342. if (isEmptyValue(value) && !rule.required) {
  16343. return callback();
  16344. }
  16345. rules.required(rule, value, source, errors, options);
  16346. if (value !== void 0) {
  16347. rules.type(rule, value, source, errors, options);
  16348. rules.range(rule, value, source, errors, options);
  16349. }
  16350. }
  16351. callback(errors);
  16352. };
  16353. var floatFn = function floatFn2(rule, value, callback, source, options) {
  16354. var errors = [];
  16355. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16356. if (validate) {
  16357. if (isEmptyValue(value) && !rule.required) {
  16358. return callback();
  16359. }
  16360. rules.required(rule, value, source, errors, options);
  16361. if (value !== void 0) {
  16362. rules.type(rule, value, source, errors, options);
  16363. rules.range(rule, value, source, errors, options);
  16364. }
  16365. }
  16366. callback(errors);
  16367. };
  16368. var array = function array2(rule, value, callback, source, options) {
  16369. var errors = [];
  16370. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16371. if (validate) {
  16372. if ((value === void 0 || value === null) && !rule.required) {
  16373. return callback();
  16374. }
  16375. rules.required(rule, value, source, errors, options, "array");
  16376. if (value !== void 0 && value !== null) {
  16377. rules.type(rule, value, source, errors, options);
  16378. rules.range(rule, value, source, errors, options);
  16379. }
  16380. }
  16381. callback(errors);
  16382. };
  16383. var object = function object2(rule, value, callback, source, options) {
  16384. var errors = [];
  16385. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16386. if (validate) {
  16387. if (isEmptyValue(value) && !rule.required) {
  16388. return callback();
  16389. }
  16390. rules.required(rule, value, source, errors, options);
  16391. if (value !== void 0) {
  16392. rules.type(rule, value, source, errors, options);
  16393. }
  16394. }
  16395. callback(errors);
  16396. };
  16397. var ENUM = "enum";
  16398. var enumerable = function enumerable2(rule, value, callback, source, options) {
  16399. var errors = [];
  16400. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16401. if (validate) {
  16402. if (isEmptyValue(value) && !rule.required) {
  16403. return callback();
  16404. }
  16405. rules.required(rule, value, source, errors, options);
  16406. if (value !== void 0) {
  16407. rules[ENUM](rule, value, source, errors, options);
  16408. }
  16409. }
  16410. callback(errors);
  16411. };
  16412. var pattern = function pattern2(rule, value, callback, source, options) {
  16413. var errors = [];
  16414. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16415. if (validate) {
  16416. if (isEmptyValue(value, "string") && !rule.required) {
  16417. return callback();
  16418. }
  16419. rules.required(rule, value, source, errors, options);
  16420. if (!isEmptyValue(value, "string")) {
  16421. rules.pattern(rule, value, source, errors, options);
  16422. }
  16423. }
  16424. callback(errors);
  16425. };
  16426. var date$1 = function date2(rule, value, callback, source, options) {
  16427. var errors = [];
  16428. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16429. if (validate) {
  16430. if (isEmptyValue(value, "date") && !rule.required) {
  16431. return callback();
  16432. }
  16433. rules.required(rule, value, source, errors, options);
  16434. if (!isEmptyValue(value, "date")) {
  16435. var dateObject;
  16436. if (value instanceof Date) {
  16437. dateObject = value;
  16438. } else {
  16439. dateObject = new Date(value);
  16440. }
  16441. rules.type(rule, dateObject, source, errors, options);
  16442. if (dateObject) {
  16443. rules.range(rule, dateObject.getTime(), source, errors, options);
  16444. }
  16445. }
  16446. }
  16447. callback(errors);
  16448. };
  16449. var required = function required2(rule, value, callback, source, options) {
  16450. var errors = [];
  16451. var type2 = Array.isArray(value) ? "array" : typeof value;
  16452. rules.required(rule, value, source, errors, options, type2);
  16453. callback(errors);
  16454. };
  16455. var type = function type2(rule, value, callback, source, options) {
  16456. var ruleType = rule.type;
  16457. var errors = [];
  16458. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16459. if (validate) {
  16460. if (isEmptyValue(value, ruleType) && !rule.required) {
  16461. return callback();
  16462. }
  16463. rules.required(rule, value, source, errors, options, ruleType);
  16464. if (!isEmptyValue(value, ruleType)) {
  16465. rules.type(rule, value, source, errors, options);
  16466. }
  16467. }
  16468. callback(errors);
  16469. };
  16470. var any = function any2(rule, value, callback, source, options) {
  16471. var errors = [];
  16472. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16473. if (validate) {
  16474. if (isEmptyValue(value) && !rule.required) {
  16475. return callback();
  16476. }
  16477. rules.required(rule, value, source, errors, options);
  16478. }
  16479. callback(errors);
  16480. };
  16481. var validators = {
  16482. string,
  16483. method,
  16484. number,
  16485. "boolean": _boolean,
  16486. regexp,
  16487. integer,
  16488. "float": floatFn,
  16489. array,
  16490. object,
  16491. "enum": enumerable,
  16492. pattern,
  16493. date: date$1,
  16494. url: type,
  16495. hex: type,
  16496. email: type,
  16497. required,
  16498. any
  16499. };
  16500. function newMessages() {
  16501. return {
  16502. "default": "Validation error on field %s",
  16503. required: "%s is required",
  16504. "enum": "%s must be one of %s",
  16505. whitespace: "%s cannot be empty",
  16506. date: {
  16507. format: "%s date %s is invalid for format %s",
  16508. parse: "%s date could not be parsed, %s is invalid ",
  16509. invalid: "%s date %s is invalid"
  16510. },
  16511. types: {
  16512. string: "%s is not a %s",
  16513. method: "%s is not a %s (function)",
  16514. array: "%s is not an %s",
  16515. object: "%s is not an %s",
  16516. number: "%s is not a %s",
  16517. date: "%s is not a %s",
  16518. "boolean": "%s is not a %s",
  16519. integer: "%s is not an %s",
  16520. "float": "%s is not a %s",
  16521. regexp: "%s is not a valid %s",
  16522. email: "%s is not a valid %s",
  16523. url: "%s is not a valid %s",
  16524. hex: "%s is not a valid %s"
  16525. },
  16526. string: {
  16527. len: "%s must be exactly %s characters",
  16528. min: "%s must be at least %s characters",
  16529. max: "%s cannot be longer than %s characters",
  16530. range: "%s must be between %s and %s characters"
  16531. },
  16532. number: {
  16533. len: "%s must equal %s",
  16534. min: "%s cannot be less than %s",
  16535. max: "%s cannot be greater than %s",
  16536. range: "%s must be between %s and %s"
  16537. },
  16538. array: {
  16539. len: "%s must be exactly %s in length",
  16540. min: "%s cannot be less than %s in length",
  16541. max: "%s cannot be greater than %s in length",
  16542. range: "%s must be between %s and %s in length"
  16543. },
  16544. pattern: {
  16545. mismatch: "%s value %s does not match pattern %s"
  16546. },
  16547. clone: function clone2() {
  16548. var cloned = JSON.parse(JSON.stringify(this));
  16549. cloned.clone = this.clone;
  16550. return cloned;
  16551. }
  16552. };
  16553. }
  16554. var messages = newMessages();
  16555. var Schema = /* @__PURE__ */ function() {
  16556. function Schema2(descriptor) {
  16557. this.rules = null;
  16558. this._messages = messages;
  16559. this.define(descriptor);
  16560. }
  16561. var _proto = Schema2.prototype;
  16562. _proto.define = function define(rules2) {
  16563. var _this = this;
  16564. if (!rules2) {
  16565. throw new Error("Cannot configure a schema with no rules");
  16566. }
  16567. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  16568. throw new Error("Rules must be an object");
  16569. }
  16570. this.rules = {};
  16571. Object.keys(rules2).forEach(function(name) {
  16572. var item = rules2[name];
  16573. _this.rules[name] = Array.isArray(item) ? item : [item];
  16574. });
  16575. };
  16576. _proto.messages = function messages2(_messages) {
  16577. if (_messages) {
  16578. this._messages = deepMerge(newMessages(), _messages);
  16579. }
  16580. return this._messages;
  16581. };
  16582. _proto.validate = function validate(source_, o2, oc) {
  16583. var _this2 = this;
  16584. if (o2 === void 0) {
  16585. o2 = {};
  16586. }
  16587. if (oc === void 0) {
  16588. oc = function oc2() {
  16589. };
  16590. }
  16591. var source = source_;
  16592. var options = o2;
  16593. var callback = oc;
  16594. if (typeof options === "function") {
  16595. callback = options;
  16596. options = {};
  16597. }
  16598. if (!this.rules || Object.keys(this.rules).length === 0) {
  16599. if (callback) {
  16600. callback(null, source);
  16601. }
  16602. return Promise.resolve(source);
  16603. }
  16604. function complete(results) {
  16605. var errors = [];
  16606. var fields = {};
  16607. function add2(e) {
  16608. if (Array.isArray(e)) {
  16609. var _errors;
  16610. errors = (_errors = errors).concat.apply(_errors, e);
  16611. } else {
  16612. errors.push(e);
  16613. }
  16614. }
  16615. for (var i = 0; i < results.length; i++) {
  16616. add2(results[i]);
  16617. }
  16618. if (!errors.length) {
  16619. callback(null, source);
  16620. } else {
  16621. fields = convertFieldsError(errors);
  16622. callback(errors, fields);
  16623. }
  16624. }
  16625. if (options.messages) {
  16626. var messages$1 = this.messages();
  16627. if (messages$1 === messages) {
  16628. messages$1 = newMessages();
  16629. }
  16630. deepMerge(messages$1, options.messages);
  16631. options.messages = messages$1;
  16632. } else {
  16633. options.messages = this.messages();
  16634. }
  16635. var series = {};
  16636. var keys2 = options.keys || Object.keys(this.rules);
  16637. keys2.forEach(function(z) {
  16638. var arr = _this2.rules[z];
  16639. var value = source[z];
  16640. arr.forEach(function(r) {
  16641. var rule = r;
  16642. if (typeof rule.transform === "function") {
  16643. if (source === source_) {
  16644. source = _extends({}, source);
  16645. }
  16646. value = source[z] = rule.transform(value);
  16647. }
  16648. if (typeof rule === "function") {
  16649. rule = {
  16650. validator: rule
  16651. };
  16652. } else {
  16653. rule = _extends({}, rule);
  16654. }
  16655. rule.validator = _this2.getValidationMethod(rule);
  16656. if (!rule.validator) {
  16657. return;
  16658. }
  16659. rule.field = z;
  16660. rule.fullField = rule.fullField || z;
  16661. rule.type = _this2.getType(rule);
  16662. series[z] = series[z] || [];
  16663. series[z].push({
  16664. rule,
  16665. value,
  16666. source,
  16667. field: z
  16668. });
  16669. });
  16670. });
  16671. var errorFields = {};
  16672. return asyncMap(series, options, function(data, doIt) {
  16673. var rule = data.rule;
  16674. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  16675. deep = deep && (rule.required || !rule.required && data.value);
  16676. rule.field = data.field;
  16677. function addFullField(key, schema) {
  16678. return _extends({}, schema, {
  16679. fullField: rule.fullField + "." + key,
  16680. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  16681. });
  16682. }
  16683. function cb(e) {
  16684. if (e === void 0) {
  16685. e = [];
  16686. }
  16687. var errorList = Array.isArray(e) ? e : [e];
  16688. if (!options.suppressWarning && errorList.length) {
  16689. Schema2.warning("async-validator:", errorList);
  16690. }
  16691. if (errorList.length && rule.message !== void 0) {
  16692. errorList = [].concat(rule.message);
  16693. }
  16694. var filledErrors = errorList.map(complementError(rule, source));
  16695. if (options.first && filledErrors.length) {
  16696. errorFields[rule.field] = 1;
  16697. return doIt(filledErrors);
  16698. }
  16699. if (!deep) {
  16700. doIt(filledErrors);
  16701. } else {
  16702. if (rule.required && !data.value) {
  16703. if (rule.message !== void 0) {
  16704. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  16705. } else if (options.error) {
  16706. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  16707. }
  16708. return doIt(filledErrors);
  16709. }
  16710. var fieldsSchema = {};
  16711. if (rule.defaultField) {
  16712. Object.keys(data.value).map(function(key) {
  16713. fieldsSchema[key] = rule.defaultField;
  16714. });
  16715. }
  16716. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  16717. var paredFieldsSchema = {};
  16718. Object.keys(fieldsSchema).forEach(function(field) {
  16719. var fieldSchema = fieldsSchema[field];
  16720. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  16721. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  16722. });
  16723. var schema = new Schema2(paredFieldsSchema);
  16724. schema.messages(options.messages);
  16725. if (data.rule.options) {
  16726. data.rule.options.messages = options.messages;
  16727. data.rule.options.error = options.error;
  16728. }
  16729. schema.validate(data.value, data.rule.options || options, function(errs) {
  16730. var finalErrors = [];
  16731. if (filledErrors && filledErrors.length) {
  16732. finalErrors.push.apply(finalErrors, filledErrors);
  16733. }
  16734. if (errs && errs.length) {
  16735. finalErrors.push.apply(finalErrors, errs);
  16736. }
  16737. doIt(finalErrors.length ? finalErrors : null);
  16738. });
  16739. }
  16740. }
  16741. var res;
  16742. if (rule.asyncValidator) {
  16743. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  16744. } else if (rule.validator) {
  16745. try {
  16746. res = rule.validator(rule, data.value, cb, data.source, options);
  16747. } catch (error) {
  16748. console.error == null ? void 0 : console.error(error);
  16749. if (!options.suppressValidatorError) {
  16750. setTimeout(function() {
  16751. throw error;
  16752. }, 0);
  16753. }
  16754. cb(error.message);
  16755. }
  16756. if (res === true) {
  16757. cb();
  16758. } else if (res === false) {
  16759. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  16760. } else if (res instanceof Array) {
  16761. cb(res);
  16762. } else if (res instanceof Error) {
  16763. cb(res.message);
  16764. }
  16765. }
  16766. if (res && res.then) {
  16767. res.then(function() {
  16768. return cb();
  16769. }, function(e) {
  16770. return cb(e);
  16771. });
  16772. }
  16773. }, function(results) {
  16774. complete(results);
  16775. }, source);
  16776. };
  16777. _proto.getType = function getType2(rule) {
  16778. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  16779. rule.type = "pattern";
  16780. }
  16781. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  16782. throw new Error(format("Unknown rule type %s", rule.type));
  16783. }
  16784. return rule.type || "string";
  16785. };
  16786. _proto.getValidationMethod = function getValidationMethod(rule) {
  16787. if (typeof rule.validator === "function") {
  16788. return rule.validator;
  16789. }
  16790. var keys2 = Object.keys(rule);
  16791. var messageIndex = keys2.indexOf("message");
  16792. if (messageIndex !== -1) {
  16793. keys2.splice(messageIndex, 1);
  16794. }
  16795. if (keys2.length === 1 && keys2[0] === "required") {
  16796. return validators.required;
  16797. }
  16798. return validators[this.getType(rule)] || void 0;
  16799. };
  16800. return Schema2;
  16801. }();
  16802. Schema.register = function register(type2, validator) {
  16803. if (typeof validator !== "function") {
  16804. throw new Error("Cannot register a validator by type, validator is not a function");
  16805. }
  16806. validators[type2] = validator;
  16807. };
  16808. Schema.warning = warning;
  16809. Schema.messages = messages;
  16810. Schema.validators = validators;
  16811. const formItemValidateStates = [
  16812. "",
  16813. "error",
  16814. "validating",
  16815. "success"
  16816. ];
  16817. const formItemProps = buildProps({
  16818. label: String,
  16819. labelWidth: {
  16820. type: [String, Number],
  16821. default: ""
  16822. },
  16823. prop: {
  16824. type: definePropType([String, Array])
  16825. },
  16826. required: {
  16827. type: Boolean,
  16828. default: void 0
  16829. },
  16830. rules: {
  16831. type: definePropType([Object, Array])
  16832. },
  16833. error: String,
  16834. validateStatus: {
  16835. type: String,
  16836. values: formItemValidateStates
  16837. },
  16838. for: String,
  16839. inlineMessage: {
  16840. type: [String, Boolean],
  16841. default: ""
  16842. },
  16843. showMessage: {
  16844. type: Boolean,
  16845. default: true
  16846. },
  16847. size: {
  16848. type: String,
  16849. values: componentSizes
  16850. }
  16851. });
  16852. const COMPONENT_NAME$l = "ElLabelWrap";
  16853. var FormLabelWrap = /* @__PURE__ */ defineComponent({
  16854. name: COMPONENT_NAME$l,
  16855. props: {
  16856. isAutoWidth: Boolean,
  16857. updateAll: Boolean
  16858. },
  16859. setup(props, {
  16860. slots
  16861. }) {
  16862. const formContext = inject(formContextKey, void 0);
  16863. const formItemContext = inject(formItemContextKey);
  16864. if (!formItemContext)
  16865. throwError(COMPONENT_NAME$l, "usage: <el-form-item><label-wrap /></el-form-item>");
  16866. const ns = useNamespace("form");
  16867. const el = ref();
  16868. const computedWidth = ref(0);
  16869. const getLabelWidth = () => {
  16870. var _a2;
  16871. if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
  16872. const width = window.getComputedStyle(el.value.firstElementChild).width;
  16873. return Math.ceil(Number.parseFloat(width));
  16874. } else {
  16875. return 0;
  16876. }
  16877. };
  16878. const updateLabelWidth = (action = "update") => {
  16879. nextTick(() => {
  16880. if (slots.default && props.isAutoWidth) {
  16881. if (action === "update") {
  16882. computedWidth.value = getLabelWidth();
  16883. } else if (action === "remove") {
  16884. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  16885. }
  16886. }
  16887. });
  16888. };
  16889. const updateLabelWidthFn = () => updateLabelWidth("update");
  16890. onMounted(() => {
  16891. updateLabelWidthFn();
  16892. });
  16893. onBeforeUnmount(() => {
  16894. updateLabelWidth("remove");
  16895. });
  16896. onUpdated(() => updateLabelWidthFn());
  16897. watch(computedWidth, (val, oldVal) => {
  16898. if (props.updateAll) {
  16899. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  16900. }
  16901. });
  16902. useResizeObserver(computed(() => {
  16903. var _a2, _b;
  16904. return (_b = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b : null;
  16905. }), updateLabelWidthFn);
  16906. return () => {
  16907. var _a2, _b;
  16908. if (!slots)
  16909. return null;
  16910. const {
  16911. isAutoWidth
  16912. } = props;
  16913. if (isAutoWidth) {
  16914. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  16915. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  16916. const style = {};
  16917. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  16918. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  16919. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  16920. if (marginWidth) {
  16921. style[marginPosition] = `${marginWidth}px`;
  16922. }
  16923. }
  16924. return createVNode("div", {
  16925. "ref": el,
  16926. "class": [ns.be("item", "label-wrap")],
  16927. "style": style
  16928. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  16929. } else {
  16930. return createVNode(Fragment, {
  16931. "ref": el
  16932. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  16933. }
  16934. };
  16935. }
  16936. });
  16937. const _hoisted_1$15 = ["role", "aria-labelledby"];
  16938. const __default__$1z = /* @__PURE__ */ defineComponent({
  16939. name: "ElFormItem"
  16940. });
  16941. const _sfc_main$2j = /* @__PURE__ */ defineComponent({
  16942. ...__default__$1z,
  16943. props: formItemProps,
  16944. setup(__props, { expose }) {
  16945. const props = __props;
  16946. const slots = useSlots();
  16947. const formContext = inject(formContextKey, void 0);
  16948. const parentFormItemContext = inject(formItemContextKey, void 0);
  16949. const _size = useFormSize(void 0, { formItem: false });
  16950. const ns = useNamespace("form-item");
  16951. const labelId = useId().value;
  16952. const inputIds = ref([]);
  16953. const validateState = ref("");
  16954. const validateStateDebounced = refDebounced(validateState, 100);
  16955. const validateMessage = ref("");
  16956. const formItemRef = ref();
  16957. let initialValue = void 0;
  16958. let isResettingField = false;
  16959. const labelStyle = computed(() => {
  16960. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  16961. return {};
  16962. }
  16963. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  16964. if (labelWidth)
  16965. return { width: labelWidth };
  16966. return {};
  16967. });
  16968. const contentStyle = computed(() => {
  16969. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  16970. return {};
  16971. }
  16972. if (!props.label && !props.labelWidth && isNested) {
  16973. return {};
  16974. }
  16975. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  16976. if (!props.label && !slots.label) {
  16977. return { marginLeft: labelWidth };
  16978. }
  16979. return {};
  16980. });
  16981. const formItemClasses = computed(() => [
  16982. ns.b(),
  16983. ns.m(_size.value),
  16984. ns.is("error", validateState.value === "error"),
  16985. ns.is("validating", validateState.value === "validating"),
  16986. ns.is("success", validateState.value === "success"),
  16987. ns.is("required", isRequired.value || props.required),
  16988. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  16989. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  16990. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  16991. ]);
  16992. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  16993. const validateClasses = computed(() => [
  16994. ns.e("error"),
  16995. { [ns.em("error", "inline")]: _inlineMessage.value }
  16996. ]);
  16997. const propString = computed(() => {
  16998. if (!props.prop)
  16999. return "";
  17000. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  17001. });
  17002. const hasLabel = computed(() => {
  17003. return !!(props.label || slots.label);
  17004. });
  17005. const labelFor = computed(() => {
  17006. return props.for || (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  17007. });
  17008. const isGroup = computed(() => {
  17009. return !labelFor.value && hasLabel.value;
  17010. });
  17011. const isNested = !!parentFormItemContext;
  17012. const fieldValue = computed(() => {
  17013. const model = formContext == null ? void 0 : formContext.model;
  17014. if (!model || !props.prop) {
  17015. return;
  17016. }
  17017. return getProp(model, props.prop).value;
  17018. });
  17019. const normalizedRules = computed(() => {
  17020. const { required: required2 } = props;
  17021. const rules2 = [];
  17022. if (props.rules) {
  17023. rules2.push(...castArray$1(props.rules));
  17024. }
  17025. const formRules = formContext == null ? void 0 : formContext.rules;
  17026. if (formRules && props.prop) {
  17027. const _rules = getProp(formRules, props.prop).value;
  17028. if (_rules) {
  17029. rules2.push(...castArray$1(_rules));
  17030. }
  17031. }
  17032. if (required2 !== void 0) {
  17033. const requiredRules = rules2.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  17034. if (requiredRules.length > 0) {
  17035. for (const [rule, i] of requiredRules) {
  17036. if (rule.required === required2)
  17037. continue;
  17038. rules2[i] = { ...rule, required: required2 };
  17039. }
  17040. } else {
  17041. rules2.push({ required: required2 });
  17042. }
  17043. }
  17044. return rules2;
  17045. });
  17046. const validateEnabled = computed(() => normalizedRules.value.length > 0);
  17047. const getFilteredRule = (trigger2) => {
  17048. const rules2 = normalizedRules.value;
  17049. return rules2.filter((rule) => {
  17050. if (!rule.trigger || !trigger2)
  17051. return true;
  17052. if (Array.isArray(rule.trigger)) {
  17053. return rule.trigger.includes(trigger2);
  17054. } else {
  17055. return rule.trigger === trigger2;
  17056. }
  17057. }).map(({ trigger: trigger22, ...rule }) => rule);
  17058. };
  17059. const isRequired = computed(() => normalizedRules.value.some((rule) => rule.required));
  17060. const shouldShowError = computed(() => {
  17061. var _a2;
  17062. return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
  17063. });
  17064. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  17065. const setValidationState = (state) => {
  17066. validateState.value = state;
  17067. };
  17068. const onValidationFailed = (error) => {
  17069. var _a2, _b;
  17070. const { errors, fields } = error;
  17071. if (!errors || !fields) {
  17072. console.error(error);
  17073. }
  17074. setValidationState("error");
  17075. validateMessage.value = errors ? (_b = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b : `${props.prop} is required` : "";
  17076. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  17077. };
  17078. const onValidationSucceeded = () => {
  17079. setValidationState("success");
  17080. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  17081. };
  17082. const doValidate = async (rules2) => {
  17083. const modelName = propString.value;
  17084. const validator = new Schema({
  17085. [modelName]: rules2
  17086. });
  17087. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  17088. onValidationSucceeded();
  17089. return true;
  17090. }).catch((err) => {
  17091. onValidationFailed(err);
  17092. return Promise.reject(err);
  17093. });
  17094. };
  17095. const validate = async (trigger2, callback) => {
  17096. if (isResettingField || !props.prop) {
  17097. return false;
  17098. }
  17099. const hasCallback = isFunction$2(callback);
  17100. if (!validateEnabled.value) {
  17101. callback == null ? void 0 : callback(false);
  17102. return false;
  17103. }
  17104. const rules2 = getFilteredRule(trigger2);
  17105. if (rules2.length === 0) {
  17106. callback == null ? void 0 : callback(true);
  17107. return true;
  17108. }
  17109. setValidationState("validating");
  17110. return doValidate(rules2).then(() => {
  17111. callback == null ? void 0 : callback(true);
  17112. return true;
  17113. }).catch((err) => {
  17114. const { fields } = err;
  17115. callback == null ? void 0 : callback(false, fields);
  17116. return hasCallback ? false : Promise.reject(fields);
  17117. });
  17118. };
  17119. const clearValidate = () => {
  17120. setValidationState("");
  17121. validateMessage.value = "";
  17122. isResettingField = false;
  17123. };
  17124. const resetField = async () => {
  17125. const model = formContext == null ? void 0 : formContext.model;
  17126. if (!model || !props.prop)
  17127. return;
  17128. const computedValue = getProp(model, props.prop);
  17129. isResettingField = true;
  17130. computedValue.value = clone(initialValue);
  17131. await nextTick();
  17132. clearValidate();
  17133. isResettingField = false;
  17134. };
  17135. const addInputId = (id) => {
  17136. if (!inputIds.value.includes(id)) {
  17137. inputIds.value.push(id);
  17138. }
  17139. };
  17140. const removeInputId = (id) => {
  17141. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  17142. };
  17143. watch(() => props.error, (val) => {
  17144. validateMessage.value = val || "";
  17145. setValidationState(val ? "error" : "");
  17146. }, { immediate: true });
  17147. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  17148. const context = reactive({
  17149. ...toRefs(props),
  17150. $el: formItemRef,
  17151. size: _size,
  17152. validateState,
  17153. labelId,
  17154. inputIds,
  17155. isGroup,
  17156. hasLabel,
  17157. addInputId,
  17158. removeInputId,
  17159. resetField,
  17160. clearValidate,
  17161. validate
  17162. });
  17163. provide(formItemContextKey, context);
  17164. onMounted(() => {
  17165. if (props.prop) {
  17166. formContext == null ? void 0 : formContext.addField(context);
  17167. initialValue = clone(fieldValue.value);
  17168. }
  17169. });
  17170. onBeforeUnmount(() => {
  17171. formContext == null ? void 0 : formContext.removeField(context);
  17172. });
  17173. expose({
  17174. size: _size,
  17175. validateMessage,
  17176. validateState,
  17177. validate,
  17178. clearValidate,
  17179. resetField
  17180. });
  17181. return (_ctx, _cache) => {
  17182. var _a2;
  17183. return openBlock(), createElementBlock("div", {
  17184. ref_key: "formItemRef",
  17185. ref: formItemRef,
  17186. class: normalizeClass(unref(formItemClasses)),
  17187. role: unref(isGroup) ? "group" : void 0,
  17188. "aria-labelledby": unref(isGroup) ? unref(labelId) : void 0
  17189. }, [
  17190. createVNode(unref(FormLabelWrap), {
  17191. "is-auto-width": unref(labelStyle).width === "auto",
  17192. "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
  17193. }, {
  17194. default: withCtx(() => [
  17195. unref(hasLabel) ? (openBlock(), createBlock(resolveDynamicComponent(unref(labelFor) ? "label" : "div"), {
  17196. key: 0,
  17197. id: unref(labelId),
  17198. for: unref(labelFor),
  17199. class: normalizeClass(unref(ns).e("label")),
  17200. style: normalizeStyle(unref(labelStyle))
  17201. }, {
  17202. default: withCtx(() => [
  17203. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  17204. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  17205. ])
  17206. ]),
  17207. _: 3
  17208. }, 8, ["id", "for", "class", "style"])) : createCommentVNode("v-if", true)
  17209. ]),
  17210. _: 3
  17211. }, 8, ["is-auto-width", "update-all"]),
  17212. createBaseVNode("div", {
  17213. class: normalizeClass(unref(ns).e("content")),
  17214. style: normalizeStyle(unref(contentStyle))
  17215. }, [
  17216. renderSlot(_ctx.$slots, "default"),
  17217. createVNode(TransitionGroup, {
  17218. name: `${unref(ns).namespace.value}-zoom-in-top`
  17219. }, {
  17220. default: withCtx(() => [
  17221. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  17222. key: 0,
  17223. error: validateMessage.value
  17224. }, () => [
  17225. createBaseVNode("div", {
  17226. class: normalizeClass(unref(validateClasses))
  17227. }, toDisplayString(validateMessage.value), 3)
  17228. ]) : createCommentVNode("v-if", true)
  17229. ]),
  17230. _: 3
  17231. }, 8, ["name"])
  17232. ], 6)
  17233. ], 10, _hoisted_1$15);
  17234. };
  17235. }
  17236. });
  17237. var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$2j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
  17238. const ElForm = withInstall(Form, {
  17239. FormItem
  17240. });
  17241. const ElFormItem = withNoopInstall(FormItem);
  17242. let hiddenTextarea = void 0;
  17243. const HIDDEN_STYLE = `
  17244. height:0 !important;
  17245. visibility:hidden !important;
  17246. ${isFirefox() ? "" : "overflow:hidden !important;"}
  17247. position:absolute !important;
  17248. z-index:-1000 !important;
  17249. top:0 !important;
  17250. right:0 !important;
  17251. `;
  17252. const CONTEXT_STYLE = [
  17253. "letter-spacing",
  17254. "line-height",
  17255. "padding-top",
  17256. "padding-bottom",
  17257. "font-family",
  17258. "font-weight",
  17259. "font-size",
  17260. "text-rendering",
  17261. "text-transform",
  17262. "width",
  17263. "text-indent",
  17264. "padding-left",
  17265. "padding-right",
  17266. "border-width",
  17267. "box-sizing"
  17268. ];
  17269. function calculateNodeStyling(targetElement) {
  17270. const style = window.getComputedStyle(targetElement);
  17271. const boxSizing = style.getPropertyValue("box-sizing");
  17272. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  17273. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  17274. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  17275. return { contextStyle, paddingSize, borderSize, boxSizing };
  17276. }
  17277. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  17278. var _a2;
  17279. if (!hiddenTextarea) {
  17280. hiddenTextarea = document.createElement("textarea");
  17281. document.body.appendChild(hiddenTextarea);
  17282. }
  17283. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  17284. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  17285. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  17286. let height = hiddenTextarea.scrollHeight;
  17287. const result = {};
  17288. if (boxSizing === "border-box") {
  17289. height = height + borderSize;
  17290. } else if (boxSizing === "content-box") {
  17291. height = height - paddingSize;
  17292. }
  17293. hiddenTextarea.value = "";
  17294. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  17295. if (isNumber(minRows)) {
  17296. let minHeight = singleRowHeight * minRows;
  17297. if (boxSizing === "border-box") {
  17298. minHeight = minHeight + paddingSize + borderSize;
  17299. }
  17300. height = Math.max(minHeight, height);
  17301. result.minHeight = `${minHeight}px`;
  17302. }
  17303. if (isNumber(maxRows)) {
  17304. let maxHeight = singleRowHeight * maxRows;
  17305. if (boxSizing === "border-box") {
  17306. maxHeight = maxHeight + paddingSize + borderSize;
  17307. }
  17308. height = Math.min(maxHeight, height);
  17309. }
  17310. result.height = `${height}px`;
  17311. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  17312. hiddenTextarea = void 0;
  17313. return result;
  17314. }
  17315. const inputProps = buildProps({
  17316. id: {
  17317. type: String,
  17318. default: void 0
  17319. },
  17320. size: useSizeProp,
  17321. disabled: Boolean,
  17322. modelValue: {
  17323. type: definePropType([
  17324. String,
  17325. Number,
  17326. Object
  17327. ]),
  17328. default: ""
  17329. },
  17330. type: {
  17331. type: String,
  17332. default: "text"
  17333. },
  17334. resize: {
  17335. type: String,
  17336. values: ["none", "both", "horizontal", "vertical"]
  17337. },
  17338. autosize: {
  17339. type: definePropType([Boolean, Object]),
  17340. default: false
  17341. },
  17342. autocomplete: {
  17343. type: String,
  17344. default: "off"
  17345. },
  17346. formatter: {
  17347. type: Function
  17348. },
  17349. parser: {
  17350. type: Function
  17351. },
  17352. placeholder: {
  17353. type: String
  17354. },
  17355. form: {
  17356. type: String
  17357. },
  17358. readonly: {
  17359. type: Boolean,
  17360. default: false
  17361. },
  17362. clearable: {
  17363. type: Boolean,
  17364. default: false
  17365. },
  17366. showPassword: {
  17367. type: Boolean,
  17368. default: false
  17369. },
  17370. showWordLimit: {
  17371. type: Boolean,
  17372. default: false
  17373. },
  17374. suffixIcon: {
  17375. type: iconPropType
  17376. },
  17377. prefixIcon: {
  17378. type: iconPropType
  17379. },
  17380. containerRole: {
  17381. type: String,
  17382. default: void 0
  17383. },
  17384. label: {
  17385. type: String,
  17386. default: void 0
  17387. },
  17388. tabindex: {
  17389. type: [String, Number],
  17390. default: 0
  17391. },
  17392. validateEvent: {
  17393. type: Boolean,
  17394. default: true
  17395. },
  17396. inputStyle: {
  17397. type: definePropType([Object, Array, String]),
  17398. default: () => mutable({})
  17399. },
  17400. autofocus: {
  17401. type: Boolean,
  17402. default: false
  17403. }
  17404. });
  17405. const inputEmits = {
  17406. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  17407. input: (value) => isString$1(value),
  17408. change: (value) => isString$1(value),
  17409. focus: (evt) => evt instanceof FocusEvent,
  17410. blur: (evt) => evt instanceof FocusEvent,
  17411. clear: () => true,
  17412. mouseleave: (evt) => evt instanceof MouseEvent,
  17413. mouseenter: (evt) => evt instanceof MouseEvent,
  17414. keydown: (evt) => evt instanceof Event,
  17415. compositionstart: (evt) => evt instanceof CompositionEvent,
  17416. compositionupdate: (evt) => evt instanceof CompositionEvent,
  17417. compositionend: (evt) => evt instanceof CompositionEvent
  17418. };
  17419. const _hoisted_1$14 = ["role"];
  17420. const _hoisted_2$I = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus"];
  17421. const _hoisted_3$k = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus"];
  17422. const __default__$1y = /* @__PURE__ */ defineComponent({
  17423. name: "ElInput",
  17424. inheritAttrs: false
  17425. });
  17426. const _sfc_main$2i = /* @__PURE__ */ defineComponent({
  17427. ...__default__$1y,
  17428. props: inputProps,
  17429. emits: inputEmits,
  17430. setup(__props, { expose, emit: emit2 }) {
  17431. const props = __props;
  17432. const rawAttrs = useAttrs$1();
  17433. const slots = useSlots();
  17434. const containerAttrs = computed(() => {
  17435. const comboBoxAttrs = {};
  17436. if (props.containerRole === "combobox") {
  17437. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  17438. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  17439. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  17440. }
  17441. return comboBoxAttrs;
  17442. });
  17443. const containerKls = computed(() => [
  17444. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  17445. nsInput.m(inputSize.value),
  17446. nsInput.is("disabled", inputDisabled.value),
  17447. nsInput.is("exceed", inputExceed.value),
  17448. {
  17449. [nsInput.b("group")]: slots.prepend || slots.append,
  17450. [nsInput.bm("group", "append")]: slots.append,
  17451. [nsInput.bm("group", "prepend")]: slots.prepend,
  17452. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  17453. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  17454. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value
  17455. },
  17456. rawAttrs.class
  17457. ]);
  17458. const wrapperKls = computed(() => [
  17459. nsInput.e("wrapper"),
  17460. nsInput.is("focus", isFocused.value)
  17461. ]);
  17462. const attrs = useAttrs({
  17463. excludeKeys: computed(() => {
  17464. return Object.keys(containerAttrs.value);
  17465. })
  17466. });
  17467. const { form, formItem } = useFormItem();
  17468. const { inputId } = useFormItemInputId(props, {
  17469. formItemContext: formItem
  17470. });
  17471. const inputSize = useFormSize();
  17472. const inputDisabled = useFormDisabled();
  17473. const nsInput = useNamespace("input");
  17474. const nsTextarea = useNamespace("textarea");
  17475. const input = shallowRef();
  17476. const textarea = shallowRef();
  17477. const hovering = ref(false);
  17478. const isComposing = ref(false);
  17479. const passwordVisible = ref(false);
  17480. const countStyle = ref();
  17481. const textareaCalcStyle = shallowRef(props.inputStyle);
  17482. const _ref = computed(() => input.value || textarea.value);
  17483. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  17484. afterBlur() {
  17485. var _a2;
  17486. if (props.validateEvent) {
  17487. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  17488. }
  17489. }
  17490. });
  17491. const needStatusIcon = computed(() => {
  17492. var _a2;
  17493. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  17494. });
  17495. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  17496. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  17497. const passwordIcon = computed(() => passwordVisible.value ? view_default : hide_default);
  17498. const containerStyle = computed(() => [
  17499. rawAttrs.style,
  17500. props.inputStyle
  17501. ]);
  17502. const textareaStyle = computed(() => [
  17503. props.inputStyle,
  17504. textareaCalcStyle.value,
  17505. { resize: props.resize }
  17506. ]);
  17507. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  17508. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  17509. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || isFocused.value));
  17510. const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  17511. const textLength = computed(() => nativeInputValue.value.length);
  17512. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  17513. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  17514. const [recordCursor, setCursor] = useCursor(input);
  17515. useResizeObserver(textarea, (entries) => {
  17516. onceInitSizeTextarea();
  17517. if (!isWordLimitVisible.value || props.resize !== "both")
  17518. return;
  17519. const entry = entries[0];
  17520. const { width } = entry.contentRect;
  17521. countStyle.value = {
  17522. right: `calc(100% - ${width + 15 + 6}px)`
  17523. };
  17524. });
  17525. const resizeTextarea = () => {
  17526. const { type: type2, autosize } = props;
  17527. if (!isClient || type2 !== "textarea" || !textarea.value)
  17528. return;
  17529. if (autosize) {
  17530. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  17531. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  17532. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  17533. textareaCalcStyle.value = {
  17534. overflowY: "hidden",
  17535. ...textareaStyle2
  17536. };
  17537. nextTick(() => {
  17538. textarea.value.offsetHeight;
  17539. textareaCalcStyle.value = textareaStyle2;
  17540. });
  17541. } else {
  17542. textareaCalcStyle.value = {
  17543. minHeight: calcTextareaHeight(textarea.value).minHeight
  17544. };
  17545. }
  17546. };
  17547. const createOnceInitResize = (resizeTextarea2) => {
  17548. let isInit = false;
  17549. return () => {
  17550. var _a2;
  17551. if (isInit || !props.autosize)
  17552. return;
  17553. const isElHidden = ((_a2 = textarea.value) == null ? void 0 : _a2.offsetParent) === null;
  17554. if (!isElHidden) {
  17555. resizeTextarea2();
  17556. isInit = true;
  17557. }
  17558. };
  17559. };
  17560. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  17561. const setNativeInputValue = () => {
  17562. const input2 = _ref.value;
  17563. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  17564. if (!input2 || input2.value === formatterValue)
  17565. return;
  17566. input2.value = formatterValue;
  17567. };
  17568. const handleInput = async (event) => {
  17569. recordCursor();
  17570. let { value } = event.target;
  17571. if (props.formatter) {
  17572. value = props.parser ? props.parser(value) : value;
  17573. }
  17574. if (isComposing.value)
  17575. return;
  17576. if (value === nativeInputValue.value) {
  17577. setNativeInputValue();
  17578. return;
  17579. }
  17580. emit2(UPDATE_MODEL_EVENT, value);
  17581. emit2("input", value);
  17582. await nextTick();
  17583. setNativeInputValue();
  17584. setCursor();
  17585. };
  17586. const handleChange = (event) => {
  17587. emit2("change", event.target.value);
  17588. };
  17589. const handleCompositionStart = (event) => {
  17590. emit2("compositionstart", event);
  17591. isComposing.value = true;
  17592. };
  17593. const handleCompositionUpdate = (event) => {
  17594. var _a2;
  17595. emit2("compositionupdate", event);
  17596. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  17597. const lastCharacter = text[text.length - 1] || "";
  17598. isComposing.value = !isKorean(lastCharacter);
  17599. };
  17600. const handleCompositionEnd = (event) => {
  17601. emit2("compositionend", event);
  17602. if (isComposing.value) {
  17603. isComposing.value = false;
  17604. handleInput(event);
  17605. }
  17606. };
  17607. const handlePasswordVisible = () => {
  17608. passwordVisible.value = !passwordVisible.value;
  17609. focus();
  17610. };
  17611. const focus = async () => {
  17612. var _a2;
  17613. await nextTick();
  17614. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  17615. };
  17616. const blur = () => {
  17617. var _a2;
  17618. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  17619. };
  17620. const handleMouseLeave = (evt) => {
  17621. hovering.value = false;
  17622. emit2("mouseleave", evt);
  17623. };
  17624. const handleMouseEnter = (evt) => {
  17625. hovering.value = true;
  17626. emit2("mouseenter", evt);
  17627. };
  17628. const handleKeydown = (evt) => {
  17629. emit2("keydown", evt);
  17630. };
  17631. const select = () => {
  17632. var _a2;
  17633. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  17634. };
  17635. const clear2 = () => {
  17636. emit2(UPDATE_MODEL_EVENT, "");
  17637. emit2("change", "");
  17638. emit2("clear");
  17639. emit2("input", "");
  17640. };
  17641. watch(() => props.modelValue, () => {
  17642. var _a2;
  17643. nextTick(() => resizeTextarea());
  17644. if (props.validateEvent) {
  17645. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  17646. }
  17647. });
  17648. watch(nativeInputValue, () => setNativeInputValue());
  17649. watch(() => props.type, async () => {
  17650. await nextTick();
  17651. setNativeInputValue();
  17652. resizeTextarea();
  17653. });
  17654. onMounted(() => {
  17655. if (!props.formatter && props.parser)
  17656. ;
  17657. setNativeInputValue();
  17658. nextTick(resizeTextarea);
  17659. });
  17660. expose({
  17661. input,
  17662. textarea,
  17663. ref: _ref,
  17664. textareaStyle,
  17665. autosize: toRef(props, "autosize"),
  17666. focus,
  17667. blur,
  17668. select,
  17669. clear: clear2,
  17670. resizeTextarea
  17671. });
  17672. return (_ctx, _cache) => {
  17673. return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(containerAttrs), {
  17674. class: unref(containerKls),
  17675. style: unref(containerStyle),
  17676. role: _ctx.containerRole,
  17677. onMouseenter: handleMouseEnter,
  17678. onMouseleave: handleMouseLeave
  17679. }), [
  17680. createCommentVNode(" input "),
  17681. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  17682. createCommentVNode(" prepend slot "),
  17683. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  17684. key: 0,
  17685. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  17686. }, [
  17687. renderSlot(_ctx.$slots, "prepend")
  17688. ], 2)) : createCommentVNode("v-if", true),
  17689. createBaseVNode("div", {
  17690. ref_key: "wrapperRef",
  17691. ref: wrapperRef,
  17692. class: normalizeClass(unref(wrapperKls))
  17693. }, [
  17694. createCommentVNode(" prefix slot "),
  17695. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  17696. key: 0,
  17697. class: normalizeClass(unref(nsInput).e("prefix"))
  17698. }, [
  17699. createBaseVNode("span", {
  17700. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  17701. }, [
  17702. renderSlot(_ctx.$slots, "prefix"),
  17703. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  17704. key: 0,
  17705. class: normalizeClass(unref(nsInput).e("icon"))
  17706. }, {
  17707. default: withCtx(() => [
  17708. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  17709. ]),
  17710. _: 1
  17711. }, 8, ["class"])) : createCommentVNode("v-if", true)
  17712. ], 2)
  17713. ], 2)) : createCommentVNode("v-if", true),
  17714. createBaseVNode("input", mergeProps({
  17715. id: unref(inputId),
  17716. ref_key: "input",
  17717. ref: input,
  17718. class: unref(nsInput).e("inner")
  17719. }, unref(attrs), {
  17720. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  17721. disabled: unref(inputDisabled),
  17722. formatter: _ctx.formatter,
  17723. parser: _ctx.parser,
  17724. readonly: _ctx.readonly,
  17725. autocomplete: _ctx.autocomplete,
  17726. tabindex: _ctx.tabindex,
  17727. "aria-label": _ctx.label,
  17728. placeholder: _ctx.placeholder,
  17729. style: _ctx.inputStyle,
  17730. form: props.form,
  17731. autofocus: props.autofocus,
  17732. onCompositionstart: handleCompositionStart,
  17733. onCompositionupdate: handleCompositionUpdate,
  17734. onCompositionend: handleCompositionEnd,
  17735. onInput: handleInput,
  17736. onFocus: _cache[0] || (_cache[0] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  17737. onBlur: _cache[1] || (_cache[1] = (...args) => unref(handleBlur) && unref(handleBlur)(...args)),
  17738. onChange: handleChange,
  17739. onKeydown: handleKeydown
  17740. }), null, 16, _hoisted_2$I),
  17741. createCommentVNode(" suffix slot "),
  17742. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  17743. key: 1,
  17744. class: normalizeClass(unref(nsInput).e("suffix"))
  17745. }, [
  17746. createBaseVNode("span", {
  17747. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  17748. }, [
  17749. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  17750. renderSlot(_ctx.$slots, "suffix"),
  17751. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  17752. key: 0,
  17753. class: normalizeClass(unref(nsInput).e("icon"))
  17754. }, {
  17755. default: withCtx(() => [
  17756. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  17757. ]),
  17758. _: 1
  17759. }, 8, ["class"])) : createCommentVNode("v-if", true)
  17760. ], 64)) : createCommentVNode("v-if", true),
  17761. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  17762. key: 1,
  17763. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  17764. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  17765. onClick: clear2
  17766. }, {
  17767. default: withCtx(() => [
  17768. createVNode(unref(circle_close_default))
  17769. ]),
  17770. _: 1
  17771. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  17772. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  17773. key: 2,
  17774. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  17775. onClick: handlePasswordVisible
  17776. }, {
  17777. default: withCtx(() => [
  17778. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  17779. ]),
  17780. _: 1
  17781. }, 8, ["class"])) : createCommentVNode("v-if", true),
  17782. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  17783. key: 3,
  17784. class: normalizeClass(unref(nsInput).e("count"))
  17785. }, [
  17786. createBaseVNode("span", {
  17787. class: normalizeClass(unref(nsInput).e("count-inner"))
  17788. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  17789. ], 2)) : createCommentVNode("v-if", true),
  17790. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  17791. key: 4,
  17792. class: normalizeClass([
  17793. unref(nsInput).e("icon"),
  17794. unref(nsInput).e("validateIcon"),
  17795. unref(nsInput).is("loading", unref(validateState) === "validating")
  17796. ])
  17797. }, {
  17798. default: withCtx(() => [
  17799. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  17800. ]),
  17801. _: 1
  17802. }, 8, ["class"])) : createCommentVNode("v-if", true)
  17803. ], 2)
  17804. ], 2)) : createCommentVNode("v-if", true)
  17805. ], 2),
  17806. createCommentVNode(" append slot "),
  17807. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  17808. key: 1,
  17809. class: normalizeClass(unref(nsInput).be("group", "append"))
  17810. }, [
  17811. renderSlot(_ctx.$slots, "append")
  17812. ], 2)) : createCommentVNode("v-if", true)
  17813. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  17814. createCommentVNode(" textarea "),
  17815. createBaseVNode("textarea", mergeProps({
  17816. id: unref(inputId),
  17817. ref_key: "textarea",
  17818. ref: textarea,
  17819. class: unref(nsTextarea).e("inner")
  17820. }, unref(attrs), {
  17821. tabindex: _ctx.tabindex,
  17822. disabled: unref(inputDisabled),
  17823. readonly: _ctx.readonly,
  17824. autocomplete: _ctx.autocomplete,
  17825. style: unref(textareaStyle),
  17826. "aria-label": _ctx.label,
  17827. placeholder: _ctx.placeholder,
  17828. form: props.form,
  17829. autofocus: props.autofocus,
  17830. onCompositionstart: handleCompositionStart,
  17831. onCompositionupdate: handleCompositionUpdate,
  17832. onCompositionend: handleCompositionEnd,
  17833. onInput: handleInput,
  17834. onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  17835. onBlur: _cache[3] || (_cache[3] = (...args) => unref(handleBlur) && unref(handleBlur)(...args)),
  17836. onChange: handleChange,
  17837. onKeydown: handleKeydown
  17838. }), null, 16, _hoisted_3$k),
  17839. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  17840. key: 0,
  17841. style: normalizeStyle(countStyle.value),
  17842. class: normalizeClass(unref(nsInput).e("count"))
  17843. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 7)) : createCommentVNode("v-if", true)
  17844. ], 64))
  17845. ], 16, _hoisted_1$14)), [
  17846. [vShow, _ctx.type !== "hidden"]
  17847. ]);
  17848. };
  17849. }
  17850. });
  17851. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$2i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  17852. const ElInput = withInstall(Input);
  17853. const GAP = 4;
  17854. const BAR_MAP = {
  17855. vertical: {
  17856. offset: "offsetHeight",
  17857. scroll: "scrollTop",
  17858. scrollSize: "scrollHeight",
  17859. size: "height",
  17860. key: "vertical",
  17861. axis: "Y",
  17862. client: "clientY",
  17863. direction: "top"
  17864. },
  17865. horizontal: {
  17866. offset: "offsetWidth",
  17867. scroll: "scrollLeft",
  17868. scrollSize: "scrollWidth",
  17869. size: "width",
  17870. key: "horizontal",
  17871. axis: "X",
  17872. client: "clientX",
  17873. direction: "left"
  17874. }
  17875. };
  17876. const renderThumbStyle$1 = ({
  17877. move,
  17878. size: size2,
  17879. bar
  17880. }) => ({
  17881. [bar.size]: size2,
  17882. transform: `translate${bar.axis}(${move}%)`
  17883. });
  17884. const scrollbarContextKey = Symbol("scrollbarContextKey");
  17885. const thumbProps = buildProps({
  17886. vertical: Boolean,
  17887. size: String,
  17888. move: Number,
  17889. ratio: {
  17890. type: Number,
  17891. required: true
  17892. },
  17893. always: Boolean
  17894. });
  17895. const COMPONENT_NAME$k = "Thumb";
  17896. const _sfc_main$2h = /* @__PURE__ */ defineComponent({
  17897. __name: "thumb",
  17898. props: thumbProps,
  17899. setup(__props) {
  17900. const props = __props;
  17901. const scrollbar = inject(scrollbarContextKey);
  17902. const ns = useNamespace("scrollbar");
  17903. if (!scrollbar)
  17904. throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
  17905. const instance = ref();
  17906. const thumb = ref();
  17907. const thumbState = ref({});
  17908. const visible = ref(false);
  17909. let cursorDown = false;
  17910. let cursorLeave = false;
  17911. let originalOnSelectStart = isClient ? document.onselectstart : null;
  17912. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  17913. const thumbStyle = computed(() => renderThumbStyle$1({
  17914. size: props.size,
  17915. move: props.move,
  17916. bar: bar.value
  17917. }));
  17918. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  17919. const clickThumbHandler = (e) => {
  17920. var _a2;
  17921. e.stopPropagation();
  17922. if (e.ctrlKey || [1, 2].includes(e.button))
  17923. return;
  17924. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  17925. startDrag(e);
  17926. const el = e.currentTarget;
  17927. if (!el)
  17928. return;
  17929. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  17930. };
  17931. const clickTrackHandler = (e) => {
  17932. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  17933. return;
  17934. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  17935. const thumbHalf = thumb.value[bar.value.offset] / 2;
  17936. const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  17937. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  17938. };
  17939. const startDrag = (e) => {
  17940. e.stopImmediatePropagation();
  17941. cursorDown = true;
  17942. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  17943. document.addEventListener("mouseup", mouseUpDocumentHandler);
  17944. originalOnSelectStart = document.onselectstart;
  17945. document.onselectstart = () => false;
  17946. };
  17947. const mouseMoveDocumentHandler = (e) => {
  17948. if (!instance.value || !thumb.value)
  17949. return;
  17950. if (cursorDown === false)
  17951. return;
  17952. const prevPage = thumbState.value[bar.value.axis];
  17953. if (!prevPage)
  17954. return;
  17955. const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  17956. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  17957. const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  17958. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  17959. };
  17960. const mouseUpDocumentHandler = () => {
  17961. cursorDown = false;
  17962. thumbState.value[bar.value.axis] = 0;
  17963. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  17964. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  17965. restoreOnselectstart();
  17966. if (cursorLeave)
  17967. visible.value = false;
  17968. };
  17969. const mouseMoveScrollbarHandler = () => {
  17970. cursorLeave = false;
  17971. visible.value = !!props.size;
  17972. };
  17973. const mouseLeaveScrollbarHandler = () => {
  17974. cursorLeave = true;
  17975. visible.value = cursorDown;
  17976. };
  17977. onBeforeUnmount(() => {
  17978. restoreOnselectstart();
  17979. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  17980. });
  17981. const restoreOnselectstart = () => {
  17982. if (document.onselectstart !== originalOnSelectStart)
  17983. document.onselectstart = originalOnSelectStart;
  17984. };
  17985. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  17986. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  17987. return (_ctx, _cache) => {
  17988. return openBlock(), createBlock(Transition, {
  17989. name: unref(ns).b("fade"),
  17990. persisted: ""
  17991. }, {
  17992. default: withCtx(() => [
  17993. withDirectives(createBaseVNode("div", {
  17994. ref_key: "instance",
  17995. ref: instance,
  17996. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
  17997. onMousedown: clickTrackHandler
  17998. }, [
  17999. createBaseVNode("div", {
  18000. ref_key: "thumb",
  18001. ref: thumb,
  18002. class: normalizeClass(unref(ns).e("thumb")),
  18003. style: normalizeStyle(unref(thumbStyle)),
  18004. onMousedown: clickThumbHandler
  18005. }, null, 38)
  18006. ], 34), [
  18007. [vShow, _ctx.always || visible.value]
  18008. ])
  18009. ]),
  18010. _: 1
  18011. }, 8, ["name"]);
  18012. };
  18013. }
  18014. });
  18015. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$2h, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  18016. const barProps = buildProps({
  18017. always: {
  18018. type: Boolean,
  18019. default: true
  18020. },
  18021. width: String,
  18022. height: String,
  18023. ratioX: {
  18024. type: Number,
  18025. default: 1
  18026. },
  18027. ratioY: {
  18028. type: Number,
  18029. default: 1
  18030. }
  18031. });
  18032. const _sfc_main$2g = /* @__PURE__ */ defineComponent({
  18033. __name: "bar",
  18034. props: barProps,
  18035. setup(__props, { expose }) {
  18036. const props = __props;
  18037. const moveX = ref(0);
  18038. const moveY = ref(0);
  18039. const handleScroll2 = (wrap) => {
  18040. if (wrap) {
  18041. const offsetHeight = wrap.offsetHeight - GAP;
  18042. const offsetWidth = wrap.offsetWidth - GAP;
  18043. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  18044. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  18045. }
  18046. };
  18047. expose({
  18048. handleScroll: handleScroll2
  18049. });
  18050. return (_ctx, _cache) => {
  18051. return openBlock(), createElementBlock(Fragment, null, [
  18052. createVNode(Thumb, {
  18053. move: moveX.value,
  18054. ratio: _ctx.ratioX,
  18055. size: _ctx.width,
  18056. always: _ctx.always
  18057. }, null, 8, ["move", "ratio", "size", "always"]),
  18058. createVNode(Thumb, {
  18059. move: moveY.value,
  18060. ratio: _ctx.ratioY,
  18061. size: _ctx.height,
  18062. vertical: "",
  18063. always: _ctx.always
  18064. }, null, 8, ["move", "ratio", "size", "always"])
  18065. ], 64);
  18066. };
  18067. }
  18068. });
  18069. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$2g, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  18070. const scrollbarProps = buildProps({
  18071. height: {
  18072. type: [String, Number],
  18073. default: ""
  18074. },
  18075. maxHeight: {
  18076. type: [String, Number],
  18077. default: ""
  18078. },
  18079. native: {
  18080. type: Boolean,
  18081. default: false
  18082. },
  18083. wrapStyle: {
  18084. type: definePropType([String, Object, Array]),
  18085. default: ""
  18086. },
  18087. wrapClass: {
  18088. type: [String, Array],
  18089. default: ""
  18090. },
  18091. viewClass: {
  18092. type: [String, Array],
  18093. default: ""
  18094. },
  18095. viewStyle: {
  18096. type: [String, Array, Object],
  18097. default: ""
  18098. },
  18099. noresize: Boolean,
  18100. tag: {
  18101. type: String,
  18102. default: "div"
  18103. },
  18104. always: Boolean,
  18105. minSize: {
  18106. type: Number,
  18107. default: 20
  18108. },
  18109. id: String,
  18110. role: String,
  18111. ariaLabel: String,
  18112. ariaOrientation: {
  18113. type: String,
  18114. values: ["horizontal", "vertical"]
  18115. }
  18116. });
  18117. const scrollbarEmits = {
  18118. scroll: ({
  18119. scrollTop,
  18120. scrollLeft
  18121. }) => [scrollTop, scrollLeft].every(isNumber)
  18122. };
  18123. const COMPONENT_NAME$j = "ElScrollbar";
  18124. const __default__$1x = /* @__PURE__ */ defineComponent({
  18125. name: COMPONENT_NAME$j
  18126. });
  18127. const _sfc_main$2f = /* @__PURE__ */ defineComponent({
  18128. ...__default__$1x,
  18129. props: scrollbarProps,
  18130. emits: scrollbarEmits,
  18131. setup(__props, { expose, emit: emit2 }) {
  18132. const props = __props;
  18133. const ns = useNamespace("scrollbar");
  18134. let stopResizeObserver = void 0;
  18135. let stopResizeListener = void 0;
  18136. const scrollbarRef = ref();
  18137. const wrapRef = ref();
  18138. const resizeRef = ref();
  18139. const sizeWidth = ref("0");
  18140. const sizeHeight = ref("0");
  18141. const barRef = ref();
  18142. const ratioY = ref(1);
  18143. const ratioX = ref(1);
  18144. const wrapStyle = computed(() => {
  18145. const style = {};
  18146. if (props.height)
  18147. style.height = addUnit(props.height);
  18148. if (props.maxHeight)
  18149. style.maxHeight = addUnit(props.maxHeight);
  18150. return [props.wrapStyle, style];
  18151. });
  18152. const wrapKls = computed(() => {
  18153. return [
  18154. props.wrapClass,
  18155. ns.e("wrap"),
  18156. { [ns.em("wrap", "hidden-default")]: !props.native }
  18157. ];
  18158. });
  18159. const resizeKls = computed(() => {
  18160. return [ns.e("view"), props.viewClass];
  18161. });
  18162. const handleScroll2 = () => {
  18163. var _a2;
  18164. if (wrapRef.value) {
  18165. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  18166. emit2("scroll", {
  18167. scrollTop: wrapRef.value.scrollTop,
  18168. scrollLeft: wrapRef.value.scrollLeft
  18169. });
  18170. }
  18171. };
  18172. function scrollTo(arg1, arg2) {
  18173. if (isObject$1(arg1)) {
  18174. wrapRef.value.scrollTo(arg1);
  18175. } else if (isNumber(arg1) && isNumber(arg2)) {
  18176. wrapRef.value.scrollTo(arg1, arg2);
  18177. }
  18178. }
  18179. const setScrollTop = (value) => {
  18180. if (!isNumber(value)) {
  18181. return;
  18182. }
  18183. wrapRef.value.scrollTop = value;
  18184. };
  18185. const setScrollLeft = (value) => {
  18186. if (!isNumber(value)) {
  18187. return;
  18188. }
  18189. wrapRef.value.scrollLeft = value;
  18190. };
  18191. const update = () => {
  18192. if (!wrapRef.value)
  18193. return;
  18194. const offsetHeight = wrapRef.value.offsetHeight - GAP;
  18195. const offsetWidth = wrapRef.value.offsetWidth - GAP;
  18196. const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
  18197. const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
  18198. const height = Math.max(originalHeight, props.minSize);
  18199. const width = Math.max(originalWidth, props.minSize);
  18200. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  18201. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  18202. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  18203. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  18204. };
  18205. watch(() => props.noresize, (noresize) => {
  18206. if (noresize) {
  18207. stopResizeObserver == null ? void 0 : stopResizeObserver();
  18208. stopResizeListener == null ? void 0 : stopResizeListener();
  18209. } else {
  18210. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  18211. stopResizeListener = useEventListener("resize", update);
  18212. }
  18213. }, { immediate: true });
  18214. watch(() => [props.maxHeight, props.height], () => {
  18215. if (!props.native)
  18216. nextTick(() => {
  18217. var _a2;
  18218. update();
  18219. if (wrapRef.value) {
  18220. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  18221. }
  18222. });
  18223. });
  18224. provide(scrollbarContextKey, reactive({
  18225. scrollbarElement: scrollbarRef,
  18226. wrapElement: wrapRef
  18227. }));
  18228. onMounted(() => {
  18229. if (!props.native)
  18230. nextTick(() => {
  18231. update();
  18232. });
  18233. });
  18234. onUpdated(() => update());
  18235. expose({
  18236. wrapRef,
  18237. update,
  18238. scrollTo,
  18239. setScrollTop,
  18240. setScrollLeft,
  18241. handleScroll: handleScroll2
  18242. });
  18243. return (_ctx, _cache) => {
  18244. return openBlock(), createElementBlock("div", {
  18245. ref_key: "scrollbarRef",
  18246. ref: scrollbarRef,
  18247. class: normalizeClass(unref(ns).b())
  18248. }, [
  18249. createBaseVNode("div", {
  18250. ref_key: "wrapRef",
  18251. ref: wrapRef,
  18252. class: normalizeClass(unref(wrapKls)),
  18253. style: normalizeStyle(unref(wrapStyle)),
  18254. onScroll: handleScroll2
  18255. }, [
  18256. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  18257. id: _ctx.id,
  18258. ref_key: "resizeRef",
  18259. ref: resizeRef,
  18260. class: normalizeClass(unref(resizeKls)),
  18261. style: normalizeStyle(_ctx.viewStyle),
  18262. role: _ctx.role,
  18263. "aria-label": _ctx.ariaLabel,
  18264. "aria-orientation": _ctx.ariaOrientation
  18265. }, {
  18266. default: withCtx(() => [
  18267. renderSlot(_ctx.$slots, "default")
  18268. ]),
  18269. _: 3
  18270. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  18271. ], 38),
  18272. !_ctx.native ? (openBlock(), createBlock(Bar, {
  18273. key: 0,
  18274. ref_key: "barRef",
  18275. ref: barRef,
  18276. height: sizeHeight.value,
  18277. width: sizeWidth.value,
  18278. always: _ctx.always,
  18279. "ratio-x": ratioX.value,
  18280. "ratio-y": ratioY.value
  18281. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  18282. ], 2);
  18283. };
  18284. }
  18285. });
  18286. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$2f, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  18287. const ElScrollbar = withInstall(Scrollbar);
  18288. const POPPER_INJECTION_KEY = Symbol("popper");
  18289. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  18290. const roleTypes = [
  18291. "dialog",
  18292. "grid",
  18293. "group",
  18294. "listbox",
  18295. "menu",
  18296. "navigation",
  18297. "tooltip",
  18298. "tree"
  18299. ];
  18300. const popperProps = buildProps({
  18301. role: {
  18302. type: String,
  18303. values: roleTypes,
  18304. default: "tooltip"
  18305. }
  18306. });
  18307. const __default__$1w = /* @__PURE__ */ defineComponent({
  18308. name: "ElPopper",
  18309. inheritAttrs: false
  18310. });
  18311. const _sfc_main$2e = /* @__PURE__ */ defineComponent({
  18312. ...__default__$1w,
  18313. props: popperProps,
  18314. setup(__props, { expose }) {
  18315. const props = __props;
  18316. const triggerRef2 = ref();
  18317. const popperInstanceRef = ref();
  18318. const contentRef = ref();
  18319. const referenceRef = ref();
  18320. const role = computed(() => props.role);
  18321. const popperProvides = {
  18322. triggerRef: triggerRef2,
  18323. popperInstanceRef,
  18324. contentRef,
  18325. referenceRef,
  18326. role
  18327. };
  18328. expose(popperProvides);
  18329. provide(POPPER_INJECTION_KEY, popperProvides);
  18330. return (_ctx, _cache) => {
  18331. return renderSlot(_ctx.$slots, "default");
  18332. };
  18333. }
  18334. });
  18335. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$2e, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  18336. const popperArrowProps = buildProps({
  18337. arrowOffset: {
  18338. type: Number,
  18339. default: 5
  18340. }
  18341. });
  18342. const __default__$1v = /* @__PURE__ */ defineComponent({
  18343. name: "ElPopperArrow",
  18344. inheritAttrs: false
  18345. });
  18346. const _sfc_main$2d = /* @__PURE__ */ defineComponent({
  18347. ...__default__$1v,
  18348. props: popperArrowProps,
  18349. setup(__props, { expose }) {
  18350. const props = __props;
  18351. const ns = useNamespace("popper");
  18352. const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  18353. watch(() => props.arrowOffset, (val) => {
  18354. arrowOffset.value = val;
  18355. });
  18356. onBeforeUnmount(() => {
  18357. arrowRef.value = void 0;
  18358. });
  18359. expose({
  18360. arrowRef
  18361. });
  18362. return (_ctx, _cache) => {
  18363. return openBlock(), createElementBlock("span", {
  18364. ref_key: "arrowRef",
  18365. ref: arrowRef,
  18366. class: normalizeClass(unref(ns).e("arrow")),
  18367. style: normalizeStyle(unref(arrowStyle)),
  18368. "data-popper-arrow": ""
  18369. }, null, 6);
  18370. };
  18371. }
  18372. });
  18373. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$2d, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  18374. const NAME = "ElOnlyChild";
  18375. const OnlyChild = /* @__PURE__ */ defineComponent({
  18376. name: NAME,
  18377. setup(_2, {
  18378. slots,
  18379. attrs
  18380. }) {
  18381. var _a2;
  18382. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  18383. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  18384. return () => {
  18385. var _a22;
  18386. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  18387. if (!defaultSlot)
  18388. return null;
  18389. if (defaultSlot.length > 1) {
  18390. return null;
  18391. }
  18392. const firstLegitNode = findFirstLegitChild(defaultSlot);
  18393. if (!firstLegitNode) {
  18394. return null;
  18395. }
  18396. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  18397. };
  18398. }
  18399. });
  18400. function findFirstLegitChild(node) {
  18401. if (!node)
  18402. return null;
  18403. const children = node;
  18404. for (const child of children) {
  18405. if (isObject$1(child)) {
  18406. switch (child.type) {
  18407. case Comment:
  18408. continue;
  18409. case Text$1:
  18410. case "svg":
  18411. return wrapTextContent(child);
  18412. case Fragment:
  18413. return findFirstLegitChild(child.children);
  18414. default:
  18415. return child;
  18416. }
  18417. }
  18418. return wrapTextContent(child);
  18419. }
  18420. return null;
  18421. }
  18422. function wrapTextContent(s2) {
  18423. const ns = useNamespace("only-child");
  18424. return createVNode("span", {
  18425. "class": ns.e("content")
  18426. }, [s2]);
  18427. }
  18428. const popperTriggerProps = buildProps({
  18429. virtualRef: {
  18430. type: definePropType(Object)
  18431. },
  18432. virtualTriggering: Boolean,
  18433. onMouseenter: {
  18434. type: definePropType(Function)
  18435. },
  18436. onMouseleave: {
  18437. type: definePropType(Function)
  18438. },
  18439. onClick: {
  18440. type: definePropType(Function)
  18441. },
  18442. onKeydown: {
  18443. type: definePropType(Function)
  18444. },
  18445. onFocus: {
  18446. type: definePropType(Function)
  18447. },
  18448. onBlur: {
  18449. type: definePropType(Function)
  18450. },
  18451. onContextmenu: {
  18452. type: definePropType(Function)
  18453. },
  18454. id: String,
  18455. open: Boolean
  18456. });
  18457. const __default__$1u = /* @__PURE__ */ defineComponent({
  18458. name: "ElPopperTrigger",
  18459. inheritAttrs: false
  18460. });
  18461. const _sfc_main$2c = /* @__PURE__ */ defineComponent({
  18462. ...__default__$1u,
  18463. props: popperTriggerProps,
  18464. setup(__props, { expose }) {
  18465. const props = __props;
  18466. const { role, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  18467. useForwardRef(triggerRef2);
  18468. const ariaControls = computed(() => {
  18469. return ariaHaspopup.value ? props.id : void 0;
  18470. });
  18471. const ariaDescribedby = computed(() => {
  18472. if (role && role.value === "tooltip") {
  18473. return props.open && props.id ? props.id : void 0;
  18474. }
  18475. return void 0;
  18476. });
  18477. const ariaHaspopup = computed(() => {
  18478. if (role && role.value !== "tooltip") {
  18479. return role.value;
  18480. }
  18481. return void 0;
  18482. });
  18483. const ariaExpanded = computed(() => {
  18484. return ariaHaspopup.value ? `${props.open}` : void 0;
  18485. });
  18486. let virtualTriggerAriaStopWatch = void 0;
  18487. onMounted(() => {
  18488. watch(() => props.virtualRef, (virtualEl) => {
  18489. if (virtualEl) {
  18490. triggerRef2.value = unrefElement(virtualEl);
  18491. }
  18492. }, {
  18493. immediate: true
  18494. });
  18495. watch(triggerRef2, (el, prevEl) => {
  18496. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  18497. virtualTriggerAriaStopWatch = void 0;
  18498. if (isElement$1(el)) {
  18499. [
  18500. "onMouseenter",
  18501. "onMouseleave",
  18502. "onClick",
  18503. "onKeydown",
  18504. "onFocus",
  18505. "onBlur",
  18506. "onContextmenu"
  18507. ].forEach((eventName) => {
  18508. var _a2;
  18509. const handler = props[eventName];
  18510. if (handler) {
  18511. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  18512. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  18513. }
  18514. });
  18515. virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  18516. [
  18517. "aria-controls",
  18518. "aria-describedby",
  18519. "aria-haspopup",
  18520. "aria-expanded"
  18521. ].forEach((key, idx) => {
  18522. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  18523. });
  18524. }, { immediate: true });
  18525. }
  18526. if (isElement$1(prevEl)) {
  18527. [
  18528. "aria-controls",
  18529. "aria-describedby",
  18530. "aria-haspopup",
  18531. "aria-expanded"
  18532. ].forEach((key) => prevEl.removeAttribute(key));
  18533. }
  18534. }, {
  18535. immediate: true
  18536. });
  18537. });
  18538. onBeforeUnmount(() => {
  18539. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  18540. virtualTriggerAriaStopWatch = void 0;
  18541. });
  18542. expose({
  18543. triggerRef: triggerRef2
  18544. });
  18545. return (_ctx, _cache) => {
  18546. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  18547. "aria-controls": unref(ariaControls),
  18548. "aria-describedby": unref(ariaDescribedby),
  18549. "aria-expanded": unref(ariaExpanded),
  18550. "aria-haspopup": unref(ariaHaspopup)
  18551. }), {
  18552. default: withCtx(() => [
  18553. renderSlot(_ctx.$slots, "default")
  18554. ]),
  18555. _: 3
  18556. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
  18557. };
  18558. }
  18559. });
  18560. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$2c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  18561. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  18562. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  18563. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  18564. const FOCUS_AFTER_TRAPPED_OPTS = {
  18565. cancelable: true,
  18566. bubbles: false
  18567. };
  18568. const FOCUSOUT_PREVENTED_OPTS = {
  18569. cancelable: true,
  18570. bubbles: false
  18571. };
  18572. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  18573. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  18574. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  18575. const focusReason = ref();
  18576. const lastUserFocusTimestamp = ref(0);
  18577. const lastAutomatedFocusTimestamp = ref(0);
  18578. let focusReasonUserCount = 0;
  18579. const obtainAllFocusableElements = (element) => {
  18580. const nodes = [];
  18581. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  18582. acceptNode: (node) => {
  18583. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  18584. if (node.disabled || node.hidden || isHiddenInput)
  18585. return NodeFilter.FILTER_SKIP;
  18586. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  18587. }
  18588. });
  18589. while (walker.nextNode())
  18590. nodes.push(walker.currentNode);
  18591. return nodes;
  18592. };
  18593. const getVisibleElement = (elements, container) => {
  18594. for (const element of elements) {
  18595. if (!isHidden(element, container))
  18596. return element;
  18597. }
  18598. };
  18599. const isHidden = (element, container) => {
  18600. if (getComputedStyle(element).visibility === "hidden")
  18601. return true;
  18602. while (element) {
  18603. if (container && element === container)
  18604. return false;
  18605. if (getComputedStyle(element).display === "none")
  18606. return true;
  18607. element = element.parentElement;
  18608. }
  18609. return false;
  18610. };
  18611. const getEdges = (container) => {
  18612. const focusable = obtainAllFocusableElements(container);
  18613. const first = getVisibleElement(focusable, container);
  18614. const last = getVisibleElement(focusable.reverse(), container);
  18615. return [first, last];
  18616. };
  18617. const isSelectable = (element) => {
  18618. return element instanceof HTMLInputElement && "select" in element;
  18619. };
  18620. const tryFocus = (element, shouldSelect) => {
  18621. if (element && element.focus) {
  18622. const prevFocusedElement = document.activeElement;
  18623. element.focus({ preventScroll: true });
  18624. lastAutomatedFocusTimestamp.value = window.performance.now();
  18625. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  18626. element.select();
  18627. }
  18628. }
  18629. };
  18630. function removeFromStack(list, item) {
  18631. const copy = [...list];
  18632. const idx = list.indexOf(item);
  18633. if (idx !== -1) {
  18634. copy.splice(idx, 1);
  18635. }
  18636. return copy;
  18637. }
  18638. const createFocusableStack = () => {
  18639. let stack = [];
  18640. const push = (layer) => {
  18641. const currentLayer = stack[0];
  18642. if (currentLayer && layer !== currentLayer) {
  18643. currentLayer.pause();
  18644. }
  18645. stack = removeFromStack(stack, layer);
  18646. stack.unshift(layer);
  18647. };
  18648. const remove2 = (layer) => {
  18649. var _a2, _b;
  18650. stack = removeFromStack(stack, layer);
  18651. (_b = (_a2 = stack[0]) == null ? void 0 : _a2.resume) == null ? void 0 : _b.call(_a2);
  18652. };
  18653. return {
  18654. push,
  18655. remove: remove2
  18656. };
  18657. };
  18658. const focusFirstDescendant = (elements, shouldSelect = false) => {
  18659. const prevFocusedElement = document.activeElement;
  18660. for (const element of elements) {
  18661. tryFocus(element, shouldSelect);
  18662. if (document.activeElement !== prevFocusedElement)
  18663. return;
  18664. }
  18665. };
  18666. const focusableStack = createFocusableStack();
  18667. const isFocusCausedByUserEvent = () => {
  18668. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  18669. };
  18670. const notifyFocusReasonPointer = () => {
  18671. focusReason.value = "pointer";
  18672. lastUserFocusTimestamp.value = window.performance.now();
  18673. };
  18674. const notifyFocusReasonKeydown = () => {
  18675. focusReason.value = "keyboard";
  18676. lastUserFocusTimestamp.value = window.performance.now();
  18677. };
  18678. const useFocusReason = () => {
  18679. onMounted(() => {
  18680. if (focusReasonUserCount === 0) {
  18681. document.addEventListener("mousedown", notifyFocusReasonPointer);
  18682. document.addEventListener("touchstart", notifyFocusReasonPointer);
  18683. document.addEventListener("keydown", notifyFocusReasonKeydown);
  18684. }
  18685. focusReasonUserCount++;
  18686. });
  18687. onBeforeUnmount(() => {
  18688. focusReasonUserCount--;
  18689. if (focusReasonUserCount <= 0) {
  18690. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  18691. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  18692. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  18693. }
  18694. });
  18695. return {
  18696. focusReason,
  18697. lastUserFocusTimestamp,
  18698. lastAutomatedFocusTimestamp
  18699. };
  18700. };
  18701. const createFocusOutPreventedEvent = (detail) => {
  18702. return new CustomEvent(FOCUSOUT_PREVENTED, {
  18703. ...FOCUSOUT_PREVENTED_OPTS,
  18704. detail
  18705. });
  18706. };
  18707. const _sfc_main$2b = /* @__PURE__ */ defineComponent({
  18708. name: "ElFocusTrap",
  18709. inheritAttrs: false,
  18710. props: {
  18711. loop: Boolean,
  18712. trapped: Boolean,
  18713. focusTrapEl: Object,
  18714. focusStartEl: {
  18715. type: [Object, String],
  18716. default: "first"
  18717. }
  18718. },
  18719. emits: [
  18720. ON_TRAP_FOCUS_EVT,
  18721. ON_RELEASE_FOCUS_EVT,
  18722. "focusin",
  18723. "focusout",
  18724. "focusout-prevented",
  18725. "release-requested"
  18726. ],
  18727. setup(props, { emit: emit2 }) {
  18728. const forwardRef = ref();
  18729. let lastFocusBeforeTrapped;
  18730. let lastFocusAfterTrapped;
  18731. const { focusReason: focusReason2 } = useFocusReason();
  18732. useEscapeKeydown((event) => {
  18733. if (props.trapped && !focusLayer.paused) {
  18734. emit2("release-requested", event);
  18735. }
  18736. });
  18737. const focusLayer = {
  18738. paused: false,
  18739. pause() {
  18740. this.paused = true;
  18741. },
  18742. resume() {
  18743. this.paused = false;
  18744. }
  18745. };
  18746. const onKeydown = (e) => {
  18747. if (!props.loop && !props.trapped)
  18748. return;
  18749. if (focusLayer.paused)
  18750. return;
  18751. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  18752. const { loop } = props;
  18753. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  18754. const currentFocusingEl = document.activeElement;
  18755. if (isTabbing && currentFocusingEl) {
  18756. const container = currentTarget;
  18757. const [first, last] = getEdges(container);
  18758. const isTabbable = first && last;
  18759. if (!isTabbable) {
  18760. if (currentFocusingEl === container) {
  18761. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  18762. focusReason: focusReason2.value
  18763. });
  18764. emit2("focusout-prevented", focusoutPreventedEvent);
  18765. if (!focusoutPreventedEvent.defaultPrevented) {
  18766. e.preventDefault();
  18767. }
  18768. }
  18769. } else {
  18770. if (!shiftKey && currentFocusingEl === last) {
  18771. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  18772. focusReason: focusReason2.value
  18773. });
  18774. emit2("focusout-prevented", focusoutPreventedEvent);
  18775. if (!focusoutPreventedEvent.defaultPrevented) {
  18776. e.preventDefault();
  18777. if (loop)
  18778. tryFocus(first, true);
  18779. }
  18780. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  18781. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  18782. focusReason: focusReason2.value
  18783. });
  18784. emit2("focusout-prevented", focusoutPreventedEvent);
  18785. if (!focusoutPreventedEvent.defaultPrevented) {
  18786. e.preventDefault();
  18787. if (loop)
  18788. tryFocus(last, true);
  18789. }
  18790. }
  18791. }
  18792. }
  18793. };
  18794. provide(FOCUS_TRAP_INJECTION_KEY, {
  18795. focusTrapRef: forwardRef,
  18796. onKeydown
  18797. });
  18798. watch(() => props.focusTrapEl, (focusTrapEl) => {
  18799. if (focusTrapEl) {
  18800. forwardRef.value = focusTrapEl;
  18801. }
  18802. }, { immediate: true });
  18803. watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  18804. if (forwardRef2) {
  18805. forwardRef2.addEventListener("keydown", onKeydown);
  18806. forwardRef2.addEventListener("focusin", onFocusIn);
  18807. forwardRef2.addEventListener("focusout", onFocusOut);
  18808. }
  18809. if (oldForwardRef) {
  18810. oldForwardRef.removeEventListener("keydown", onKeydown);
  18811. oldForwardRef.removeEventListener("focusin", onFocusIn);
  18812. oldForwardRef.removeEventListener("focusout", onFocusOut);
  18813. }
  18814. });
  18815. const trapOnFocus = (e) => {
  18816. emit2(ON_TRAP_FOCUS_EVT, e);
  18817. };
  18818. const releaseOnFocus = (e) => emit2(ON_RELEASE_FOCUS_EVT, e);
  18819. const onFocusIn = (e) => {
  18820. const trapContainer = unref(forwardRef);
  18821. if (!trapContainer)
  18822. return;
  18823. const target = e.target;
  18824. const relatedTarget = e.relatedTarget;
  18825. const isFocusedInTrap = target && trapContainer.contains(target);
  18826. if (!props.trapped) {
  18827. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  18828. if (!isPrevFocusedInTrap) {
  18829. lastFocusBeforeTrapped = relatedTarget;
  18830. }
  18831. }
  18832. if (isFocusedInTrap)
  18833. emit2("focusin", e);
  18834. if (focusLayer.paused)
  18835. return;
  18836. if (props.trapped) {
  18837. if (isFocusedInTrap) {
  18838. lastFocusAfterTrapped = target;
  18839. } else {
  18840. tryFocus(lastFocusAfterTrapped, true);
  18841. }
  18842. }
  18843. };
  18844. const onFocusOut = (e) => {
  18845. const trapContainer = unref(forwardRef);
  18846. if (focusLayer.paused || !trapContainer)
  18847. return;
  18848. if (props.trapped) {
  18849. const relatedTarget = e.relatedTarget;
  18850. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  18851. setTimeout(() => {
  18852. if (!focusLayer.paused && props.trapped) {
  18853. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  18854. focusReason: focusReason2.value
  18855. });
  18856. emit2("focusout-prevented", focusoutPreventedEvent);
  18857. if (!focusoutPreventedEvent.defaultPrevented) {
  18858. tryFocus(lastFocusAfterTrapped, true);
  18859. }
  18860. }
  18861. }, 0);
  18862. }
  18863. } else {
  18864. const target = e.target;
  18865. const isFocusedInTrap = target && trapContainer.contains(target);
  18866. if (!isFocusedInTrap)
  18867. emit2("focusout", e);
  18868. }
  18869. };
  18870. async function startTrap() {
  18871. await nextTick();
  18872. const trapContainer = unref(forwardRef);
  18873. if (trapContainer) {
  18874. focusableStack.push(focusLayer);
  18875. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  18876. lastFocusBeforeTrapped = prevFocusedElement;
  18877. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  18878. if (!isPrevFocusContained) {
  18879. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  18880. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  18881. trapContainer.dispatchEvent(focusEvent);
  18882. if (!focusEvent.defaultPrevented) {
  18883. nextTick(() => {
  18884. let focusStartEl = props.focusStartEl;
  18885. if (!isString$1(focusStartEl)) {
  18886. tryFocus(focusStartEl);
  18887. if (document.activeElement !== focusStartEl) {
  18888. focusStartEl = "first";
  18889. }
  18890. }
  18891. if (focusStartEl === "first") {
  18892. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  18893. }
  18894. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  18895. tryFocus(trapContainer);
  18896. }
  18897. });
  18898. }
  18899. }
  18900. }
  18901. }
  18902. function stopTrap() {
  18903. const trapContainer = unref(forwardRef);
  18904. if (trapContainer) {
  18905. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  18906. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  18907. ...FOCUS_AFTER_TRAPPED_OPTS,
  18908. detail: {
  18909. focusReason: focusReason2.value
  18910. }
  18911. });
  18912. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  18913. trapContainer.dispatchEvent(releasedEvent);
  18914. if (!releasedEvent.defaultPrevented && (focusReason2.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  18915. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  18916. }
  18917. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  18918. focusableStack.remove(focusLayer);
  18919. }
  18920. }
  18921. onMounted(() => {
  18922. if (props.trapped) {
  18923. startTrap();
  18924. }
  18925. watch(() => props.trapped, (trapped) => {
  18926. if (trapped) {
  18927. startTrap();
  18928. } else {
  18929. stopTrap();
  18930. }
  18931. });
  18932. });
  18933. onBeforeUnmount(() => {
  18934. if (props.trapped) {
  18935. stopTrap();
  18936. }
  18937. });
  18938. return {
  18939. onKeydown
  18940. };
  18941. }
  18942. });
  18943. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  18944. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  18945. }
  18946. var ElFocusTrap = /* @__PURE__ */ _export_sfc$1(_sfc_main$2b, [["render", _sfc_render$v], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);
  18947. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  18948. const popperCoreConfigProps = buildProps({
  18949. boundariesPadding: {
  18950. type: Number,
  18951. default: 0
  18952. },
  18953. fallbackPlacements: {
  18954. type: definePropType(Array),
  18955. default: void 0
  18956. },
  18957. gpuAcceleration: {
  18958. type: Boolean,
  18959. default: true
  18960. },
  18961. offset: {
  18962. type: Number,
  18963. default: 12
  18964. },
  18965. placement: {
  18966. type: String,
  18967. values: Ee,
  18968. default: "bottom"
  18969. },
  18970. popperOptions: {
  18971. type: definePropType(Object),
  18972. default: () => ({})
  18973. },
  18974. strategy: {
  18975. type: String,
  18976. values: POSITIONING_STRATEGIES,
  18977. default: "absolute"
  18978. }
  18979. });
  18980. const popperContentProps = buildProps({
  18981. ...popperCoreConfigProps,
  18982. id: String,
  18983. style: {
  18984. type: definePropType([String, Array, Object])
  18985. },
  18986. className: {
  18987. type: definePropType([String, Array, Object])
  18988. },
  18989. effect: {
  18990. type: String,
  18991. default: "dark"
  18992. },
  18993. visible: Boolean,
  18994. enterable: {
  18995. type: Boolean,
  18996. default: true
  18997. },
  18998. pure: Boolean,
  18999. focusOnShow: {
  19000. type: Boolean,
  19001. default: false
  19002. },
  19003. trapping: {
  19004. type: Boolean,
  19005. default: false
  19006. },
  19007. popperClass: {
  19008. type: definePropType([String, Array, Object])
  19009. },
  19010. popperStyle: {
  19011. type: definePropType([String, Array, Object])
  19012. },
  19013. referenceEl: {
  19014. type: definePropType(Object)
  19015. },
  19016. triggerTargetEl: {
  19017. type: definePropType(Object)
  19018. },
  19019. stopPopperMouseEvent: {
  19020. type: Boolean,
  19021. default: true
  19022. },
  19023. ariaLabel: {
  19024. type: String,
  19025. default: void 0
  19026. },
  19027. virtualTriggering: Boolean,
  19028. zIndex: Number
  19029. });
  19030. const popperContentEmits = {
  19031. mouseenter: (evt) => evt instanceof MouseEvent,
  19032. mouseleave: (evt) => evt instanceof MouseEvent,
  19033. focus: () => true,
  19034. blur: () => true,
  19035. close: () => true
  19036. };
  19037. const buildPopperOptions = (props, modifiers = []) => {
  19038. const { placement, strategy, popperOptions } = props;
  19039. const options = {
  19040. placement,
  19041. strategy,
  19042. ...popperOptions,
  19043. modifiers: [...genModifiers(props), ...modifiers]
  19044. };
  19045. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  19046. return options;
  19047. };
  19048. const unwrapMeasurableEl = ($el) => {
  19049. if (!isClient)
  19050. return;
  19051. return unrefElement($el);
  19052. };
  19053. function genModifiers(options) {
  19054. const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
  19055. return [
  19056. {
  19057. name: "offset",
  19058. options: {
  19059. offset: [0, offset2 != null ? offset2 : 12]
  19060. }
  19061. },
  19062. {
  19063. name: "preventOverflow",
  19064. options: {
  19065. padding: {
  19066. top: 2,
  19067. bottom: 2,
  19068. left: 5,
  19069. right: 5
  19070. }
  19071. }
  19072. },
  19073. {
  19074. name: "flip",
  19075. options: {
  19076. padding: 5,
  19077. fallbackPlacements
  19078. }
  19079. },
  19080. {
  19081. name: "computeStyles",
  19082. options: {
  19083. gpuAcceleration
  19084. }
  19085. }
  19086. ];
  19087. }
  19088. function deriveExtraModifiers(options, modifiers) {
  19089. if (modifiers) {
  19090. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  19091. }
  19092. }
  19093. const DEFAULT_ARROW_OFFSET = 0;
  19094. const usePopperContent = (props) => {
  19095. const { popperInstanceRef, contentRef, triggerRef: triggerRef2, role } = inject(POPPER_INJECTION_KEY, void 0);
  19096. const arrowRef = ref();
  19097. const arrowOffset = ref();
  19098. const eventListenerModifier = computed(() => {
  19099. return {
  19100. name: "eventListeners",
  19101. enabled: !!props.visible
  19102. };
  19103. });
  19104. const arrowModifier = computed(() => {
  19105. var _a2;
  19106. const arrowEl = unref(arrowRef);
  19107. const offset2 = (_a2 = unref(arrowOffset)) != null ? _a2 : DEFAULT_ARROW_OFFSET;
  19108. return {
  19109. name: "arrow",
  19110. enabled: !isUndefined$1(arrowEl),
  19111. options: {
  19112. element: arrowEl,
  19113. padding: offset2
  19114. }
  19115. };
  19116. });
  19117. const options = computed(() => {
  19118. return {
  19119. onFirstUpdate: () => {
  19120. update();
  19121. },
  19122. ...buildPopperOptions(props, [
  19123. unref(arrowModifier),
  19124. unref(eventListenerModifier)
  19125. ])
  19126. };
  19127. });
  19128. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  19129. const { attributes: attributes2, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  19130. watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  19131. onMounted(() => {
  19132. watch(() => {
  19133. var _a2;
  19134. return (_a2 = unref(computedReference)) == null ? void 0 : _a2.getBoundingClientRect();
  19135. }, () => {
  19136. update();
  19137. });
  19138. });
  19139. return {
  19140. attributes: attributes2,
  19141. arrowRef,
  19142. contentRef,
  19143. instanceRef,
  19144. state,
  19145. styles,
  19146. role,
  19147. forceUpdate,
  19148. update
  19149. };
  19150. };
  19151. const usePopperContentDOM = (props, {
  19152. attributes: attributes2,
  19153. styles,
  19154. role
  19155. }) => {
  19156. const { nextZIndex } = useZIndex();
  19157. const ns = useNamespace("popper");
  19158. const contentAttrs = computed(() => unref(attributes2).popper);
  19159. const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  19160. const contentClass = computed(() => [
  19161. ns.b(),
  19162. ns.is("pure", props.pure),
  19163. ns.is(props.effect),
  19164. props.popperClass
  19165. ]);
  19166. const contentStyle = computed(() => {
  19167. return [
  19168. { zIndex: unref(contentZIndex) },
  19169. unref(styles).popper,
  19170. props.popperStyle || {}
  19171. ];
  19172. });
  19173. const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
  19174. const arrowStyle = computed(() => unref(styles).arrow || {});
  19175. const updateZIndex = () => {
  19176. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  19177. };
  19178. return {
  19179. ariaModal,
  19180. arrowStyle,
  19181. contentAttrs,
  19182. contentClass,
  19183. contentStyle,
  19184. contentZIndex,
  19185. updateZIndex
  19186. };
  19187. };
  19188. const usePopperContentFocusTrap = (props, emit2) => {
  19189. const trapped = ref(false);
  19190. const focusStartRef = ref();
  19191. const onFocusAfterTrapped = () => {
  19192. emit2("focus");
  19193. };
  19194. const onFocusAfterReleased = (event) => {
  19195. var _a2;
  19196. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) !== "pointer") {
  19197. focusStartRef.value = "first";
  19198. emit2("blur");
  19199. }
  19200. };
  19201. const onFocusInTrap = (event) => {
  19202. if (props.visible && !trapped.value) {
  19203. if (event.target) {
  19204. focusStartRef.value = event.target;
  19205. }
  19206. trapped.value = true;
  19207. }
  19208. };
  19209. const onFocusoutPrevented = (event) => {
  19210. if (!props.trapping) {
  19211. if (event.detail.focusReason === "pointer") {
  19212. event.preventDefault();
  19213. }
  19214. trapped.value = false;
  19215. }
  19216. };
  19217. const onReleaseRequested = () => {
  19218. trapped.value = false;
  19219. emit2("close");
  19220. };
  19221. return {
  19222. focusStartRef,
  19223. trapped,
  19224. onFocusAfterReleased,
  19225. onFocusAfterTrapped,
  19226. onFocusInTrap,
  19227. onFocusoutPrevented,
  19228. onReleaseRequested
  19229. };
  19230. };
  19231. const __default__$1t = /* @__PURE__ */ defineComponent({
  19232. name: "ElPopperContent"
  19233. });
  19234. const _sfc_main$2a = /* @__PURE__ */ defineComponent({
  19235. ...__default__$1t,
  19236. props: popperContentProps,
  19237. emits: popperContentEmits,
  19238. setup(__props, { expose, emit: emit2 }) {
  19239. const props = __props;
  19240. const {
  19241. focusStartRef,
  19242. trapped,
  19243. onFocusAfterReleased,
  19244. onFocusAfterTrapped,
  19245. onFocusInTrap,
  19246. onFocusoutPrevented,
  19247. onReleaseRequested
  19248. } = usePopperContentFocusTrap(props, emit2);
  19249. const { attributes: attributes2, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  19250. const {
  19251. ariaModal,
  19252. arrowStyle,
  19253. contentAttrs,
  19254. contentClass,
  19255. contentStyle,
  19256. updateZIndex
  19257. } = usePopperContentDOM(props, {
  19258. styles,
  19259. attributes: attributes2,
  19260. role
  19261. });
  19262. const formItemContext = inject(formItemContextKey, void 0);
  19263. const arrowOffset = ref();
  19264. provide(POPPER_CONTENT_INJECTION_KEY, {
  19265. arrowStyle,
  19266. arrowRef,
  19267. arrowOffset
  19268. });
  19269. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  19270. provide(formItemContextKey, {
  19271. ...formItemContext,
  19272. addInputId: NOOP,
  19273. removeInputId: NOOP
  19274. });
  19275. }
  19276. let triggerTargetAriaStopWatch = void 0;
  19277. const updatePopper = (shouldUpdateZIndex = true) => {
  19278. update();
  19279. shouldUpdateZIndex && updateZIndex();
  19280. };
  19281. const togglePopperAlive = () => {
  19282. updatePopper(false);
  19283. if (props.visible && props.focusOnShow) {
  19284. trapped.value = true;
  19285. } else if (props.visible === false) {
  19286. trapped.value = false;
  19287. }
  19288. };
  19289. onMounted(() => {
  19290. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  19291. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  19292. triggerTargetAriaStopWatch = void 0;
  19293. const el = unref(triggerTargetEl || contentRef.value);
  19294. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  19295. if (isElement$1(el)) {
  19296. triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  19297. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  19298. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  19299. });
  19300. }, { immediate: true });
  19301. }
  19302. if (prevEl !== el && isElement$1(prevEl)) {
  19303. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  19304. prevEl.removeAttribute(key);
  19305. });
  19306. }
  19307. }, { immediate: true });
  19308. watch(() => props.visible, togglePopperAlive, { immediate: true });
  19309. });
  19310. onBeforeUnmount(() => {
  19311. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  19312. triggerTargetAriaStopWatch = void 0;
  19313. });
  19314. expose({
  19315. popperContentRef: contentRef,
  19316. popperInstanceRef: instanceRef,
  19317. updatePopper,
  19318. contentStyle
  19319. });
  19320. return (_ctx, _cache) => {
  19321. return openBlock(), createElementBlock("div", mergeProps({
  19322. ref_key: "contentRef",
  19323. ref: contentRef
  19324. }, unref(contentAttrs), {
  19325. style: unref(contentStyle),
  19326. class: unref(contentClass),
  19327. tabindex: "-1",
  19328. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  19329. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  19330. }), [
  19331. createVNode(unref(ElFocusTrap), {
  19332. trapped: unref(trapped),
  19333. "trap-on-focus-in": true,
  19334. "focus-trap-el": unref(contentRef),
  19335. "focus-start-el": unref(focusStartRef),
  19336. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  19337. onFocusAfterReleased: unref(onFocusAfterReleased),
  19338. onFocusin: unref(onFocusInTrap),
  19339. onFocusoutPrevented: unref(onFocusoutPrevented),
  19340. onReleaseRequested: unref(onReleaseRequested)
  19341. }, {
  19342. default: withCtx(() => [
  19343. renderSlot(_ctx.$slots, "default")
  19344. ]),
  19345. _: 3
  19346. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  19347. ], 16);
  19348. };
  19349. }
  19350. });
  19351. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$2a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  19352. const ElPopper = withInstall(Popper);
  19353. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  19354. const useTooltipContentProps = buildProps({
  19355. ...useDelayedToggleProps,
  19356. ...popperContentProps,
  19357. appendTo: {
  19358. type: definePropType([String, Object])
  19359. },
  19360. content: {
  19361. type: String,
  19362. default: ""
  19363. },
  19364. rawContent: {
  19365. type: Boolean,
  19366. default: false
  19367. },
  19368. persistent: Boolean,
  19369. ariaLabel: String,
  19370. visible: {
  19371. type: definePropType(Boolean),
  19372. default: null
  19373. },
  19374. transition: String,
  19375. teleported: {
  19376. type: Boolean,
  19377. default: true
  19378. },
  19379. disabled: Boolean
  19380. });
  19381. const useTooltipTriggerProps = buildProps({
  19382. ...popperTriggerProps,
  19383. disabled: Boolean,
  19384. trigger: {
  19385. type: definePropType([String, Array]),
  19386. default: "hover"
  19387. },
  19388. triggerKeys: {
  19389. type: definePropType(Array),
  19390. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  19391. }
  19392. });
  19393. const {
  19394. useModelToggleProps: useTooltipModelToggleProps,
  19395. useModelToggleEmits: useTooltipModelToggleEmits,
  19396. useModelToggle: useTooltipModelToggle
  19397. } = createModelToggleComposable("visible");
  19398. const useTooltipProps = buildProps({
  19399. ...popperProps,
  19400. ...useTooltipModelToggleProps,
  19401. ...useTooltipContentProps,
  19402. ...useTooltipTriggerProps,
  19403. ...popperArrowProps,
  19404. showArrow: {
  19405. type: Boolean,
  19406. default: true
  19407. }
  19408. });
  19409. const tooltipEmits = [
  19410. ...useTooltipModelToggleEmits,
  19411. "before-show",
  19412. "before-hide",
  19413. "show",
  19414. "hide",
  19415. "open",
  19416. "close"
  19417. ];
  19418. const isTriggerType = (trigger2, type2) => {
  19419. if (isArray$3(trigger2)) {
  19420. return trigger2.includes(type2);
  19421. }
  19422. return trigger2 === type2;
  19423. };
  19424. const whenTrigger = (trigger2, type2, handler) => {
  19425. return (e) => {
  19426. isTriggerType(unref(trigger2), type2) && handler(e);
  19427. };
  19428. };
  19429. const __default__$1s = /* @__PURE__ */ defineComponent({
  19430. name: "ElTooltipTrigger"
  19431. });
  19432. const _sfc_main$29 = /* @__PURE__ */ defineComponent({
  19433. ...__default__$1s,
  19434. props: useTooltipTriggerProps,
  19435. setup(__props, { expose }) {
  19436. const props = __props;
  19437. const ns = useNamespace("tooltip");
  19438. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  19439. const triggerRef2 = ref(null);
  19440. const stopWhenControlledOrDisabled = () => {
  19441. if (unref(controlled) || props.disabled) {
  19442. return true;
  19443. }
  19444. };
  19445. const trigger2 = toRef(props, "trigger");
  19446. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onOpen));
  19447. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onClose));
  19448. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "click", (e) => {
  19449. if (e.button === 0) {
  19450. onToggle(e);
  19451. }
  19452. }));
  19453. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onOpen));
  19454. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onClose));
  19455. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "contextmenu", (e) => {
  19456. e.preventDefault();
  19457. onToggle(e);
  19458. }));
  19459. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  19460. const { code } = e;
  19461. if (props.triggerKeys.includes(code)) {
  19462. e.preventDefault();
  19463. onToggle(e);
  19464. }
  19465. });
  19466. expose({
  19467. triggerRef: triggerRef2
  19468. });
  19469. return (_ctx, _cache) => {
  19470. return openBlock(), createBlock(unref(ElPopperTrigger), {
  19471. id: unref(id),
  19472. "virtual-ref": _ctx.virtualRef,
  19473. open: unref(open),
  19474. "virtual-triggering": _ctx.virtualTriggering,
  19475. class: normalizeClass(unref(ns).e("trigger")),
  19476. onBlur: unref(onBlur),
  19477. onClick: unref(onClick),
  19478. onContextmenu: unref(onContextMenu),
  19479. onFocus: unref(onFocus),
  19480. onMouseenter: unref(onMouseenter),
  19481. onMouseleave: unref(onMouseleave),
  19482. onKeydown: unref(onKeydown)
  19483. }, {
  19484. default: withCtx(() => [
  19485. renderSlot(_ctx.$slots, "default")
  19486. ]),
  19487. _: 3
  19488. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  19489. };
  19490. }
  19491. });
  19492. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$29, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  19493. const __default__$1r = /* @__PURE__ */ defineComponent({
  19494. name: "ElTooltipContent",
  19495. inheritAttrs: false
  19496. });
  19497. const _sfc_main$28 = /* @__PURE__ */ defineComponent({
  19498. ...__default__$1r,
  19499. props: useTooltipContentProps,
  19500. setup(__props, { expose }) {
  19501. const props = __props;
  19502. const { selector } = usePopperContainerId();
  19503. const ns = useNamespace("tooltip");
  19504. const contentRef = ref(null);
  19505. const destroyed = ref(false);
  19506. const {
  19507. controlled,
  19508. id,
  19509. open,
  19510. trigger: trigger2,
  19511. onClose,
  19512. onOpen,
  19513. onShow,
  19514. onHide,
  19515. onBeforeShow,
  19516. onBeforeHide
  19517. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  19518. const transitionClass = computed(() => {
  19519. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  19520. });
  19521. const persistentRef = computed(() => {
  19522. return props.persistent;
  19523. });
  19524. onBeforeUnmount(() => {
  19525. destroyed.value = true;
  19526. });
  19527. const shouldRender = computed(() => {
  19528. return unref(persistentRef) ? true : unref(open);
  19529. });
  19530. const shouldShow = computed(() => {
  19531. return props.disabled ? false : unref(open);
  19532. });
  19533. const appendTo = computed(() => {
  19534. return props.appendTo || selector.value;
  19535. });
  19536. const contentStyle = computed(() => {
  19537. var _a2;
  19538. return (_a2 = props.style) != null ? _a2 : {};
  19539. });
  19540. const ariaHidden = computed(() => !unref(open));
  19541. const onTransitionLeave = () => {
  19542. onHide();
  19543. };
  19544. const stopWhenControlled = () => {
  19545. if (unref(controlled))
  19546. return true;
  19547. };
  19548. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  19549. if (props.enterable && unref(trigger2) === "hover") {
  19550. onOpen();
  19551. }
  19552. });
  19553. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  19554. if (unref(trigger2) === "hover") {
  19555. onClose();
  19556. }
  19557. });
  19558. const onBeforeEnter = () => {
  19559. var _a2, _b;
  19560. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  19561. onBeforeShow == null ? void 0 : onBeforeShow();
  19562. };
  19563. const onBeforeLeave = () => {
  19564. onBeforeHide == null ? void 0 : onBeforeHide();
  19565. };
  19566. const onAfterShow = () => {
  19567. onShow();
  19568. stopHandle = onClickOutside(computed(() => {
  19569. var _a2;
  19570. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  19571. }), () => {
  19572. if (unref(controlled))
  19573. return;
  19574. const $trigger = unref(trigger2);
  19575. if ($trigger !== "hover") {
  19576. onClose();
  19577. }
  19578. });
  19579. };
  19580. const onBlur = () => {
  19581. if (!props.virtualTriggering) {
  19582. onClose();
  19583. }
  19584. };
  19585. let stopHandle;
  19586. watch(() => unref(open), (val) => {
  19587. if (!val) {
  19588. stopHandle == null ? void 0 : stopHandle();
  19589. }
  19590. }, {
  19591. flush: "post"
  19592. });
  19593. watch(() => props.content, () => {
  19594. var _a2, _b;
  19595. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  19596. });
  19597. expose({
  19598. contentRef
  19599. });
  19600. return (_ctx, _cache) => {
  19601. return openBlock(), createBlock(Teleport, {
  19602. disabled: !_ctx.teleported,
  19603. to: unref(appendTo)
  19604. }, [
  19605. createVNode(Transition, {
  19606. name: unref(transitionClass),
  19607. onAfterLeave: onTransitionLeave,
  19608. onBeforeEnter,
  19609. onAfterEnter: onAfterShow,
  19610. onBeforeLeave
  19611. }, {
  19612. default: withCtx(() => [
  19613. unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
  19614. key: 0,
  19615. id: unref(id),
  19616. ref_key: "contentRef",
  19617. ref: contentRef
  19618. }, _ctx.$attrs, {
  19619. "aria-label": _ctx.ariaLabel,
  19620. "aria-hidden": unref(ariaHidden),
  19621. "boundaries-padding": _ctx.boundariesPadding,
  19622. "fallback-placements": _ctx.fallbackPlacements,
  19623. "gpu-acceleration": _ctx.gpuAcceleration,
  19624. offset: _ctx.offset,
  19625. placement: _ctx.placement,
  19626. "popper-options": _ctx.popperOptions,
  19627. strategy: _ctx.strategy,
  19628. effect: _ctx.effect,
  19629. enterable: _ctx.enterable,
  19630. pure: _ctx.pure,
  19631. "popper-class": _ctx.popperClass,
  19632. "popper-style": [_ctx.popperStyle, unref(contentStyle)],
  19633. "reference-el": _ctx.referenceEl,
  19634. "trigger-target-el": _ctx.triggerTargetEl,
  19635. visible: unref(shouldShow),
  19636. "z-index": _ctx.zIndex,
  19637. onMouseenter: unref(onContentEnter),
  19638. onMouseleave: unref(onContentLeave),
  19639. onBlur,
  19640. onClose: unref(onClose)
  19641. }), {
  19642. default: withCtx(() => [
  19643. !destroyed.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  19644. ]),
  19645. _: 3
  19646. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
  19647. [vShow, unref(shouldShow)]
  19648. ]) : createCommentVNode("v-if", true)
  19649. ]),
  19650. _: 3
  19651. }, 8, ["name"])
  19652. ], 8, ["disabled", "to"]);
  19653. };
  19654. }
  19655. });
  19656. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$28, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  19657. const _hoisted_1$13 = ["innerHTML"];
  19658. const _hoisted_2$H = { key: 1 };
  19659. const __default__$1q = /* @__PURE__ */ defineComponent({
  19660. name: "ElTooltip"
  19661. });
  19662. const _sfc_main$27 = /* @__PURE__ */ defineComponent({
  19663. ...__default__$1q,
  19664. props: useTooltipProps,
  19665. emits: tooltipEmits,
  19666. setup(__props, { expose, emit: emit2 }) {
  19667. const props = __props;
  19668. usePopperContainer();
  19669. const id = useId();
  19670. const popperRef = ref();
  19671. const contentRef = ref();
  19672. const updatePopper = () => {
  19673. var _a2;
  19674. const popperComponent = unref(popperRef);
  19675. if (popperComponent) {
  19676. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  19677. }
  19678. };
  19679. const open = ref(false);
  19680. const toggleReason = ref();
  19681. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  19682. indicator: open,
  19683. toggleReason
  19684. });
  19685. const { onOpen, onClose } = useDelayedToggle({
  19686. showAfter: toRef(props, "showAfter"),
  19687. hideAfter: toRef(props, "hideAfter"),
  19688. autoClose: toRef(props, "autoClose"),
  19689. open: show,
  19690. close: hide
  19691. });
  19692. const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  19693. provide(TOOLTIP_INJECTION_KEY, {
  19694. controlled,
  19695. id,
  19696. open: readonly(open),
  19697. trigger: toRef(props, "trigger"),
  19698. onOpen: (event) => {
  19699. onOpen(event);
  19700. },
  19701. onClose: (event) => {
  19702. onClose(event);
  19703. },
  19704. onToggle: (event) => {
  19705. if (unref(open)) {
  19706. onClose(event);
  19707. } else {
  19708. onOpen(event);
  19709. }
  19710. },
  19711. onShow: () => {
  19712. emit2("show", toggleReason.value);
  19713. },
  19714. onHide: () => {
  19715. emit2("hide", toggleReason.value);
  19716. },
  19717. onBeforeShow: () => {
  19718. emit2("before-show", toggleReason.value);
  19719. },
  19720. onBeforeHide: () => {
  19721. emit2("before-hide", toggleReason.value);
  19722. },
  19723. updatePopper
  19724. });
  19725. watch(() => props.disabled, (disabled) => {
  19726. if (disabled && open.value) {
  19727. open.value = false;
  19728. }
  19729. });
  19730. const isFocusInsideContent = (event) => {
  19731. var _a2, _b;
  19732. const popperContent = (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.contentRef) == null ? void 0 : _b.popperContentRef;
  19733. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  19734. return popperContent && popperContent.contains(activeElement);
  19735. };
  19736. onDeactivated(() => open.value && hide());
  19737. expose({
  19738. popperRef,
  19739. contentRef,
  19740. isFocusInsideContent,
  19741. updatePopper,
  19742. onOpen,
  19743. onClose,
  19744. hide
  19745. });
  19746. return (_ctx, _cache) => {
  19747. return openBlock(), createBlock(unref(ElPopper), {
  19748. ref_key: "popperRef",
  19749. ref: popperRef,
  19750. role: _ctx.role
  19751. }, {
  19752. default: withCtx(() => [
  19753. createVNode(ElTooltipTrigger, {
  19754. disabled: _ctx.disabled,
  19755. trigger: _ctx.trigger,
  19756. "trigger-keys": _ctx.triggerKeys,
  19757. "virtual-ref": _ctx.virtualRef,
  19758. "virtual-triggering": _ctx.virtualTriggering
  19759. }, {
  19760. default: withCtx(() => [
  19761. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  19762. ]),
  19763. _: 3
  19764. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  19765. createVNode(ElTooltipContent, {
  19766. ref_key: "contentRef",
  19767. ref: contentRef,
  19768. "aria-label": _ctx.ariaLabel,
  19769. "boundaries-padding": _ctx.boundariesPadding,
  19770. content: _ctx.content,
  19771. disabled: _ctx.disabled,
  19772. effect: _ctx.effect,
  19773. enterable: _ctx.enterable,
  19774. "fallback-placements": _ctx.fallbackPlacements,
  19775. "hide-after": _ctx.hideAfter,
  19776. "gpu-acceleration": _ctx.gpuAcceleration,
  19777. offset: _ctx.offset,
  19778. persistent: _ctx.persistent,
  19779. "popper-class": _ctx.popperClass,
  19780. "popper-style": _ctx.popperStyle,
  19781. placement: _ctx.placement,
  19782. "popper-options": _ctx.popperOptions,
  19783. pure: _ctx.pure,
  19784. "raw-content": _ctx.rawContent,
  19785. "reference-el": _ctx.referenceEl,
  19786. "trigger-target-el": _ctx.triggerTargetEl,
  19787. "show-after": _ctx.showAfter,
  19788. strategy: _ctx.strategy,
  19789. teleported: _ctx.teleported,
  19790. transition: _ctx.transition,
  19791. "virtual-triggering": _ctx.virtualTriggering,
  19792. "z-index": _ctx.zIndex,
  19793. "append-to": _ctx.appendTo
  19794. }, {
  19795. default: withCtx(() => [
  19796. renderSlot(_ctx.$slots, "content", {}, () => [
  19797. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  19798. key: 0,
  19799. innerHTML: _ctx.content
  19800. }, null, 8, _hoisted_1$13)) : (openBlock(), createElementBlock("span", _hoisted_2$H, toDisplayString(_ctx.content), 1))
  19801. ]),
  19802. _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
  19803. key: 0,
  19804. "arrow-offset": _ctx.arrowOffset
  19805. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  19806. ]),
  19807. _: 3
  19808. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
  19809. ]),
  19810. _: 3
  19811. }, 8, ["role"]);
  19812. };
  19813. }
  19814. });
  19815. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$27, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  19816. const ElTooltip = withInstall(Tooltip);
  19817. const autocompleteProps = buildProps({
  19818. valueKey: {
  19819. type: String,
  19820. default: "value"
  19821. },
  19822. modelValue: {
  19823. type: [String, Number],
  19824. default: ""
  19825. },
  19826. debounce: {
  19827. type: Number,
  19828. default: 300
  19829. },
  19830. placement: {
  19831. type: definePropType(String),
  19832. values: [
  19833. "top",
  19834. "top-start",
  19835. "top-end",
  19836. "bottom",
  19837. "bottom-start",
  19838. "bottom-end"
  19839. ],
  19840. default: "bottom-start"
  19841. },
  19842. fetchSuggestions: {
  19843. type: definePropType([Function, Array]),
  19844. default: NOOP
  19845. },
  19846. popperClass: {
  19847. type: String,
  19848. default: ""
  19849. },
  19850. triggerOnFocus: {
  19851. type: Boolean,
  19852. default: true
  19853. },
  19854. selectWhenUnmatched: {
  19855. type: Boolean,
  19856. default: false
  19857. },
  19858. hideLoading: {
  19859. type: Boolean,
  19860. default: false
  19861. },
  19862. label: {
  19863. type: String
  19864. },
  19865. teleported: useTooltipContentProps.teleported,
  19866. highlightFirstItem: {
  19867. type: Boolean,
  19868. default: false
  19869. },
  19870. fitInputWidth: {
  19871. type: Boolean,
  19872. default: false
  19873. },
  19874. clearable: {
  19875. type: Boolean,
  19876. default: false
  19877. },
  19878. disabled: {
  19879. type: Boolean,
  19880. default: false
  19881. },
  19882. name: String
  19883. });
  19884. const autocompleteEmits = {
  19885. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  19886. [INPUT_EVENT]: (value) => isString$1(value),
  19887. [CHANGE_EVENT]: (value) => isString$1(value),
  19888. focus: (evt) => evt instanceof FocusEvent,
  19889. blur: (evt) => evt instanceof FocusEvent,
  19890. clear: () => true,
  19891. select: (item) => isObject$1(item)
  19892. };
  19893. const _hoisted_1$12 = ["aria-expanded", "aria-owns"];
  19894. const _hoisted_2$G = { key: 0 };
  19895. const _hoisted_3$j = ["id", "aria-selected", "onClick"];
  19896. const COMPONENT_NAME$i = "ElAutocomplete";
  19897. const __default__$1p = /* @__PURE__ */ defineComponent({
  19898. name: COMPONENT_NAME$i,
  19899. inheritAttrs: false
  19900. });
  19901. const _sfc_main$26 = /* @__PURE__ */ defineComponent({
  19902. ...__default__$1p,
  19903. props: autocompleteProps,
  19904. emits: autocompleteEmits,
  19905. setup(__props, { expose, emit: emit2 }) {
  19906. const props = __props;
  19907. const attrs = useAttrs();
  19908. const rawAttrs = useAttrs$1();
  19909. const disabled = useFormDisabled();
  19910. const ns = useNamespace("autocomplete");
  19911. const inputRef = ref();
  19912. const regionRef = ref();
  19913. const popperRef = ref();
  19914. const listboxRef = ref();
  19915. let readonly2 = false;
  19916. let ignoreFocusEvent = false;
  19917. const suggestions = ref([]);
  19918. const highlightedIndex = ref(-1);
  19919. const dropdownWidth = ref("");
  19920. const activated = ref(false);
  19921. const suggestionDisabled = ref(false);
  19922. const loading = ref(false);
  19923. const listboxId = computed(() => ns.b(String(generateId())));
  19924. const styles = computed(() => rawAttrs.style);
  19925. const suggestionVisible = computed(() => {
  19926. const isValidData = suggestions.value.length > 0;
  19927. return (isValidData || loading.value) && activated.value;
  19928. });
  19929. const suggestionLoading = computed(() => !props.hideLoading && loading.value);
  19930. const refInput = computed(() => {
  19931. if (inputRef.value) {
  19932. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  19933. }
  19934. return [];
  19935. });
  19936. const onSuggestionShow = () => {
  19937. if (suggestionVisible.value) {
  19938. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  19939. }
  19940. };
  19941. const onHide = () => {
  19942. highlightedIndex.value = -1;
  19943. };
  19944. const getData = async (queryString) => {
  19945. if (suggestionDisabled.value)
  19946. return;
  19947. const cb = (suggestionList) => {
  19948. loading.value = false;
  19949. if (suggestionDisabled.value)
  19950. return;
  19951. if (isArray$3(suggestionList)) {
  19952. suggestions.value = suggestionList;
  19953. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  19954. } else {
  19955. throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array");
  19956. }
  19957. };
  19958. loading.value = true;
  19959. if (isArray$3(props.fetchSuggestions)) {
  19960. cb(props.fetchSuggestions);
  19961. } else {
  19962. const result = await props.fetchSuggestions(queryString, cb);
  19963. if (isArray$3(result))
  19964. cb(result);
  19965. }
  19966. };
  19967. const debouncedGetData = debounce(getData, props.debounce);
  19968. const handleInput = (value) => {
  19969. const valuePresented = !!value;
  19970. emit2(INPUT_EVENT, value);
  19971. emit2(UPDATE_MODEL_EVENT, value);
  19972. suggestionDisabled.value = false;
  19973. activated.value || (activated.value = valuePresented);
  19974. if (!props.triggerOnFocus && !value) {
  19975. suggestionDisabled.value = true;
  19976. suggestions.value = [];
  19977. return;
  19978. }
  19979. debouncedGetData(value);
  19980. };
  19981. const handleMouseDown = (event) => {
  19982. var _a2;
  19983. if (disabled.value)
  19984. return;
  19985. if (((_a2 = event.target) == null ? void 0 : _a2.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  19986. activated.value = true;
  19987. }
  19988. };
  19989. const handleChange = (value) => {
  19990. emit2(CHANGE_EVENT, value);
  19991. };
  19992. const handleFocus = (evt) => {
  19993. if (!ignoreFocusEvent) {
  19994. activated.value = true;
  19995. emit2("focus", evt);
  19996. if (props.triggerOnFocus && !readonly2) {
  19997. debouncedGetData(String(props.modelValue));
  19998. }
  19999. } else {
  20000. ignoreFocusEvent = false;
  20001. }
  20002. };
  20003. const handleBlur = (evt) => {
  20004. setTimeout(() => {
  20005. var _a2;
  20006. if ((_a2 = popperRef.value) == null ? void 0 : _a2.isFocusInsideContent()) {
  20007. ignoreFocusEvent = true;
  20008. return;
  20009. }
  20010. activated.value && close2();
  20011. emit2("blur", evt);
  20012. });
  20013. };
  20014. const handleClear = () => {
  20015. activated.value = false;
  20016. emit2(UPDATE_MODEL_EVENT, "");
  20017. emit2("clear");
  20018. };
  20019. const handleKeyEnter = async () => {
  20020. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  20021. handleSelect(suggestions.value[highlightedIndex.value]);
  20022. } else if (props.selectWhenUnmatched) {
  20023. emit2("select", { value: props.modelValue });
  20024. suggestions.value = [];
  20025. highlightedIndex.value = -1;
  20026. }
  20027. };
  20028. const handleKeyEscape = (evt) => {
  20029. if (suggestionVisible.value) {
  20030. evt.preventDefault();
  20031. evt.stopPropagation();
  20032. close2();
  20033. }
  20034. };
  20035. const close2 = () => {
  20036. activated.value = false;
  20037. };
  20038. const focus = () => {
  20039. var _a2;
  20040. (_a2 = inputRef.value) == null ? void 0 : _a2.focus();
  20041. };
  20042. const blur = () => {
  20043. var _a2;
  20044. (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  20045. };
  20046. const handleSelect = async (item) => {
  20047. emit2(INPUT_EVENT, item[props.valueKey]);
  20048. emit2(UPDATE_MODEL_EVENT, item[props.valueKey]);
  20049. emit2("select", item);
  20050. suggestions.value = [];
  20051. highlightedIndex.value = -1;
  20052. };
  20053. const highlight = (index2) => {
  20054. if (!suggestionVisible.value || loading.value)
  20055. return;
  20056. if (index2 < 0) {
  20057. highlightedIndex.value = -1;
  20058. return;
  20059. }
  20060. if (index2 >= suggestions.value.length) {
  20061. index2 = suggestions.value.length - 1;
  20062. }
  20063. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  20064. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  20065. const highlightItem = suggestionList[index2];
  20066. const scrollTop = suggestion.scrollTop;
  20067. const { offsetTop, scrollHeight } = highlightItem;
  20068. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  20069. suggestion.scrollTop += scrollHeight;
  20070. }
  20071. if (offsetTop < scrollTop) {
  20072. suggestion.scrollTop -= scrollHeight;
  20073. }
  20074. highlightedIndex.value = index2;
  20075. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  20076. };
  20077. onClickOutside(listboxRef, () => {
  20078. suggestionVisible.value && close2();
  20079. });
  20080. onMounted(() => {
  20081. inputRef.value.ref.setAttribute("role", "textbox");
  20082. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  20083. inputRef.value.ref.setAttribute("aria-controls", "id");
  20084. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  20085. readonly2 = inputRef.value.ref.hasAttribute("readonly");
  20086. });
  20087. expose({
  20088. highlightedIndex,
  20089. activated,
  20090. loading,
  20091. inputRef,
  20092. popperRef,
  20093. suggestions,
  20094. handleSelect,
  20095. handleKeyEnter,
  20096. focus,
  20097. blur,
  20098. close: close2,
  20099. highlight
  20100. });
  20101. return (_ctx, _cache) => {
  20102. return openBlock(), createBlock(unref(ElTooltip), {
  20103. ref_key: "popperRef",
  20104. ref: popperRef,
  20105. visible: unref(suggestionVisible),
  20106. placement: _ctx.placement,
  20107. "fallback-placements": ["bottom-start", "top-start"],
  20108. "popper-class": [unref(ns).e("popper"), _ctx.popperClass],
  20109. teleported: _ctx.teleported,
  20110. "gpu-acceleration": false,
  20111. pure: "",
  20112. "manual-mode": "",
  20113. effect: "light",
  20114. trigger: "click",
  20115. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  20116. persistent: "",
  20117. role: "listbox",
  20118. onBeforeShow: onSuggestionShow,
  20119. onHide
  20120. }, {
  20121. content: withCtx(() => [
  20122. createBaseVNode("div", {
  20123. ref_key: "regionRef",
  20124. ref: regionRef,
  20125. class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", unref(suggestionLoading))]),
  20126. style: normalizeStyle({
  20127. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  20128. outline: "none"
  20129. }),
  20130. role: "region"
  20131. }, [
  20132. createVNode(unref(ElScrollbar), {
  20133. id: unref(listboxId),
  20134. tag: "ul",
  20135. "wrap-class": unref(ns).be("suggestion", "wrap"),
  20136. "view-class": unref(ns).be("suggestion", "list"),
  20137. role: "listbox"
  20138. }, {
  20139. default: withCtx(() => [
  20140. unref(suggestionLoading) ? (openBlock(), createElementBlock("li", _hoisted_2$G, [
  20141. createVNode(unref(ElIcon), {
  20142. class: normalizeClass(unref(ns).is("loading"))
  20143. }, {
  20144. default: withCtx(() => [
  20145. createVNode(unref(loading_default))
  20146. ]),
  20147. _: 1
  20148. }, 8, ["class"])
  20149. ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index2) => {
  20150. return openBlock(), createElementBlock("li", {
  20151. id: `${unref(listboxId)}-item-${index2}`,
  20152. key: index2,
  20153. class: normalizeClass({ highlighted: highlightedIndex.value === index2 }),
  20154. role: "option",
  20155. "aria-selected": highlightedIndex.value === index2,
  20156. onClick: ($event) => handleSelect(item)
  20157. }, [
  20158. renderSlot(_ctx.$slots, "default", { item }, () => [
  20159. createTextVNode(toDisplayString(item[_ctx.valueKey]), 1)
  20160. ])
  20161. ], 10, _hoisted_3$j);
  20162. }), 128))
  20163. ]),
  20164. _: 3
  20165. }, 8, ["id", "wrap-class", "view-class"])
  20166. ], 6)
  20167. ]),
  20168. default: withCtx(() => [
  20169. createBaseVNode("div", {
  20170. ref_key: "listboxRef",
  20171. ref: listboxRef,
  20172. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  20173. style: normalizeStyle(unref(styles)),
  20174. role: "combobox",
  20175. "aria-haspopup": "listbox",
  20176. "aria-expanded": unref(suggestionVisible),
  20177. "aria-owns": unref(listboxId)
  20178. }, [
  20179. createVNode(unref(ElInput), mergeProps({
  20180. ref_key: "inputRef",
  20181. ref: inputRef
  20182. }, unref(attrs), {
  20183. clearable: _ctx.clearable,
  20184. disabled: unref(disabled),
  20185. name: _ctx.name,
  20186. "model-value": _ctx.modelValue,
  20187. onInput: handleInput,
  20188. onChange: handleChange,
  20189. onFocus: handleFocus,
  20190. onBlur: handleBlur,
  20191. onClear: handleClear,
  20192. onKeydown: [
  20193. _cache[0] || (_cache[0] = withKeys(withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"])),
  20194. _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"])),
  20195. withKeys(handleKeyEnter, ["enter"]),
  20196. withKeys(close2, ["tab"]),
  20197. withKeys(handleKeyEscape, ["esc"])
  20198. ],
  20199. onMousedown: handleMouseDown
  20200. }), createSlots({ _: 2 }, [
  20201. _ctx.$slots.prepend ? {
  20202. name: "prepend",
  20203. fn: withCtx(() => [
  20204. renderSlot(_ctx.$slots, "prepend")
  20205. ])
  20206. } : void 0,
  20207. _ctx.$slots.append ? {
  20208. name: "append",
  20209. fn: withCtx(() => [
  20210. renderSlot(_ctx.$slots, "append")
  20211. ])
  20212. } : void 0,
  20213. _ctx.$slots.prefix ? {
  20214. name: "prefix",
  20215. fn: withCtx(() => [
  20216. renderSlot(_ctx.$slots, "prefix")
  20217. ])
  20218. } : void 0,
  20219. _ctx.$slots.suffix ? {
  20220. name: "suffix",
  20221. fn: withCtx(() => [
  20222. renderSlot(_ctx.$slots, "suffix")
  20223. ])
  20224. } : void 0
  20225. ]), 1040, ["clearable", "disabled", "name", "model-value", "onKeydown"])
  20226. ], 14, _hoisted_1$12)
  20227. ]),
  20228. _: 3
  20229. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  20230. };
  20231. }
  20232. });
  20233. var Autocomplete = /* @__PURE__ */ _export_sfc$1(_sfc_main$26, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/autocomplete/src/autocomplete.vue"]]);
  20234. const ElAutocomplete = withInstall(Autocomplete);
  20235. const avatarProps = buildProps({
  20236. size: {
  20237. type: [Number, String],
  20238. values: componentSizes,
  20239. default: "",
  20240. validator: (val) => isNumber(val)
  20241. },
  20242. shape: {
  20243. type: String,
  20244. values: ["circle", "square"],
  20245. default: "circle"
  20246. },
  20247. icon: {
  20248. type: iconPropType
  20249. },
  20250. src: {
  20251. type: String,
  20252. default: ""
  20253. },
  20254. alt: String,
  20255. srcSet: String,
  20256. fit: {
  20257. type: definePropType(String),
  20258. default: "cover"
  20259. }
  20260. });
  20261. const avatarEmits = {
  20262. error: (evt) => evt instanceof Event
  20263. };
  20264. const _hoisted_1$11 = ["src", "alt", "srcset"];
  20265. const __default__$1o = /* @__PURE__ */ defineComponent({
  20266. name: "ElAvatar"
  20267. });
  20268. const _sfc_main$25 = /* @__PURE__ */ defineComponent({
  20269. ...__default__$1o,
  20270. props: avatarProps,
  20271. emits: avatarEmits,
  20272. setup(__props, { emit: emit2 }) {
  20273. const props = __props;
  20274. const ns = useNamespace("avatar");
  20275. const hasLoadError = ref(false);
  20276. const avatarClass = computed(() => {
  20277. const { size: size2, icon, shape } = props;
  20278. const classList = [ns.b()];
  20279. if (isString$1(size2))
  20280. classList.push(ns.m(size2));
  20281. if (icon)
  20282. classList.push(ns.m("icon"));
  20283. if (shape)
  20284. classList.push(ns.m(shape));
  20285. return classList;
  20286. });
  20287. const sizeStyle = computed(() => {
  20288. const { size: size2 } = props;
  20289. return isNumber(size2) ? ns.cssVarBlock({
  20290. size: addUnit(size2) || ""
  20291. }) : void 0;
  20292. });
  20293. const fitStyle = computed(() => ({
  20294. objectFit: props.fit
  20295. }));
  20296. watch(() => props.src, () => hasLoadError.value = false);
  20297. function handleError2(e) {
  20298. hasLoadError.value = true;
  20299. emit2("error", e);
  20300. }
  20301. return (_ctx, _cache) => {
  20302. return openBlock(), createElementBlock("span", {
  20303. class: normalizeClass(unref(avatarClass)),
  20304. style: normalizeStyle(unref(sizeStyle))
  20305. }, [
  20306. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
  20307. key: 0,
  20308. src: _ctx.src,
  20309. alt: _ctx.alt,
  20310. srcset: _ctx.srcSet,
  20311. style: normalizeStyle(unref(fitStyle)),
  20312. onError: handleError2
  20313. }, null, 44, _hoisted_1$11)) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  20314. default: withCtx(() => [
  20315. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  20316. ]),
  20317. _: 1
  20318. })) : renderSlot(_ctx.$slots, "default", { key: 2 })
  20319. ], 6);
  20320. };
  20321. }
  20322. });
  20323. var Avatar = /* @__PURE__ */ _export_sfc$1(_sfc_main$25, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/avatar/src/avatar.vue"]]);
  20324. const ElAvatar = withInstall(Avatar);
  20325. const backtopProps = {
  20326. visibilityHeight: {
  20327. type: Number,
  20328. default: 200
  20329. },
  20330. target: {
  20331. type: String,
  20332. default: ""
  20333. },
  20334. right: {
  20335. type: Number,
  20336. default: 40
  20337. },
  20338. bottom: {
  20339. type: Number,
  20340. default: 40
  20341. }
  20342. };
  20343. const backtopEmits = {
  20344. click: (evt) => evt instanceof MouseEvent
  20345. };
  20346. const useBackTop = (props, emit2, componentName2) => {
  20347. const el = shallowRef();
  20348. const container = shallowRef();
  20349. const visible = ref(false);
  20350. const handleScroll2 = () => {
  20351. if (el.value)
  20352. visible.value = el.value.scrollTop >= props.visibilityHeight;
  20353. };
  20354. const handleClick = (event) => {
  20355. var _a2;
  20356. (_a2 = el.value) == null ? void 0 : _a2.scrollTo({ top: 0, behavior: "smooth" });
  20357. emit2("click", event);
  20358. };
  20359. const handleScrollThrottled = useThrottleFn(handleScroll2, 300, true);
  20360. useEventListener(container, "scroll", handleScrollThrottled);
  20361. onMounted(() => {
  20362. var _a2;
  20363. container.value = document;
  20364. el.value = document.documentElement;
  20365. if (props.target) {
  20366. el.value = (_a2 = document.querySelector(props.target)) != null ? _a2 : void 0;
  20367. if (!el.value) {
  20368. throwError(componentName2, `target does not exist: ${props.target}`);
  20369. }
  20370. container.value = el.value;
  20371. }
  20372. handleScroll2();
  20373. });
  20374. return {
  20375. visible,
  20376. handleClick
  20377. };
  20378. };
  20379. const COMPONENT_NAME$h = "ElBacktop";
  20380. const __default__$1n = /* @__PURE__ */ defineComponent({
  20381. name: COMPONENT_NAME$h
  20382. });
  20383. const _sfc_main$24 = /* @__PURE__ */ defineComponent({
  20384. ...__default__$1n,
  20385. props: backtopProps,
  20386. emits: backtopEmits,
  20387. setup(__props, { emit: emit2 }) {
  20388. const props = __props;
  20389. const ns = useNamespace("backtop");
  20390. const { handleClick, visible } = useBackTop(props, emit2, COMPONENT_NAME$h);
  20391. const backTopStyle = computed(() => ({
  20392. right: `${props.right}px`,
  20393. bottom: `${props.bottom}px`
  20394. }));
  20395. return (_ctx, _cache) => {
  20396. return openBlock(), createBlock(Transition, {
  20397. name: `${unref(ns).namespace.value}-fade-in`
  20398. }, {
  20399. default: withCtx(() => [
  20400. unref(visible) ? (openBlock(), createElementBlock("div", {
  20401. key: 0,
  20402. style: normalizeStyle(unref(backTopStyle)),
  20403. class: normalizeClass(unref(ns).b()),
  20404. onClick: _cache[0] || (_cache[0] = withModifiers((...args) => unref(handleClick) && unref(handleClick)(...args), ["stop"]))
  20405. }, [
  20406. renderSlot(_ctx.$slots, "default", {}, () => [
  20407. createVNode(unref(ElIcon), {
  20408. class: normalizeClass(unref(ns).e("icon"))
  20409. }, {
  20410. default: withCtx(() => [
  20411. createVNode(unref(caret_top_default))
  20412. ]),
  20413. _: 1
  20414. }, 8, ["class"])
  20415. ])
  20416. ], 6)) : createCommentVNode("v-if", true)
  20417. ]),
  20418. _: 3
  20419. }, 8, ["name"]);
  20420. };
  20421. }
  20422. });
  20423. var Backtop = /* @__PURE__ */ _export_sfc$1(_sfc_main$24, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/backtop/src/backtop.vue"]]);
  20424. const ElBacktop = withInstall(Backtop);
  20425. const badgeProps = buildProps({
  20426. value: {
  20427. type: [String, Number],
  20428. default: ""
  20429. },
  20430. max: {
  20431. type: Number,
  20432. default: 99
  20433. },
  20434. isDot: Boolean,
  20435. hidden: Boolean,
  20436. type: {
  20437. type: String,
  20438. values: ["primary", "success", "warning", "info", "danger"],
  20439. default: "danger"
  20440. }
  20441. });
  20442. const _hoisted_1$10 = ["textContent"];
  20443. const __default__$1m = /* @__PURE__ */ defineComponent({
  20444. name: "ElBadge"
  20445. });
  20446. const _sfc_main$23 = /* @__PURE__ */ defineComponent({
  20447. ...__default__$1m,
  20448. props: badgeProps,
  20449. setup(__props, { expose }) {
  20450. const props = __props;
  20451. const ns = useNamespace("badge");
  20452. const content = computed(() => {
  20453. if (props.isDot)
  20454. return "";
  20455. if (isNumber(props.value) && isNumber(props.max)) {
  20456. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  20457. }
  20458. return `${props.value}`;
  20459. });
  20460. expose({
  20461. content
  20462. });
  20463. return (_ctx, _cache) => {
  20464. return openBlock(), createElementBlock("div", {
  20465. class: normalizeClass(unref(ns).b())
  20466. }, [
  20467. renderSlot(_ctx.$slots, "default"),
  20468. createVNode(Transition, {
  20469. name: `${unref(ns).namespace.value}-zoom-in-center`,
  20470. persisted: ""
  20471. }, {
  20472. default: withCtx(() => [
  20473. withDirectives(createBaseVNode("sup", {
  20474. class: normalizeClass([
  20475. unref(ns).e("content"),
  20476. unref(ns).em("content", _ctx.type),
  20477. unref(ns).is("fixed", !!_ctx.$slots.default),
  20478. unref(ns).is("dot", _ctx.isDot)
  20479. ]),
  20480. textContent: toDisplayString(unref(content))
  20481. }, null, 10, _hoisted_1$10), [
  20482. [vShow, !_ctx.hidden && (unref(content) || _ctx.isDot)]
  20483. ])
  20484. ]),
  20485. _: 1
  20486. }, 8, ["name"])
  20487. ], 2);
  20488. };
  20489. }
  20490. });
  20491. var Badge = /* @__PURE__ */ _export_sfc$1(_sfc_main$23, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);
  20492. const ElBadge = withInstall(Badge);
  20493. const breadcrumbKey = Symbol("breadcrumbKey");
  20494. const breadcrumbProps = buildProps({
  20495. separator: {
  20496. type: String,
  20497. default: "/"
  20498. },
  20499. separatorIcon: {
  20500. type: iconPropType
  20501. }
  20502. });
  20503. const __default__$1l = /* @__PURE__ */ defineComponent({
  20504. name: "ElBreadcrumb"
  20505. });
  20506. const _sfc_main$22 = /* @__PURE__ */ defineComponent({
  20507. ...__default__$1l,
  20508. props: breadcrumbProps,
  20509. setup(__props) {
  20510. const props = __props;
  20511. const ns = useNamespace("breadcrumb");
  20512. const breadcrumb = ref();
  20513. provide(breadcrumbKey, props);
  20514. onMounted(() => {
  20515. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  20516. if (items.length) {
  20517. items[items.length - 1].setAttribute("aria-current", "page");
  20518. }
  20519. });
  20520. return (_ctx, _cache) => {
  20521. return openBlock(), createElementBlock("div", {
  20522. ref_key: "breadcrumb",
  20523. ref: breadcrumb,
  20524. class: normalizeClass(unref(ns).b()),
  20525. "aria-label": "Breadcrumb",
  20526. role: "navigation"
  20527. }, [
  20528. renderSlot(_ctx.$slots, "default")
  20529. ], 2);
  20530. };
  20531. }
  20532. });
  20533. var Breadcrumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$22, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/breadcrumb/src/breadcrumb.vue"]]);
  20534. const breadcrumbItemProps = buildProps({
  20535. to: {
  20536. type: definePropType([String, Object]),
  20537. default: ""
  20538. },
  20539. replace: {
  20540. type: Boolean,
  20541. default: false
  20542. }
  20543. });
  20544. const __default__$1k = /* @__PURE__ */ defineComponent({
  20545. name: "ElBreadcrumbItem"
  20546. });
  20547. const _sfc_main$21 = /* @__PURE__ */ defineComponent({
  20548. ...__default__$1k,
  20549. props: breadcrumbItemProps,
  20550. setup(__props) {
  20551. const props = __props;
  20552. const instance = getCurrentInstance();
  20553. const breadcrumbContext = inject(breadcrumbKey, void 0);
  20554. const ns = useNamespace("breadcrumb");
  20555. const router2 = instance.appContext.config.globalProperties.$router;
  20556. const link = ref();
  20557. const onClick = () => {
  20558. if (!props.to || !router2)
  20559. return;
  20560. props.replace ? router2.replace(props.to) : router2.push(props.to);
  20561. };
  20562. return (_ctx, _cache) => {
  20563. var _a2, _b;
  20564. return openBlock(), createElementBlock("span", {
  20565. class: normalizeClass(unref(ns).e("item"))
  20566. }, [
  20567. createBaseVNode("span", {
  20568. ref_key: "link",
  20569. ref: link,
  20570. class: normalizeClass([unref(ns).e("inner"), unref(ns).is("link", !!_ctx.to)]),
  20571. role: "link",
  20572. onClick
  20573. }, [
  20574. renderSlot(_ctx.$slots, "default")
  20575. ], 2),
  20576. ((_a2 = unref(breadcrumbContext)) == null ? void 0 : _a2.separatorIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  20577. key: 0,
  20578. class: normalizeClass(unref(ns).e("separator"))
  20579. }, {
  20580. default: withCtx(() => [
  20581. (openBlock(), createBlock(resolveDynamicComponent(unref(breadcrumbContext).separatorIcon)))
  20582. ]),
  20583. _: 1
  20584. }, 8, ["class"])) : (openBlock(), createElementBlock("span", {
  20585. key: 1,
  20586. class: normalizeClass(unref(ns).e("separator")),
  20587. role: "presentation"
  20588. }, toDisplayString((_b = unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  20589. ], 2);
  20590. };
  20591. }
  20592. });
  20593. var BreadcrumbItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$21, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/breadcrumb/src/breadcrumb-item.vue"]]);
  20594. const ElBreadcrumb = withInstall(Breadcrumb, {
  20595. BreadcrumbItem
  20596. });
  20597. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  20598. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  20599. const useButton = (props, emit2) => {
  20600. useDeprecated({
  20601. from: "type.text",
  20602. replacement: "link",
  20603. version: "3.0.0",
  20604. scope: "props",
  20605. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  20606. }, computed(() => props.type === "text"));
  20607. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  20608. const globalConfig2 = useGlobalConfig("button");
  20609. const { form } = useFormItem();
  20610. const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  20611. const _disabled = useFormDisabled();
  20612. const _ref = ref();
  20613. const slots = useSlots();
  20614. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  20615. const autoInsertSpace = computed(() => {
  20616. var _a2, _b, _c;
  20617. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  20618. });
  20619. const _props = computed(() => {
  20620. if (props.tag === "button") {
  20621. return {
  20622. ariaDisabled: _disabled.value || props.loading,
  20623. disabled: _disabled.value || props.loading,
  20624. autofocus: props.autofocus,
  20625. type: props.nativeType
  20626. };
  20627. }
  20628. return {};
  20629. });
  20630. const shouldAddSpace = computed(() => {
  20631. var _a2;
  20632. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  20633. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  20634. const slot = defaultSlot[0];
  20635. if ((slot == null ? void 0 : slot.type) === Text$1) {
  20636. const text = slot.children;
  20637. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  20638. }
  20639. }
  20640. return false;
  20641. });
  20642. const handleClick = (evt) => {
  20643. if (props.nativeType === "reset") {
  20644. form == null ? void 0 : form.resetFields();
  20645. }
  20646. emit2("click", evt);
  20647. };
  20648. return {
  20649. _disabled,
  20650. _size,
  20651. _type,
  20652. _ref,
  20653. _props,
  20654. shouldAddSpace,
  20655. handleClick
  20656. };
  20657. };
  20658. const buttonTypes = [
  20659. "default",
  20660. "primary",
  20661. "success",
  20662. "warning",
  20663. "info",
  20664. "danger",
  20665. "text",
  20666. ""
  20667. ];
  20668. const buttonNativeTypes = ["button", "submit", "reset"];
  20669. const buttonProps = buildProps({
  20670. size: useSizeProp,
  20671. disabled: Boolean,
  20672. type: {
  20673. type: String,
  20674. values: buttonTypes,
  20675. default: ""
  20676. },
  20677. icon: {
  20678. type: iconPropType
  20679. },
  20680. nativeType: {
  20681. type: String,
  20682. values: buttonNativeTypes,
  20683. default: "button"
  20684. },
  20685. loading: Boolean,
  20686. loadingIcon: {
  20687. type: iconPropType,
  20688. default: () => loading_default
  20689. },
  20690. plain: Boolean,
  20691. text: Boolean,
  20692. link: Boolean,
  20693. bg: Boolean,
  20694. autofocus: Boolean,
  20695. round: Boolean,
  20696. circle: Boolean,
  20697. color: String,
  20698. dark: Boolean,
  20699. autoInsertSpace: {
  20700. type: Boolean,
  20701. default: void 0
  20702. },
  20703. tag: {
  20704. type: definePropType([String, Object]),
  20705. default: "button"
  20706. }
  20707. });
  20708. const buttonEmits = {
  20709. click: (evt) => evt instanceof MouseEvent
  20710. };
  20711. function bound01$1(n, max2) {
  20712. if (isOnePointZero$1(n)) {
  20713. n = "100%";
  20714. }
  20715. var isPercent = isPercentage$1(n);
  20716. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  20717. if (isPercent) {
  20718. n = parseInt(String(n * max2), 10) / 100;
  20719. }
  20720. if (Math.abs(n - max2) < 1e-6) {
  20721. return 1;
  20722. }
  20723. if (max2 === 360) {
  20724. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  20725. } else {
  20726. n = n % max2 / parseFloat(String(max2));
  20727. }
  20728. return n;
  20729. }
  20730. function clamp01(val) {
  20731. return Math.min(1, Math.max(0, val));
  20732. }
  20733. function isOnePointZero$1(n) {
  20734. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  20735. }
  20736. function isPercentage$1(n) {
  20737. return typeof n === "string" && n.indexOf("%") !== -1;
  20738. }
  20739. function boundAlpha(a2) {
  20740. a2 = parseFloat(a2);
  20741. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  20742. a2 = 1;
  20743. }
  20744. return a2;
  20745. }
  20746. function convertToPercentage(n) {
  20747. if (n <= 1) {
  20748. return "".concat(Number(n) * 100, "%");
  20749. }
  20750. return n;
  20751. }
  20752. function pad2(c2) {
  20753. return c2.length === 1 ? "0" + c2 : String(c2);
  20754. }
  20755. function rgbToRgb(r, g, b2) {
  20756. return {
  20757. r: bound01$1(r, 255) * 255,
  20758. g: bound01$1(g, 255) * 255,
  20759. b: bound01$1(b2, 255) * 255
  20760. };
  20761. }
  20762. function rgbToHsl(r, g, b2) {
  20763. r = bound01$1(r, 255);
  20764. g = bound01$1(g, 255);
  20765. b2 = bound01$1(b2, 255);
  20766. var max2 = Math.max(r, g, b2);
  20767. var min2 = Math.min(r, g, b2);
  20768. var h2 = 0;
  20769. var s2 = 0;
  20770. var l2 = (max2 + min2) / 2;
  20771. if (max2 === min2) {
  20772. s2 = 0;
  20773. h2 = 0;
  20774. } else {
  20775. var d2 = max2 - min2;
  20776. s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  20777. switch (max2) {
  20778. case r:
  20779. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  20780. break;
  20781. case g:
  20782. h2 = (b2 - r) / d2 + 2;
  20783. break;
  20784. case b2:
  20785. h2 = (r - g) / d2 + 4;
  20786. break;
  20787. }
  20788. h2 /= 6;
  20789. }
  20790. return { h: h2, s: s2, l: l2 };
  20791. }
  20792. function hue2rgb(p2, q2, t) {
  20793. if (t < 0) {
  20794. t += 1;
  20795. }
  20796. if (t > 1) {
  20797. t -= 1;
  20798. }
  20799. if (t < 1 / 6) {
  20800. return p2 + (q2 - p2) * (6 * t);
  20801. }
  20802. if (t < 1 / 2) {
  20803. return q2;
  20804. }
  20805. if (t < 2 / 3) {
  20806. return p2 + (q2 - p2) * (2 / 3 - t) * 6;
  20807. }
  20808. return p2;
  20809. }
  20810. function hslToRgb(h2, s2, l2) {
  20811. var r;
  20812. var g;
  20813. var b2;
  20814. h2 = bound01$1(h2, 360);
  20815. s2 = bound01$1(s2, 100);
  20816. l2 = bound01$1(l2, 100);
  20817. if (s2 === 0) {
  20818. g = l2;
  20819. b2 = l2;
  20820. r = l2;
  20821. } else {
  20822. var q2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  20823. var p2 = 2 * l2 - q2;
  20824. r = hue2rgb(p2, q2, h2 + 1 / 3);
  20825. g = hue2rgb(p2, q2, h2);
  20826. b2 = hue2rgb(p2, q2, h2 - 1 / 3);
  20827. }
  20828. return { r: r * 255, g: g * 255, b: b2 * 255 };
  20829. }
  20830. function rgbToHsv(r, g, b2) {
  20831. r = bound01$1(r, 255);
  20832. g = bound01$1(g, 255);
  20833. b2 = bound01$1(b2, 255);
  20834. var max2 = Math.max(r, g, b2);
  20835. var min2 = Math.min(r, g, b2);
  20836. var h2 = 0;
  20837. var v2 = max2;
  20838. var d2 = max2 - min2;
  20839. var s2 = max2 === 0 ? 0 : d2 / max2;
  20840. if (max2 === min2) {
  20841. h2 = 0;
  20842. } else {
  20843. switch (max2) {
  20844. case r:
  20845. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  20846. break;
  20847. case g:
  20848. h2 = (b2 - r) / d2 + 2;
  20849. break;
  20850. case b2:
  20851. h2 = (r - g) / d2 + 4;
  20852. break;
  20853. }
  20854. h2 /= 6;
  20855. }
  20856. return { h: h2, s: s2, v: v2 };
  20857. }
  20858. function hsvToRgb(h2, s2, v2) {
  20859. h2 = bound01$1(h2, 360) * 6;
  20860. s2 = bound01$1(s2, 100);
  20861. v2 = bound01$1(v2, 100);
  20862. var i = Math.floor(h2);
  20863. var f2 = h2 - i;
  20864. var p2 = v2 * (1 - s2);
  20865. var q2 = v2 * (1 - f2 * s2);
  20866. var t = v2 * (1 - (1 - f2) * s2);
  20867. var mod = i % 6;
  20868. var r = [v2, q2, p2, p2, t, v2][mod];
  20869. var g = [t, v2, v2, q2, p2, p2][mod];
  20870. var b2 = [p2, p2, t, v2, v2, q2][mod];
  20871. return { r: r * 255, g: g * 255, b: b2 * 255 };
  20872. }
  20873. function rgbToHex(r, g, b2, allow3Char) {
  20874. var hex = [
  20875. pad2(Math.round(r).toString(16)),
  20876. pad2(Math.round(g).toString(16)),
  20877. pad2(Math.round(b2).toString(16))
  20878. ];
  20879. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  20880. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  20881. }
  20882. return hex.join("");
  20883. }
  20884. function rgbaToHex(r, g, b2, a2, allow4Char) {
  20885. var hex = [
  20886. pad2(Math.round(r).toString(16)),
  20887. pad2(Math.round(g).toString(16)),
  20888. pad2(Math.round(b2).toString(16)),
  20889. pad2(convertDecimalToHex(a2))
  20890. ];
  20891. if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
  20892. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  20893. }
  20894. return hex.join("");
  20895. }
  20896. function convertDecimalToHex(d2) {
  20897. return Math.round(parseFloat(d2) * 255).toString(16);
  20898. }
  20899. function convertHexToDecimal(h2) {
  20900. return parseIntFromHex(h2) / 255;
  20901. }
  20902. function parseIntFromHex(val) {
  20903. return parseInt(val, 16);
  20904. }
  20905. function numberInputToObject(color) {
  20906. return {
  20907. r: color >> 16,
  20908. g: (color & 65280) >> 8,
  20909. b: color & 255
  20910. };
  20911. }
  20912. var names = {
  20913. aliceblue: "#f0f8ff",
  20914. antiquewhite: "#faebd7",
  20915. aqua: "#00ffff",
  20916. aquamarine: "#7fffd4",
  20917. azure: "#f0ffff",
  20918. beige: "#f5f5dc",
  20919. bisque: "#ffe4c4",
  20920. black: "#000000",
  20921. blanchedalmond: "#ffebcd",
  20922. blue: "#0000ff",
  20923. blueviolet: "#8a2be2",
  20924. brown: "#a52a2a",
  20925. burlywood: "#deb887",
  20926. cadetblue: "#5f9ea0",
  20927. chartreuse: "#7fff00",
  20928. chocolate: "#d2691e",
  20929. coral: "#ff7f50",
  20930. cornflowerblue: "#6495ed",
  20931. cornsilk: "#fff8dc",
  20932. crimson: "#dc143c",
  20933. cyan: "#00ffff",
  20934. darkblue: "#00008b",
  20935. darkcyan: "#008b8b",
  20936. darkgoldenrod: "#b8860b",
  20937. darkgray: "#a9a9a9",
  20938. darkgreen: "#006400",
  20939. darkgrey: "#a9a9a9",
  20940. darkkhaki: "#bdb76b",
  20941. darkmagenta: "#8b008b",
  20942. darkolivegreen: "#556b2f",
  20943. darkorange: "#ff8c00",
  20944. darkorchid: "#9932cc",
  20945. darkred: "#8b0000",
  20946. darksalmon: "#e9967a",
  20947. darkseagreen: "#8fbc8f",
  20948. darkslateblue: "#483d8b",
  20949. darkslategray: "#2f4f4f",
  20950. darkslategrey: "#2f4f4f",
  20951. darkturquoise: "#00ced1",
  20952. darkviolet: "#9400d3",
  20953. deeppink: "#ff1493",
  20954. deepskyblue: "#00bfff",
  20955. dimgray: "#696969",
  20956. dimgrey: "#696969",
  20957. dodgerblue: "#1e90ff",
  20958. firebrick: "#b22222",
  20959. floralwhite: "#fffaf0",
  20960. forestgreen: "#228b22",
  20961. fuchsia: "#ff00ff",
  20962. gainsboro: "#dcdcdc",
  20963. ghostwhite: "#f8f8ff",
  20964. goldenrod: "#daa520",
  20965. gold: "#ffd700",
  20966. gray: "#808080",
  20967. green: "#008000",
  20968. greenyellow: "#adff2f",
  20969. grey: "#808080",
  20970. honeydew: "#f0fff0",
  20971. hotpink: "#ff69b4",
  20972. indianred: "#cd5c5c",
  20973. indigo: "#4b0082",
  20974. ivory: "#fffff0",
  20975. khaki: "#f0e68c",
  20976. lavenderblush: "#fff0f5",
  20977. lavender: "#e6e6fa",
  20978. lawngreen: "#7cfc00",
  20979. lemonchiffon: "#fffacd",
  20980. lightblue: "#add8e6",
  20981. lightcoral: "#f08080",
  20982. lightcyan: "#e0ffff",
  20983. lightgoldenrodyellow: "#fafad2",
  20984. lightgray: "#d3d3d3",
  20985. lightgreen: "#90ee90",
  20986. lightgrey: "#d3d3d3",
  20987. lightpink: "#ffb6c1",
  20988. lightsalmon: "#ffa07a",
  20989. lightseagreen: "#20b2aa",
  20990. lightskyblue: "#87cefa",
  20991. lightslategray: "#778899",
  20992. lightslategrey: "#778899",
  20993. lightsteelblue: "#b0c4de",
  20994. lightyellow: "#ffffe0",
  20995. lime: "#00ff00",
  20996. limegreen: "#32cd32",
  20997. linen: "#faf0e6",
  20998. magenta: "#ff00ff",
  20999. maroon: "#800000",
  21000. mediumaquamarine: "#66cdaa",
  21001. mediumblue: "#0000cd",
  21002. mediumorchid: "#ba55d3",
  21003. mediumpurple: "#9370db",
  21004. mediumseagreen: "#3cb371",
  21005. mediumslateblue: "#7b68ee",
  21006. mediumspringgreen: "#00fa9a",
  21007. mediumturquoise: "#48d1cc",
  21008. mediumvioletred: "#c71585",
  21009. midnightblue: "#191970",
  21010. mintcream: "#f5fffa",
  21011. mistyrose: "#ffe4e1",
  21012. moccasin: "#ffe4b5",
  21013. navajowhite: "#ffdead",
  21014. navy: "#000080",
  21015. oldlace: "#fdf5e6",
  21016. olive: "#808000",
  21017. olivedrab: "#6b8e23",
  21018. orange: "#ffa500",
  21019. orangered: "#ff4500",
  21020. orchid: "#da70d6",
  21021. palegoldenrod: "#eee8aa",
  21022. palegreen: "#98fb98",
  21023. paleturquoise: "#afeeee",
  21024. palevioletred: "#db7093",
  21025. papayawhip: "#ffefd5",
  21026. peachpuff: "#ffdab9",
  21027. peru: "#cd853f",
  21028. pink: "#ffc0cb",
  21029. plum: "#dda0dd",
  21030. powderblue: "#b0e0e6",
  21031. purple: "#800080",
  21032. rebeccapurple: "#663399",
  21033. red: "#ff0000",
  21034. rosybrown: "#bc8f8f",
  21035. royalblue: "#4169e1",
  21036. saddlebrown: "#8b4513",
  21037. salmon: "#fa8072",
  21038. sandybrown: "#f4a460",
  21039. seagreen: "#2e8b57",
  21040. seashell: "#fff5ee",
  21041. sienna: "#a0522d",
  21042. silver: "#c0c0c0",
  21043. skyblue: "#87ceeb",
  21044. slateblue: "#6a5acd",
  21045. slategray: "#708090",
  21046. slategrey: "#708090",
  21047. snow: "#fffafa",
  21048. springgreen: "#00ff7f",
  21049. steelblue: "#4682b4",
  21050. tan: "#d2b48c",
  21051. teal: "#008080",
  21052. thistle: "#d8bfd8",
  21053. tomato: "#ff6347",
  21054. turquoise: "#40e0d0",
  21055. violet: "#ee82ee",
  21056. wheat: "#f5deb3",
  21057. white: "#ffffff",
  21058. whitesmoke: "#f5f5f5",
  21059. yellow: "#ffff00",
  21060. yellowgreen: "#9acd32"
  21061. };
  21062. function inputToRGB(color) {
  21063. var rgb = { r: 0, g: 0, b: 0 };
  21064. var a2 = 1;
  21065. var s2 = null;
  21066. var v2 = null;
  21067. var l2 = null;
  21068. var ok = false;
  21069. var format2 = false;
  21070. if (typeof color === "string") {
  21071. color = stringInputToObject(color);
  21072. }
  21073. if (typeof color === "object") {
  21074. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  21075. rgb = rgbToRgb(color.r, color.g, color.b);
  21076. ok = true;
  21077. format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  21078. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  21079. s2 = convertToPercentage(color.s);
  21080. v2 = convertToPercentage(color.v);
  21081. rgb = hsvToRgb(color.h, s2, v2);
  21082. ok = true;
  21083. format2 = "hsv";
  21084. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  21085. s2 = convertToPercentage(color.s);
  21086. l2 = convertToPercentage(color.l);
  21087. rgb = hslToRgb(color.h, s2, l2);
  21088. ok = true;
  21089. format2 = "hsl";
  21090. }
  21091. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  21092. a2 = color.a;
  21093. }
  21094. }
  21095. a2 = boundAlpha(a2);
  21096. return {
  21097. ok,
  21098. format: color.format || format2,
  21099. r: Math.min(255, Math.max(rgb.r, 0)),
  21100. g: Math.min(255, Math.max(rgb.g, 0)),
  21101. b: Math.min(255, Math.max(rgb.b, 0)),
  21102. a: a2
  21103. };
  21104. }
  21105. var CSS_INTEGER = "[-\\+]?\\d+%?";
  21106. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  21107. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  21108. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21109. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21110. var matchers = {
  21111. CSS_UNIT: new RegExp(CSS_UNIT),
  21112. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  21113. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  21114. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  21115. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  21116. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  21117. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  21118. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21119. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  21120. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21121. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  21122. };
  21123. function stringInputToObject(color) {
  21124. color = color.trim().toLowerCase();
  21125. if (color.length === 0) {
  21126. return false;
  21127. }
  21128. var named = false;
  21129. if (names[color]) {
  21130. color = names[color];
  21131. named = true;
  21132. } else if (color === "transparent") {
  21133. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  21134. }
  21135. var match = matchers.rgb.exec(color);
  21136. if (match) {
  21137. return { r: match[1], g: match[2], b: match[3] };
  21138. }
  21139. match = matchers.rgba.exec(color);
  21140. if (match) {
  21141. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  21142. }
  21143. match = matchers.hsl.exec(color);
  21144. if (match) {
  21145. return { h: match[1], s: match[2], l: match[3] };
  21146. }
  21147. match = matchers.hsla.exec(color);
  21148. if (match) {
  21149. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  21150. }
  21151. match = matchers.hsv.exec(color);
  21152. if (match) {
  21153. return { h: match[1], s: match[2], v: match[3] };
  21154. }
  21155. match = matchers.hsva.exec(color);
  21156. if (match) {
  21157. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  21158. }
  21159. match = matchers.hex8.exec(color);
  21160. if (match) {
  21161. return {
  21162. r: parseIntFromHex(match[1]),
  21163. g: parseIntFromHex(match[2]),
  21164. b: parseIntFromHex(match[3]),
  21165. a: convertHexToDecimal(match[4]),
  21166. format: named ? "name" : "hex8"
  21167. };
  21168. }
  21169. match = matchers.hex6.exec(color);
  21170. if (match) {
  21171. return {
  21172. r: parseIntFromHex(match[1]),
  21173. g: parseIntFromHex(match[2]),
  21174. b: parseIntFromHex(match[3]),
  21175. format: named ? "name" : "hex"
  21176. };
  21177. }
  21178. match = matchers.hex4.exec(color);
  21179. if (match) {
  21180. return {
  21181. r: parseIntFromHex(match[1] + match[1]),
  21182. g: parseIntFromHex(match[2] + match[2]),
  21183. b: parseIntFromHex(match[3] + match[3]),
  21184. a: convertHexToDecimal(match[4] + match[4]),
  21185. format: named ? "name" : "hex8"
  21186. };
  21187. }
  21188. match = matchers.hex3.exec(color);
  21189. if (match) {
  21190. return {
  21191. r: parseIntFromHex(match[1] + match[1]),
  21192. g: parseIntFromHex(match[2] + match[2]),
  21193. b: parseIntFromHex(match[3] + match[3]),
  21194. format: named ? "name" : "hex"
  21195. };
  21196. }
  21197. return false;
  21198. }
  21199. function isValidCSSUnit(color) {
  21200. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  21201. }
  21202. var TinyColor = (
  21203. /** @class */
  21204. function() {
  21205. function TinyColor2(color, opts) {
  21206. if (color === void 0) {
  21207. color = "";
  21208. }
  21209. if (opts === void 0) {
  21210. opts = {};
  21211. }
  21212. var _a2;
  21213. if (color instanceof TinyColor2) {
  21214. return color;
  21215. }
  21216. if (typeof color === "number") {
  21217. color = numberInputToObject(color);
  21218. }
  21219. this.originalInput = color;
  21220. var rgb = inputToRGB(color);
  21221. this.originalInput = color;
  21222. this.r = rgb.r;
  21223. this.g = rgb.g;
  21224. this.b = rgb.b;
  21225. this.a = rgb.a;
  21226. this.roundA = Math.round(100 * this.a) / 100;
  21227. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  21228. this.gradientType = opts.gradientType;
  21229. if (this.r < 1) {
  21230. this.r = Math.round(this.r);
  21231. }
  21232. if (this.g < 1) {
  21233. this.g = Math.round(this.g);
  21234. }
  21235. if (this.b < 1) {
  21236. this.b = Math.round(this.b);
  21237. }
  21238. this.isValid = rgb.ok;
  21239. }
  21240. TinyColor2.prototype.isDark = function() {
  21241. return this.getBrightness() < 128;
  21242. };
  21243. TinyColor2.prototype.isLight = function() {
  21244. return !this.isDark();
  21245. };
  21246. TinyColor2.prototype.getBrightness = function() {
  21247. var rgb = this.toRgb();
  21248. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  21249. };
  21250. TinyColor2.prototype.getLuminance = function() {
  21251. var rgb = this.toRgb();
  21252. var R2;
  21253. var G2;
  21254. var B2;
  21255. var RsRGB = rgb.r / 255;
  21256. var GsRGB = rgb.g / 255;
  21257. var BsRGB = rgb.b / 255;
  21258. if (RsRGB <= 0.03928) {
  21259. R2 = RsRGB / 12.92;
  21260. } else {
  21261. R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  21262. }
  21263. if (GsRGB <= 0.03928) {
  21264. G2 = GsRGB / 12.92;
  21265. } else {
  21266. G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  21267. }
  21268. if (BsRGB <= 0.03928) {
  21269. B2 = BsRGB / 12.92;
  21270. } else {
  21271. B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  21272. }
  21273. return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  21274. };
  21275. TinyColor2.prototype.getAlpha = function() {
  21276. return this.a;
  21277. };
  21278. TinyColor2.prototype.setAlpha = function(alpha) {
  21279. this.a = boundAlpha(alpha);
  21280. this.roundA = Math.round(100 * this.a) / 100;
  21281. return this;
  21282. };
  21283. TinyColor2.prototype.isMonochrome = function() {
  21284. var s2 = this.toHsl().s;
  21285. return s2 === 0;
  21286. };
  21287. TinyColor2.prototype.toHsv = function() {
  21288. var hsv = rgbToHsv(this.r, this.g, this.b);
  21289. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  21290. };
  21291. TinyColor2.prototype.toHsvString = function() {
  21292. var hsv = rgbToHsv(this.r, this.g, this.b);
  21293. var h2 = Math.round(hsv.h * 360);
  21294. var s2 = Math.round(hsv.s * 100);
  21295. var v2 = Math.round(hsv.v * 100);
  21296. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  21297. };
  21298. TinyColor2.prototype.toHsl = function() {
  21299. var hsl = rgbToHsl(this.r, this.g, this.b);
  21300. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  21301. };
  21302. TinyColor2.prototype.toHslString = function() {
  21303. var hsl = rgbToHsl(this.r, this.g, this.b);
  21304. var h2 = Math.round(hsl.h * 360);
  21305. var s2 = Math.round(hsl.s * 100);
  21306. var l2 = Math.round(hsl.l * 100);
  21307. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  21308. };
  21309. TinyColor2.prototype.toHex = function(allow3Char) {
  21310. if (allow3Char === void 0) {
  21311. allow3Char = false;
  21312. }
  21313. return rgbToHex(this.r, this.g, this.b, allow3Char);
  21314. };
  21315. TinyColor2.prototype.toHexString = function(allow3Char) {
  21316. if (allow3Char === void 0) {
  21317. allow3Char = false;
  21318. }
  21319. return "#" + this.toHex(allow3Char);
  21320. };
  21321. TinyColor2.prototype.toHex8 = function(allow4Char) {
  21322. if (allow4Char === void 0) {
  21323. allow4Char = false;
  21324. }
  21325. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  21326. };
  21327. TinyColor2.prototype.toHex8String = function(allow4Char) {
  21328. if (allow4Char === void 0) {
  21329. allow4Char = false;
  21330. }
  21331. return "#" + this.toHex8(allow4Char);
  21332. };
  21333. TinyColor2.prototype.toHexShortString = function(allowShortChar) {
  21334. if (allowShortChar === void 0) {
  21335. allowShortChar = false;
  21336. }
  21337. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  21338. };
  21339. TinyColor2.prototype.toRgb = function() {
  21340. return {
  21341. r: Math.round(this.r),
  21342. g: Math.round(this.g),
  21343. b: Math.round(this.b),
  21344. a: this.a
  21345. };
  21346. };
  21347. TinyColor2.prototype.toRgbString = function() {
  21348. var r = Math.round(this.r);
  21349. var g = Math.round(this.g);
  21350. var b2 = Math.round(this.b);
  21351. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  21352. };
  21353. TinyColor2.prototype.toPercentageRgb = function() {
  21354. var fmt = function(x2) {
  21355. return "".concat(Math.round(bound01$1(x2, 255) * 100), "%");
  21356. };
  21357. return {
  21358. r: fmt(this.r),
  21359. g: fmt(this.g),
  21360. b: fmt(this.b),
  21361. a: this.a
  21362. };
  21363. };
  21364. TinyColor2.prototype.toPercentageRgbString = function() {
  21365. var rnd = function(x2) {
  21366. return Math.round(bound01$1(x2, 255) * 100);
  21367. };
  21368. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  21369. };
  21370. TinyColor2.prototype.toName = function() {
  21371. if (this.a === 0) {
  21372. return "transparent";
  21373. }
  21374. if (this.a < 1) {
  21375. return false;
  21376. }
  21377. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  21378. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  21379. var _b = _a2[_i], key = _b[0], value = _b[1];
  21380. if (hex === value) {
  21381. return key;
  21382. }
  21383. }
  21384. return false;
  21385. };
  21386. TinyColor2.prototype.toString = function(format2) {
  21387. var formatSet = Boolean(format2);
  21388. format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
  21389. var formattedString = false;
  21390. var hasAlpha = this.a < 1 && this.a >= 0;
  21391. var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
  21392. if (needsAlphaFormat) {
  21393. if (format2 === "name" && this.a === 0) {
  21394. return this.toName();
  21395. }
  21396. return this.toRgbString();
  21397. }
  21398. if (format2 === "rgb") {
  21399. formattedString = this.toRgbString();
  21400. }
  21401. if (format2 === "prgb") {
  21402. formattedString = this.toPercentageRgbString();
  21403. }
  21404. if (format2 === "hex" || format2 === "hex6") {
  21405. formattedString = this.toHexString();
  21406. }
  21407. if (format2 === "hex3") {
  21408. formattedString = this.toHexString(true);
  21409. }
  21410. if (format2 === "hex4") {
  21411. formattedString = this.toHex8String(true);
  21412. }
  21413. if (format2 === "hex8") {
  21414. formattedString = this.toHex8String();
  21415. }
  21416. if (format2 === "name") {
  21417. formattedString = this.toName();
  21418. }
  21419. if (format2 === "hsl") {
  21420. formattedString = this.toHslString();
  21421. }
  21422. if (format2 === "hsv") {
  21423. formattedString = this.toHsvString();
  21424. }
  21425. return formattedString || this.toHexString();
  21426. };
  21427. TinyColor2.prototype.toNumber = function() {
  21428. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  21429. };
  21430. TinyColor2.prototype.clone = function() {
  21431. return new TinyColor2(this.toString());
  21432. };
  21433. TinyColor2.prototype.lighten = function(amount) {
  21434. if (amount === void 0) {
  21435. amount = 10;
  21436. }
  21437. var hsl = this.toHsl();
  21438. hsl.l += amount / 100;
  21439. hsl.l = clamp01(hsl.l);
  21440. return new TinyColor2(hsl);
  21441. };
  21442. TinyColor2.prototype.brighten = function(amount) {
  21443. if (amount === void 0) {
  21444. amount = 10;
  21445. }
  21446. var rgb = this.toRgb();
  21447. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  21448. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  21449. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  21450. return new TinyColor2(rgb);
  21451. };
  21452. TinyColor2.prototype.darken = function(amount) {
  21453. if (amount === void 0) {
  21454. amount = 10;
  21455. }
  21456. var hsl = this.toHsl();
  21457. hsl.l -= amount / 100;
  21458. hsl.l = clamp01(hsl.l);
  21459. return new TinyColor2(hsl);
  21460. };
  21461. TinyColor2.prototype.tint = function(amount) {
  21462. if (amount === void 0) {
  21463. amount = 10;
  21464. }
  21465. return this.mix("white", amount);
  21466. };
  21467. TinyColor2.prototype.shade = function(amount) {
  21468. if (amount === void 0) {
  21469. amount = 10;
  21470. }
  21471. return this.mix("black", amount);
  21472. };
  21473. TinyColor2.prototype.desaturate = function(amount) {
  21474. if (amount === void 0) {
  21475. amount = 10;
  21476. }
  21477. var hsl = this.toHsl();
  21478. hsl.s -= amount / 100;
  21479. hsl.s = clamp01(hsl.s);
  21480. return new TinyColor2(hsl);
  21481. };
  21482. TinyColor2.prototype.saturate = function(amount) {
  21483. if (amount === void 0) {
  21484. amount = 10;
  21485. }
  21486. var hsl = this.toHsl();
  21487. hsl.s += amount / 100;
  21488. hsl.s = clamp01(hsl.s);
  21489. return new TinyColor2(hsl);
  21490. };
  21491. TinyColor2.prototype.greyscale = function() {
  21492. return this.desaturate(100);
  21493. };
  21494. TinyColor2.prototype.spin = function(amount) {
  21495. var hsl = this.toHsl();
  21496. var hue = (hsl.h + amount) % 360;
  21497. hsl.h = hue < 0 ? 360 + hue : hue;
  21498. return new TinyColor2(hsl);
  21499. };
  21500. TinyColor2.prototype.mix = function(color, amount) {
  21501. if (amount === void 0) {
  21502. amount = 50;
  21503. }
  21504. var rgb1 = this.toRgb();
  21505. var rgb2 = new TinyColor2(color).toRgb();
  21506. var p2 = amount / 100;
  21507. var rgba = {
  21508. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  21509. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  21510. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  21511. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  21512. };
  21513. return new TinyColor2(rgba);
  21514. };
  21515. TinyColor2.prototype.analogous = function(results, slices) {
  21516. if (results === void 0) {
  21517. results = 6;
  21518. }
  21519. if (slices === void 0) {
  21520. slices = 30;
  21521. }
  21522. var hsl = this.toHsl();
  21523. var part = 360 / slices;
  21524. var ret = [this];
  21525. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  21526. hsl.h = (hsl.h + part) % 360;
  21527. ret.push(new TinyColor2(hsl));
  21528. }
  21529. return ret;
  21530. };
  21531. TinyColor2.prototype.complement = function() {
  21532. var hsl = this.toHsl();
  21533. hsl.h = (hsl.h + 180) % 360;
  21534. return new TinyColor2(hsl);
  21535. };
  21536. TinyColor2.prototype.monochromatic = function(results) {
  21537. if (results === void 0) {
  21538. results = 6;
  21539. }
  21540. var hsv = this.toHsv();
  21541. var h2 = hsv.h;
  21542. var s2 = hsv.s;
  21543. var v2 = hsv.v;
  21544. var res = [];
  21545. var modification = 1 / results;
  21546. while (results--) {
  21547. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  21548. v2 = (v2 + modification) % 1;
  21549. }
  21550. return res;
  21551. };
  21552. TinyColor2.prototype.splitcomplement = function() {
  21553. var hsl = this.toHsl();
  21554. var h2 = hsl.h;
  21555. return [
  21556. this,
  21557. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  21558. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  21559. ];
  21560. };
  21561. TinyColor2.prototype.onBackground = function(background) {
  21562. var fg = this.toRgb();
  21563. var bg = new TinyColor2(background).toRgb();
  21564. var alpha = fg.a + bg.a * (1 - fg.a);
  21565. return new TinyColor2({
  21566. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  21567. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  21568. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  21569. a: alpha
  21570. });
  21571. };
  21572. TinyColor2.prototype.triad = function() {
  21573. return this.polyad(3);
  21574. };
  21575. TinyColor2.prototype.tetrad = function() {
  21576. return this.polyad(4);
  21577. };
  21578. TinyColor2.prototype.polyad = function(n) {
  21579. var hsl = this.toHsl();
  21580. var h2 = hsl.h;
  21581. var result = [this];
  21582. var increment = 360 / n;
  21583. for (var i = 1; i < n; i++) {
  21584. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  21585. }
  21586. return result;
  21587. };
  21588. TinyColor2.prototype.equals = function(color) {
  21589. return this.toRgbString() === new TinyColor2(color).toRgbString();
  21590. };
  21591. return TinyColor2;
  21592. }()
  21593. );
  21594. function darken(color, amount = 20) {
  21595. return color.mix("#141414", amount).toString();
  21596. }
  21597. function useButtonCustomStyle(props) {
  21598. const _disabled = useFormDisabled();
  21599. const ns = useNamespace("button");
  21600. return computed(() => {
  21601. let styles = {};
  21602. const buttonColor = props.color;
  21603. if (buttonColor) {
  21604. const color = new TinyColor(buttonColor);
  21605. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  21606. if (props.plain) {
  21607. styles = ns.cssVarBlock({
  21608. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  21609. "text-color": buttonColor,
  21610. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  21611. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  21612. "hover-bg-color": buttonColor,
  21613. "hover-border-color": buttonColor,
  21614. "active-bg-color": activeBgColor,
  21615. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  21616. "active-border-color": activeBgColor
  21617. });
  21618. if (_disabled.value) {
  21619. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  21620. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  21621. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  21622. }
  21623. } else {
  21624. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  21625. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  21626. styles = ns.cssVarBlock({
  21627. "bg-color": buttonColor,
  21628. "text-color": textColor,
  21629. "border-color": buttonColor,
  21630. "hover-bg-color": hoverBgColor,
  21631. "hover-text-color": textColor,
  21632. "hover-border-color": hoverBgColor,
  21633. "active-bg-color": activeBgColor,
  21634. "active-border-color": activeBgColor
  21635. });
  21636. if (_disabled.value) {
  21637. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  21638. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  21639. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  21640. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  21641. }
  21642. }
  21643. }
  21644. return styles;
  21645. });
  21646. }
  21647. const __default__$1j = /* @__PURE__ */ defineComponent({
  21648. name: "ElButton"
  21649. });
  21650. const _sfc_main$20 = /* @__PURE__ */ defineComponent({
  21651. ...__default__$1j,
  21652. props: buttonProps,
  21653. emits: buttonEmits,
  21654. setup(__props, { expose, emit: emit2 }) {
  21655. const props = __props;
  21656. const buttonStyle = useButtonCustomStyle(props);
  21657. const ns = useNamespace("button");
  21658. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit2);
  21659. expose({
  21660. ref: _ref,
  21661. size: _size,
  21662. type: _type,
  21663. disabled: _disabled,
  21664. shouldAddSpace
  21665. });
  21666. return (_ctx, _cache) => {
  21667. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
  21668. ref_key: "_ref",
  21669. ref: _ref
  21670. }, unref(_props), {
  21671. class: [
  21672. unref(ns).b(),
  21673. unref(ns).m(unref(_type)),
  21674. unref(ns).m(unref(_size)),
  21675. unref(ns).is("disabled", unref(_disabled)),
  21676. unref(ns).is("loading", _ctx.loading),
  21677. unref(ns).is("plain", _ctx.plain),
  21678. unref(ns).is("round", _ctx.round),
  21679. unref(ns).is("circle", _ctx.circle),
  21680. unref(ns).is("text", _ctx.text),
  21681. unref(ns).is("link", _ctx.link),
  21682. unref(ns).is("has-bg", _ctx.bg)
  21683. ],
  21684. style: unref(buttonStyle),
  21685. onClick: unref(handleClick)
  21686. }), {
  21687. default: withCtx(() => [
  21688. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  21689. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  21690. key: 1,
  21691. class: normalizeClass(unref(ns).is("loading"))
  21692. }, {
  21693. default: withCtx(() => [
  21694. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  21695. ]),
  21696. _: 1
  21697. }, 8, ["class"]))
  21698. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  21699. default: withCtx(() => [
  21700. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  21701. ]),
  21702. _: 3
  21703. })) : createCommentVNode("v-if", true),
  21704. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  21705. key: 2,
  21706. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  21707. }, [
  21708. renderSlot(_ctx.$slots, "default")
  21709. ], 2)) : createCommentVNode("v-if", true)
  21710. ]),
  21711. _: 3
  21712. }, 16, ["class", "style", "onClick"]);
  21713. };
  21714. }
  21715. });
  21716. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$20, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  21717. const buttonGroupProps = {
  21718. size: buttonProps.size,
  21719. type: buttonProps.type
  21720. };
  21721. const __default__$1i = /* @__PURE__ */ defineComponent({
  21722. name: "ElButtonGroup"
  21723. });
  21724. const _sfc_main$1$ = /* @__PURE__ */ defineComponent({
  21725. ...__default__$1i,
  21726. props: buttonGroupProps,
  21727. setup(__props) {
  21728. const props = __props;
  21729. provide(buttonGroupContextKey, reactive({
  21730. size: toRef(props, "size"),
  21731. type: toRef(props, "type")
  21732. }));
  21733. const ns = useNamespace("button");
  21734. return (_ctx, _cache) => {
  21735. return openBlock(), createElementBlock("div", {
  21736. class: normalizeClass(`${unref(ns).b("group")}`)
  21737. }, [
  21738. renderSlot(_ctx.$slots, "default")
  21739. ], 2);
  21740. };
  21741. }
  21742. });
  21743. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  21744. const ElButton = withInstall(Button, {
  21745. ButtonGroup
  21746. });
  21747. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  21748. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  21749. function getDefaultExportFromCjs(x2) {
  21750. return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
  21751. }
  21752. var dayjs_min = { exports: {} };
  21753. (function(module2, exports2) {
  21754. !function(t, e) {
  21755. module2.exports = e();
  21756. }(commonjsGlobal, function() {
  21757. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h2 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
  21758. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  21759. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  21760. } }, m2 = function(t2, e2, n2) {
  21761. var r2 = String(t2);
  21762. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  21763. }, v2 = { s: m2, z: function(t2) {
  21764. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  21765. return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
  21766. }, m: function t2(e2, n2) {
  21767. if (e2.date() < n2.date())
  21768. return -t2(n2, e2);
  21769. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c2), s3 = n2 - i2 < 0, u3 = e2.clone().add(r2 + (s3 ? -1 : 1), c2);
  21770. return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
  21771. }, a: function(t2) {
  21772. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  21773. }, p: function(t2) {
  21774. return { M: c2, y: h2, w: o2, d: a2, D: d2, h: u2, m: s2, s: i, ms: r, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  21775. }, u: function(t2) {
  21776. return void 0 === t2;
  21777. } }, g = "en", D2 = {};
  21778. D2[g] = M2;
  21779. var p2 = "$isDayjsObject", S2 = function(t2) {
  21780. return t2 instanceof _2 || !(!t2 || !t2[p2]);
  21781. }, w2 = function t2(e2, n2, r2) {
  21782. var i2;
  21783. if (!e2)
  21784. return g;
  21785. if ("string" == typeof e2) {
  21786. var s3 = e2.toLowerCase();
  21787. D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
  21788. var u3 = e2.split("-");
  21789. if (!i2 && u3.length > 1)
  21790. return t2(u3[0]);
  21791. } else {
  21792. var a3 = e2.name;
  21793. D2[a3] = e2, i2 = a3;
  21794. }
  21795. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  21796. }, O2 = function(t2, e2) {
  21797. if (S2(t2))
  21798. return t2.clone();
  21799. var n2 = "object" == typeof e2 ? e2 : {};
  21800. return n2.date = t2, n2.args = arguments, new _2(n2);
  21801. }, b2 = v2;
  21802. b2.l = w2, b2.i = S2, b2.w = function(t2, e2) {
  21803. return O2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  21804. };
  21805. var _2 = function() {
  21806. function M3(t2) {
  21807. this.$L = w2(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p2] = true;
  21808. }
  21809. var m3 = M3.prototype;
  21810. return m3.parse = function(t2) {
  21811. this.$d = function(t3) {
  21812. var e2 = t3.date, n2 = t3.utc;
  21813. if (null === e2)
  21814. return /* @__PURE__ */ new Date(NaN);
  21815. if (b2.u(e2))
  21816. return /* @__PURE__ */ new Date();
  21817. if (e2 instanceof Date)
  21818. return new Date(e2);
  21819. if ("string" == typeof e2 && !/Z$/i.test(e2)) {
  21820. var r2 = e2.match($);
  21821. if (r2) {
  21822. var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
  21823. return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s3);
  21824. }
  21825. }
  21826. return new Date(e2);
  21827. }(t2), this.init();
  21828. }, m3.init = function() {
  21829. var t2 = this.$d;
  21830. this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
  21831. }, m3.$utils = function() {
  21832. return b2;
  21833. }, m3.isValid = function() {
  21834. return !(this.$d.toString() === l2);
  21835. }, m3.isSame = function(t2, e2) {
  21836. var n2 = O2(t2);
  21837. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  21838. }, m3.isAfter = function(t2, e2) {
  21839. return O2(t2) < this.startOf(e2);
  21840. }, m3.isBefore = function(t2, e2) {
  21841. return this.endOf(e2) < O2(t2);
  21842. }, m3.$g = function(t2, e2, n2) {
  21843. return b2.u(t2) ? this[e2] : this.set(n2, t2);
  21844. }, m3.unix = function() {
  21845. return Math.floor(this.valueOf() / 1e3);
  21846. }, m3.valueOf = function() {
  21847. return this.$d.getTime();
  21848. }, m3.startOf = function(t2, e2) {
  21849. var n2 = this, r2 = !!b2.u(e2) || e2, f3 = b2.p(t2), l3 = function(t3, e3) {
  21850. var i2 = b2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  21851. return r2 ? i2 : i2.endOf(a2);
  21852. }, $2 = function(t3, e3) {
  21853. return b2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  21854. }, y2 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
  21855. switch (f3) {
  21856. case h2:
  21857. return r2 ? l3(1, 0) : l3(31, 11);
  21858. case c2:
  21859. return r2 ? l3(1, M4) : l3(0, M4 + 1);
  21860. case o2:
  21861. var g2 = this.$locale().weekStart || 0, D3 = (y2 < g2 ? y2 + 7 : y2) - g2;
  21862. return l3(r2 ? m4 - D3 : m4 + (6 - D3), M4);
  21863. case a2:
  21864. case d2:
  21865. return $2(v3 + "Hours", 0);
  21866. case u2:
  21867. return $2(v3 + "Minutes", 1);
  21868. case s2:
  21869. return $2(v3 + "Seconds", 2);
  21870. case i:
  21871. return $2(v3 + "Milliseconds", 3);
  21872. default:
  21873. return this.clone();
  21874. }
  21875. }, m3.endOf = function(t2) {
  21876. return this.startOf(t2, false);
  21877. }, m3.$set = function(t2, e2) {
  21878. var n2, o3 = b2.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n2 = {}, n2[a2] = f3 + "Date", n2[d2] = f3 + "Date", n2[c2] = f3 + "Month", n2[h2] = f3 + "FullYear", n2[u2] = f3 + "Hours", n2[s2] = f3 + "Minutes", n2[i] = f3 + "Seconds", n2[r] = f3 + "Milliseconds", n2)[o3], $2 = o3 === a2 ? this.$D + (e2 - this.$W) : e2;
  21879. if (o3 === c2 || o3 === h2) {
  21880. var y2 = this.clone().set(d2, 1);
  21881. y2.$d[l3]($2), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
  21882. } else
  21883. l3 && this.$d[l3]($2);
  21884. return this.init(), this;
  21885. }, m3.set = function(t2, e2) {
  21886. return this.clone().$set(t2, e2);
  21887. }, m3.get = function(t2) {
  21888. return this[b2.p(t2)]();
  21889. }, m3.add = function(r2, f3) {
  21890. var d3, l3 = this;
  21891. r2 = Number(r2);
  21892. var $2 = b2.p(f3), y2 = function(t2) {
  21893. var e2 = O2(l3);
  21894. return b2.w(e2.date(e2.date() + Math.round(t2 * r2)), l3);
  21895. };
  21896. if ($2 === c2)
  21897. return this.set(c2, this.$M + r2);
  21898. if ($2 === h2)
  21899. return this.set(h2, this.$y + r2);
  21900. if ($2 === a2)
  21901. return y2(1);
  21902. if ($2 === o2)
  21903. return y2(7);
  21904. var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[$2] || 1, m4 = this.$d.getTime() + r2 * M4;
  21905. return b2.w(m4, this);
  21906. }, m3.subtract = function(t2, e2) {
  21907. return this.add(-1 * t2, e2);
  21908. }, m3.format = function(t2) {
  21909. var e2 = this, n2 = this.$locale();
  21910. if (!this.isValid())
  21911. return n2.invalidDate || l2;
  21912. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n2.weekdays, c3 = n2.months, f3 = n2.meridiem, h3 = function(t3, n3, i3, s4) {
  21913. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
  21914. }, d3 = function(t3) {
  21915. return b2.s(s3 % 12 || 12, t3, "0");
  21916. }, $2 = f3 || function(t3, e3, n3) {
  21917. var r3 = t3 < 12 ? "AM" : "PM";
  21918. return n3 ? r3.toLowerCase() : r3;
  21919. };
  21920. return r2.replace(y, function(t3, r3) {
  21921. return r3 || function(t4) {
  21922. switch (t4) {
  21923. case "YY":
  21924. return String(e2.$y).slice(-2);
  21925. case "YYYY":
  21926. return b2.s(e2.$y, 4, "0");
  21927. case "M":
  21928. return a3 + 1;
  21929. case "MM":
  21930. return b2.s(a3 + 1, 2, "0");
  21931. case "MMM":
  21932. return h3(n2.monthsShort, a3, c3, 3);
  21933. case "MMMM":
  21934. return h3(c3, a3);
  21935. case "D":
  21936. return e2.$D;
  21937. case "DD":
  21938. return b2.s(e2.$D, 2, "0");
  21939. case "d":
  21940. return String(e2.$W);
  21941. case "dd":
  21942. return h3(n2.weekdaysMin, e2.$W, o3, 2);
  21943. case "ddd":
  21944. return h3(n2.weekdaysShort, e2.$W, o3, 3);
  21945. case "dddd":
  21946. return o3[e2.$W];
  21947. case "H":
  21948. return String(s3);
  21949. case "HH":
  21950. return b2.s(s3, 2, "0");
  21951. case "h":
  21952. return d3(1);
  21953. case "hh":
  21954. return d3(2);
  21955. case "a":
  21956. return $2(s3, u3, true);
  21957. case "A":
  21958. return $2(s3, u3, false);
  21959. case "m":
  21960. return String(u3);
  21961. case "mm":
  21962. return b2.s(u3, 2, "0");
  21963. case "s":
  21964. return String(e2.$s);
  21965. case "ss":
  21966. return b2.s(e2.$s, 2, "0");
  21967. case "SSS":
  21968. return b2.s(e2.$ms, 3, "0");
  21969. case "Z":
  21970. return i2;
  21971. }
  21972. return null;
  21973. }(t3) || i2.replace(":", "");
  21974. });
  21975. }, m3.utcOffset = function() {
  21976. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  21977. }, m3.diff = function(r2, d3, l3) {
  21978. var $2, y2 = this, M4 = b2.p(d3), m4 = O2(r2), v3 = (m4.utcOffset() - this.utcOffset()) * e, g2 = this - m4, D3 = function() {
  21979. return b2.m(y2, m4);
  21980. };
  21981. switch (M4) {
  21982. case h2:
  21983. $2 = D3() / 12;
  21984. break;
  21985. case c2:
  21986. $2 = D3();
  21987. break;
  21988. case f2:
  21989. $2 = D3() / 3;
  21990. break;
  21991. case o2:
  21992. $2 = (g2 - v3) / 6048e5;
  21993. break;
  21994. case a2:
  21995. $2 = (g2 - v3) / 864e5;
  21996. break;
  21997. case u2:
  21998. $2 = g2 / n;
  21999. break;
  22000. case s2:
  22001. $2 = g2 / e;
  22002. break;
  22003. case i:
  22004. $2 = g2 / t;
  22005. break;
  22006. default:
  22007. $2 = g2;
  22008. }
  22009. return l3 ? $2 : b2.a($2);
  22010. }, m3.daysInMonth = function() {
  22011. return this.endOf(c2).$D;
  22012. }, m3.$locale = function() {
  22013. return D2[this.$L];
  22014. }, m3.locale = function(t2, e2) {
  22015. if (!t2)
  22016. return this.$L;
  22017. var n2 = this.clone(), r2 = w2(t2, e2, true);
  22018. return r2 && (n2.$L = r2), n2;
  22019. }, m3.clone = function() {
  22020. return b2.w(this.$d, this);
  22021. }, m3.toDate = function() {
  22022. return new Date(this.valueOf());
  22023. }, m3.toJSON = function() {
  22024. return this.isValid() ? this.toISOString() : null;
  22025. }, m3.toISOString = function() {
  22026. return this.$d.toISOString();
  22027. }, m3.toString = function() {
  22028. return this.$d.toUTCString();
  22029. }, M3;
  22030. }(), k = _2.prototype;
  22031. return O2.prototype = k, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t2) {
  22032. k[t2[1]] = function(e2) {
  22033. return this.$g(e2, t2[0], t2[1]);
  22034. };
  22035. }), O2.extend = function(t2, e2) {
  22036. return t2.$i || (t2(e2, _2, O2), t2.$i = true), O2;
  22037. }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t2) {
  22038. return O2(1e3 * t2);
  22039. }, O2.en = D2[g], O2.Ls = D2, O2.p = {}, O2;
  22040. });
  22041. })(dayjs_min);
  22042. var dayjs_minExports = dayjs_min.exports;
  22043. const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
  22044. var customParseFormat$1 = { exports: {} };
  22045. (function(module2, exports2) {
  22046. !function(e, t) {
  22047. module2.exports = t();
  22048. }(commonjsGlobal, function() {
  22049. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^-_:/,()\s\d]+/, o2 = {}, s2 = function(e2) {
  22050. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  22051. };
  22052. var a2 = function(e2) {
  22053. return function(t2) {
  22054. this[e2] = +t2;
  22055. };
  22056. }, f2 = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  22057. (this.zone || (this.zone = {})).offset = function(e3) {
  22058. if (!e3)
  22059. return 0;
  22060. if ("Z" === e3)
  22061. return 0;
  22062. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  22063. return 0 === n2 ? 0 : "+" === t2[0] ? -n2 : n2;
  22064. }(e2);
  22065. }], h2 = function(e2) {
  22066. var t2 = o2[e2];
  22067. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  22068. }, u2 = function(e2, t2) {
  22069. var n2, r2 = o2.meridiem;
  22070. if (r2) {
  22071. for (var i2 = 1; i2 <= 24; i2 += 1)
  22072. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  22073. n2 = i2 > 12;
  22074. break;
  22075. }
  22076. } else
  22077. n2 = e2 === (t2 ? "pm" : "PM");
  22078. return n2;
  22079. }, d2 = { A: [i, function(e2) {
  22080. this.afternoon = u2(e2, false);
  22081. }], a: [i, function(e2) {
  22082. this.afternoon = u2(e2, true);
  22083. }], S: [/\d/, function(e2) {
  22084. this.milliseconds = 100 * +e2;
  22085. }], SS: [n, function(e2) {
  22086. this.milliseconds = 10 * +e2;
  22087. }], SSS: [/\d{3}/, function(e2) {
  22088. this.milliseconds = +e2;
  22089. }], s: [r, a2("seconds")], ss: [r, a2("seconds")], m: [r, a2("minutes")], mm: [r, a2("minutes")], H: [r, a2("hours")], h: [r, a2("hours")], HH: [r, a2("hours")], hh: [r, a2("hours")], D: [r, a2("day")], DD: [n, a2("day")], Do: [i, function(e2) {
  22090. var t2 = o2.ordinal, n2 = e2.match(/\d+/);
  22091. if (this.day = n2[0], t2)
  22092. for (var r2 = 1; r2 <= 31; r2 += 1)
  22093. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  22094. }], M: [r, a2("month")], MM: [n, a2("month")], MMM: [i, function(e2) {
  22095. var t2 = h2("months"), n2 = (h2("monthsShort") || t2.map(function(e3) {
  22096. return e3.slice(0, 3);
  22097. })).indexOf(e2) + 1;
  22098. if (n2 < 1)
  22099. throw new Error();
  22100. this.month = n2 % 12 || n2;
  22101. }], MMMM: [i, function(e2) {
  22102. var t2 = h2("months").indexOf(e2) + 1;
  22103. if (t2 < 1)
  22104. throw new Error();
  22105. this.month = t2 % 12 || t2;
  22106. }], Y: [/[+-]?\d+/, a2("year")], YY: [n, function(e2) {
  22107. this.year = s2(e2);
  22108. }], YYYY: [/\d{4}/, a2("year")], Z: f2, ZZ: f2 };
  22109. function c2(n2) {
  22110. var r2, i2;
  22111. r2 = n2, i2 = o2 && o2.formats;
  22112. for (var s3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  22113. var o3 = r3 && r3.toUpperCase();
  22114. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  22115. return t3 || n4.slice(1);
  22116. });
  22117. })).match(t), a3 = s3.length, f3 = 0; f3 < a3; f3 += 1) {
  22118. var h3 = s3[f3], u3 = d2[h3], c3 = u3 && u3[0], l2 = u3 && u3[1];
  22119. s3[f3] = l2 ? { regex: c3, parser: l2 } : h3.replace(/^\[|\]$/g, "");
  22120. }
  22121. return function(e2) {
  22122. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
  22123. var i3 = s3[n3];
  22124. if ("string" == typeof i3)
  22125. r3 += i3.length;
  22126. else {
  22127. var o3 = i3.regex, f4 = i3.parser, h4 = e2.slice(r3), u4 = o3.exec(h4)[0];
  22128. f4.call(t2, u4), e2 = e2.replace(u4, "");
  22129. }
  22130. }
  22131. return function(e3) {
  22132. var t3 = e3.afternoon;
  22133. if (void 0 !== t3) {
  22134. var n4 = e3.hours;
  22135. t3 ? n4 < 12 && (e3.hours += 12) : 12 === n4 && (e3.hours = 0), delete e3.afternoon;
  22136. }
  22137. }(t2), t2;
  22138. };
  22139. }
  22140. return function(e2, t2, n2) {
  22141. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s2 = e2.parseTwoDigitYear);
  22142. var r2 = t2.prototype, i2 = r2.parse;
  22143. r2.parse = function(e3) {
  22144. var t3 = e3.date, r3 = e3.utc, s3 = e3.args;
  22145. this.$u = r3;
  22146. var a3 = s3[1];
  22147. if ("string" == typeof a3) {
  22148. var f3 = true === s3[2], h3 = true === s3[3], u3 = f3 || h3, d3 = s3[2];
  22149. h3 && (d3 = s3[2]), o2 = this.$locale(), !f3 && d3 && (o2 = n2.Ls[d3]), this.$d = function(e4, t4, n3) {
  22150. try {
  22151. if (["x", "X"].indexOf(t4) > -1)
  22152. return new Date(("X" === t4 ? 1e3 : 1) * e4);
  22153. var r4 = c2(t4)(e4), i3 = r4.year, o3 = r4.month, s4 = r4.day, a4 = r4.hours, f4 = r4.minutes, h4 = r4.seconds, u4 = r4.milliseconds, d4 = r4.zone, l3 = /* @__PURE__ */ new Date(), m3 = s4 || (i3 || o3 ? 1 : l3.getDate()), M3 = i3 || l3.getFullYear(), Y2 = 0;
  22154. i3 && !o3 || (Y2 = o3 > 0 ? o3 - 1 : l3.getMonth());
  22155. var p2 = a4 || 0, v2 = f4 || 0, D2 = h4 || 0, g = u4 || 0;
  22156. return d4 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g + 60 * d4.offset * 1e3)) : n3 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g)) : new Date(M3, Y2, m3, p2, v2, D2, g);
  22157. } catch (e5) {
  22158. return /* @__PURE__ */ new Date("");
  22159. }
  22160. }(t3, a3, r3), this.init(), d3 && true !== d3 && (this.$L = this.locale(d3).$L), u3 && t3 != this.format(a3) && (this.$d = /* @__PURE__ */ new Date("")), o2 = {};
  22161. } else if (a3 instanceof Array)
  22162. for (var l2 = a3.length, m2 = 1; m2 <= l2; m2 += 1) {
  22163. s3[1] = a3[m2 - 1];
  22164. var M2 = n2.apply(this, s3);
  22165. if (M2.isValid()) {
  22166. this.$d = M2.$d, this.$L = M2.$L, this.init();
  22167. break;
  22168. }
  22169. m2 === l2 && (this.$d = /* @__PURE__ */ new Date(""));
  22170. }
  22171. else
  22172. i2.call(this, e3);
  22173. };
  22174. };
  22175. });
  22176. })(customParseFormat$1);
  22177. var customParseFormatExports = customParseFormat$1.exports;
  22178. const customParseFormat = /* @__PURE__ */ getDefaultExportFromCjs(customParseFormatExports);
  22179. const timeUnits$1 = ["hours", "minutes", "seconds"];
  22180. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  22181. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  22182. const DEFAULT_FORMATS_DATEPICKER = {
  22183. date: DEFAULT_FORMATS_DATE,
  22184. dates: DEFAULT_FORMATS_DATE,
  22185. week: "gggg[w]ww",
  22186. year: "YYYY",
  22187. month: "YYYY-MM",
  22188. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  22189. monthrange: "YYYY-MM",
  22190. daterange: DEFAULT_FORMATS_DATE,
  22191. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  22192. };
  22193. const buildTimeList = (value, bound) => {
  22194. return [
  22195. value > 0 ? value - 1 : void 0,
  22196. value,
  22197. value < bound ? value + 1 : void 0
  22198. ];
  22199. };
  22200. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  22201. const extractDateFormat = (format2) => {
  22202. return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  22203. };
  22204. const extractTimeFormat = (format2) => {
  22205. return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  22206. };
  22207. const dateEquals = function(a2, b2) {
  22208. const aIsDate = isDate(a2);
  22209. const bIsDate = isDate(b2);
  22210. if (aIsDate && bIsDate) {
  22211. return a2.getTime() === b2.getTime();
  22212. }
  22213. if (!aIsDate && !bIsDate) {
  22214. return a2 === b2;
  22215. }
  22216. return false;
  22217. };
  22218. const valueEquals = function(a2, b2) {
  22219. const aIsArray = isArray$3(a2);
  22220. const bIsArray = isArray$3(b2);
  22221. if (aIsArray && bIsArray) {
  22222. if (a2.length !== b2.length) {
  22223. return false;
  22224. }
  22225. return a2.every((item, index2) => dateEquals(item, b2[index2]));
  22226. }
  22227. if (!aIsArray && !bIsArray) {
  22228. return dateEquals(a2, b2);
  22229. }
  22230. return false;
  22231. };
  22232. const parseDate = function(date2, format2, lang) {
  22233. const day = isEmpty(format2) || format2 === "x" ? dayjs(date2).locale(lang) : dayjs(date2, format2).locale(lang);
  22234. return day.isValid() ? day : void 0;
  22235. };
  22236. const formatter = function(date2, format2, lang) {
  22237. if (isEmpty(format2))
  22238. return date2;
  22239. if (format2 === "x")
  22240. return +date2;
  22241. return dayjs(date2).locale(lang).format(format2);
  22242. };
  22243. const makeList = (total2, method2) => {
  22244. var _a2;
  22245. const arr = [];
  22246. const disabledArr = method2 == null ? void 0 : method2();
  22247. for (let i = 0; i < total2; i++) {
  22248. arr.push((_a2 = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a2 : false);
  22249. }
  22250. return arr;
  22251. };
  22252. const disabledTimeListsProps = buildProps({
  22253. disabledHours: {
  22254. type: definePropType(Function)
  22255. },
  22256. disabledMinutes: {
  22257. type: definePropType(Function)
  22258. },
  22259. disabledSeconds: {
  22260. type: definePropType(Function)
  22261. }
  22262. });
  22263. const timePanelSharedProps = buildProps({
  22264. visible: Boolean,
  22265. actualVisible: {
  22266. type: Boolean,
  22267. default: void 0
  22268. },
  22269. format: {
  22270. type: String,
  22271. default: ""
  22272. }
  22273. });
  22274. const timePickerDefaultProps = buildProps({
  22275. id: {
  22276. type: definePropType([Array, String])
  22277. },
  22278. name: {
  22279. type: definePropType([Array, String]),
  22280. default: ""
  22281. },
  22282. popperClass: {
  22283. type: String,
  22284. default: ""
  22285. },
  22286. format: String,
  22287. valueFormat: String,
  22288. dateFormat: String,
  22289. timeFormat: String,
  22290. type: {
  22291. type: String,
  22292. default: ""
  22293. },
  22294. clearable: {
  22295. type: Boolean,
  22296. default: true
  22297. },
  22298. clearIcon: {
  22299. type: definePropType([String, Object]),
  22300. default: circle_close_default
  22301. },
  22302. editable: {
  22303. type: Boolean,
  22304. default: true
  22305. },
  22306. prefixIcon: {
  22307. type: definePropType([String, Object]),
  22308. default: ""
  22309. },
  22310. size: useSizeProp,
  22311. readonly: Boolean,
  22312. disabled: Boolean,
  22313. placeholder: {
  22314. type: String,
  22315. default: ""
  22316. },
  22317. popperOptions: {
  22318. type: definePropType(Object),
  22319. default: () => ({})
  22320. },
  22321. modelValue: {
  22322. type: definePropType([Date, Array, String, Number]),
  22323. default: ""
  22324. },
  22325. rangeSeparator: {
  22326. type: String,
  22327. default: "-"
  22328. },
  22329. startPlaceholder: String,
  22330. endPlaceholder: String,
  22331. defaultValue: {
  22332. type: definePropType([Date, Array])
  22333. },
  22334. defaultTime: {
  22335. type: definePropType([Date, Array])
  22336. },
  22337. isRange: Boolean,
  22338. ...disabledTimeListsProps,
  22339. disabledDate: {
  22340. type: Function
  22341. },
  22342. cellClassName: {
  22343. type: Function
  22344. },
  22345. shortcuts: {
  22346. type: Array,
  22347. default: () => []
  22348. },
  22349. arrowControl: Boolean,
  22350. label: {
  22351. type: String,
  22352. default: void 0
  22353. },
  22354. tabindex: {
  22355. type: definePropType([String, Number]),
  22356. default: 0
  22357. },
  22358. validateEvent: {
  22359. type: Boolean,
  22360. default: true
  22361. },
  22362. unlinkPanels: Boolean
  22363. });
  22364. const _hoisted_1$$ = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  22365. const _hoisted_2$F = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  22366. const __default__$1h = /* @__PURE__ */ defineComponent({
  22367. name: "Picker"
  22368. });
  22369. const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
  22370. ...__default__$1h,
  22371. props: timePickerDefaultProps,
  22372. emits: [
  22373. "update:modelValue",
  22374. "change",
  22375. "focus",
  22376. "blur",
  22377. "calendar-change",
  22378. "panel-change",
  22379. "visible-change",
  22380. "keydown"
  22381. ],
  22382. setup(__props, { expose, emit: emit2 }) {
  22383. const props = __props;
  22384. const attrs = useAttrs$1();
  22385. const { lang } = useLocale();
  22386. const nsDate = useNamespace("date");
  22387. const nsInput = useNamespace("input");
  22388. const nsRange = useNamespace("range");
  22389. const { form, formItem } = useFormItem();
  22390. const elPopperOptions = inject("ElPopperOptions", {});
  22391. const refPopper = ref();
  22392. const inputRef = ref();
  22393. const pickerVisible = ref(false);
  22394. const pickerActualVisible = ref(false);
  22395. const valueOnOpen = ref(null);
  22396. let hasJustTabExitedInput = false;
  22397. let ignoreFocusEvent = false;
  22398. const rangeInputKls = computed(() => [
  22399. nsDate.b("editor"),
  22400. nsDate.bm("editor", props.type),
  22401. nsInput.e("wrapper"),
  22402. nsDate.is("disabled", pickerDisabled.value),
  22403. nsDate.is("active", pickerVisible.value),
  22404. nsRange.b("editor"),
  22405. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  22406. attrs.class
  22407. ]);
  22408. const clearIconKls = computed(() => [
  22409. nsInput.e("icon"),
  22410. nsRange.e("close-icon"),
  22411. !showClose.value ? nsRange.e("close-icon--hidden") : ""
  22412. ]);
  22413. watch(pickerVisible, (val) => {
  22414. if (!val) {
  22415. userInput.value = null;
  22416. nextTick(() => {
  22417. emitChange(props.modelValue);
  22418. });
  22419. } else {
  22420. nextTick(() => {
  22421. if (val) {
  22422. valueOnOpen.value = props.modelValue;
  22423. }
  22424. });
  22425. }
  22426. });
  22427. const emitChange = (val, isClear) => {
  22428. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  22429. emit2("change", val);
  22430. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  22431. }
  22432. };
  22433. const emitInput = (input) => {
  22434. if (!valueEquals(props.modelValue, input)) {
  22435. let formatted;
  22436. if (isArray$3(input)) {
  22437. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  22438. } else if (input) {
  22439. formatted = formatter(input, props.valueFormat, lang.value);
  22440. }
  22441. emit2("update:modelValue", input ? formatted : input, lang.value);
  22442. }
  22443. };
  22444. const emitKeydown = (e) => {
  22445. emit2("keydown", e);
  22446. };
  22447. const refInput = computed(() => {
  22448. if (inputRef.value) {
  22449. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  22450. return Array.from(_r.querySelectorAll("input"));
  22451. }
  22452. return [];
  22453. });
  22454. const setSelectionRange = (start, end2, pos) => {
  22455. const _inputs = refInput.value;
  22456. if (!_inputs.length)
  22457. return;
  22458. if (!pos || pos === "min") {
  22459. _inputs[0].setSelectionRange(start, end2);
  22460. _inputs[0].focus();
  22461. } else if (pos === "max") {
  22462. _inputs[1].setSelectionRange(start, end2);
  22463. _inputs[1].focus();
  22464. }
  22465. };
  22466. const focusOnInputBox = () => {
  22467. focus(true, true);
  22468. nextTick(() => {
  22469. ignoreFocusEvent = false;
  22470. });
  22471. };
  22472. const onPick = (date2 = "", visible = false) => {
  22473. if (!visible) {
  22474. ignoreFocusEvent = true;
  22475. }
  22476. pickerVisible.value = visible;
  22477. let result;
  22478. if (isArray$3(date2)) {
  22479. result = date2.map((_2) => _2.toDate());
  22480. } else {
  22481. result = date2 ? date2.toDate() : date2;
  22482. }
  22483. userInput.value = null;
  22484. emitInput(result);
  22485. };
  22486. const onBeforeShow = () => {
  22487. pickerActualVisible.value = true;
  22488. };
  22489. const onShow = () => {
  22490. emit2("visible-change", true);
  22491. };
  22492. const onKeydownPopperContent = (event) => {
  22493. if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) {
  22494. focus(true, true);
  22495. }
  22496. };
  22497. const onHide = () => {
  22498. pickerActualVisible.value = false;
  22499. pickerVisible.value = false;
  22500. ignoreFocusEvent = false;
  22501. emit2("visible-change", false);
  22502. };
  22503. const handleOpen = () => {
  22504. pickerVisible.value = true;
  22505. };
  22506. const handleClose = () => {
  22507. pickerVisible.value = false;
  22508. };
  22509. const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => {
  22510. ignoreFocusEvent = isIgnoreFocusEvent;
  22511. const [leftInput, rightInput] = unref(refInput);
  22512. let input = leftInput;
  22513. if (!focusStartInput && isRangeInput.value) {
  22514. input = rightInput;
  22515. }
  22516. if (input) {
  22517. input.focus();
  22518. }
  22519. };
  22520. const handleFocusInput = (e) => {
  22521. if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) {
  22522. return;
  22523. }
  22524. pickerVisible.value = true;
  22525. emit2("focus", e);
  22526. };
  22527. let currentHandleBlurDeferCallback = void 0;
  22528. const handleBlurInput = (e) => {
  22529. const handleBlurDefer = async () => {
  22530. setTimeout(() => {
  22531. var _a2;
  22532. if (currentHandleBlurDeferCallback === handleBlurDefer) {
  22533. if (!(((_a2 = refPopper.value) == null ? void 0 : _a2.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((input) => {
  22534. return input.contains(document.activeElement);
  22535. }).length === 0) {
  22536. handleChange();
  22537. pickerVisible.value = false;
  22538. emit2("blur", e);
  22539. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  22540. }
  22541. hasJustTabExitedInput = false;
  22542. }
  22543. }, 0);
  22544. };
  22545. currentHandleBlurDeferCallback = handleBlurDefer;
  22546. handleBlurDefer();
  22547. };
  22548. const pickerDisabled = computed(() => {
  22549. return props.disabled || (form == null ? void 0 : form.disabled);
  22550. });
  22551. const parsedValue2 = computed(() => {
  22552. let dayOrDays;
  22553. if (valueIsEmpty.value) {
  22554. if (pickerOptions.value.getDefaultValue) {
  22555. dayOrDays = pickerOptions.value.getDefaultValue();
  22556. }
  22557. } else {
  22558. if (isArray$3(props.modelValue)) {
  22559. dayOrDays = props.modelValue.map((d2) => parseDate(d2, props.valueFormat, lang.value));
  22560. } else {
  22561. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  22562. }
  22563. }
  22564. if (pickerOptions.value.getRangeAvailableTime) {
  22565. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  22566. if (!isEqual$1(availableResult, dayOrDays)) {
  22567. dayOrDays = availableResult;
  22568. emitInput(isArray$3(dayOrDays) ? dayOrDays.map((_2) => _2.toDate()) : dayOrDays.toDate());
  22569. }
  22570. }
  22571. if (isArray$3(dayOrDays) && dayOrDays.some((day) => !day)) {
  22572. dayOrDays = [];
  22573. }
  22574. return dayOrDays;
  22575. });
  22576. const displayValue = computed(() => {
  22577. if (!pickerOptions.value.panelReady)
  22578. return "";
  22579. const formattedValue = formatDayjsToString(parsedValue2.value);
  22580. if (isArray$3(userInput.value)) {
  22581. return [
  22582. userInput.value[0] || formattedValue && formattedValue[0] || "",
  22583. userInput.value[1] || formattedValue && formattedValue[1] || ""
  22584. ];
  22585. } else if (userInput.value !== null) {
  22586. return userInput.value;
  22587. }
  22588. if (!isTimePicker.value && valueIsEmpty.value)
  22589. return "";
  22590. if (!pickerVisible.value && valueIsEmpty.value)
  22591. return "";
  22592. if (formattedValue) {
  22593. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  22594. }
  22595. return "";
  22596. });
  22597. const isTimeLikePicker = computed(() => props.type.includes("time"));
  22598. const isTimePicker = computed(() => props.type.startsWith("time"));
  22599. const isDatesPicker = computed(() => props.type === "dates");
  22600. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  22601. const showClose = ref(false);
  22602. const onClearIconClick = (event) => {
  22603. if (props.readonly || pickerDisabled.value)
  22604. return;
  22605. if (showClose.value) {
  22606. event.stopPropagation();
  22607. focusOnInputBox();
  22608. emitInput(null);
  22609. emitChange(null, true);
  22610. showClose.value = false;
  22611. pickerVisible.value = false;
  22612. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  22613. }
  22614. };
  22615. const valueIsEmpty = computed(() => {
  22616. const { modelValue } = props;
  22617. return !modelValue || isArray$3(modelValue) && !modelValue.filter(Boolean).length;
  22618. });
  22619. const onMouseDownInput = async (event) => {
  22620. var _a2;
  22621. if (props.readonly || pickerDisabled.value)
  22622. return;
  22623. if (((_a2 = event.target) == null ? void 0 : _a2.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  22624. pickerVisible.value = true;
  22625. }
  22626. };
  22627. const onMouseEnter = () => {
  22628. if (props.readonly || pickerDisabled.value)
  22629. return;
  22630. if (!valueIsEmpty.value && props.clearable) {
  22631. showClose.value = true;
  22632. }
  22633. };
  22634. const onMouseLeave = () => {
  22635. showClose.value = false;
  22636. };
  22637. const onTouchStartInput = (event) => {
  22638. var _a2;
  22639. if (props.readonly || pickerDisabled.value)
  22640. return;
  22641. if (((_a2 = event.touches[0].target) == null ? void 0 : _a2.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  22642. pickerVisible.value = true;
  22643. }
  22644. };
  22645. const isRangeInput = computed(() => {
  22646. return props.type.includes("range");
  22647. });
  22648. const pickerSize = useFormSize();
  22649. const popperEl = computed(() => {
  22650. var _a2, _b;
  22651. return (_b = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  22652. });
  22653. const actualInputRef = computed(() => {
  22654. var _a2;
  22655. if (unref(isRangeInput)) {
  22656. return unref(inputRef);
  22657. }
  22658. return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
  22659. });
  22660. onClickOutside(actualInputRef, (e) => {
  22661. const unrefedPopperEl = unref(popperEl);
  22662. const inputEl = unref(actualInputRef);
  22663. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  22664. return;
  22665. pickerVisible.value = false;
  22666. });
  22667. const userInput = ref(null);
  22668. const handleChange = () => {
  22669. if (userInput.value) {
  22670. const value = parseUserInputToDayjs(displayValue.value);
  22671. if (value) {
  22672. if (isValidValue2(value)) {
  22673. emitInput(isArray$3(value) ? value.map((_2) => _2.toDate()) : value.toDate());
  22674. userInput.value = null;
  22675. }
  22676. }
  22677. }
  22678. if (userInput.value === "") {
  22679. emitInput(null);
  22680. emitChange(null);
  22681. userInput.value = null;
  22682. }
  22683. };
  22684. const parseUserInputToDayjs = (value) => {
  22685. if (!value)
  22686. return null;
  22687. return pickerOptions.value.parseUserInput(value);
  22688. };
  22689. const formatDayjsToString = (value) => {
  22690. if (!value)
  22691. return null;
  22692. return pickerOptions.value.formatToString(value);
  22693. };
  22694. const isValidValue2 = (value) => {
  22695. return pickerOptions.value.isValidValue(value);
  22696. };
  22697. const handleKeydownInput = async (event) => {
  22698. if (props.readonly || pickerDisabled.value)
  22699. return;
  22700. const { code } = event;
  22701. emitKeydown(event);
  22702. if (code === EVENT_CODE.esc) {
  22703. if (pickerVisible.value === true) {
  22704. pickerVisible.value = false;
  22705. event.preventDefault();
  22706. event.stopPropagation();
  22707. }
  22708. return;
  22709. }
  22710. if (code === EVENT_CODE.down) {
  22711. if (pickerOptions.value.handleFocusPicker) {
  22712. event.preventDefault();
  22713. event.stopPropagation();
  22714. }
  22715. if (pickerVisible.value === false) {
  22716. pickerVisible.value = true;
  22717. await nextTick();
  22718. }
  22719. if (pickerOptions.value.handleFocusPicker) {
  22720. pickerOptions.value.handleFocusPicker();
  22721. return;
  22722. }
  22723. }
  22724. if (code === EVENT_CODE.tab) {
  22725. hasJustTabExitedInput = true;
  22726. return;
  22727. }
  22728. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  22729. if (userInput.value === null || userInput.value === "" || isValidValue2(parseUserInputToDayjs(displayValue.value))) {
  22730. handleChange();
  22731. pickerVisible.value = false;
  22732. }
  22733. event.stopPropagation();
  22734. return;
  22735. }
  22736. if (userInput.value) {
  22737. event.stopPropagation();
  22738. return;
  22739. }
  22740. if (pickerOptions.value.handleKeydownInput) {
  22741. pickerOptions.value.handleKeydownInput(event);
  22742. }
  22743. };
  22744. const onUserInput = (e) => {
  22745. userInput.value = e;
  22746. if (!pickerVisible.value) {
  22747. pickerVisible.value = true;
  22748. }
  22749. };
  22750. const handleStartInput = (event) => {
  22751. const target = event.target;
  22752. if (userInput.value) {
  22753. userInput.value = [target.value, userInput.value[1]];
  22754. } else {
  22755. userInput.value = [target.value, null];
  22756. }
  22757. };
  22758. const handleEndInput = (event) => {
  22759. const target = event.target;
  22760. if (userInput.value) {
  22761. userInput.value = [userInput.value[0], target.value];
  22762. } else {
  22763. userInput.value = [null, target.value];
  22764. }
  22765. };
  22766. const handleStartChange = () => {
  22767. var _a2;
  22768. const values = userInput.value;
  22769. const value = parseUserInputToDayjs(values && values[0]);
  22770. const parsedVal = unref(parsedValue2);
  22771. if (value && value.isValid()) {
  22772. userInput.value = [
  22773. formatDayjsToString(value),
  22774. ((_a2 = displayValue.value) == null ? void 0 : _a2[1]) || null
  22775. ];
  22776. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  22777. if (isValidValue2(newValue)) {
  22778. emitInput(newValue);
  22779. userInput.value = null;
  22780. }
  22781. }
  22782. };
  22783. const handleEndChange = () => {
  22784. var _a2;
  22785. const values = unref(userInput);
  22786. const value = parseUserInputToDayjs(values && values[1]);
  22787. const parsedVal = unref(parsedValue2);
  22788. if (value && value.isValid()) {
  22789. userInput.value = [
  22790. ((_a2 = unref(displayValue)) == null ? void 0 : _a2[0]) || null,
  22791. formatDayjsToString(value)
  22792. ];
  22793. const newValue = [parsedVal && parsedVal[0], value];
  22794. if (isValidValue2(newValue)) {
  22795. emitInput(newValue);
  22796. userInput.value = null;
  22797. }
  22798. }
  22799. };
  22800. const pickerOptions = ref({});
  22801. const onSetPickerOption = (e) => {
  22802. pickerOptions.value[e[0]] = e[1];
  22803. pickerOptions.value.panelReady = true;
  22804. };
  22805. const onCalendarChange = (e) => {
  22806. emit2("calendar-change", e);
  22807. };
  22808. const onPanelChange = (value, mode, view) => {
  22809. emit2("panel-change", value, mode, view);
  22810. };
  22811. provide("EP_PICKER_BASE", {
  22812. props
  22813. });
  22814. expose({
  22815. focus,
  22816. handleFocusInput,
  22817. handleBlurInput,
  22818. handleOpen,
  22819. handleClose,
  22820. onPick
  22821. });
  22822. return (_ctx, _cache) => {
  22823. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  22824. ref_key: "refPopper",
  22825. ref: refPopper,
  22826. visible: pickerVisible.value,
  22827. effect: "light",
  22828. pure: "",
  22829. trigger: "click"
  22830. }, _ctx.$attrs, {
  22831. role: "dialog",
  22832. teleported: "",
  22833. transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
  22834. "popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  22835. "popper-options": unref(elPopperOptions),
  22836. "fallback-placements": ["bottom", "top", "right", "left"],
  22837. "gpu-acceleration": false,
  22838. "stop-popper-mouse-event": false,
  22839. "hide-after": 0,
  22840. persistent: "",
  22841. onBeforeShow,
  22842. onShow,
  22843. onHide
  22844. }), {
  22845. default: withCtx(() => [
  22846. !unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
  22847. key: 0,
  22848. id: _ctx.id,
  22849. ref_key: "inputRef",
  22850. ref: inputRef,
  22851. "container-role": "combobox",
  22852. "model-value": unref(displayValue),
  22853. name: _ctx.name,
  22854. size: unref(pickerSize),
  22855. disabled: unref(pickerDisabled),
  22856. placeholder: _ctx.placeholder,
  22857. class: normalizeClass([unref(nsDate).b("editor"), unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  22858. style: normalizeStyle(_ctx.$attrs.style),
  22859. readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || _ctx.type === "week",
  22860. label: _ctx.label,
  22861. tabindex: _ctx.tabindex,
  22862. "validate-event": false,
  22863. onInput: onUserInput,
  22864. onFocus: handleFocusInput,
  22865. onBlur: handleBlurInput,
  22866. onKeydown: handleKeydownInput,
  22867. onChange: handleChange,
  22868. onMousedown: onMouseDownInput,
  22869. onMouseenter: onMouseEnter,
  22870. onMouseleave: onMouseLeave,
  22871. onTouchstart: onTouchStartInput,
  22872. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  22873. }, ["stop"]))
  22874. }, {
  22875. prefix: withCtx(() => [
  22876. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  22877. key: 0,
  22878. class: normalizeClass(unref(nsInput).e("icon")),
  22879. onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
  22880. onTouchstart: onTouchStartInput
  22881. }, {
  22882. default: withCtx(() => [
  22883. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  22884. ]),
  22885. _: 1
  22886. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  22887. ]),
  22888. suffix: withCtx(() => [
  22889. showClose.value && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  22890. key: 0,
  22891. class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
  22892. onClick: withModifiers(onClearIconClick, ["stop"])
  22893. }, {
  22894. default: withCtx(() => [
  22895. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  22896. ]),
  22897. _: 1
  22898. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22899. ]),
  22900. _: 1
  22901. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "label", "tabindex", "onKeydown"])) : (openBlock(), createElementBlock("div", {
  22902. key: 1,
  22903. ref_key: "inputRef",
  22904. ref: inputRef,
  22905. class: normalizeClass(unref(rangeInputKls)),
  22906. style: normalizeStyle(_ctx.$attrs.style),
  22907. onClick: handleFocusInput,
  22908. onMouseenter: onMouseEnter,
  22909. onMouseleave: onMouseLeave,
  22910. onTouchstart: onTouchStartInput,
  22911. onKeydown: handleKeydownInput
  22912. }, [
  22913. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  22914. key: 0,
  22915. class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")]),
  22916. onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
  22917. onTouchstart: onTouchStartInput
  22918. }, {
  22919. default: withCtx(() => [
  22920. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  22921. ]),
  22922. _: 1
  22923. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  22924. createBaseVNode("input", {
  22925. id: _ctx.id && _ctx.id[0],
  22926. autocomplete: "off",
  22927. name: _ctx.name && _ctx.name[0],
  22928. placeholder: _ctx.startPlaceholder,
  22929. value: unref(displayValue) && unref(displayValue)[0],
  22930. disabled: unref(pickerDisabled),
  22931. readonly: !_ctx.editable || _ctx.readonly,
  22932. class: normalizeClass(unref(nsRange).b("input")),
  22933. onMousedown: onMouseDownInput,
  22934. onInput: handleStartInput,
  22935. onChange: handleStartChange,
  22936. onFocus: handleFocusInput,
  22937. onBlur: handleBlurInput
  22938. }, null, 42, _hoisted_1$$),
  22939. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  22940. createBaseVNode("span", {
  22941. class: normalizeClass(unref(nsRange).b("separator"))
  22942. }, toDisplayString(_ctx.rangeSeparator), 3)
  22943. ]),
  22944. createBaseVNode("input", {
  22945. id: _ctx.id && _ctx.id[1],
  22946. autocomplete: "off",
  22947. name: _ctx.name && _ctx.name[1],
  22948. placeholder: _ctx.endPlaceholder,
  22949. value: unref(displayValue) && unref(displayValue)[1],
  22950. disabled: unref(pickerDisabled),
  22951. readonly: !_ctx.editable || _ctx.readonly,
  22952. class: normalizeClass(unref(nsRange).b("input")),
  22953. onMousedown: onMouseDownInput,
  22954. onFocus: handleFocusInput,
  22955. onBlur: handleBlurInput,
  22956. onInput: handleEndInput,
  22957. onChange: handleEndChange
  22958. }, null, 42, _hoisted_2$F),
  22959. _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  22960. key: 1,
  22961. class: normalizeClass(unref(clearIconKls)),
  22962. onClick: onClearIconClick
  22963. }, {
  22964. default: withCtx(() => [
  22965. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  22966. ]),
  22967. _: 1
  22968. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22969. ], 38))
  22970. ]),
  22971. content: withCtx(() => [
  22972. renderSlot(_ctx.$slots, "default", {
  22973. visible: pickerVisible.value,
  22974. actualVisible: pickerActualVisible.value,
  22975. parsedValue: unref(parsedValue2),
  22976. format: _ctx.format,
  22977. dateFormat: _ctx.dateFormat,
  22978. timeFormat: _ctx.timeFormat,
  22979. unlinkPanels: _ctx.unlinkPanels,
  22980. type: _ctx.type,
  22981. defaultValue: _ctx.defaultValue,
  22982. onPick,
  22983. onSelectRange: setSelectionRange,
  22984. onSetPickerOption,
  22985. onCalendarChange,
  22986. onPanelChange,
  22987. onKeydown: onKeydownPopperContent,
  22988. onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
  22989. }, ["stop"]))
  22990. })
  22991. ]),
  22992. _: 3
  22993. }, 16, ["visible", "transition", "popper-class", "popper-options"]);
  22994. };
  22995. }
  22996. });
  22997. var CommonPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$1_, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
  22998. const panelTimePickerProps = buildProps({
  22999. ...timePanelSharedProps,
  23000. datetimeRole: String,
  23001. parsedValue: {
  23002. type: definePropType(Object)
  23003. }
  23004. });
  23005. const useTimePanel = ({
  23006. getAvailableHours,
  23007. getAvailableMinutes,
  23008. getAvailableSeconds
  23009. }) => {
  23010. const getAvailableTime = (date2, role, first, compareDate) => {
  23011. const availableTimeGetters = {
  23012. hour: getAvailableHours,
  23013. minute: getAvailableMinutes,
  23014. second: getAvailableSeconds
  23015. };
  23016. let result = date2;
  23017. ["hour", "minute", "second"].forEach((type2) => {
  23018. if (availableTimeGetters[type2]) {
  23019. let availableTimeSlots;
  23020. const method2 = availableTimeGetters[type2];
  23021. switch (type2) {
  23022. case "minute": {
  23023. availableTimeSlots = method2(result.hour(), role, compareDate);
  23024. break;
  23025. }
  23026. case "second": {
  23027. availableTimeSlots = method2(result.hour(), result.minute(), role, compareDate);
  23028. break;
  23029. }
  23030. default: {
  23031. availableTimeSlots = method2(role, compareDate);
  23032. break;
  23033. }
  23034. }
  23035. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type2]())) {
  23036. const pos = first ? 0 : availableTimeSlots.length - 1;
  23037. result = result[type2](availableTimeSlots[pos]);
  23038. }
  23039. }
  23040. });
  23041. return result;
  23042. };
  23043. const timePickerOptions = {};
  23044. const onSetOption = ([key, val]) => {
  23045. timePickerOptions[key] = val;
  23046. };
  23047. return {
  23048. timePickerOptions,
  23049. getAvailableTime,
  23050. onSetOption
  23051. };
  23052. };
  23053. const makeAvailableArr = (disabledList) => {
  23054. const trueOrNumber = (isDisabled, index2) => isDisabled || index2;
  23055. const getNumber = (predicate) => predicate !== true;
  23056. return disabledList.map(trueOrNumber).filter(getNumber);
  23057. };
  23058. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  23059. const getHoursList = (role, compare) => {
  23060. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  23061. };
  23062. const getMinutesList = (hour, role, compare) => {
  23063. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  23064. };
  23065. const getSecondsList = (hour, minute, role, compare) => {
  23066. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  23067. };
  23068. return {
  23069. getHoursList,
  23070. getMinutesList,
  23071. getSecondsList
  23072. };
  23073. };
  23074. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  23075. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  23076. const getAvailableHours = (role, compare) => {
  23077. return makeAvailableArr(getHoursList(role, compare));
  23078. };
  23079. const getAvailableMinutes = (hour, role, compare) => {
  23080. return makeAvailableArr(getMinutesList(hour, role, compare));
  23081. };
  23082. const getAvailableSeconds = (hour, minute, role, compare) => {
  23083. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  23084. };
  23085. return {
  23086. getAvailableHours,
  23087. getAvailableMinutes,
  23088. getAvailableSeconds
  23089. };
  23090. };
  23091. const useOldValue = (props) => {
  23092. const oldValue = ref(props.parsedValue);
  23093. watch(() => props.visible, (val) => {
  23094. if (!val) {
  23095. oldValue.value = props.parsedValue;
  23096. }
  23097. });
  23098. return oldValue;
  23099. };
  23100. const nodeList = /* @__PURE__ */ new Map();
  23101. let startClick;
  23102. if (isClient) {
  23103. document.addEventListener("mousedown", (e) => startClick = e);
  23104. document.addEventListener("mouseup", (e) => {
  23105. for (const handlers of nodeList.values()) {
  23106. for (const { documentHandler } of handlers) {
  23107. documentHandler(e, startClick);
  23108. }
  23109. }
  23110. });
  23111. }
  23112. function createDocumentHandler(el, binding) {
  23113. let excludes = [];
  23114. if (Array.isArray(binding.arg)) {
  23115. excludes = binding.arg;
  23116. } else if (isElement$1(binding.arg)) {
  23117. excludes.push(binding.arg);
  23118. }
  23119. return function(mouseup, mousedown) {
  23120. const popperRef = binding.instance.popperRef;
  23121. const mouseUpTarget = mouseup.target;
  23122. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  23123. const isBound = !binding || !binding.instance;
  23124. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  23125. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  23126. const isSelf = el === mouseUpTarget;
  23127. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  23128. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  23129. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  23130. return;
  23131. }
  23132. binding.value(mouseup, mousedown);
  23133. };
  23134. }
  23135. const ClickOutside = {
  23136. beforeMount(el, binding) {
  23137. if (!nodeList.has(el)) {
  23138. nodeList.set(el, []);
  23139. }
  23140. nodeList.get(el).push({
  23141. documentHandler: createDocumentHandler(el, binding),
  23142. bindingFn: binding.value
  23143. });
  23144. },
  23145. updated(el, binding) {
  23146. if (!nodeList.has(el)) {
  23147. nodeList.set(el, []);
  23148. }
  23149. const handlers = nodeList.get(el);
  23150. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  23151. const newHandler = {
  23152. documentHandler: createDocumentHandler(el, binding),
  23153. bindingFn: binding.value
  23154. };
  23155. if (oldHandlerIndex >= 0) {
  23156. handlers.splice(oldHandlerIndex, 1, newHandler);
  23157. } else {
  23158. handlers.push(newHandler);
  23159. }
  23160. },
  23161. unmounted(el) {
  23162. nodeList.delete(el);
  23163. }
  23164. };
  23165. const REPEAT_INTERVAL = 100;
  23166. const REPEAT_DELAY = 600;
  23167. const vRepeatClick = {
  23168. beforeMount(el, binding) {
  23169. const value = binding.value;
  23170. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$2(value) ? {} : value;
  23171. let intervalId;
  23172. let delayId;
  23173. const handler = () => isFunction$2(value) ? value() : value.handler();
  23174. const clear2 = () => {
  23175. if (delayId) {
  23176. clearTimeout(delayId);
  23177. delayId = void 0;
  23178. }
  23179. if (intervalId) {
  23180. clearInterval(intervalId);
  23181. intervalId = void 0;
  23182. }
  23183. };
  23184. el.addEventListener("mousedown", (evt) => {
  23185. if (evt.button !== 0)
  23186. return;
  23187. clear2();
  23188. handler();
  23189. document.addEventListener("mouseup", () => clear2(), {
  23190. once: true
  23191. });
  23192. delayId = setTimeout(() => {
  23193. intervalId = setInterval(() => {
  23194. handler();
  23195. }, interval);
  23196. }, delay);
  23197. });
  23198. }
  23199. };
  23200. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  23201. const FOCUS_STACK = [];
  23202. const FOCUS_HANDLER = (e) => {
  23203. if (FOCUS_STACK.length === 0)
  23204. return;
  23205. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  23206. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  23207. if (focusableElement.length === 1) {
  23208. e.preventDefault();
  23209. if (document.activeElement !== focusableElement[0]) {
  23210. focusableElement[0].focus();
  23211. }
  23212. return;
  23213. }
  23214. const goingBackward = e.shiftKey;
  23215. const isFirst = e.target === focusableElement[0];
  23216. const isLast = e.target === focusableElement[focusableElement.length - 1];
  23217. if (isFirst && goingBackward) {
  23218. e.preventDefault();
  23219. focusableElement[focusableElement.length - 1].focus();
  23220. }
  23221. if (isLast && !goingBackward) {
  23222. e.preventDefault();
  23223. focusableElement[0].focus();
  23224. }
  23225. }
  23226. };
  23227. const TrapFocus = {
  23228. beforeMount(el) {
  23229. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  23230. FOCUS_STACK.push(el);
  23231. if (FOCUS_STACK.length <= 1) {
  23232. document.addEventListener("keydown", FOCUS_HANDLER);
  23233. }
  23234. },
  23235. updated(el) {
  23236. nextTick(() => {
  23237. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  23238. });
  23239. },
  23240. unmounted() {
  23241. FOCUS_STACK.shift();
  23242. if (FOCUS_STACK.length === 0) {
  23243. document.removeEventListener("keydown", FOCUS_HANDLER);
  23244. }
  23245. }
  23246. };
  23247. var v = false, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
  23248. function a() {
  23249. if (!v) {
  23250. v = true;
  23251. var e = navigator.userAgent, n = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e), i = /(Mac OS X)|(Windows)|(Linux)/.exec(e);
  23252. if (x = /\b(iPhone|iP[ao]d)/.exec(e), E = /\b(iP[ao]d)/.exec(e), w = /Android/i.exec(e), M = /FBAN\/\w+;/i.exec(e), F = /Mobile/i.exec(e), D = !!/Win64/.exec(e), n) {
  23253. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  23254. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  23255. N = r ? parseFloat(r[1]) + 4 : o, f = n[2] ? parseFloat(n[2]) : NaN, s = n[3] ? parseFloat(n[3]) : NaN, u = n[4] ? parseFloat(n[4]) : NaN, u ? (n = /(?:Chrome\/(\d+\.\d+))/.exec(e), d = n && n[1] ? parseFloat(n[1]) : NaN) : d = NaN;
  23256. } else
  23257. o = f = s = d = u = NaN;
  23258. if (i) {
  23259. if (i[1]) {
  23260. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  23261. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  23262. } else
  23263. l = false;
  23264. p = !!i[2], m = !!i[3];
  23265. } else
  23266. l = p = m = false;
  23267. }
  23268. }
  23269. var _ = { ie: function() {
  23270. return a() || o;
  23271. }, ieCompatibilityMode: function() {
  23272. return a() || N > o;
  23273. }, ie64: function() {
  23274. return _.ie() && D;
  23275. }, firefox: function() {
  23276. return a() || f;
  23277. }, opera: function() {
  23278. return a() || s;
  23279. }, webkit: function() {
  23280. return a() || u;
  23281. }, safari: function() {
  23282. return _.webkit();
  23283. }, chrome: function() {
  23284. return a() || d;
  23285. }, windows: function() {
  23286. return a() || p;
  23287. }, osx: function() {
  23288. return a() || l;
  23289. }, linux: function() {
  23290. return a() || m;
  23291. }, iphone: function() {
  23292. return a() || x;
  23293. }, mobile: function() {
  23294. return a() || x || E || w || F;
  23295. }, nativeApp: function() {
  23296. return a() || M;
  23297. }, android: function() {
  23298. return a() || w;
  23299. }, ipad: function() {
  23300. return a() || E;
  23301. } }, A = _;
  23302. var c = !!(typeof window < "u" && window.document && window.document.createElement), U = { canUseDOM: c, canUseWorkers: typeof Worker < "u", canUseEventListeners: c && !!(window.addEventListener || window.attachEvent), canUseViewport: c && !!window.screen, isInWorker: !c }, h = U;
  23303. var X;
  23304. h.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  23305. function S(e, n) {
  23306. if (!h.canUseDOM || n && !("addEventListener" in document))
  23307. return false;
  23308. var i = "on" + e, r = i in document;
  23309. if (!r) {
  23310. var t = document.createElement("div");
  23311. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  23312. }
  23313. return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  23314. }
  23315. var b = S;
  23316. var O = 10, I = 40, P = 800;
  23317. function T(e) {
  23318. var n = 0, i = 0, r = 0, t = 0;
  23319. return "detail" in e && (i = e.detail), "wheelDelta" in e && (i = -e.wheelDelta / 120), "wheelDeltaY" in e && (i = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (n = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (n = i, i = 0), r = n * O, t = i * O, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= I, t *= I) : (r *= P, t *= P)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), { spinX: n, spinY: i, pixelX: r, pixelY: t };
  23320. }
  23321. T.getEventType = function() {
  23322. return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
  23323. };
  23324. var Y = T;
  23325. /**
  23326. * Checks if an event is supported in the current execution environment.
  23327. *
  23328. * NOTE: This will not work correctly for non-generic events such as `change`,
  23329. * `reset`, `load`, `error`, and `select`.
  23330. *
  23331. * Borrows from Modernizr.
  23332. *
  23333. * @param {string} eventNameSuffix Event name, e.g. "click".
  23334. * @param {?boolean} capture Check if the capture phase is supported.
  23335. * @return {boolean} True if the event is supported.
  23336. * @internal
  23337. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  23338. */
  23339. const mousewheel = function(element, callback) {
  23340. if (element && element.addEventListener) {
  23341. const fn2 = function(event) {
  23342. const normalized = Y(event);
  23343. callback && Reflect.apply(callback, this, [event, normalized]);
  23344. };
  23345. element.addEventListener("wheel", fn2, { passive: true });
  23346. }
  23347. };
  23348. const Mousewheel = {
  23349. beforeMount(el, binding) {
  23350. mousewheel(el, binding.value);
  23351. }
  23352. };
  23353. const basicTimeSpinnerProps = buildProps({
  23354. role: {
  23355. type: String,
  23356. required: true
  23357. },
  23358. spinnerDate: {
  23359. type: definePropType(Object),
  23360. required: true
  23361. },
  23362. showSeconds: {
  23363. type: Boolean,
  23364. default: true
  23365. },
  23366. arrowControl: Boolean,
  23367. amPmMode: {
  23368. type: definePropType(String),
  23369. default: ""
  23370. },
  23371. ...disabledTimeListsProps
  23372. });
  23373. const _hoisted_1$_ = ["onClick"];
  23374. const _hoisted_2$E = ["onMouseenter"];
  23375. const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
  23376. __name: "basic-time-spinner",
  23377. props: basicTimeSpinnerProps,
  23378. emits: ["change", "select-range", "set-option"],
  23379. setup(__props, { emit: emit2 }) {
  23380. const props = __props;
  23381. const ns = useNamespace("time");
  23382. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  23383. let isScrolling = false;
  23384. const currentScrollbar = ref();
  23385. const listHoursRef = ref();
  23386. const listMinutesRef = ref();
  23387. const listSecondsRef = ref();
  23388. const listRefsMap = {
  23389. hours: listHoursRef,
  23390. minutes: listMinutesRef,
  23391. seconds: listSecondsRef
  23392. };
  23393. const spinnerItems = computed(() => {
  23394. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  23395. });
  23396. const timePartials = computed(() => {
  23397. const { spinnerDate } = props;
  23398. const hours = spinnerDate.hour();
  23399. const minutes = spinnerDate.minute();
  23400. const seconds = spinnerDate.second();
  23401. return { hours, minutes, seconds };
  23402. });
  23403. const timeList = computed(() => {
  23404. const { hours, minutes } = unref(timePartials);
  23405. return {
  23406. hours: getHoursList(props.role),
  23407. minutes: getMinutesList(hours, props.role),
  23408. seconds: getSecondsList(hours, minutes, props.role)
  23409. };
  23410. });
  23411. const arrowControlTimeList = computed(() => {
  23412. const { hours, minutes, seconds } = unref(timePartials);
  23413. return {
  23414. hours: buildTimeList(hours, 23),
  23415. minutes: buildTimeList(minutes, 59),
  23416. seconds: buildTimeList(seconds, 59)
  23417. };
  23418. });
  23419. const debouncedResetScroll = debounce((type2) => {
  23420. isScrolling = false;
  23421. adjustCurrentSpinner(type2);
  23422. }, 200);
  23423. const getAmPmFlag = (hour) => {
  23424. const shouldShowAmPm = !!props.amPmMode;
  23425. if (!shouldShowAmPm)
  23426. return "";
  23427. const isCapital = props.amPmMode === "A";
  23428. let content = hour < 12 ? " am" : " pm";
  23429. if (isCapital)
  23430. content = content.toUpperCase();
  23431. return content;
  23432. };
  23433. const emitSelectRange = (type2) => {
  23434. let range2;
  23435. switch (type2) {
  23436. case "hours":
  23437. range2 = [0, 2];
  23438. break;
  23439. case "minutes":
  23440. range2 = [3, 5];
  23441. break;
  23442. case "seconds":
  23443. range2 = [6, 8];
  23444. break;
  23445. }
  23446. const [left2, right2] = range2;
  23447. emit2("select-range", left2, right2);
  23448. currentScrollbar.value = type2;
  23449. };
  23450. const adjustCurrentSpinner = (type2) => {
  23451. adjustSpinner(type2, unref(timePartials)[type2]);
  23452. };
  23453. const adjustSpinners = () => {
  23454. adjustCurrentSpinner("hours");
  23455. adjustCurrentSpinner("minutes");
  23456. adjustCurrentSpinner("seconds");
  23457. };
  23458. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  23459. const adjustSpinner = (type2, value) => {
  23460. if (props.arrowControl)
  23461. return;
  23462. const scrollbar = unref(listRefsMap[type2]);
  23463. if (scrollbar && scrollbar.$el) {
  23464. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type2));
  23465. }
  23466. };
  23467. const typeItemHeight = (type2) => {
  23468. const scrollbar = unref(listRefsMap[type2]);
  23469. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  23470. if (listItem) {
  23471. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  23472. }
  23473. return 0;
  23474. };
  23475. const onIncrement = () => {
  23476. scrollDown(1);
  23477. };
  23478. const onDecrement = () => {
  23479. scrollDown(-1);
  23480. };
  23481. const scrollDown = (step) => {
  23482. if (!currentScrollbar.value) {
  23483. emitSelectRange("hours");
  23484. }
  23485. const label = currentScrollbar.value;
  23486. const now2 = unref(timePartials)[label];
  23487. const total2 = currentScrollbar.value === "hours" ? 24 : 60;
  23488. const next = findNextUnDisabled(label, now2, step, total2);
  23489. modifyDateField(label, next);
  23490. adjustSpinner(label, next);
  23491. nextTick(() => emitSelectRange(label));
  23492. };
  23493. const findNextUnDisabled = (type2, now2, step, total2) => {
  23494. let next = (now2 + step + total2) % total2;
  23495. const list = unref(timeList)[type2];
  23496. while (list[next] && next !== now2) {
  23497. next = (next + step + total2) % total2;
  23498. }
  23499. return next;
  23500. };
  23501. const modifyDateField = (type2, value) => {
  23502. const list = unref(timeList)[type2];
  23503. const isDisabled = list[value];
  23504. if (isDisabled)
  23505. return;
  23506. const { hours, minutes, seconds } = unref(timePartials);
  23507. let changeTo;
  23508. switch (type2) {
  23509. case "hours":
  23510. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  23511. break;
  23512. case "minutes":
  23513. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  23514. break;
  23515. case "seconds":
  23516. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  23517. break;
  23518. }
  23519. emit2("change", changeTo);
  23520. };
  23521. const handleClick = (type2, { value, disabled }) => {
  23522. if (!disabled) {
  23523. modifyDateField(type2, value);
  23524. emitSelectRange(type2);
  23525. adjustSpinner(type2, value);
  23526. }
  23527. };
  23528. const handleScroll2 = (type2) => {
  23529. isScrolling = true;
  23530. debouncedResetScroll(type2);
  23531. const value = Math.min(Math.round((getScrollbarElement(unref(listRefsMap[type2]).$el).scrollTop - (scrollBarHeight(type2) * 0.5 - 10) / typeItemHeight(type2) + 3) / typeItemHeight(type2)), type2 === "hours" ? 23 : 59);
  23532. modifyDateField(type2, value);
  23533. };
  23534. const scrollBarHeight = (type2) => {
  23535. return unref(listRefsMap[type2]).$el.offsetHeight;
  23536. };
  23537. const bindScrollEvent = () => {
  23538. const bindFunction = (type2) => {
  23539. const scrollbar = unref(listRefsMap[type2]);
  23540. if (scrollbar && scrollbar.$el) {
  23541. getScrollbarElement(scrollbar.$el).onscroll = () => {
  23542. handleScroll2(type2);
  23543. };
  23544. }
  23545. };
  23546. bindFunction("hours");
  23547. bindFunction("minutes");
  23548. bindFunction("seconds");
  23549. };
  23550. onMounted(() => {
  23551. nextTick(() => {
  23552. !props.arrowControl && bindScrollEvent();
  23553. adjustSpinners();
  23554. if (props.role === "start")
  23555. emitSelectRange("hours");
  23556. });
  23557. });
  23558. const setRef2 = (scrollbar, type2) => {
  23559. listRefsMap[type2].value = scrollbar;
  23560. };
  23561. emit2("set-option", [`${props.role}_scrollDown`, scrollDown]);
  23562. emit2("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  23563. watch(() => props.spinnerDate, () => {
  23564. if (isScrolling)
  23565. return;
  23566. adjustSpinners();
  23567. });
  23568. return (_ctx, _cache) => {
  23569. return openBlock(), createElementBlock("div", {
  23570. class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  23571. }, [
  23572. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(spinnerItems), (item) => {
  23573. return openBlock(), createBlock(unref(ElScrollbar), {
  23574. key: item,
  23575. ref_for: true,
  23576. ref: (scrollbar) => setRef2(scrollbar, item),
  23577. class: normalizeClass(unref(ns).be("spinner", "wrapper")),
  23578. "wrap-style": "max-height: inherit;",
  23579. "view-class": unref(ns).be("spinner", "list"),
  23580. noresize: "",
  23581. tag: "ul",
  23582. onMouseenter: ($event) => emitSelectRange(item),
  23583. onMousemove: ($event) => adjustCurrentSpinner(item)
  23584. }, {
  23585. default: withCtx(() => [
  23586. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeList)[item], (disabled, key) => {
  23587. return openBlock(), createElementBlock("li", {
  23588. key,
  23589. class: normalizeClass([
  23590. unref(ns).be("spinner", "item"),
  23591. unref(ns).is("active", key === unref(timePartials)[item]),
  23592. unref(ns).is("disabled", disabled)
  23593. ]),
  23594. onClick: ($event) => handleClick(item, { value: key, disabled })
  23595. }, [
  23596. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  23597. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)
  23598. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  23599. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  23600. ], 64))
  23601. ], 10, _hoisted_1$_);
  23602. }), 128))
  23603. ]),
  23604. _: 2
  23605. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  23606. }), 128)) : createCommentVNode("v-if", true),
  23607. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(spinnerItems), (item) => {
  23608. return openBlock(), createElementBlock("div", {
  23609. key: item,
  23610. class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
  23611. onMouseenter: ($event) => emitSelectRange(item)
  23612. }, [
  23613. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  23614. class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")])
  23615. }, {
  23616. default: withCtx(() => [
  23617. createVNode(unref(arrow_up_default))
  23618. ]),
  23619. _: 1
  23620. }, 8, ["class"])), [
  23621. [unref(vRepeatClick), onDecrement]
  23622. ]),
  23623. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  23624. class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")])
  23625. }, {
  23626. default: withCtx(() => [
  23627. createVNode(unref(arrow_down_default))
  23628. ]),
  23629. _: 1
  23630. }, 8, ["class"])), [
  23631. [unref(vRepeatClick), onIncrement]
  23632. ]),
  23633. createBaseVNode("ul", {
  23634. class: normalizeClass(unref(ns).be("spinner", "list"))
  23635. }, [
  23636. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(arrowControlTimeList)[item], (time, key) => {
  23637. return openBlock(), createElementBlock("li", {
  23638. key,
  23639. class: normalizeClass([
  23640. unref(ns).be("spinner", "item"),
  23641. unref(ns).is("active", time === unref(timePartials)[item]),
  23642. unref(ns).is("disabled", unref(timeList)[item][time])
  23643. ])
  23644. }, [
  23645. typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  23646. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  23647. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)
  23648. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  23649. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  23650. ], 64))
  23651. ], 64)) : createCommentVNode("v-if", true)
  23652. ], 2);
  23653. }), 128))
  23654. ], 2)
  23655. ], 42, _hoisted_2$E);
  23656. }), 128)) : createCommentVNode("v-if", true)
  23657. ], 2);
  23658. };
  23659. }
  23660. });
  23661. var TimeSpinner = /* @__PURE__ */ _export_sfc$1(_sfc_main$1Z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
  23662. const _sfc_main$1Y = /* @__PURE__ */ defineComponent({
  23663. __name: "panel-time-pick",
  23664. props: panelTimePickerProps,
  23665. emits: ["pick", "select-range", "set-picker-option"],
  23666. setup(__props, { emit: emit2 }) {
  23667. const props = __props;
  23668. const pickerBase = inject("EP_PICKER_BASE");
  23669. const {
  23670. arrowControl,
  23671. disabledHours,
  23672. disabledMinutes,
  23673. disabledSeconds,
  23674. defaultValue
  23675. } = pickerBase.props;
  23676. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  23677. const ns = useNamespace("time");
  23678. const { t, lang } = useLocale();
  23679. const selectionRange = ref([0, 2]);
  23680. const oldValue = useOldValue(props);
  23681. const transitionName = computed(() => {
  23682. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  23683. });
  23684. const showSeconds = computed(() => {
  23685. return props.format.includes("ss");
  23686. });
  23687. const amPmMode = computed(() => {
  23688. if (props.format.includes("A"))
  23689. return "A";
  23690. if (props.format.includes("a"))
  23691. return "a";
  23692. return "";
  23693. });
  23694. const isValidValue2 = (_date) => {
  23695. const parsedDate = dayjs(_date).locale(lang.value);
  23696. const result = getRangeAvailableTime(parsedDate);
  23697. return parsedDate.isSame(result);
  23698. };
  23699. const handleCancel = () => {
  23700. emit2("pick", oldValue.value, false);
  23701. };
  23702. const handleConfirm = (visible = false, first = false) => {
  23703. if (first)
  23704. return;
  23705. emit2("pick", props.parsedValue, visible);
  23706. };
  23707. const handleChange = (_date) => {
  23708. if (!props.visible) {
  23709. return;
  23710. }
  23711. const result = getRangeAvailableTime(_date).millisecond(0);
  23712. emit2("pick", result, true);
  23713. };
  23714. const setSelectionRange = (start, end2) => {
  23715. emit2("select-range", start, end2);
  23716. selectionRange.value = [start, end2];
  23717. };
  23718. const changeSelectionRange = (step) => {
  23719. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  23720. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  23721. const index2 = list.indexOf(selectionRange.value[0]);
  23722. const next = (index2 + step + list.length) % list.length;
  23723. timePickerOptions["start_emitSelectRange"](mapping[next]);
  23724. };
  23725. const handleKeydown = (event) => {
  23726. const code = event.code;
  23727. const { left: left2, right: right2, up: up2, down: down2 } = EVENT_CODE;
  23728. if ([left2, right2].includes(code)) {
  23729. const step = code === left2 ? -1 : 1;
  23730. changeSelectionRange(step);
  23731. event.preventDefault();
  23732. return;
  23733. }
  23734. if ([up2, down2].includes(code)) {
  23735. const step = code === up2 ? -1 : 1;
  23736. timePickerOptions["start_scrollDown"](step);
  23737. event.preventDefault();
  23738. return;
  23739. }
  23740. };
  23741. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  23742. getAvailableHours,
  23743. getAvailableMinutes,
  23744. getAvailableSeconds
  23745. });
  23746. const getRangeAvailableTime = (date2) => {
  23747. return getAvailableTime(date2, props.datetimeRole || "", true);
  23748. };
  23749. const parseUserInput = (value) => {
  23750. if (!value)
  23751. return null;
  23752. return dayjs(value, props.format).locale(lang.value);
  23753. };
  23754. const formatToString = (value) => {
  23755. if (!value)
  23756. return null;
  23757. return value.format(props.format);
  23758. };
  23759. const getDefaultValue2 = () => {
  23760. return dayjs(defaultValue).locale(lang.value);
  23761. };
  23762. emit2("set-picker-option", ["isValidValue", isValidValue2]);
  23763. emit2("set-picker-option", ["formatToString", formatToString]);
  23764. emit2("set-picker-option", ["parseUserInput", parseUserInput]);
  23765. emit2("set-picker-option", ["handleKeydownInput", handleKeydown]);
  23766. emit2("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  23767. emit2("set-picker-option", ["getDefaultValue", getDefaultValue2]);
  23768. return (_ctx, _cache) => {
  23769. return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
  23770. default: withCtx(() => [
  23771. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  23772. key: 0,
  23773. class: normalizeClass(unref(ns).b("panel"))
  23774. }, [
  23775. createBaseVNode("div", {
  23776. class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": unref(showSeconds) }])
  23777. }, [
  23778. createVNode(TimeSpinner, {
  23779. ref: "spinner",
  23780. role: _ctx.datetimeRole || "start",
  23781. "arrow-control": unref(arrowControl),
  23782. "show-seconds": unref(showSeconds),
  23783. "am-pm-mode": unref(amPmMode),
  23784. "spinner-date": _ctx.parsedValue,
  23785. "disabled-hours": unref(disabledHours),
  23786. "disabled-minutes": unref(disabledMinutes),
  23787. "disabled-seconds": unref(disabledSeconds),
  23788. onChange: handleChange,
  23789. onSetOption: unref(onSetOption),
  23790. onSelectRange: setSelectionRange
  23791. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  23792. ], 2),
  23793. createBaseVNode("div", {
  23794. class: normalizeClass(unref(ns).be("panel", "footer"))
  23795. }, [
  23796. createBaseVNode("button", {
  23797. type: "button",
  23798. class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
  23799. onClick: handleCancel
  23800. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3),
  23801. createBaseVNode("button", {
  23802. type: "button",
  23803. class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
  23804. onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
  23805. }, toDisplayString(unref(t)("el.datepicker.confirm")), 3)
  23806. ], 2)
  23807. ], 2)) : createCommentVNode("v-if", true)
  23808. ]),
  23809. _: 1
  23810. }, 8, ["name"]);
  23811. };
  23812. }
  23813. });
  23814. var TimePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1Y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]);
  23815. const panelTimeRangeProps = buildProps({
  23816. ...timePanelSharedProps,
  23817. parsedValue: {
  23818. type: definePropType(Array)
  23819. }
  23820. });
  23821. const _hoisted_1$Z = ["disabled"];
  23822. const _sfc_main$1X = /* @__PURE__ */ defineComponent({
  23823. __name: "panel-time-range",
  23824. props: panelTimeRangeProps,
  23825. emits: ["pick", "select-range", "set-picker-option"],
  23826. setup(__props, { emit: emit2 }) {
  23827. const props = __props;
  23828. const makeSelectRange = (start, end2) => {
  23829. const result = [];
  23830. for (let i = start; i <= end2; i++) {
  23831. result.push(i);
  23832. }
  23833. return result;
  23834. };
  23835. const { t, lang } = useLocale();
  23836. const nsTime = useNamespace("time");
  23837. const nsPicker = useNamespace("picker");
  23838. const pickerBase = inject("EP_PICKER_BASE");
  23839. const {
  23840. arrowControl,
  23841. disabledHours,
  23842. disabledMinutes,
  23843. disabledSeconds,
  23844. defaultValue
  23845. } = pickerBase.props;
  23846. const startContainerKls = computed(() => [
  23847. nsTime.be("range-picker", "body"),
  23848. nsTime.be("panel", "content"),
  23849. nsTime.is("arrow", arrowControl),
  23850. showSeconds.value ? "has-seconds" : ""
  23851. ]);
  23852. const endContainerKls = computed(() => [
  23853. nsTime.be("range-picker", "body"),
  23854. nsTime.be("panel", "content"),
  23855. nsTime.is("arrow", arrowControl),
  23856. showSeconds.value ? "has-seconds" : ""
  23857. ]);
  23858. const startTime = computed(() => props.parsedValue[0]);
  23859. const endTime = computed(() => props.parsedValue[1]);
  23860. const oldValue = useOldValue(props);
  23861. const handleCancel = () => {
  23862. emit2("pick", oldValue.value, false);
  23863. };
  23864. const showSeconds = computed(() => {
  23865. return props.format.includes("ss");
  23866. });
  23867. const amPmMode = computed(() => {
  23868. if (props.format.includes("A"))
  23869. return "A";
  23870. if (props.format.includes("a"))
  23871. return "a";
  23872. return "";
  23873. });
  23874. const handleConfirm = (visible = false) => {
  23875. emit2("pick", [startTime.value, endTime.value], visible);
  23876. };
  23877. const handleMinChange = (date2) => {
  23878. handleChange(date2.millisecond(0), endTime.value);
  23879. };
  23880. const handleMaxChange = (date2) => {
  23881. handleChange(startTime.value, date2.millisecond(0));
  23882. };
  23883. const isValidValue2 = (_date) => {
  23884. const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
  23885. const result = getRangeAvailableTime(parsedDate);
  23886. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  23887. };
  23888. const handleChange = (start, end2) => {
  23889. emit2("pick", [start, end2], true);
  23890. };
  23891. const btnConfirmDisabled = computed(() => {
  23892. return startTime.value > endTime.value;
  23893. });
  23894. const selectionRange = ref([0, 2]);
  23895. const setMinSelectionRange = (start, end2) => {
  23896. emit2("select-range", start, end2, "min");
  23897. selectionRange.value = [start, end2];
  23898. };
  23899. const offset2 = computed(() => showSeconds.value ? 11 : 8);
  23900. const setMaxSelectionRange = (start, end2) => {
  23901. emit2("select-range", start, end2, "max");
  23902. const _offset = unref(offset2);
  23903. selectionRange.value = [start + _offset, end2 + _offset];
  23904. };
  23905. const changeSelectionRange = (step) => {
  23906. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  23907. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  23908. const index2 = list.indexOf(selectionRange.value[0]);
  23909. const next = (index2 + step + list.length) % list.length;
  23910. const half = list.length / 2;
  23911. if (next < half) {
  23912. timePickerOptions["start_emitSelectRange"](mapping[next]);
  23913. } else {
  23914. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  23915. }
  23916. };
  23917. const handleKeydown = (event) => {
  23918. const code = event.code;
  23919. const { left: left2, right: right2, up: up2, down: down2 } = EVENT_CODE;
  23920. if ([left2, right2].includes(code)) {
  23921. const step = code === left2 ? -1 : 1;
  23922. changeSelectionRange(step);
  23923. event.preventDefault();
  23924. return;
  23925. }
  23926. if ([up2, down2].includes(code)) {
  23927. const step = code === up2 ? -1 : 1;
  23928. const role = selectionRange.value[0] < offset2.value ? "start" : "end";
  23929. timePickerOptions[`${role}_scrollDown`](step);
  23930. event.preventDefault();
  23931. return;
  23932. }
  23933. };
  23934. const disabledHours_ = (role, compare) => {
  23935. const defaultDisable = disabledHours ? disabledHours(role) : [];
  23936. const isStart = role === "start";
  23937. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  23938. const compareHour = compareDate.hour();
  23939. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  23940. return union$1(defaultDisable, nextDisable);
  23941. };
  23942. const disabledMinutes_ = (hour, role, compare) => {
  23943. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  23944. const isStart = role === "start";
  23945. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  23946. const compareHour = compareDate.hour();
  23947. if (hour !== compareHour) {
  23948. return defaultDisable;
  23949. }
  23950. const compareMinute = compareDate.minute();
  23951. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  23952. return union$1(defaultDisable, nextDisable);
  23953. };
  23954. const disabledSeconds_ = (hour, minute, role, compare) => {
  23955. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  23956. const isStart = role === "start";
  23957. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  23958. const compareHour = compareDate.hour();
  23959. const compareMinute = compareDate.minute();
  23960. if (hour !== compareHour || minute !== compareMinute) {
  23961. return defaultDisable;
  23962. }
  23963. const compareSecond = compareDate.second();
  23964. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  23965. return union$1(defaultDisable, nextDisable);
  23966. };
  23967. const getRangeAvailableTime = ([start, end2]) => {
  23968. return [
  23969. getAvailableTime(start, "start", true, end2),
  23970. getAvailableTime(end2, "end", false, start)
  23971. ];
  23972. };
  23973. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  23974. const {
  23975. timePickerOptions,
  23976. getAvailableTime,
  23977. onSetOption
  23978. } = useTimePanel({
  23979. getAvailableHours,
  23980. getAvailableMinutes,
  23981. getAvailableSeconds
  23982. });
  23983. const parseUserInput = (days) => {
  23984. if (!days)
  23985. return null;
  23986. if (isArray$3(days)) {
  23987. return days.map((d2) => dayjs(d2, props.format).locale(lang.value));
  23988. }
  23989. return dayjs(days, props.format).locale(lang.value);
  23990. };
  23991. const formatToString = (days) => {
  23992. if (!days)
  23993. return null;
  23994. if (isArray$3(days)) {
  23995. return days.map((d2) => d2.format(props.format));
  23996. }
  23997. return days.format(props.format);
  23998. };
  23999. const getDefaultValue2 = () => {
  24000. if (isArray$3(defaultValue)) {
  24001. return defaultValue.map((d2) => dayjs(d2).locale(lang.value));
  24002. }
  24003. const defaultDay = dayjs(defaultValue).locale(lang.value);
  24004. return [defaultDay, defaultDay.add(60, "m")];
  24005. };
  24006. emit2("set-picker-option", ["formatToString", formatToString]);
  24007. emit2("set-picker-option", ["parseUserInput", parseUserInput]);
  24008. emit2("set-picker-option", ["isValidValue", isValidValue2]);
  24009. emit2("set-picker-option", ["handleKeydownInput", handleKeydown]);
  24010. emit2("set-picker-option", ["getDefaultValue", getDefaultValue2]);
  24011. emit2("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  24012. return (_ctx, _cache) => {
  24013. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  24014. key: 0,
  24015. class: normalizeClass([unref(nsTime).b("range-picker"), unref(nsPicker).b("panel")])
  24016. }, [
  24017. createBaseVNode("div", {
  24018. class: normalizeClass(unref(nsTime).be("range-picker", "content"))
  24019. }, [
  24020. createBaseVNode("div", {
  24021. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  24022. }, [
  24023. createBaseVNode("div", {
  24024. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  24025. }, toDisplayString(unref(t)("el.datepicker.startTime")), 3),
  24026. createBaseVNode("div", {
  24027. class: normalizeClass(unref(startContainerKls))
  24028. }, [
  24029. createVNode(TimeSpinner, {
  24030. ref: "minSpinner",
  24031. role: "start",
  24032. "show-seconds": unref(showSeconds),
  24033. "am-pm-mode": unref(amPmMode),
  24034. "arrow-control": unref(arrowControl),
  24035. "spinner-date": unref(startTime),
  24036. "disabled-hours": disabledHours_,
  24037. "disabled-minutes": disabledMinutes_,
  24038. "disabled-seconds": disabledSeconds_,
  24039. onChange: handleMinChange,
  24040. onSetOption: unref(onSetOption),
  24041. onSelectRange: setMinSelectionRange
  24042. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  24043. ], 2)
  24044. ], 2),
  24045. createBaseVNode("div", {
  24046. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  24047. }, [
  24048. createBaseVNode("div", {
  24049. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  24050. }, toDisplayString(unref(t)("el.datepicker.endTime")), 3),
  24051. createBaseVNode("div", {
  24052. class: normalizeClass(unref(endContainerKls))
  24053. }, [
  24054. createVNode(TimeSpinner, {
  24055. ref: "maxSpinner",
  24056. role: "end",
  24057. "show-seconds": unref(showSeconds),
  24058. "am-pm-mode": unref(amPmMode),
  24059. "arrow-control": unref(arrowControl),
  24060. "spinner-date": unref(endTime),
  24061. "disabled-hours": disabledHours_,
  24062. "disabled-minutes": disabledMinutes_,
  24063. "disabled-seconds": disabledSeconds_,
  24064. onChange: handleMaxChange,
  24065. onSetOption: unref(onSetOption),
  24066. onSelectRange: setMaxSelectionRange
  24067. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  24068. ], 2)
  24069. ], 2)
  24070. ], 2),
  24071. createBaseVNode("div", {
  24072. class: normalizeClass(unref(nsTime).be("panel", "footer"))
  24073. }, [
  24074. createBaseVNode("button", {
  24075. type: "button",
  24076. class: normalizeClass([unref(nsTime).be("panel", "btn"), "cancel"]),
  24077. onClick: _cache[0] || (_cache[0] = ($event) => handleCancel())
  24078. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3),
  24079. createBaseVNode("button", {
  24080. type: "button",
  24081. class: normalizeClass([unref(nsTime).be("panel", "btn"), "confirm"]),
  24082. disabled: unref(btnConfirmDisabled),
  24083. onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm())
  24084. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, _hoisted_1$Z)
  24085. ], 2)
  24086. ], 2)) : createCommentVNode("v-if", true);
  24087. };
  24088. }
  24089. });
  24090. var TimeRangePanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1X, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-range.vue"]]);
  24091. dayjs.extend(customParseFormat);
  24092. var TimePicker = /* @__PURE__ */ defineComponent({
  24093. name: "ElTimePicker",
  24094. install: null,
  24095. props: {
  24096. ...timePickerDefaultProps,
  24097. isRange: {
  24098. type: Boolean,
  24099. default: false
  24100. }
  24101. },
  24102. emits: ["update:modelValue"],
  24103. setup(props, ctx) {
  24104. const commonPicker = ref();
  24105. const [type2, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  24106. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  24107. provide("ElPopperOptions", props.popperOptions);
  24108. ctx.expose({
  24109. focus: (e) => {
  24110. var _a2;
  24111. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocusInput(e);
  24112. },
  24113. blur: (e) => {
  24114. var _a2;
  24115. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlurInput(e);
  24116. },
  24117. handleOpen: () => {
  24118. var _a2;
  24119. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleOpen();
  24120. },
  24121. handleClose: () => {
  24122. var _a2;
  24123. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleClose();
  24124. }
  24125. });
  24126. return () => {
  24127. var _a2;
  24128. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
  24129. return createVNode(CommonPicker, mergeProps(props, {
  24130. "ref": commonPicker,
  24131. "type": type2,
  24132. "format": format2,
  24133. "onUpdate:modelValue": modelUpdater
  24134. }), {
  24135. default: (props2) => createVNode(Panel, props2, null)
  24136. });
  24137. };
  24138. }
  24139. });
  24140. const _TimePicker = TimePicker;
  24141. _TimePicker.install = (app) => {
  24142. app.component(_TimePicker.name, _TimePicker);
  24143. };
  24144. const ElTimePicker = _TimePicker;
  24145. const getPrevMonthLastDays = (date2, count) => {
  24146. const lastDay = date2.subtract(1, "month").endOf("month").date();
  24147. return rangeArr(count).map((_2, index2) => lastDay - (count - index2 - 1));
  24148. };
  24149. const getMonthDays = (date2) => {
  24150. const days = date2.daysInMonth();
  24151. return rangeArr(days).map((_2, index2) => index2 + 1);
  24152. };
  24153. const toNestedArr = (days) => rangeArr(days.length / 7).map((index2) => {
  24154. const start = index2 * 7;
  24155. return days.slice(start, start + 7);
  24156. });
  24157. const dateTableProps = buildProps({
  24158. selectedDay: {
  24159. type: definePropType(Object)
  24160. },
  24161. range: {
  24162. type: definePropType(Array)
  24163. },
  24164. date: {
  24165. type: definePropType(Object),
  24166. required: true
  24167. },
  24168. hideHeader: {
  24169. type: Boolean
  24170. }
  24171. });
  24172. const dateTableEmits = {
  24173. pick: (value) => isObject$1(value)
  24174. };
  24175. var localeData$1 = { exports: {} };
  24176. (function(module2, exports2) {
  24177. !function(n, e) {
  24178. module2.exports = e();
  24179. }(commonjsGlobal, function() {
  24180. return function(n, e, t) {
  24181. var r = e.prototype, o2 = function(n2) {
  24182. return n2 && (n2.indexOf ? n2 : n2.s);
  24183. }, u2 = function(n2, e2, t2, r2, u3) {
  24184. var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f2 = a3 || s3.map(function(n3) {
  24185. return n3.slice(0, r2);
  24186. });
  24187. if (!u3)
  24188. return f2;
  24189. var d2 = i2.weekStart;
  24190. return f2.map(function(n3, e3) {
  24191. return f2[(e3 + (d2 || 0)) % 7];
  24192. });
  24193. }, i = function() {
  24194. return t.Ls[t.locale()];
  24195. }, a2 = function(n2, e2) {
  24196. return n2.formats[e2] || function(n3) {
  24197. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  24198. return e3 || t2.slice(1);
  24199. });
  24200. }(n2.formats[e2.toUpperCase()]);
  24201. }, s2 = function() {
  24202. var n2 = this;
  24203. return { months: function(e2) {
  24204. return e2 ? e2.format("MMMM") : u2(n2, "months");
  24205. }, monthsShort: function(e2) {
  24206. return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
  24207. }, firstDayOfWeek: function() {
  24208. return n2.$locale().weekStart || 0;
  24209. }, weekdays: function(e2) {
  24210. return e2 ? e2.format("dddd") : u2(n2, "weekdays");
  24211. }, weekdaysMin: function(e2) {
  24212. return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
  24213. }, weekdaysShort: function(e2) {
  24214. return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
  24215. }, longDateFormat: function(e2) {
  24216. return a2(n2.$locale(), e2);
  24217. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  24218. };
  24219. r.localeData = function() {
  24220. return s2.bind(this)();
  24221. }, t.localeData = function() {
  24222. var n2 = i();
  24223. return { firstDayOfWeek: function() {
  24224. return n2.weekStart || 0;
  24225. }, weekdays: function() {
  24226. return t.weekdays();
  24227. }, weekdaysShort: function() {
  24228. return t.weekdaysShort();
  24229. }, weekdaysMin: function() {
  24230. return t.weekdaysMin();
  24231. }, months: function() {
  24232. return t.months();
  24233. }, monthsShort: function() {
  24234. return t.monthsShort();
  24235. }, longDateFormat: function(e2) {
  24236. return a2(n2, e2);
  24237. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  24238. }, t.months = function() {
  24239. return u2(i(), "months");
  24240. }, t.monthsShort = function() {
  24241. return u2(i(), "monthsShort", "months", 3);
  24242. }, t.weekdays = function(n2) {
  24243. return u2(i(), "weekdays", null, null, n2);
  24244. }, t.weekdaysShort = function(n2) {
  24245. return u2(i(), "weekdaysShort", "weekdays", 3, n2);
  24246. }, t.weekdaysMin = function(n2) {
  24247. return u2(i(), "weekdaysMin", "weekdays", 2, n2);
  24248. };
  24249. };
  24250. });
  24251. })(localeData$1);
  24252. var localeDataExports = localeData$1.exports;
  24253. const localeData = /* @__PURE__ */ getDefaultExportFromCjs(localeDataExports);
  24254. const useDateTable = (props, emit2) => {
  24255. dayjs.extend(localeData);
  24256. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  24257. const { t, lang } = useLocale();
  24258. const now2 = dayjs().locale(lang.value);
  24259. const isInRange = computed(() => !!props.range && !!props.range.length);
  24260. const rows = computed(() => {
  24261. let days = [];
  24262. if (isInRange.value) {
  24263. const [start, end2] = props.range;
  24264. const currentMonthRange = rangeArr(end2.date() - start.date() + 1).map((index2) => ({
  24265. text: start.date() + index2,
  24266. type: "current"
  24267. }));
  24268. let remaining = currentMonthRange.length % 7;
  24269. remaining = remaining === 0 ? 0 : 7 - remaining;
  24270. const nextMonthRange = rangeArr(remaining).map((_2, index2) => ({
  24271. text: index2 + 1,
  24272. type: "next"
  24273. }));
  24274. days = currentMonthRange.concat(nextMonthRange);
  24275. } else {
  24276. const firstDay = props.date.startOf("month").day();
  24277. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  24278. text: day,
  24279. type: "prev"
  24280. }));
  24281. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  24282. text: day,
  24283. type: "current"
  24284. }));
  24285. days = [...prevMonthDays, ...currentMonthDays];
  24286. const remaining = 7 - (days.length % 7 || 7);
  24287. const nextMonthDays = rangeArr(remaining).map((_2, index2) => ({
  24288. text: index2 + 1,
  24289. type: "next"
  24290. }));
  24291. days = days.concat(nextMonthDays);
  24292. }
  24293. return toNestedArr(days);
  24294. });
  24295. const weekDays = computed(() => {
  24296. const start = firstDayOfWeek;
  24297. if (start === 0) {
  24298. return WEEK_DAYS.map((_2) => t(`el.datepicker.weeks.${_2}`));
  24299. } else {
  24300. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_2) => t(`el.datepicker.weeks.${_2}`));
  24301. }
  24302. });
  24303. const getFormattedDate = (day, type2) => {
  24304. switch (type2) {
  24305. case "prev":
  24306. return props.date.startOf("month").subtract(1, "month").date(day);
  24307. case "next":
  24308. return props.date.startOf("month").add(1, "month").date(day);
  24309. case "current":
  24310. return props.date.date(day);
  24311. }
  24312. };
  24313. const handlePickDay = ({ text, type: type2 }) => {
  24314. const date2 = getFormattedDate(text, type2);
  24315. emit2("pick", date2);
  24316. };
  24317. const getSlotData = ({ text, type: type2 }) => {
  24318. const day = getFormattedDate(text, type2);
  24319. return {
  24320. isSelected: day.isSame(props.selectedDay),
  24321. type: `${type2}-month`,
  24322. day: day.format("YYYY-MM-DD"),
  24323. date: day.toDate()
  24324. };
  24325. };
  24326. return {
  24327. now: now2,
  24328. isInRange,
  24329. rows,
  24330. weekDays,
  24331. getFormattedDate,
  24332. handlePickDay,
  24333. getSlotData
  24334. };
  24335. };
  24336. const _hoisted_1$Y = { key: 0 };
  24337. const _hoisted_2$D = ["onClick"];
  24338. const __default__$1g = /* @__PURE__ */ defineComponent({
  24339. name: "DateTable"
  24340. });
  24341. const _sfc_main$1W = /* @__PURE__ */ defineComponent({
  24342. ...__default__$1g,
  24343. props: dateTableProps,
  24344. emits: dateTableEmits,
  24345. setup(__props, { expose, emit: emit2 }) {
  24346. const props = __props;
  24347. const {
  24348. isInRange,
  24349. now: now2,
  24350. rows,
  24351. weekDays,
  24352. getFormattedDate,
  24353. handlePickDay,
  24354. getSlotData
  24355. } = useDateTable(props, emit2);
  24356. const nsTable = useNamespace("calendar-table");
  24357. const nsDay = useNamespace("calendar-day");
  24358. const getCellClass = ({ text, type: type2 }) => {
  24359. const classes = [type2];
  24360. if (type2 === "current") {
  24361. const date2 = getFormattedDate(text, type2);
  24362. if (date2.isSame(props.selectedDay, "day")) {
  24363. classes.push(nsDay.is("selected"));
  24364. }
  24365. if (date2.isSame(now2, "day")) {
  24366. classes.push(nsDay.is("today"));
  24367. }
  24368. }
  24369. return classes;
  24370. };
  24371. expose({
  24372. getFormattedDate
  24373. });
  24374. return (_ctx, _cache) => {
  24375. return openBlock(), createElementBlock("table", {
  24376. class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
  24377. cellspacing: "0",
  24378. cellpadding: "0"
  24379. }, [
  24380. !_ctx.hideHeader ? (openBlock(), createElementBlock("thead", _hoisted_1$Y, [
  24381. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
  24382. return openBlock(), createElementBlock("th", { key: day }, toDisplayString(day), 1);
  24383. }), 128))
  24384. ])) : createCommentVNode("v-if", true),
  24385. createBaseVNode("tbody", null, [
  24386. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index2) => {
  24387. return openBlock(), createElementBlock("tr", {
  24388. key: index2,
  24389. class: normalizeClass({
  24390. [unref(nsTable).e("row")]: true,
  24391. [unref(nsTable).em("row", "hide-border")]: index2 === 0 && _ctx.hideHeader
  24392. })
  24393. }, [
  24394. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
  24395. return openBlock(), createElementBlock("td", {
  24396. key,
  24397. class: normalizeClass(getCellClass(cell)),
  24398. onClick: ($event) => unref(handlePickDay)(cell)
  24399. }, [
  24400. createBaseVNode("div", {
  24401. class: normalizeClass(unref(nsDay).b())
  24402. }, [
  24403. renderSlot(_ctx.$slots, "date-cell", {
  24404. data: unref(getSlotData)(cell)
  24405. }, () => [
  24406. createBaseVNode("span", null, toDisplayString(cell.text), 1)
  24407. ])
  24408. ], 2)
  24409. ], 10, _hoisted_2$D);
  24410. }), 128))
  24411. ], 2);
  24412. }), 128))
  24413. ])
  24414. ], 2);
  24415. };
  24416. }
  24417. });
  24418. var DateTable$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1W, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/calendar/src/date-table.vue"]]);
  24419. const adjacentMonth = (start, end2) => {
  24420. const firstMonthLastDay = start.endOf("month");
  24421. const lastMonthFirstDay = end2.startOf("month");
  24422. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  24423. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  24424. return [
  24425. [start, firstMonthLastDay],
  24426. [lastMonthStartDay.startOf("week"), end2]
  24427. ];
  24428. };
  24429. const threeConsecutiveMonth = (start, end2) => {
  24430. const firstMonthLastDay = start.endOf("month");
  24431. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  24432. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  24433. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  24434. const lastMonthFirstDay = end2.startOf("month");
  24435. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  24436. return [
  24437. [start, firstMonthLastDay],
  24438. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  24439. [lastMonthStartDay.startOf("week"), end2]
  24440. ];
  24441. };
  24442. const useCalendar = (props, emit2, componentName2) => {
  24443. const slots = useSlots();
  24444. const { lang } = useLocale();
  24445. const selectedDay = ref();
  24446. const now2 = dayjs().locale(lang.value);
  24447. const realSelectedDay = computed({
  24448. get() {
  24449. if (!props.modelValue)
  24450. return selectedDay.value;
  24451. return date2.value;
  24452. },
  24453. set(val) {
  24454. if (!val)
  24455. return;
  24456. selectedDay.value = val;
  24457. const result = val.toDate();
  24458. emit2(INPUT_EVENT, result);
  24459. emit2(UPDATE_MODEL_EVENT, result);
  24460. }
  24461. });
  24462. const validatedRange = computed(() => {
  24463. if (!props.range)
  24464. return [];
  24465. const rangeArrDayjs = props.range.map((_2) => dayjs(_2).locale(lang.value));
  24466. const [startDayjs, endDayjs] = rangeArrDayjs;
  24467. if (startDayjs.isAfter(endDayjs)) {
  24468. return [];
  24469. }
  24470. if (startDayjs.isSame(endDayjs, "month")) {
  24471. return calculateValidatedDateRange(startDayjs, endDayjs);
  24472. } else {
  24473. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  24474. return [];
  24475. }
  24476. return calculateValidatedDateRange(startDayjs, endDayjs);
  24477. }
  24478. });
  24479. const date2 = computed(() => {
  24480. if (!props.modelValue) {
  24481. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now2);
  24482. } else {
  24483. return dayjs(props.modelValue).locale(lang.value);
  24484. }
  24485. });
  24486. const prevMonthDayjs = computed(() => date2.value.subtract(1, "month").date(1));
  24487. const nextMonthDayjs = computed(() => date2.value.add(1, "month").date(1));
  24488. const prevYearDayjs = computed(() => date2.value.subtract(1, "year").date(1));
  24489. const nextYearDayjs = computed(() => date2.value.add(1, "year").date(1));
  24490. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  24491. const firstDay = startDayjs.startOf("week");
  24492. const lastDay = endDayjs.endOf("week");
  24493. const firstMonth = firstDay.get("month");
  24494. const lastMonth = lastDay.get("month");
  24495. if (firstMonth === lastMonth) {
  24496. return [[firstDay, lastDay]];
  24497. } else if ((firstMonth + 1) % 12 === lastMonth) {
  24498. return adjacentMonth(firstDay, lastDay);
  24499. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  24500. return threeConsecutiveMonth(firstDay, lastDay);
  24501. } else {
  24502. return [];
  24503. }
  24504. };
  24505. const pickDay = (day) => {
  24506. realSelectedDay.value = day;
  24507. };
  24508. const selectDate = (type2) => {
  24509. const dateMap = {
  24510. "prev-month": prevMonthDayjs.value,
  24511. "next-month": nextMonthDayjs.value,
  24512. "prev-year": prevYearDayjs.value,
  24513. "next-year": nextYearDayjs.value,
  24514. today: now2
  24515. };
  24516. const day = dateMap[type2];
  24517. if (!day.isSame(date2.value, "day")) {
  24518. pickDay(day);
  24519. }
  24520. };
  24521. useDeprecated({
  24522. from: '"dateCell"',
  24523. replacement: '"date-cell"',
  24524. scope: "ElCalendar",
  24525. version: "2.3.0",
  24526. ref: "https://element-plus.org/en-US/component/calendar.html#slots",
  24527. type: "Slot"
  24528. }, computed(() => !!slots.dateCell));
  24529. return {
  24530. calculateValidatedDateRange,
  24531. date: date2,
  24532. realSelectedDay,
  24533. pickDay,
  24534. selectDate,
  24535. validatedRange
  24536. };
  24537. };
  24538. const isValidRange$1 = (range2) => isArray$3(range2) && range2.length === 2 && range2.every((item) => isDate(item));
  24539. const calendarProps = buildProps({
  24540. modelValue: {
  24541. type: Date
  24542. },
  24543. range: {
  24544. type: definePropType(Array),
  24545. validator: isValidRange$1
  24546. }
  24547. });
  24548. const calendarEmits = {
  24549. [UPDATE_MODEL_EVENT]: (value) => isDate(value),
  24550. [INPUT_EVENT]: (value) => isDate(value)
  24551. };
  24552. const COMPONENT_NAME$g = "ElCalendar";
  24553. const __default__$1f = /* @__PURE__ */ defineComponent({
  24554. name: COMPONENT_NAME$g
  24555. });
  24556. const _sfc_main$1V = /* @__PURE__ */ defineComponent({
  24557. ...__default__$1f,
  24558. props: calendarProps,
  24559. emits: calendarEmits,
  24560. setup(__props, { expose, emit: emit2 }) {
  24561. const props = __props;
  24562. const ns = useNamespace("calendar");
  24563. const {
  24564. calculateValidatedDateRange,
  24565. date: date2,
  24566. pickDay,
  24567. realSelectedDay,
  24568. selectDate,
  24569. validatedRange
  24570. } = useCalendar(props, emit2);
  24571. const { t } = useLocale();
  24572. const i18nDate = computed(() => {
  24573. const pickedMonth = `el.datepicker.month${date2.value.format("M")}`;
  24574. return `${date2.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  24575. });
  24576. expose({
  24577. selectedDay: realSelectedDay,
  24578. pickDay,
  24579. selectDate,
  24580. calculateValidatedDateRange
  24581. });
  24582. return (_ctx, _cache) => {
  24583. return openBlock(), createElementBlock("div", {
  24584. class: normalizeClass(unref(ns).b())
  24585. }, [
  24586. createBaseVNode("div", {
  24587. class: normalizeClass(unref(ns).e("header"))
  24588. }, [
  24589. renderSlot(_ctx.$slots, "header", { date: unref(i18nDate) }, () => [
  24590. createBaseVNode("div", {
  24591. class: normalizeClass(unref(ns).e("title"))
  24592. }, toDisplayString(unref(i18nDate)), 3),
  24593. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  24594. key: 0,
  24595. class: normalizeClass(unref(ns).e("button-group"))
  24596. }, [
  24597. createVNode(unref(ElButtonGroup$1), null, {
  24598. default: withCtx(() => [
  24599. createVNode(unref(ElButton), {
  24600. size: "small",
  24601. onClick: _cache[0] || (_cache[0] = ($event) => unref(selectDate)("prev-month"))
  24602. }, {
  24603. default: withCtx(() => [
  24604. createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)
  24605. ]),
  24606. _: 1
  24607. }),
  24608. createVNode(unref(ElButton), {
  24609. size: "small",
  24610. onClick: _cache[1] || (_cache[1] = ($event) => unref(selectDate)("today"))
  24611. }, {
  24612. default: withCtx(() => [
  24613. createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)
  24614. ]),
  24615. _: 1
  24616. }),
  24617. createVNode(unref(ElButton), {
  24618. size: "small",
  24619. onClick: _cache[2] || (_cache[2] = ($event) => unref(selectDate)("next-month"))
  24620. }, {
  24621. default: withCtx(() => [
  24622. createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)
  24623. ]),
  24624. _: 1
  24625. })
  24626. ]),
  24627. _: 1
  24628. })
  24629. ], 2)) : createCommentVNode("v-if", true)
  24630. ])
  24631. ], 2),
  24632. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  24633. key: 0,
  24634. class: normalizeClass(unref(ns).e("body"))
  24635. }, [
  24636. createVNode(DateTable$1, {
  24637. date: unref(date2),
  24638. "selected-day": unref(realSelectedDay),
  24639. onPick: unref(pickDay)
  24640. }, createSlots({ _: 2 }, [
  24641. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  24642. name: "date-cell",
  24643. fn: withCtx((data) => [
  24644. _ctx.$slots["date-cell"] ? renderSlot(_ctx.$slots, "date-cell", normalizeProps(mergeProps({ key: 0 }, data))) : renderSlot(_ctx.$slots, "dateCell", normalizeProps(mergeProps({ key: 1 }, data)))
  24645. ])
  24646. } : void 0
  24647. ]), 1032, ["date", "selected-day", "onPick"])
  24648. ], 2)) : (openBlock(), createElementBlock("div", {
  24649. key: 1,
  24650. class: normalizeClass(unref(ns).e("body"))
  24651. }, [
  24652. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index2) => {
  24653. return openBlock(), createBlock(DateTable$1, {
  24654. key: index2,
  24655. date: range_[0],
  24656. "selected-day": unref(realSelectedDay),
  24657. range: range_,
  24658. "hide-header": index2 !== 0,
  24659. onPick: unref(pickDay)
  24660. }, createSlots({ _: 2 }, [
  24661. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  24662. name: "date-cell",
  24663. fn: withCtx((data) => [
  24664. _ctx.$slots["date-cell"] ? renderSlot(_ctx.$slots, "date-cell", normalizeProps(mergeProps({ key: 0 }, data))) : renderSlot(_ctx.$slots, "dateCell", normalizeProps(mergeProps({ key: 1 }, data)))
  24665. ])
  24666. } : void 0
  24667. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  24668. }), 128))
  24669. ], 2))
  24670. ], 2);
  24671. };
  24672. }
  24673. });
  24674. var Calendar = /* @__PURE__ */ _export_sfc$1(_sfc_main$1V, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/calendar/src/calendar.vue"]]);
  24675. const ElCalendar = withInstall(Calendar);
  24676. const cardProps = buildProps({
  24677. header: {
  24678. type: String,
  24679. default: ""
  24680. },
  24681. footer: {
  24682. type: String,
  24683. default: ""
  24684. },
  24685. bodyStyle: {
  24686. type: definePropType([String, Object, Array]),
  24687. default: ""
  24688. },
  24689. bodyClass: String,
  24690. shadow: {
  24691. type: String,
  24692. values: ["always", "hover", "never"],
  24693. default: "always"
  24694. }
  24695. });
  24696. const __default__$1e = /* @__PURE__ */ defineComponent({
  24697. name: "ElCard"
  24698. });
  24699. const _sfc_main$1U = /* @__PURE__ */ defineComponent({
  24700. ...__default__$1e,
  24701. props: cardProps,
  24702. setup(__props) {
  24703. const ns = useNamespace("card");
  24704. return (_ctx, _cache) => {
  24705. return openBlock(), createElementBlock("div", {
  24706. class: normalizeClass([unref(ns).b(), unref(ns).is(`${_ctx.shadow}-shadow`)])
  24707. }, [
  24708. _ctx.$slots.header || _ctx.header ? (openBlock(), createElementBlock("div", {
  24709. key: 0,
  24710. class: normalizeClass(unref(ns).e("header"))
  24711. }, [
  24712. renderSlot(_ctx.$slots, "header", {}, () => [
  24713. createTextVNode(toDisplayString(_ctx.header), 1)
  24714. ])
  24715. ], 2)) : createCommentVNode("v-if", true),
  24716. createBaseVNode("div", {
  24717. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass]),
  24718. style: normalizeStyle(_ctx.bodyStyle)
  24719. }, [
  24720. renderSlot(_ctx.$slots, "default")
  24721. ], 6),
  24722. _ctx.$slots.footer || _ctx.footer ? (openBlock(), createElementBlock("div", {
  24723. key: 1,
  24724. class: normalizeClass(unref(ns).e("footer"))
  24725. }, [
  24726. renderSlot(_ctx.$slots, "footer", {}, () => [
  24727. createTextVNode(toDisplayString(_ctx.footer), 1)
  24728. ])
  24729. ], 2)) : createCommentVNode("v-if", true)
  24730. ], 2);
  24731. };
  24732. }
  24733. });
  24734. var Card = /* @__PURE__ */ _export_sfc$1(_sfc_main$1U, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/card/src/card.vue"]]);
  24735. const ElCard = withInstall(Card);
  24736. const carouselProps = buildProps({
  24737. initialIndex: {
  24738. type: Number,
  24739. default: 0
  24740. },
  24741. height: {
  24742. type: String,
  24743. default: ""
  24744. },
  24745. trigger: {
  24746. type: String,
  24747. values: ["hover", "click"],
  24748. default: "hover"
  24749. },
  24750. autoplay: {
  24751. type: Boolean,
  24752. default: true
  24753. },
  24754. interval: {
  24755. type: Number,
  24756. default: 3e3
  24757. },
  24758. indicatorPosition: {
  24759. type: String,
  24760. values: ["", "none", "outside"],
  24761. default: ""
  24762. },
  24763. arrow: {
  24764. type: String,
  24765. values: ["always", "hover", "never"],
  24766. default: "hover"
  24767. },
  24768. type: {
  24769. type: String,
  24770. values: ["", "card"],
  24771. default: ""
  24772. },
  24773. loop: {
  24774. type: Boolean,
  24775. default: true
  24776. },
  24777. direction: {
  24778. type: String,
  24779. values: ["horizontal", "vertical"],
  24780. default: "horizontal"
  24781. },
  24782. pauseOnHover: {
  24783. type: Boolean,
  24784. default: true
  24785. }
  24786. });
  24787. const carouselEmits = {
  24788. change: (current, prev) => [current, prev].every(isNumber)
  24789. };
  24790. const carouselContextKey = Symbol("carouselContextKey");
  24791. const THROTTLE_TIME = 300;
  24792. const useCarousel = (props, emit2, componentName2) => {
  24793. const {
  24794. children: items,
  24795. addChild: addItem,
  24796. removeChild: removeItem
  24797. } = useOrderedChildren(getCurrentInstance(), "ElCarouselItem");
  24798. const slots = useSlots();
  24799. const activeIndex = ref(-1);
  24800. const timer = ref(null);
  24801. const hover = ref(false);
  24802. const root2 = ref();
  24803. const containerHeight = ref(0);
  24804. const isItemsTwoLength = ref(true);
  24805. const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
  24806. const hasLabel = computed(() => {
  24807. return items.value.some((item) => item.props.label.toString().length > 0);
  24808. });
  24809. const isCardType = computed(() => props.type === "card");
  24810. const isVertical = computed(() => props.direction === "vertical");
  24811. const containerStyle = computed(() => {
  24812. if (props.height !== "auto") {
  24813. return {
  24814. height: props.height
  24815. };
  24816. }
  24817. return {
  24818. height: `${containerHeight.value}px`,
  24819. overflow: "hidden"
  24820. };
  24821. });
  24822. const throttledArrowClick = throttle((index2) => {
  24823. setActiveItem(index2);
  24824. }, THROTTLE_TIME, { trailing: true });
  24825. const throttledIndicatorHover = throttle((index2) => {
  24826. handleIndicatorHover(index2);
  24827. }, THROTTLE_TIME);
  24828. const isTwoLengthShow = (index2) => {
  24829. if (!isItemsTwoLength.value)
  24830. return true;
  24831. return activeIndex.value <= 1 ? index2 <= 1 : index2 > 1;
  24832. };
  24833. function pauseTimer() {
  24834. if (timer.value) {
  24835. clearInterval(timer.value);
  24836. timer.value = null;
  24837. }
  24838. }
  24839. function startTimer() {
  24840. if (props.interval <= 0 || !props.autoplay || timer.value)
  24841. return;
  24842. timer.value = setInterval(() => playSlides(), props.interval);
  24843. }
  24844. const playSlides = () => {
  24845. if (activeIndex.value < items.value.length - 1) {
  24846. activeIndex.value = activeIndex.value + 1;
  24847. } else if (props.loop) {
  24848. activeIndex.value = 0;
  24849. }
  24850. };
  24851. function setActiveItem(index2) {
  24852. if (isString$1(index2)) {
  24853. const filteredItems = items.value.filter((item) => item.props.name === index2);
  24854. if (filteredItems.length > 0) {
  24855. index2 = items.value.indexOf(filteredItems[0]);
  24856. }
  24857. }
  24858. index2 = Number(index2);
  24859. if (Number.isNaN(index2) || index2 !== Math.floor(index2)) {
  24860. return;
  24861. }
  24862. const itemCount = items.value.length;
  24863. const oldIndex = activeIndex.value;
  24864. if (index2 < 0) {
  24865. activeIndex.value = props.loop ? itemCount - 1 : 0;
  24866. } else if (index2 >= itemCount) {
  24867. activeIndex.value = props.loop ? 0 : itemCount - 1;
  24868. } else {
  24869. activeIndex.value = index2;
  24870. }
  24871. if (oldIndex === activeIndex.value) {
  24872. resetItemPosition(oldIndex);
  24873. }
  24874. resetTimer();
  24875. }
  24876. function resetItemPosition(oldIndex) {
  24877. items.value.forEach((item, index2) => {
  24878. item.translateItem(index2, activeIndex.value, oldIndex);
  24879. });
  24880. }
  24881. function itemInStage(item, index2) {
  24882. var _a2, _b, _c, _d;
  24883. const _items = unref(items);
  24884. const itemCount = _items.length;
  24885. if (itemCount === 0 || !item.states.inStage)
  24886. return false;
  24887. const nextItemIndex = index2 + 1;
  24888. const prevItemIndex = index2 - 1;
  24889. const lastItemIndex = itemCount - 1;
  24890. const isLastItemActive = _items[lastItemIndex].states.active;
  24891. const isFirstItemActive = _items[0].states.active;
  24892. const isNextItemActive = (_b = (_a2 = _items[nextItemIndex]) == null ? void 0 : _a2.states) == null ? void 0 : _b.active;
  24893. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  24894. if (index2 === lastItemIndex && isFirstItemActive || isNextItemActive) {
  24895. return "left";
  24896. } else if (index2 === 0 && isLastItemActive || isPrevItemActive) {
  24897. return "right";
  24898. }
  24899. return false;
  24900. }
  24901. function handleMouseEnter() {
  24902. hover.value = true;
  24903. if (props.pauseOnHover) {
  24904. pauseTimer();
  24905. }
  24906. }
  24907. function handleMouseLeave() {
  24908. hover.value = false;
  24909. startTimer();
  24910. }
  24911. function handleButtonEnter(arrow2) {
  24912. if (unref(isVertical))
  24913. return;
  24914. items.value.forEach((item, index2) => {
  24915. if (arrow2 === itemInStage(item, index2)) {
  24916. item.states.hover = true;
  24917. }
  24918. });
  24919. }
  24920. function handleButtonLeave() {
  24921. if (unref(isVertical))
  24922. return;
  24923. items.value.forEach((item) => {
  24924. item.states.hover = false;
  24925. });
  24926. }
  24927. function handleIndicatorClick(index2) {
  24928. activeIndex.value = index2;
  24929. }
  24930. function handleIndicatorHover(index2) {
  24931. if (props.trigger === "hover" && index2 !== activeIndex.value) {
  24932. activeIndex.value = index2;
  24933. }
  24934. }
  24935. function prev() {
  24936. setActiveItem(activeIndex.value - 1);
  24937. }
  24938. function next() {
  24939. setActiveItem(activeIndex.value + 1);
  24940. }
  24941. function resetTimer() {
  24942. pauseTimer();
  24943. if (!props.pauseOnHover)
  24944. startTimer();
  24945. }
  24946. function setContainerHeight(height) {
  24947. if (props.height !== "auto")
  24948. return;
  24949. containerHeight.value = height;
  24950. }
  24951. function PlaceholderItem() {
  24952. var _a2;
  24953. const defaultSlots = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  24954. if (!defaultSlots)
  24955. return null;
  24956. const flatSlots = flattedChildren(defaultSlots);
  24957. const carouselItemsName = "ElCarouselItem";
  24958. const normalizeSlots = flatSlots.filter((slot) => {
  24959. return isVNode(slot) && slot.type.name === carouselItemsName;
  24960. });
  24961. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  24962. isItemsTwoLength.value = true;
  24963. return normalizeSlots;
  24964. }
  24965. isItemsTwoLength.value = false;
  24966. return null;
  24967. }
  24968. watch(() => activeIndex.value, (current, prev2) => {
  24969. resetItemPosition(prev2);
  24970. if (isItemsTwoLength.value) {
  24971. current = current % 2;
  24972. prev2 = prev2 % 2;
  24973. }
  24974. if (prev2 > -1) {
  24975. emit2("change", current, prev2);
  24976. }
  24977. });
  24978. watch(() => props.autoplay, (autoplay) => {
  24979. autoplay ? startTimer() : pauseTimer();
  24980. });
  24981. watch(() => props.loop, () => {
  24982. setActiveItem(activeIndex.value);
  24983. });
  24984. watch(() => props.interval, () => {
  24985. resetTimer();
  24986. });
  24987. const resizeObserver = shallowRef();
  24988. onMounted(() => {
  24989. watch(() => items.value, () => {
  24990. if (items.value.length > 0)
  24991. setActiveItem(props.initialIndex);
  24992. }, {
  24993. immediate: true
  24994. });
  24995. resizeObserver.value = useResizeObserver(root2.value, () => {
  24996. resetItemPosition();
  24997. });
  24998. startTimer();
  24999. });
  25000. onBeforeUnmount(() => {
  25001. pauseTimer();
  25002. if (root2.value && resizeObserver.value)
  25003. resizeObserver.value.stop();
  25004. });
  25005. provide(carouselContextKey, {
  25006. root: root2,
  25007. isCardType,
  25008. isVertical,
  25009. items,
  25010. loop: props.loop,
  25011. addItem,
  25012. removeItem,
  25013. setActiveItem,
  25014. setContainerHeight
  25015. });
  25016. return {
  25017. root: root2,
  25018. activeIndex,
  25019. arrowDisplay,
  25020. hasLabel,
  25021. hover,
  25022. isCardType,
  25023. items,
  25024. isVertical,
  25025. containerStyle,
  25026. isItemsTwoLength,
  25027. handleButtonEnter,
  25028. handleButtonLeave,
  25029. handleIndicatorClick,
  25030. handleMouseEnter,
  25031. handleMouseLeave,
  25032. setActiveItem,
  25033. prev,
  25034. next,
  25035. PlaceholderItem,
  25036. isTwoLengthShow,
  25037. throttledArrowClick,
  25038. throttledIndicatorHover
  25039. };
  25040. };
  25041. const _hoisted_1$X = ["onMouseenter", "onClick"];
  25042. const _hoisted_2$C = { key: 0 };
  25043. const COMPONENT_NAME$f = "ElCarousel";
  25044. const __default__$1d = /* @__PURE__ */ defineComponent({
  25045. name: COMPONENT_NAME$f
  25046. });
  25047. const _sfc_main$1T = /* @__PURE__ */ defineComponent({
  25048. ...__default__$1d,
  25049. props: carouselProps,
  25050. emits: carouselEmits,
  25051. setup(__props, { expose, emit: emit2 }) {
  25052. const props = __props;
  25053. const {
  25054. root: root2,
  25055. activeIndex,
  25056. arrowDisplay,
  25057. hasLabel,
  25058. hover,
  25059. isCardType,
  25060. items,
  25061. isVertical,
  25062. containerStyle,
  25063. handleButtonEnter,
  25064. handleButtonLeave,
  25065. handleIndicatorClick,
  25066. handleMouseEnter,
  25067. handleMouseLeave,
  25068. setActiveItem,
  25069. prev,
  25070. next,
  25071. PlaceholderItem,
  25072. isTwoLengthShow,
  25073. throttledArrowClick,
  25074. throttledIndicatorHover
  25075. } = useCarousel(props, emit2);
  25076. const ns = useNamespace("carousel");
  25077. const carouselClasses = computed(() => {
  25078. const classes = [ns.b(), ns.m(props.direction)];
  25079. if (unref(isCardType)) {
  25080. classes.push(ns.m("card"));
  25081. }
  25082. return classes;
  25083. });
  25084. const indicatorsClasses = computed(() => {
  25085. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  25086. if (unref(hasLabel)) {
  25087. classes.push(ns.em("indicators", "labels"));
  25088. }
  25089. if (props.indicatorPosition === "outside") {
  25090. classes.push(ns.em("indicators", "outside"));
  25091. }
  25092. if (unref(isVertical)) {
  25093. classes.push(ns.em("indicators", "right"));
  25094. }
  25095. return classes;
  25096. });
  25097. expose({
  25098. setActiveItem,
  25099. prev,
  25100. next
  25101. });
  25102. return (_ctx, _cache) => {
  25103. return openBlock(), createElementBlock("div", {
  25104. ref_key: "root",
  25105. ref: root2,
  25106. class: normalizeClass(unref(carouselClasses)),
  25107. onMouseenter: _cache[6] || (_cache[6] = withModifiers((...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args), ["stop"])),
  25108. onMouseleave: _cache[7] || (_cache[7] = withModifiers((...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args), ["stop"]))
  25109. }, [
  25110. createBaseVNode("div", {
  25111. class: normalizeClass(unref(ns).e("container")),
  25112. style: normalizeStyle(unref(containerStyle))
  25113. }, [
  25114. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  25115. key: 0,
  25116. name: "carousel-arrow-left",
  25117. persisted: ""
  25118. }, {
  25119. default: withCtx(() => [
  25120. withDirectives(createBaseVNode("button", {
  25121. type: "button",
  25122. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
  25123. onMouseenter: _cache[0] || (_cache[0] = ($event) => unref(handleButtonEnter)("left")),
  25124. onMouseleave: _cache[1] || (_cache[1] = (...args) => unref(handleButtonLeave) && unref(handleButtonLeave)(...args)),
  25125. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) - 1), ["stop"]))
  25126. }, [
  25127. createVNode(unref(ElIcon), null, {
  25128. default: withCtx(() => [
  25129. createVNode(unref(arrow_left_default))
  25130. ]),
  25131. _: 1
  25132. })
  25133. ], 34), [
  25134. [
  25135. vShow,
  25136. (_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) > 0)
  25137. ]
  25138. ])
  25139. ]),
  25140. _: 1
  25141. })) : createCommentVNode("v-if", true),
  25142. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  25143. key: 1,
  25144. name: "carousel-arrow-right",
  25145. persisted: ""
  25146. }, {
  25147. default: withCtx(() => [
  25148. withDirectives(createBaseVNode("button", {
  25149. type: "button",
  25150. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
  25151. onMouseenter: _cache[3] || (_cache[3] = ($event) => unref(handleButtonEnter)("right")),
  25152. onMouseleave: _cache[4] || (_cache[4] = (...args) => unref(handleButtonLeave) && unref(handleButtonLeave)(...args)),
  25153. onClick: _cache[5] || (_cache[5] = withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) + 1), ["stop"]))
  25154. }, [
  25155. createVNode(unref(ElIcon), null, {
  25156. default: withCtx(() => [
  25157. createVNode(unref(arrow_right_default))
  25158. ]),
  25159. _: 1
  25160. })
  25161. ], 34), [
  25162. [
  25163. vShow,
  25164. (_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) < unref(items).length - 1)
  25165. ]
  25166. ])
  25167. ]),
  25168. _: 1
  25169. })) : createCommentVNode("v-if", true),
  25170. createVNode(unref(PlaceholderItem)),
  25171. renderSlot(_ctx.$slots, "default")
  25172. ], 6),
  25173. _ctx.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
  25174. key: 0,
  25175. class: normalizeClass(unref(indicatorsClasses))
  25176. }, [
  25177. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index2) => {
  25178. return withDirectives((openBlock(), createElementBlock("li", {
  25179. key: index2,
  25180. class: normalizeClass([
  25181. unref(ns).e("indicator"),
  25182. unref(ns).em("indicator", _ctx.direction),
  25183. unref(ns).is("active", index2 === unref(activeIndex))
  25184. ]),
  25185. onMouseenter: ($event) => unref(throttledIndicatorHover)(index2),
  25186. onClick: withModifiers(($event) => unref(handleIndicatorClick)(index2), ["stop"])
  25187. }, [
  25188. createBaseVNode("button", {
  25189. class: normalizeClass(unref(ns).e("button"))
  25190. }, [
  25191. unref(hasLabel) ? (openBlock(), createElementBlock("span", _hoisted_2$C, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)
  25192. ], 2)
  25193. ], 42, _hoisted_1$X)), [
  25194. [vShow, unref(isTwoLengthShow)(index2)]
  25195. ]);
  25196. }), 128))
  25197. ], 2)) : createCommentVNode("v-if", true)
  25198. ], 34);
  25199. };
  25200. }
  25201. });
  25202. var Carousel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1T, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/carousel/src/carousel.vue"]]);
  25203. const carouselItemProps = buildProps({
  25204. name: { type: String, default: "" },
  25205. label: {
  25206. type: [String, Number],
  25207. default: ""
  25208. }
  25209. });
  25210. const useCarouselItem = (props, componentName2) => {
  25211. const carouselContext = inject(carouselContextKey);
  25212. const instance = getCurrentInstance();
  25213. const CARD_SCALE = 0.83;
  25214. const carouselItemRef = ref();
  25215. const hover = ref(false);
  25216. const translate2 = ref(0);
  25217. const scale = ref(1);
  25218. const active = ref(false);
  25219. const ready = ref(false);
  25220. const inStage = ref(false);
  25221. const animating = ref(false);
  25222. const { isCardType, isVertical } = carouselContext;
  25223. function processIndex(index2, activeIndex, length) {
  25224. const lastItemIndex = length - 1;
  25225. const prevItemIndex = activeIndex - 1;
  25226. const nextItemIndex = activeIndex + 1;
  25227. const halfItemIndex = length / 2;
  25228. if (activeIndex === 0 && index2 === lastItemIndex) {
  25229. return -1;
  25230. } else if (activeIndex === lastItemIndex && index2 === 0) {
  25231. return length;
  25232. } else if (index2 < prevItemIndex && activeIndex - index2 >= halfItemIndex) {
  25233. return length + 1;
  25234. } else if (index2 > nextItemIndex && index2 - activeIndex >= halfItemIndex) {
  25235. return -2;
  25236. }
  25237. return index2;
  25238. }
  25239. function calcCardTranslate(index2, activeIndex) {
  25240. var _a2, _b;
  25241. const parentWidth = unref(isVertical) ? ((_a2 = carouselContext.root.value) == null ? void 0 : _a2.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
  25242. if (inStage.value) {
  25243. return parentWidth * ((2 - CARD_SCALE) * (index2 - activeIndex) + 1) / 4;
  25244. } else if (index2 < activeIndex) {
  25245. return -(1 + CARD_SCALE) * parentWidth / 4;
  25246. } else {
  25247. return (3 + CARD_SCALE) * parentWidth / 4;
  25248. }
  25249. }
  25250. function calcTranslate(index2, activeIndex, isVertical2) {
  25251. const rootEl = carouselContext.root.value;
  25252. if (!rootEl)
  25253. return 0;
  25254. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  25255. return distance * (index2 - activeIndex);
  25256. }
  25257. const translateItem = (index2, activeIndex, oldIndex) => {
  25258. var _a2;
  25259. const _isCardType = unref(isCardType);
  25260. const carouselItemLength = (_a2 = carouselContext.items.value.length) != null ? _a2 : Number.NaN;
  25261. const isActive = index2 === activeIndex;
  25262. if (!_isCardType && !isUndefined(oldIndex)) {
  25263. animating.value = isActive || index2 === oldIndex;
  25264. }
  25265. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  25266. index2 = processIndex(index2, activeIndex, carouselItemLength);
  25267. }
  25268. const _isVertical = unref(isVertical);
  25269. active.value = isActive;
  25270. if (_isCardType) {
  25271. inStage.value = Math.round(Math.abs(index2 - activeIndex)) <= 1;
  25272. translate2.value = calcCardTranslate(index2, activeIndex);
  25273. scale.value = unref(active) ? 1 : CARD_SCALE;
  25274. } else {
  25275. translate2.value = calcTranslate(index2, activeIndex, _isVertical);
  25276. }
  25277. ready.value = true;
  25278. if (isActive && carouselItemRef.value) {
  25279. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  25280. }
  25281. };
  25282. function handleItemClick() {
  25283. if (carouselContext && unref(isCardType)) {
  25284. const index2 = carouselContext.items.value.findIndex(({ uid: uid2 }) => uid2 === instance.uid);
  25285. carouselContext.setActiveItem(index2);
  25286. }
  25287. }
  25288. onMounted(() => {
  25289. carouselContext.addItem({
  25290. props,
  25291. states: reactive({
  25292. hover,
  25293. translate: translate2,
  25294. scale,
  25295. active,
  25296. ready,
  25297. inStage,
  25298. animating
  25299. }),
  25300. uid: instance.uid,
  25301. translateItem
  25302. });
  25303. });
  25304. onUnmounted(() => {
  25305. carouselContext.removeItem(instance.uid);
  25306. });
  25307. return {
  25308. carouselItemRef,
  25309. active,
  25310. animating,
  25311. hover,
  25312. inStage,
  25313. isVertical,
  25314. translate: translate2,
  25315. isCardType,
  25316. scale,
  25317. ready,
  25318. handleItemClick
  25319. };
  25320. };
  25321. const __default__$1c = /* @__PURE__ */ defineComponent({
  25322. name: "ElCarouselItem"
  25323. });
  25324. const _sfc_main$1S = /* @__PURE__ */ defineComponent({
  25325. ...__default__$1c,
  25326. props: carouselItemProps,
  25327. setup(__props) {
  25328. const props = __props;
  25329. const ns = useNamespace("carousel");
  25330. const {
  25331. carouselItemRef,
  25332. active,
  25333. animating,
  25334. hover,
  25335. inStage,
  25336. isVertical,
  25337. translate: translate2,
  25338. isCardType,
  25339. scale,
  25340. ready,
  25341. handleItemClick
  25342. } = useCarouselItem(props);
  25343. const itemStyle = computed(() => {
  25344. const translateType = `translate${unref(isVertical) ? "Y" : "X"}`;
  25345. const _translate = `${translateType}(${unref(translate2)}px)`;
  25346. const _scale = `scale(${unref(scale)})`;
  25347. const transform = [_translate, _scale].join(" ");
  25348. return {
  25349. transform
  25350. };
  25351. });
  25352. return (_ctx, _cache) => {
  25353. return withDirectives((openBlock(), createElementBlock("div", {
  25354. ref_key: "carouselItemRef",
  25355. ref: carouselItemRef,
  25356. class: normalizeClass([
  25357. unref(ns).e("item"),
  25358. unref(ns).is("active", unref(active)),
  25359. unref(ns).is("in-stage", unref(inStage)),
  25360. unref(ns).is("hover", unref(hover)),
  25361. unref(ns).is("animating", unref(animating)),
  25362. {
  25363. [unref(ns).em("item", "card")]: unref(isCardType),
  25364. [unref(ns).em("item", "card-vertical")]: unref(isCardType) && unref(isVertical)
  25365. }
  25366. ]),
  25367. style: normalizeStyle(unref(itemStyle)),
  25368. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleItemClick) && unref(handleItemClick)(...args))
  25369. }, [
  25370. unref(isCardType) ? withDirectives((openBlock(), createElementBlock("div", {
  25371. key: 0,
  25372. class: normalizeClass(unref(ns).e("mask"))
  25373. }, null, 2)), [
  25374. [vShow, !unref(active)]
  25375. ]) : createCommentVNode("v-if", true),
  25376. renderSlot(_ctx.$slots, "default")
  25377. ], 6)), [
  25378. [vShow, unref(ready)]
  25379. ]);
  25380. };
  25381. }
  25382. });
  25383. var CarouselItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$1S, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/carousel/src/carousel-item.vue"]]);
  25384. const ElCarousel = withInstall(Carousel, {
  25385. CarouselItem
  25386. });
  25387. const ElCarouselItem = withNoopInstall(CarouselItem);
  25388. const checkboxProps = {
  25389. modelValue: {
  25390. type: [Number, String, Boolean],
  25391. default: void 0
  25392. },
  25393. label: {
  25394. type: [String, Boolean, Number, Object],
  25395. default: void 0
  25396. },
  25397. indeterminate: Boolean,
  25398. disabled: Boolean,
  25399. checked: Boolean,
  25400. name: {
  25401. type: String,
  25402. default: void 0
  25403. },
  25404. trueLabel: {
  25405. type: [String, Number],
  25406. default: void 0
  25407. },
  25408. falseLabel: {
  25409. type: [String, Number],
  25410. default: void 0
  25411. },
  25412. id: {
  25413. type: String,
  25414. default: void 0
  25415. },
  25416. controls: {
  25417. type: String,
  25418. default: void 0
  25419. },
  25420. border: Boolean,
  25421. size: useSizeProp,
  25422. tabindex: [String, Number],
  25423. validateEvent: {
  25424. type: Boolean,
  25425. default: true
  25426. }
  25427. };
  25428. const checkboxEmits = {
  25429. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  25430. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  25431. };
  25432. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  25433. const useCheckboxDisabled = ({
  25434. model,
  25435. isChecked
  25436. }) => {
  25437. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  25438. const isLimitDisabled = computed(() => {
  25439. var _a2, _b;
  25440. const max2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value;
  25441. const min2 = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  25442. return !isUndefined(max2) && model.value.length >= max2 && !isChecked.value || !isUndefined(min2) && model.value.length <= min2 && isChecked.value;
  25443. });
  25444. const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  25445. return {
  25446. isDisabled,
  25447. isLimitDisabled
  25448. };
  25449. };
  25450. const useCheckboxEvent = (props, {
  25451. model,
  25452. isLimitExceeded,
  25453. hasOwnLabel,
  25454. isDisabled,
  25455. isLabeledByFormItem
  25456. }) => {
  25457. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  25458. const { formItem } = useFormItem();
  25459. const { emit: emit2 } = getCurrentInstance();
  25460. function getLabeledValue(value) {
  25461. var _a2, _b;
  25462. return value === props.trueLabel || value === true ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b = props.falseLabel) != null ? _b : false;
  25463. }
  25464. function emitChangeEvent(checked, e) {
  25465. emit2("change", getLabeledValue(checked), e);
  25466. }
  25467. function handleChange(e) {
  25468. if (isLimitExceeded.value)
  25469. return;
  25470. const target = e.target;
  25471. emit2("change", getLabeledValue(target.checked), e);
  25472. }
  25473. async function onClickRoot(e) {
  25474. if (isLimitExceeded.value)
  25475. return;
  25476. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  25477. const eventTargets = e.composedPath();
  25478. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  25479. if (!hasLabel) {
  25480. model.value = getLabeledValue([false, props.falseLabel].includes(model.value));
  25481. await nextTick();
  25482. emitChangeEvent(model.value, e);
  25483. }
  25484. }
  25485. }
  25486. const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  25487. watch(() => props.modelValue, () => {
  25488. if (validateEvent.value) {
  25489. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25490. }
  25491. });
  25492. return {
  25493. handleChange,
  25494. onClickRoot
  25495. };
  25496. };
  25497. const useCheckboxModel = (props) => {
  25498. const selfModel = ref(false);
  25499. const { emit: emit2 } = getCurrentInstance();
  25500. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  25501. const isGroup = computed(() => isUndefined(checkboxGroup) === false);
  25502. const isLimitExceeded = ref(false);
  25503. const model = computed({
  25504. get() {
  25505. var _a2, _b;
  25506. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  25507. },
  25508. set(val) {
  25509. var _a2, _b;
  25510. if (isGroup.value && isArray$3(val)) {
  25511. isLimitExceeded.value = ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a2.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value);
  25512. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  25513. } else {
  25514. emit2(UPDATE_MODEL_EVENT, val);
  25515. selfModel.value = val;
  25516. }
  25517. }
  25518. });
  25519. return {
  25520. model,
  25521. isGroup,
  25522. isLimitExceeded
  25523. };
  25524. };
  25525. const useCheckboxStatus = (props, slots, { model }) => {
  25526. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  25527. const isFocused = ref(false);
  25528. const isChecked = computed(() => {
  25529. const value = model.value;
  25530. if (isBoolean(value)) {
  25531. return value;
  25532. } else if (isArray$3(value)) {
  25533. if (isObject$1(props.label)) {
  25534. return value.map(toRaw).some((o2) => isEqual$1(o2, props.label));
  25535. } else {
  25536. return value.map(toRaw).includes(props.label);
  25537. }
  25538. } else if (value !== null && value !== void 0) {
  25539. return value === props.trueLabel;
  25540. } else {
  25541. return !!value;
  25542. }
  25543. });
  25544. const checkboxButtonSize = useFormSize(computed(() => {
  25545. var _a2;
  25546. return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
  25547. }), {
  25548. prop: true
  25549. });
  25550. const checkboxSize = useFormSize(computed(() => {
  25551. var _a2;
  25552. return (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a2.value;
  25553. }));
  25554. const hasOwnLabel = computed(() => {
  25555. return !!slots.default || !isNil(props.label);
  25556. });
  25557. return {
  25558. checkboxButtonSize,
  25559. isChecked,
  25560. isFocused,
  25561. checkboxSize,
  25562. hasOwnLabel
  25563. };
  25564. };
  25565. const setStoreValue = (props, { model }) => {
  25566. function addToStore() {
  25567. if (isArray$3(model.value) && !model.value.includes(props.label)) {
  25568. model.value.push(props.label);
  25569. } else {
  25570. model.value = props.trueLabel || true;
  25571. }
  25572. }
  25573. props.checked && addToStore();
  25574. };
  25575. const useCheckbox = (props, slots) => {
  25576. const { formItem: elFormItem } = useFormItem();
  25577. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  25578. const {
  25579. isFocused,
  25580. isChecked,
  25581. checkboxButtonSize,
  25582. checkboxSize,
  25583. hasOwnLabel
  25584. } = useCheckboxStatus(props, slots, { model });
  25585. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  25586. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  25587. formItemContext: elFormItem,
  25588. disableIdGeneration: hasOwnLabel,
  25589. disableIdManagement: isGroup
  25590. });
  25591. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  25592. model,
  25593. isLimitExceeded,
  25594. hasOwnLabel,
  25595. isDisabled,
  25596. isLabeledByFormItem
  25597. });
  25598. setStoreValue(props, { model });
  25599. return {
  25600. inputId,
  25601. isLabeledByFormItem,
  25602. isChecked,
  25603. isDisabled,
  25604. isFocused,
  25605. checkboxButtonSize,
  25606. checkboxSize,
  25607. hasOwnLabel,
  25608. model,
  25609. handleChange,
  25610. onClickRoot
  25611. };
  25612. };
  25613. const _hoisted_1$W = ["id", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value"];
  25614. const _hoisted_2$B = ["id", "indeterminate", "disabled", "value", "name", "tabindex"];
  25615. const __default__$1b = /* @__PURE__ */ defineComponent({
  25616. name: "ElCheckbox"
  25617. });
  25618. const _sfc_main$1R = /* @__PURE__ */ defineComponent({
  25619. ...__default__$1b,
  25620. props: checkboxProps,
  25621. emits: checkboxEmits,
  25622. setup(__props) {
  25623. const props = __props;
  25624. const slots = useSlots();
  25625. const {
  25626. inputId,
  25627. isLabeledByFormItem,
  25628. isChecked,
  25629. isDisabled,
  25630. isFocused,
  25631. checkboxSize,
  25632. hasOwnLabel,
  25633. model,
  25634. handleChange,
  25635. onClickRoot
  25636. } = useCheckbox(props, slots);
  25637. const ns = useNamespace("checkbox");
  25638. const compKls = computed(() => {
  25639. return [
  25640. ns.b(),
  25641. ns.m(checkboxSize.value),
  25642. ns.is("disabled", isDisabled.value),
  25643. ns.is("bordered", props.border),
  25644. ns.is("checked", isChecked.value)
  25645. ];
  25646. });
  25647. const spanKls = computed(() => {
  25648. return [
  25649. ns.e("input"),
  25650. ns.is("disabled", isDisabled.value),
  25651. ns.is("checked", isChecked.value),
  25652. ns.is("indeterminate", props.indeterminate),
  25653. ns.is("focus", isFocused.value)
  25654. ];
  25655. });
  25656. return (_ctx, _cache) => {
  25657. return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
  25658. class: normalizeClass(unref(compKls)),
  25659. "aria-controls": _ctx.indeterminate ? _ctx.controls : null,
  25660. onClick: unref(onClickRoot)
  25661. }, {
  25662. default: withCtx(() => [
  25663. createBaseVNode("span", {
  25664. class: normalizeClass(unref(spanKls))
  25665. }, [
  25666. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  25667. key: 0,
  25668. id: unref(inputId),
  25669. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
  25670. class: normalizeClass(unref(ns).e("original")),
  25671. type: "checkbox",
  25672. indeterminate: _ctx.indeterminate,
  25673. name: _ctx.name,
  25674. tabindex: _ctx.tabindex,
  25675. disabled: unref(isDisabled),
  25676. "true-value": _ctx.trueLabel,
  25677. "false-value": _ctx.falseLabel,
  25678. onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  25679. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  25680. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  25681. onClick: _cache[4] || (_cache[4] = withModifiers(() => {
  25682. }, ["stop"]))
  25683. }, null, 42, _hoisted_1$W)), [
  25684. [vModelCheckbox, unref(model)]
  25685. ]) : withDirectives((openBlock(), createElementBlock("input", {
  25686. key: 1,
  25687. id: unref(inputId),
  25688. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(model) ? model.value = $event : null),
  25689. class: normalizeClass(unref(ns).e("original")),
  25690. type: "checkbox",
  25691. indeterminate: _ctx.indeterminate,
  25692. disabled: unref(isDisabled),
  25693. value: _ctx.label,
  25694. name: _ctx.name,
  25695. tabindex: _ctx.tabindex,
  25696. onChange: _cache[6] || (_cache[6] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  25697. onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
  25698. onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
  25699. onClick: _cache[9] || (_cache[9] = withModifiers(() => {
  25700. }, ["stop"]))
  25701. }, null, 42, _hoisted_2$B)), [
  25702. [vModelCheckbox, unref(model)]
  25703. ]),
  25704. createBaseVNode("span", {
  25705. class: normalizeClass(unref(ns).e("inner"))
  25706. }, null, 2)
  25707. ], 2),
  25708. unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
  25709. key: 0,
  25710. class: normalizeClass(unref(ns).e("label"))
  25711. }, [
  25712. renderSlot(_ctx.$slots, "default"),
  25713. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  25714. createTextVNode(toDisplayString(_ctx.label), 1)
  25715. ], 64)) : createCommentVNode("v-if", true)
  25716. ], 2)) : createCommentVNode("v-if", true)
  25717. ]),
  25718. _: 3
  25719. }, 8, ["class", "aria-controls", "onClick"]);
  25720. };
  25721. }
  25722. });
  25723. var Checkbox = /* @__PURE__ */ _export_sfc$1(_sfc_main$1R, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
  25724. const _hoisted_1$V = ["name", "tabindex", "disabled", "true-value", "false-value"];
  25725. const _hoisted_2$A = ["name", "tabindex", "disabled", "value"];
  25726. const __default__$1a = /* @__PURE__ */ defineComponent({
  25727. name: "ElCheckboxButton"
  25728. });
  25729. const _sfc_main$1Q = /* @__PURE__ */ defineComponent({
  25730. ...__default__$1a,
  25731. props: checkboxProps,
  25732. emits: checkboxEmits,
  25733. setup(__props) {
  25734. const props = __props;
  25735. const slots = useSlots();
  25736. const {
  25737. isFocused,
  25738. isChecked,
  25739. isDisabled,
  25740. checkboxButtonSize,
  25741. model,
  25742. handleChange
  25743. } = useCheckbox(props, slots);
  25744. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  25745. const ns = useNamespace("checkbox");
  25746. const activeStyle = computed(() => {
  25747. var _a2, _b, _c, _d;
  25748. const fillValue = (_b = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b : "";
  25749. return {
  25750. backgroundColor: fillValue,
  25751. borderColor: fillValue,
  25752. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  25753. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  25754. };
  25755. });
  25756. const labelKls = computed(() => {
  25757. return [
  25758. ns.b("button"),
  25759. ns.bm("button", checkboxButtonSize.value),
  25760. ns.is("disabled", isDisabled.value),
  25761. ns.is("checked", isChecked.value),
  25762. ns.is("focus", isFocused.value)
  25763. ];
  25764. });
  25765. return (_ctx, _cache) => {
  25766. return openBlock(), createElementBlock("label", {
  25767. class: normalizeClass(unref(labelKls))
  25768. }, [
  25769. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  25770. key: 0,
  25771. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
  25772. class: normalizeClass(unref(ns).be("button", "original")),
  25773. type: "checkbox",
  25774. name: _ctx.name,
  25775. tabindex: _ctx.tabindex,
  25776. disabled: unref(isDisabled),
  25777. "true-value": _ctx.trueLabel,
  25778. "false-value": _ctx.falseLabel,
  25779. onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  25780. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  25781. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  25782. onClick: _cache[4] || (_cache[4] = withModifiers(() => {
  25783. }, ["stop"]))
  25784. }, null, 42, _hoisted_1$V)), [
  25785. [vModelCheckbox, unref(model)]
  25786. ]) : withDirectives((openBlock(), createElementBlock("input", {
  25787. key: 1,
  25788. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(model) ? model.value = $event : null),
  25789. class: normalizeClass(unref(ns).be("button", "original")),
  25790. type: "checkbox",
  25791. name: _ctx.name,
  25792. tabindex: _ctx.tabindex,
  25793. disabled: unref(isDisabled),
  25794. value: _ctx.label,
  25795. onChange: _cache[6] || (_cache[6] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  25796. onFocus: _cache[7] || (_cache[7] = ($event) => isFocused.value = true),
  25797. onBlur: _cache[8] || (_cache[8] = ($event) => isFocused.value = false),
  25798. onClick: _cache[9] || (_cache[9] = withModifiers(() => {
  25799. }, ["stop"]))
  25800. }, null, 42, _hoisted_2$A)), [
  25801. [vModelCheckbox, unref(model)]
  25802. ]),
  25803. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  25804. key: 2,
  25805. class: normalizeClass(unref(ns).be("button", "inner")),
  25806. style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
  25807. }, [
  25808. renderSlot(_ctx.$slots, "default", {}, () => [
  25809. createTextVNode(toDisplayString(_ctx.label), 1)
  25810. ])
  25811. ], 6)) : createCommentVNode("v-if", true)
  25812. ], 2);
  25813. };
  25814. }
  25815. });
  25816. var CheckboxButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$1Q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
  25817. const checkboxGroupProps = buildProps({
  25818. modelValue: {
  25819. type: definePropType(Array),
  25820. default: () => []
  25821. },
  25822. disabled: Boolean,
  25823. min: Number,
  25824. max: Number,
  25825. size: useSizeProp,
  25826. label: String,
  25827. fill: String,
  25828. textColor: String,
  25829. tag: {
  25830. type: String,
  25831. default: "div"
  25832. },
  25833. validateEvent: {
  25834. type: Boolean,
  25835. default: true
  25836. }
  25837. });
  25838. const checkboxGroupEmits = {
  25839. [UPDATE_MODEL_EVENT]: (val) => isArray$3(val),
  25840. change: (val) => isArray$3(val)
  25841. };
  25842. const __default__$19 = /* @__PURE__ */ defineComponent({
  25843. name: "ElCheckboxGroup"
  25844. });
  25845. const _sfc_main$1P = /* @__PURE__ */ defineComponent({
  25846. ...__default__$19,
  25847. props: checkboxGroupProps,
  25848. emits: checkboxGroupEmits,
  25849. setup(__props, { emit: emit2 }) {
  25850. const props = __props;
  25851. const ns = useNamespace("checkbox");
  25852. const { formItem } = useFormItem();
  25853. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  25854. formItemContext: formItem
  25855. });
  25856. const changeEvent = async (value) => {
  25857. emit2(UPDATE_MODEL_EVENT, value);
  25858. await nextTick();
  25859. emit2("change", value);
  25860. };
  25861. const modelValue = computed({
  25862. get() {
  25863. return props.modelValue;
  25864. },
  25865. set(val) {
  25866. changeEvent(val);
  25867. }
  25868. });
  25869. provide(checkboxGroupContextKey, {
  25870. ...pick$1(toRefs(props), [
  25871. "size",
  25872. "min",
  25873. "max",
  25874. "disabled",
  25875. "validateEvent",
  25876. "fill",
  25877. "textColor"
  25878. ]),
  25879. modelValue,
  25880. changeEvent
  25881. });
  25882. watch(() => props.modelValue, () => {
  25883. if (props.validateEvent) {
  25884. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25885. }
  25886. });
  25887. return (_ctx, _cache) => {
  25888. var _a2;
  25889. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  25890. id: unref(groupId),
  25891. class: normalizeClass(unref(ns).b("group")),
  25892. role: "group",
  25893. "aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "checkbox-group" : void 0,
  25894. "aria-labelledby": unref(isLabeledByFormItem) ? (_a2 = unref(formItem)) == null ? void 0 : _a2.labelId : void 0
  25895. }, {
  25896. default: withCtx(() => [
  25897. renderSlot(_ctx.$slots, "default")
  25898. ]),
  25899. _: 3
  25900. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  25901. };
  25902. }
  25903. });
  25904. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1P, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
  25905. const ElCheckbox = withInstall(Checkbox, {
  25906. CheckboxButton,
  25907. CheckboxGroup
  25908. });
  25909. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  25910. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  25911. const radioPropsBase = buildProps({
  25912. size: useSizeProp,
  25913. disabled: Boolean,
  25914. label: {
  25915. type: [String, Number, Boolean],
  25916. default: ""
  25917. }
  25918. });
  25919. const radioProps = buildProps({
  25920. ...radioPropsBase,
  25921. modelValue: {
  25922. type: [String, Number, Boolean],
  25923. default: ""
  25924. },
  25925. name: {
  25926. type: String,
  25927. default: ""
  25928. },
  25929. border: Boolean
  25930. });
  25931. const radioEmits = {
  25932. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  25933. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  25934. };
  25935. const radioGroupKey = Symbol("radioGroupKey");
  25936. const useRadio = (props, emit2) => {
  25937. const radioRef = ref();
  25938. const radioGroup = inject(radioGroupKey, void 0);
  25939. const isGroup = computed(() => !!radioGroup);
  25940. const modelValue = computed({
  25941. get() {
  25942. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  25943. },
  25944. set(val) {
  25945. if (isGroup.value) {
  25946. radioGroup.changeEvent(val);
  25947. } else {
  25948. emit2 && emit2(UPDATE_MODEL_EVENT, val);
  25949. }
  25950. radioRef.value.checked = props.modelValue === props.label;
  25951. }
  25952. });
  25953. const size2 = useFormSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  25954. const disabled = useFormDisabled(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  25955. const focus = ref(false);
  25956. const tabIndex = computed(() => {
  25957. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  25958. });
  25959. return {
  25960. radioRef,
  25961. isGroup,
  25962. radioGroup,
  25963. focus,
  25964. size: size2,
  25965. disabled,
  25966. tabIndex,
  25967. modelValue
  25968. };
  25969. };
  25970. const _hoisted_1$U = ["value", "name", "disabled"];
  25971. const __default__$18 = /* @__PURE__ */ defineComponent({
  25972. name: "ElRadio"
  25973. });
  25974. const _sfc_main$1O = /* @__PURE__ */ defineComponent({
  25975. ...__default__$18,
  25976. props: radioProps,
  25977. emits: radioEmits,
  25978. setup(__props, { emit: emit2 }) {
  25979. const props = __props;
  25980. const ns = useNamespace("radio");
  25981. const { radioRef, radioGroup, focus, size: size2, disabled, modelValue } = useRadio(props, emit2);
  25982. function handleChange() {
  25983. nextTick(() => emit2("change", modelValue.value));
  25984. }
  25985. return (_ctx, _cache) => {
  25986. var _a2;
  25987. return openBlock(), createElementBlock("label", {
  25988. class: normalizeClass([
  25989. unref(ns).b(),
  25990. unref(ns).is("disabled", unref(disabled)),
  25991. unref(ns).is("focus", unref(focus)),
  25992. unref(ns).is("bordered", _ctx.border),
  25993. unref(ns).is("checked", unref(modelValue) === _ctx.label),
  25994. unref(ns).m(unref(size2))
  25995. ])
  25996. }, [
  25997. createBaseVNode("span", {
  25998. class: normalizeClass([
  25999. unref(ns).e("input"),
  26000. unref(ns).is("disabled", unref(disabled)),
  26001. unref(ns).is("checked", unref(modelValue) === _ctx.label)
  26002. ])
  26003. }, [
  26004. withDirectives(createBaseVNode("input", {
  26005. ref_key: "radioRef",
  26006. ref: radioRef,
  26007. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  26008. class: normalizeClass(unref(ns).e("original")),
  26009. value: _ctx.label,
  26010. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  26011. disabled: unref(disabled),
  26012. type: "radio",
  26013. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  26014. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  26015. onChange: handleChange,
  26016. onClick: _cache[3] || (_cache[3] = withModifiers(() => {
  26017. }, ["stop"]))
  26018. }, null, 42, _hoisted_1$U), [
  26019. [vModelRadio, unref(modelValue)]
  26020. ]),
  26021. createBaseVNode("span", {
  26022. class: normalizeClass(unref(ns).e("inner"))
  26023. }, null, 2)
  26024. ], 2),
  26025. createBaseVNode("span", {
  26026. class: normalizeClass(unref(ns).e("label")),
  26027. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  26028. }, ["stop"]))
  26029. }, [
  26030. renderSlot(_ctx.$slots, "default", {}, () => [
  26031. createTextVNode(toDisplayString(_ctx.label), 1)
  26032. ])
  26033. ], 34)
  26034. ], 2);
  26035. };
  26036. }
  26037. });
  26038. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$1O, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  26039. const radioButtonProps = buildProps({
  26040. ...radioPropsBase,
  26041. name: {
  26042. type: String,
  26043. default: ""
  26044. }
  26045. });
  26046. const _hoisted_1$T = ["value", "name", "disabled"];
  26047. const __default__$17 = /* @__PURE__ */ defineComponent({
  26048. name: "ElRadioButton"
  26049. });
  26050. const _sfc_main$1N = /* @__PURE__ */ defineComponent({
  26051. ...__default__$17,
  26052. props: radioButtonProps,
  26053. setup(__props) {
  26054. const props = __props;
  26055. const ns = useNamespace("radio");
  26056. const { radioRef, focus, size: size2, disabled, modelValue, radioGroup } = useRadio(props);
  26057. const activeStyle = computed(() => {
  26058. return {
  26059. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  26060. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  26061. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  26062. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  26063. };
  26064. });
  26065. return (_ctx, _cache) => {
  26066. var _a2;
  26067. return openBlock(), createElementBlock("label", {
  26068. class: normalizeClass([
  26069. unref(ns).b("button"),
  26070. unref(ns).is("active", unref(modelValue) === _ctx.label),
  26071. unref(ns).is("disabled", unref(disabled)),
  26072. unref(ns).is("focus", unref(focus)),
  26073. unref(ns).bm("button", unref(size2))
  26074. ])
  26075. }, [
  26076. withDirectives(createBaseVNode("input", {
  26077. ref_key: "radioRef",
  26078. ref: radioRef,
  26079. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  26080. class: normalizeClass(unref(ns).be("button", "original-radio")),
  26081. value: _ctx.label,
  26082. type: "radio",
  26083. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  26084. disabled: unref(disabled),
  26085. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  26086. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  26087. onClick: _cache[3] || (_cache[3] = withModifiers(() => {
  26088. }, ["stop"]))
  26089. }, null, 42, _hoisted_1$T), [
  26090. [vModelRadio, unref(modelValue)]
  26091. ]),
  26092. createBaseVNode("span", {
  26093. class: normalizeClass(unref(ns).be("button", "inner")),
  26094. style: normalizeStyle(unref(modelValue) === _ctx.label ? unref(activeStyle) : {}),
  26095. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  26096. }, ["stop"]))
  26097. }, [
  26098. renderSlot(_ctx.$slots, "default", {}, () => [
  26099. createTextVNode(toDisplayString(_ctx.label), 1)
  26100. ])
  26101. ], 38)
  26102. ], 2);
  26103. };
  26104. }
  26105. });
  26106. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$1N, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  26107. const radioGroupProps = buildProps({
  26108. id: {
  26109. type: String,
  26110. default: void 0
  26111. },
  26112. size: useSizeProp,
  26113. disabled: Boolean,
  26114. modelValue: {
  26115. type: [String, Number, Boolean],
  26116. default: ""
  26117. },
  26118. fill: {
  26119. type: String,
  26120. default: ""
  26121. },
  26122. label: {
  26123. type: String,
  26124. default: void 0
  26125. },
  26126. textColor: {
  26127. type: String,
  26128. default: ""
  26129. },
  26130. name: {
  26131. type: String,
  26132. default: void 0
  26133. },
  26134. validateEvent: {
  26135. type: Boolean,
  26136. default: true
  26137. }
  26138. });
  26139. const radioGroupEmits = radioEmits;
  26140. const _hoisted_1$S = ["id", "aria-label", "aria-labelledby"];
  26141. const __default__$16 = /* @__PURE__ */ defineComponent({
  26142. name: "ElRadioGroup"
  26143. });
  26144. const _sfc_main$1M = /* @__PURE__ */ defineComponent({
  26145. ...__default__$16,
  26146. props: radioGroupProps,
  26147. emits: radioGroupEmits,
  26148. setup(__props, { emit: emit2 }) {
  26149. const props = __props;
  26150. const ns = useNamespace("radio");
  26151. const radioId = useId();
  26152. const radioGroupRef = ref();
  26153. const { formItem } = useFormItem();
  26154. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  26155. formItemContext: formItem
  26156. });
  26157. const changeEvent = (value) => {
  26158. emit2(UPDATE_MODEL_EVENT, value);
  26159. nextTick(() => emit2("change", value));
  26160. };
  26161. onMounted(() => {
  26162. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  26163. const firstLabel = radios[0];
  26164. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  26165. firstLabel.tabIndex = 0;
  26166. }
  26167. });
  26168. const name = computed(() => {
  26169. return props.name || radioId.value;
  26170. });
  26171. provide(radioGroupKey, reactive({
  26172. ...toRefs(props),
  26173. changeEvent,
  26174. name
  26175. }));
  26176. watch(() => props.modelValue, () => {
  26177. if (props.validateEvent) {
  26178. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  26179. }
  26180. });
  26181. return (_ctx, _cache) => {
  26182. return openBlock(), createElementBlock("div", {
  26183. id: unref(groupId),
  26184. ref_key: "radioGroupRef",
  26185. ref: radioGroupRef,
  26186. class: normalizeClass(unref(ns).b("group")),
  26187. role: "radiogroup",
  26188. "aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
  26189. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  26190. }, [
  26191. renderSlot(_ctx.$slots, "default")
  26192. ], 10, _hoisted_1$S);
  26193. };
  26194. }
  26195. });
  26196. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1M, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  26197. const ElRadio = withInstall(Radio, {
  26198. RadioButton,
  26199. RadioGroup
  26200. });
  26201. const ElRadioGroup = withNoopInstall(RadioGroup);
  26202. const ElRadioButton = withNoopInstall(RadioButton);
  26203. var NodeContent$1 = /* @__PURE__ */ defineComponent({
  26204. name: "NodeContent",
  26205. setup() {
  26206. const ns = useNamespace("cascader-node");
  26207. return {
  26208. ns
  26209. };
  26210. },
  26211. render() {
  26212. const { ns } = this;
  26213. const { node, panel } = this.$parent;
  26214. const { data, label } = node;
  26215. const { renderLabelFn } = panel;
  26216. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  26217. }
  26218. });
  26219. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  26220. const _sfc_main$1L = /* @__PURE__ */ defineComponent({
  26221. name: "ElCascaderNode",
  26222. components: {
  26223. ElCheckbox,
  26224. ElRadio,
  26225. NodeContent: NodeContent$1,
  26226. ElIcon,
  26227. Check: check_default,
  26228. Loading: loading_default,
  26229. ArrowRight: arrow_right_default
  26230. },
  26231. props: {
  26232. node: {
  26233. type: Object,
  26234. required: true
  26235. },
  26236. menuId: String
  26237. },
  26238. emits: ["expand"],
  26239. setup(props, { emit: emit2 }) {
  26240. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  26241. const ns = useNamespace("cascader-node");
  26242. const isHoverMenu = computed(() => panel.isHoverMenu);
  26243. const multiple = computed(() => panel.config.multiple);
  26244. const checkStrictly = computed(() => panel.config.checkStrictly);
  26245. const checkedNodeId = computed(() => {
  26246. var _a2;
  26247. return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
  26248. });
  26249. const isDisabled = computed(() => props.node.isDisabled);
  26250. const isLeaf2 = computed(() => props.node.isLeaf);
  26251. const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
  26252. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  26253. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  26254. const isInPath = (node) => {
  26255. var _a2;
  26256. const { level, uid: uid2 } = props.node;
  26257. return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
  26258. };
  26259. const doExpand = () => {
  26260. if (inExpandingPath.value)
  26261. return;
  26262. panel.expandNode(props.node);
  26263. };
  26264. const doCheck = (checked) => {
  26265. const { node } = props;
  26266. if (checked === node.checked)
  26267. return;
  26268. panel.handleCheckChange(node, checked);
  26269. };
  26270. const doLoad = () => {
  26271. panel.lazyLoad(props.node, () => {
  26272. if (!isLeaf2.value)
  26273. doExpand();
  26274. });
  26275. };
  26276. const handleHoverExpand = (e) => {
  26277. if (!isHoverMenu.value)
  26278. return;
  26279. handleExpand();
  26280. !isLeaf2.value && emit2("expand", e);
  26281. };
  26282. const handleExpand = () => {
  26283. const { node } = props;
  26284. if (!expandable.value || node.loading)
  26285. return;
  26286. node.loaded ? doExpand() : doLoad();
  26287. };
  26288. const handleClick = () => {
  26289. if (isHoverMenu.value && !isLeaf2.value)
  26290. return;
  26291. if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  26292. handleCheck(true);
  26293. } else {
  26294. handleExpand();
  26295. }
  26296. };
  26297. const handleSelectCheck = (checked) => {
  26298. if (checkStrictly.value) {
  26299. doCheck(checked);
  26300. if (props.node.loaded) {
  26301. doExpand();
  26302. }
  26303. } else {
  26304. handleCheck(checked);
  26305. }
  26306. };
  26307. const handleCheck = (checked) => {
  26308. if (!props.node.loaded) {
  26309. doLoad();
  26310. } else {
  26311. doCheck(checked);
  26312. !checkStrictly.value && doExpand();
  26313. }
  26314. };
  26315. return {
  26316. panel,
  26317. isHoverMenu,
  26318. multiple,
  26319. checkStrictly,
  26320. checkedNodeId,
  26321. isDisabled,
  26322. isLeaf: isLeaf2,
  26323. expandable,
  26324. inExpandingPath,
  26325. inCheckedPath,
  26326. ns,
  26327. handleHoverExpand,
  26328. handleExpand,
  26329. handleClick,
  26330. handleCheck,
  26331. handleSelectCheck
  26332. };
  26333. }
  26334. });
  26335. const _hoisted_1$R = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  26336. const _hoisted_2$z = /* @__PURE__ */ createBaseVNode("span", null, null, -1);
  26337. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  26338. const _component_el_checkbox = resolveComponent("el-checkbox");
  26339. const _component_el_radio = resolveComponent("el-radio");
  26340. const _component_check = resolveComponent("check");
  26341. const _component_el_icon = resolveComponent("el-icon");
  26342. const _component_node_content = resolveComponent("node-content");
  26343. const _component_loading = resolveComponent("loading");
  26344. const _component_arrow_right = resolveComponent("arrow-right");
  26345. return openBlock(), createElementBlock("li", {
  26346. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  26347. role: "menuitem",
  26348. "aria-haspopup": !_ctx.isLeaf,
  26349. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  26350. "aria-expanded": _ctx.inExpandingPath,
  26351. tabindex: _ctx.expandable ? -1 : void 0,
  26352. class: normalizeClass([
  26353. _ctx.ns.b(),
  26354. _ctx.ns.is("selectable", _ctx.checkStrictly),
  26355. _ctx.ns.is("active", _ctx.node.checked),
  26356. _ctx.ns.is("disabled", !_ctx.expandable),
  26357. _ctx.inExpandingPath && "in-active-path",
  26358. _ctx.inCheckedPath && "in-checked-path"
  26359. ]),
  26360. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  26361. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  26362. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  26363. }, [
  26364. createCommentVNode(" prefix "),
  26365. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  26366. key: 0,
  26367. "model-value": _ctx.node.checked,
  26368. indeterminate: _ctx.node.indeterminate,
  26369. disabled: _ctx.isDisabled,
  26370. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  26371. }, ["stop"])),
  26372. "onUpdate:modelValue": _ctx.handleSelectCheck
  26373. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  26374. key: 1,
  26375. "model-value": _ctx.checkedNodeId,
  26376. label: _ctx.node.uid,
  26377. disabled: _ctx.isDisabled,
  26378. "onUpdate:modelValue": _ctx.handleSelectCheck,
  26379. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  26380. }, ["stop"]))
  26381. }, {
  26382. default: withCtx(() => [
  26383. createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
  26384. _hoisted_2$z
  26385. ]),
  26386. _: 1
  26387. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  26388. key: 2,
  26389. class: normalizeClass(_ctx.ns.e("prefix"))
  26390. }, {
  26391. default: withCtx(() => [
  26392. createVNode(_component_check)
  26393. ]),
  26394. _: 1
  26395. }, 8, ["class"])) : createCommentVNode("v-if", true),
  26396. createCommentVNode(" content "),
  26397. createVNode(_component_node_content),
  26398. createCommentVNode(" postfix "),
  26399. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  26400. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  26401. key: 0,
  26402. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  26403. }, {
  26404. default: withCtx(() => [
  26405. createVNode(_component_loading)
  26406. ]),
  26407. _: 1
  26408. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  26409. key: 1,
  26410. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  26411. }, {
  26412. default: withCtx(() => [
  26413. createVNode(_component_arrow_right)
  26414. ]),
  26415. _: 1
  26416. }, 8, ["class"]))
  26417. ], 64)) : createCommentVNode("v-if", true)
  26418. ], 42, _hoisted_1$R);
  26419. }
  26420. var ElCascaderNode = /* @__PURE__ */ _export_sfc$1(_sfc_main$1L, [["render", _sfc_render$u], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
  26421. const _sfc_main$1K = /* @__PURE__ */ defineComponent({
  26422. name: "ElCascaderMenu",
  26423. components: {
  26424. Loading: loading_default,
  26425. ElIcon,
  26426. ElScrollbar,
  26427. ElCascaderNode
  26428. },
  26429. props: {
  26430. nodes: {
  26431. type: Array,
  26432. required: true
  26433. },
  26434. index: {
  26435. type: Number,
  26436. required: true
  26437. }
  26438. },
  26439. setup(props) {
  26440. const instance = getCurrentInstance();
  26441. const ns = useNamespace("cascader-menu");
  26442. const { t } = useLocale();
  26443. const id = generateId();
  26444. let activeNode = null;
  26445. let hoverTimer = null;
  26446. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  26447. const hoverZone = ref(null);
  26448. const isEmpty2 = computed(() => !props.nodes.length);
  26449. const isLoading = computed(() => !panel.initialLoaded);
  26450. const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
  26451. const handleExpand = (e) => {
  26452. activeNode = e.target;
  26453. };
  26454. const handleMouseMove = (e) => {
  26455. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  26456. return;
  26457. if (activeNode.contains(e.target)) {
  26458. clearHoverTimer();
  26459. const el = instance.vnode.el;
  26460. const { left: left2 } = el.getBoundingClientRect();
  26461. const { offsetWidth, offsetHeight } = el;
  26462. const startX = e.clientX - left2;
  26463. const top = activeNode.offsetTop;
  26464. const bottom = top + activeNode.offsetHeight;
  26465. hoverZone.value.innerHTML = `
  26466. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  26467. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  26468. `;
  26469. } else if (!hoverTimer) {
  26470. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  26471. }
  26472. };
  26473. const clearHoverTimer = () => {
  26474. if (!hoverTimer)
  26475. return;
  26476. clearTimeout(hoverTimer);
  26477. hoverTimer = null;
  26478. };
  26479. const clearHoverZone = () => {
  26480. if (!hoverZone.value)
  26481. return;
  26482. hoverZone.value.innerHTML = "";
  26483. clearHoverTimer();
  26484. };
  26485. return {
  26486. ns,
  26487. panel,
  26488. hoverZone,
  26489. isEmpty: isEmpty2,
  26490. isLoading,
  26491. menuId,
  26492. t,
  26493. handleExpand,
  26494. handleMouseMove,
  26495. clearHoverZone
  26496. };
  26497. }
  26498. });
  26499. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  26500. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  26501. const _component_loading = resolveComponent("loading");
  26502. const _component_el_icon = resolveComponent("el-icon");
  26503. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  26504. return openBlock(), createBlock(_component_el_scrollbar, {
  26505. key: _ctx.menuId,
  26506. tag: "ul",
  26507. role: "menu",
  26508. class: normalizeClass(_ctx.ns.b()),
  26509. "wrap-class": _ctx.ns.e("wrap"),
  26510. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  26511. onMousemove: _ctx.handleMouseMove,
  26512. onMouseleave: _ctx.clearHoverZone
  26513. }, {
  26514. default: withCtx(() => {
  26515. var _a2;
  26516. return [
  26517. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  26518. return openBlock(), createBlock(_component_el_cascader_node, {
  26519. key: node.uid,
  26520. node,
  26521. "menu-id": _ctx.menuId,
  26522. onExpand: _ctx.handleExpand
  26523. }, null, 8, ["node", "menu-id", "onExpand"]);
  26524. }), 128)),
  26525. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  26526. key: 0,
  26527. class: normalizeClass(_ctx.ns.e("empty-text"))
  26528. }, [
  26529. createVNode(_component_el_icon, {
  26530. size: "14",
  26531. class: normalizeClass(_ctx.ns.is("loading"))
  26532. }, {
  26533. default: withCtx(() => [
  26534. createVNode(_component_loading)
  26535. ]),
  26536. _: 1
  26537. }, 8, ["class"]),
  26538. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  26539. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  26540. key: 1,
  26541. class: normalizeClass(_ctx.ns.e("empty-text"))
  26542. }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  26543. key: 2,
  26544. ref: "hoverZone",
  26545. class: normalizeClass(_ctx.ns.e("hover-zone"))
  26546. }, null, 2)) : createCommentVNode("v-if", true)
  26547. ];
  26548. }),
  26549. _: 1
  26550. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  26551. }
  26552. var ElCascaderMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$1K, [["render", _sfc_render$t], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
  26553. let uid = 0;
  26554. const calculatePathNodes = (node) => {
  26555. const nodes = [node];
  26556. let { parent } = node;
  26557. while (parent) {
  26558. nodes.unshift(parent);
  26559. parent = parent.parent;
  26560. }
  26561. return nodes;
  26562. };
  26563. let Node$2 = class Node2 {
  26564. constructor(data, config, parent, root2 = false) {
  26565. this.data = data;
  26566. this.config = config;
  26567. this.parent = parent;
  26568. this.root = root2;
  26569. this.uid = uid++;
  26570. this.checked = false;
  26571. this.indeterminate = false;
  26572. this.loading = false;
  26573. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  26574. const childrenData = data[childrenKey];
  26575. const pathNodes = calculatePathNodes(this);
  26576. this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
  26577. this.value = data[valueKey];
  26578. this.label = data[labelKey];
  26579. this.pathNodes = pathNodes;
  26580. this.pathValues = pathNodes.map((node) => node.value);
  26581. this.pathLabels = pathNodes.map((node) => node.label);
  26582. this.childrenData = childrenData;
  26583. this.children = (childrenData || []).map((child) => new Node2(child, config, this));
  26584. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  26585. }
  26586. get isDisabled() {
  26587. const { data, parent, config } = this;
  26588. const { disabled, checkStrictly } = config;
  26589. const isDisabled = isFunction$2(disabled) ? disabled(data, this) : !!data[disabled];
  26590. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  26591. }
  26592. get isLeaf() {
  26593. const { data, config, childrenData, loaded } = this;
  26594. const { lazy, leaf } = config;
  26595. const isLeaf2 = isFunction$2(leaf) ? leaf(data, this) : data[leaf];
  26596. return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
  26597. }
  26598. get valueByOption() {
  26599. return this.config.emitPath ? this.pathValues : this.value;
  26600. }
  26601. appendChild(childData) {
  26602. const { childrenData, children } = this;
  26603. const node = new Node2(childData, this.config, this);
  26604. if (Array.isArray(childrenData)) {
  26605. childrenData.push(childData);
  26606. } else {
  26607. this.childrenData = [childData];
  26608. }
  26609. children.push(node);
  26610. return node;
  26611. }
  26612. calcText(allLevels, separator) {
  26613. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  26614. this.text = text;
  26615. return text;
  26616. }
  26617. broadcast(event, ...args) {
  26618. const handlerName = `onParent${capitalize(event)}`;
  26619. this.children.forEach((child) => {
  26620. if (child) {
  26621. child.broadcast(event, ...args);
  26622. child[handlerName] && child[handlerName](...args);
  26623. }
  26624. });
  26625. }
  26626. emit(event, ...args) {
  26627. const { parent } = this;
  26628. const handlerName = `onChild${capitalize(event)}`;
  26629. if (parent) {
  26630. parent[handlerName] && parent[handlerName](...args);
  26631. parent.emit(event, ...args);
  26632. }
  26633. }
  26634. onParentCheck(checked) {
  26635. if (!this.isDisabled) {
  26636. this.setCheckState(checked);
  26637. }
  26638. }
  26639. onChildCheck() {
  26640. const { children } = this;
  26641. const validChildren = children.filter((child) => !child.isDisabled);
  26642. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  26643. this.setCheckState(checked);
  26644. }
  26645. setCheckState(checked) {
  26646. const totalNum = this.children.length;
  26647. const checkedNum = this.children.reduce((c2, p2) => {
  26648. const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
  26649. return c2 + num;
  26650. }, 0);
  26651. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  26652. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  26653. }
  26654. doCheck(checked) {
  26655. if (this.checked === checked)
  26656. return;
  26657. const { checkStrictly, multiple } = this.config;
  26658. if (checkStrictly || !multiple) {
  26659. this.checked = checked;
  26660. } else {
  26661. this.broadcast("check", checked);
  26662. this.setCheckState(checked);
  26663. this.emit("check");
  26664. }
  26665. }
  26666. };
  26667. const flatNodes = (nodes, leafOnly) => {
  26668. return nodes.reduce((res, node) => {
  26669. if (node.isLeaf) {
  26670. res.push(node);
  26671. } else {
  26672. !leafOnly && res.push(node);
  26673. res = res.concat(flatNodes(node.children, leafOnly));
  26674. }
  26675. return res;
  26676. }, []);
  26677. };
  26678. class Store {
  26679. constructor(data, config) {
  26680. this.config = config;
  26681. const nodes = (data || []).map((nodeData) => new Node$2(nodeData, this.config));
  26682. this.nodes = nodes;
  26683. this.allNodes = flatNodes(nodes, false);
  26684. this.leafNodes = flatNodes(nodes, true);
  26685. }
  26686. getNodes() {
  26687. return this.nodes;
  26688. }
  26689. getFlattedNodes(leafOnly) {
  26690. return leafOnly ? this.leafNodes : this.allNodes;
  26691. }
  26692. appendNode(nodeData, parentNode) {
  26693. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$2(nodeData, this.config);
  26694. if (!parentNode)
  26695. this.nodes.push(node);
  26696. this.allNodes.push(node);
  26697. node.isLeaf && this.leafNodes.push(node);
  26698. }
  26699. appendNodes(nodeDataList, parentNode) {
  26700. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  26701. }
  26702. getNodeByValue(value, leafOnly = false) {
  26703. if (!value && value !== 0)
  26704. return null;
  26705. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  26706. return node || null;
  26707. }
  26708. getSameNode(node) {
  26709. if (!node)
  26710. return null;
  26711. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  26712. return node_ || null;
  26713. }
  26714. }
  26715. const CommonProps = buildProps({
  26716. modelValue: {
  26717. type: definePropType([Number, String, Array])
  26718. },
  26719. options: {
  26720. type: definePropType(Array),
  26721. default: () => []
  26722. },
  26723. props: {
  26724. type: definePropType(Object),
  26725. default: () => ({})
  26726. }
  26727. });
  26728. const DefaultProps = {
  26729. expandTrigger: "click",
  26730. multiple: false,
  26731. checkStrictly: false,
  26732. emitPath: true,
  26733. lazy: false,
  26734. lazyLoad: NOOP,
  26735. value: "value",
  26736. label: "label",
  26737. children: "children",
  26738. leaf: "leaf",
  26739. disabled: "disabled",
  26740. hoverThreshold: 500
  26741. };
  26742. const useCascaderConfig = (props) => {
  26743. return computed(() => ({
  26744. ...DefaultProps,
  26745. ...props.props
  26746. }));
  26747. };
  26748. const getMenuIndex = (el) => {
  26749. if (!el)
  26750. return 0;
  26751. const pieces = el.id.split("-");
  26752. return Number(pieces[pieces.length - 2]);
  26753. };
  26754. const checkNode = (el) => {
  26755. if (!el)
  26756. return;
  26757. const input = el.querySelector("input");
  26758. if (input) {
  26759. input.click();
  26760. } else if (isLeaf(el)) {
  26761. el.click();
  26762. }
  26763. };
  26764. const sortByOriginalOrder = (oldNodes, newNodes) => {
  26765. const newNodesCopy = newNodes.slice(0);
  26766. const newIds = newNodesCopy.map((node) => node.uid);
  26767. const res = oldNodes.reduce((acc, item) => {
  26768. const index2 = newIds.indexOf(item.uid);
  26769. if (index2 > -1) {
  26770. acc.push(item);
  26771. newNodesCopy.splice(index2, 1);
  26772. newIds.splice(index2, 1);
  26773. }
  26774. return acc;
  26775. }, []);
  26776. res.push(...newNodesCopy);
  26777. return res;
  26778. };
  26779. const _sfc_main$1J = /* @__PURE__ */ defineComponent({
  26780. name: "ElCascaderPanel",
  26781. components: {
  26782. ElCascaderMenu
  26783. },
  26784. props: {
  26785. ...CommonProps,
  26786. border: {
  26787. type: Boolean,
  26788. default: true
  26789. },
  26790. renderLabel: Function
  26791. },
  26792. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  26793. setup(props, { emit: emit2, slots }) {
  26794. let manualChecked = false;
  26795. const ns = useNamespace("cascader");
  26796. const config = useCascaderConfig(props);
  26797. let store = null;
  26798. const initialLoaded = ref(true);
  26799. const menuList = ref([]);
  26800. const checkedValue = ref(null);
  26801. const menus = ref([]);
  26802. const expandingNode = ref(null);
  26803. const checkedNodes = ref([]);
  26804. const isHoverMenu = computed(() => config.value.expandTrigger === "hover");
  26805. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  26806. const initStore = () => {
  26807. const { options } = props;
  26808. const cfg = config.value;
  26809. manualChecked = false;
  26810. store = new Store(options, cfg);
  26811. menus.value = [store.getNodes()];
  26812. if (cfg.lazy && isEmpty(props.options)) {
  26813. initialLoaded.value = false;
  26814. lazyLoad(void 0, (list) => {
  26815. if (list) {
  26816. store = new Store(list, cfg);
  26817. menus.value = [store.getNodes()];
  26818. }
  26819. initialLoaded.value = true;
  26820. syncCheckedValue(false, true);
  26821. });
  26822. } else {
  26823. syncCheckedValue(false, true);
  26824. }
  26825. };
  26826. const lazyLoad = (node, cb) => {
  26827. const cfg = config.value;
  26828. node = node || new Node$2({}, cfg, void 0, true);
  26829. node.loading = true;
  26830. const resolve2 = (dataList) => {
  26831. const _node = node;
  26832. const parent = _node.root ? null : _node;
  26833. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  26834. _node.loading = false;
  26835. _node.loaded = true;
  26836. _node.childrenData = _node.childrenData || [];
  26837. cb && cb(dataList);
  26838. };
  26839. cfg.lazyLoad(node, resolve2);
  26840. };
  26841. const expandNode = (node, silent) => {
  26842. var _a2;
  26843. const { level } = node;
  26844. const newMenus = menus.value.slice(0, level);
  26845. let newExpandingNode;
  26846. if (node.isLeaf) {
  26847. newExpandingNode = node.pathNodes[level - 2];
  26848. } else {
  26849. newExpandingNode = node;
  26850. newMenus.push(node.children);
  26851. }
  26852. if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  26853. expandingNode.value = node;
  26854. menus.value = newMenus;
  26855. !silent && emit2("expand-change", (node == null ? void 0 : node.pathValues) || []);
  26856. }
  26857. };
  26858. const handleCheckChange = (node, checked, emitClose = true) => {
  26859. const { checkStrictly, multiple } = config.value;
  26860. const oldNode = checkedNodes.value[0];
  26861. manualChecked = true;
  26862. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  26863. node.doCheck(checked);
  26864. calculateCheckedValue();
  26865. emitClose && !multiple && !checkStrictly && emit2("close");
  26866. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  26867. };
  26868. const expandParentNode = (node) => {
  26869. if (!node)
  26870. return;
  26871. node = node.parent;
  26872. expandParentNode(node);
  26873. node && expandNode(node);
  26874. };
  26875. const getFlattedNodes = (leafOnly) => {
  26876. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  26877. };
  26878. const getCheckedNodes = (leafOnly) => {
  26879. var _a2;
  26880. return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
  26881. };
  26882. const clearCheckedNodes = () => {
  26883. checkedNodes.value.forEach((node) => node.doCheck(false));
  26884. calculateCheckedValue();
  26885. menus.value = menus.value.slice(0, 1);
  26886. expandingNode.value = null;
  26887. emit2("expand-change", []);
  26888. };
  26889. const calculateCheckedValue = () => {
  26890. var _a2;
  26891. const { checkStrictly, multiple } = config.value;
  26892. const oldNodes = checkedNodes.value;
  26893. const newNodes = getCheckedNodes(!checkStrictly);
  26894. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  26895. const values = nodes.map((node) => node.valueByOption);
  26896. checkedNodes.value = nodes;
  26897. checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
  26898. };
  26899. const syncCheckedValue = (loaded = false, forced = false) => {
  26900. const { modelValue } = props;
  26901. const { lazy, multiple, checkStrictly } = config.value;
  26902. const leafOnly = !checkStrictly;
  26903. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  26904. return;
  26905. if (lazy && !loaded) {
  26906. const values = unique(flattenDeep(castArray(modelValue)));
  26907. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  26908. if (nodes.length) {
  26909. nodes.forEach((node) => {
  26910. lazyLoad(node, () => syncCheckedValue(false, forced));
  26911. });
  26912. } else {
  26913. syncCheckedValue(true, forced);
  26914. }
  26915. } else {
  26916. const values = multiple ? castArray(modelValue) : [modelValue];
  26917. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  26918. syncMenuState(nodes, forced);
  26919. checkedValue.value = cloneDeep(modelValue);
  26920. }
  26921. };
  26922. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  26923. const { checkStrictly } = config.value;
  26924. const oldNodes = checkedNodes.value;
  26925. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  26926. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  26927. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  26928. if (newExpandingNode) {
  26929. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  26930. } else {
  26931. expandingNode.value = null;
  26932. }
  26933. oldNodes.forEach((node) => node.doCheck(false));
  26934. if (props.props.multiple) {
  26935. reactive(newNodes).forEach((node) => node.doCheck(true));
  26936. } else {
  26937. newNodes.forEach((node) => node.doCheck(true));
  26938. }
  26939. checkedNodes.value = newNodes;
  26940. nextTick(scrollToExpandingNode);
  26941. };
  26942. const scrollToExpandingNode = () => {
  26943. if (!isClient)
  26944. return;
  26945. menuList.value.forEach((menu) => {
  26946. const menuElement = menu == null ? void 0 : menu.$el;
  26947. if (menuElement) {
  26948. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  26949. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  26950. scrollIntoView(container, activeNode);
  26951. }
  26952. });
  26953. };
  26954. const handleKeyDown = (e) => {
  26955. const target = e.target;
  26956. const { code } = e;
  26957. switch (code) {
  26958. case EVENT_CODE.up:
  26959. case EVENT_CODE.down: {
  26960. e.preventDefault();
  26961. const distance = code === EVENT_CODE.up ? -1 : 1;
  26962. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  26963. break;
  26964. }
  26965. case EVENT_CODE.left: {
  26966. e.preventDefault();
  26967. const preMenu = menuList.value[getMenuIndex(target) - 1];
  26968. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  26969. focusNode(expandedNode);
  26970. break;
  26971. }
  26972. case EVENT_CODE.right: {
  26973. e.preventDefault();
  26974. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  26975. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  26976. focusNode(firstNode);
  26977. break;
  26978. }
  26979. case EVENT_CODE.enter:
  26980. checkNode(target);
  26981. break;
  26982. }
  26983. };
  26984. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  26985. config,
  26986. expandingNode,
  26987. checkedNodes,
  26988. isHoverMenu,
  26989. initialLoaded,
  26990. renderLabelFn,
  26991. lazyLoad,
  26992. expandNode,
  26993. handleCheckChange
  26994. }));
  26995. watch([config, () => props.options], initStore, {
  26996. deep: true,
  26997. immediate: true
  26998. });
  26999. watch(() => props.modelValue, () => {
  27000. manualChecked = false;
  27001. syncCheckedValue();
  27002. }, {
  27003. deep: true
  27004. });
  27005. watch(() => checkedValue.value, (val) => {
  27006. if (!isEqual$1(val, props.modelValue)) {
  27007. emit2(UPDATE_MODEL_EVENT, val);
  27008. emit2(CHANGE_EVENT, val);
  27009. }
  27010. });
  27011. onBeforeUpdate(() => menuList.value = []);
  27012. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  27013. return {
  27014. ns,
  27015. menuList,
  27016. menus,
  27017. checkedNodes,
  27018. handleKeyDown,
  27019. handleCheckChange,
  27020. getFlattedNodes,
  27021. getCheckedNodes,
  27022. clearCheckedNodes,
  27023. calculateCheckedValue,
  27024. scrollToExpandingNode
  27025. };
  27026. }
  27027. });
  27028. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  27029. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  27030. return openBlock(), createElementBlock("div", {
  27031. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  27032. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  27033. }, [
  27034. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index2) => {
  27035. return openBlock(), createBlock(_component_el_cascader_menu, {
  27036. key: index2,
  27037. ref_for: true,
  27038. ref: (item) => _ctx.menuList[index2] = item,
  27039. index: index2,
  27040. nodes: [...menu]
  27041. }, null, 8, ["index", "nodes"]);
  27042. }), 128))
  27043. ], 34);
  27044. }
  27045. var CascaderPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1J, [["render", _sfc_render$s], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
  27046. CascaderPanel.install = (app) => {
  27047. app.component(CascaderPanel.name, CascaderPanel);
  27048. };
  27049. const _CascaderPanel = CascaderPanel;
  27050. const ElCascaderPanel = _CascaderPanel;
  27051. const tagProps = buildProps({
  27052. type: {
  27053. type: String,
  27054. values: ["success", "info", "warning", "danger", ""],
  27055. default: ""
  27056. },
  27057. closable: Boolean,
  27058. disableTransitions: Boolean,
  27059. hit: Boolean,
  27060. color: {
  27061. type: String,
  27062. default: ""
  27063. },
  27064. size: {
  27065. type: String,
  27066. values: componentSizes,
  27067. default: ""
  27068. },
  27069. effect: {
  27070. type: String,
  27071. values: ["dark", "light", "plain"],
  27072. default: "light"
  27073. },
  27074. round: Boolean
  27075. });
  27076. const tagEmits = {
  27077. close: (evt) => evt instanceof MouseEvent,
  27078. click: (evt) => evt instanceof MouseEvent
  27079. };
  27080. const __default__$15 = /* @__PURE__ */ defineComponent({
  27081. name: "ElTag"
  27082. });
  27083. const _sfc_main$1I = /* @__PURE__ */ defineComponent({
  27084. ...__default__$15,
  27085. props: tagProps,
  27086. emits: tagEmits,
  27087. setup(__props, { emit: emit2 }) {
  27088. const props = __props;
  27089. const tagSize = useFormSize();
  27090. const ns = useNamespace("tag");
  27091. const containerKls = computed(() => {
  27092. const { type: type2, hit, effect, closable, round: round2 } = props;
  27093. return [
  27094. ns.b(),
  27095. ns.is("closable", closable),
  27096. ns.m(type2),
  27097. ns.m(tagSize.value),
  27098. ns.m(effect),
  27099. ns.is("hit", hit),
  27100. ns.is("round", round2)
  27101. ];
  27102. });
  27103. const handleClose = (event) => {
  27104. emit2("close", event);
  27105. };
  27106. const handleClick = (event) => {
  27107. emit2("click", event);
  27108. };
  27109. return (_ctx, _cache) => {
  27110. return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  27111. key: 0,
  27112. class: normalizeClass(unref(containerKls)),
  27113. style: normalizeStyle({ backgroundColor: _ctx.color }),
  27114. onClick: handleClick
  27115. }, [
  27116. createBaseVNode("span", {
  27117. class: normalizeClass(unref(ns).e("content"))
  27118. }, [
  27119. renderSlot(_ctx.$slots, "default")
  27120. ], 2),
  27121. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  27122. key: 0,
  27123. class: normalizeClass(unref(ns).e("close")),
  27124. onClick: withModifiers(handleClose, ["stop"])
  27125. }, {
  27126. default: withCtx(() => [
  27127. createVNode(unref(close_default))
  27128. ]),
  27129. _: 1
  27130. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  27131. ], 6)) : (openBlock(), createBlock(Transition, {
  27132. key: 1,
  27133. name: `${unref(ns).namespace.value}-zoom-in-center`,
  27134. appear: ""
  27135. }, {
  27136. default: withCtx(() => [
  27137. createBaseVNode("span", {
  27138. class: normalizeClass(unref(containerKls)),
  27139. style: normalizeStyle({ backgroundColor: _ctx.color }),
  27140. onClick: handleClick
  27141. }, [
  27142. createBaseVNode("span", {
  27143. class: normalizeClass(unref(ns).e("content"))
  27144. }, [
  27145. renderSlot(_ctx.$slots, "default")
  27146. ], 2),
  27147. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  27148. key: 0,
  27149. class: normalizeClass(unref(ns).e("close")),
  27150. onClick: withModifiers(handleClose, ["stop"])
  27151. }, {
  27152. default: withCtx(() => [
  27153. createVNode(unref(close_default))
  27154. ]),
  27155. _: 1
  27156. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  27157. ], 6)
  27158. ]),
  27159. _: 3
  27160. }, 8, ["name"]));
  27161. };
  27162. }
  27163. });
  27164. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$1I, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  27165. const ElTag = withInstall(Tag);
  27166. const cascaderProps = buildProps({
  27167. ...CommonProps,
  27168. size: useSizeProp,
  27169. placeholder: String,
  27170. disabled: Boolean,
  27171. clearable: Boolean,
  27172. filterable: Boolean,
  27173. filterMethod: {
  27174. type: definePropType(Function),
  27175. default: (node, keyword) => node.text.includes(keyword)
  27176. },
  27177. separator: {
  27178. type: String,
  27179. default: " / "
  27180. },
  27181. showAllLevels: {
  27182. type: Boolean,
  27183. default: true
  27184. },
  27185. collapseTags: Boolean,
  27186. maxCollapseTags: {
  27187. type: Number,
  27188. default: 1
  27189. },
  27190. collapseTagsTooltip: {
  27191. type: Boolean,
  27192. default: false
  27193. },
  27194. debounce: {
  27195. type: Number,
  27196. default: 300
  27197. },
  27198. beforeFilter: {
  27199. type: definePropType(Function),
  27200. default: () => true
  27201. },
  27202. popperClass: {
  27203. type: String,
  27204. default: ""
  27205. },
  27206. teleported: useTooltipContentProps.teleported,
  27207. tagType: { ...tagProps.type, default: "info" },
  27208. validateEvent: {
  27209. type: Boolean,
  27210. default: true
  27211. }
  27212. });
  27213. const cascaderEmits = {
  27214. [UPDATE_MODEL_EVENT]: (val) => !!val || val === null,
  27215. [CHANGE_EVENT]: (val) => !!val || val === null,
  27216. focus: (evt) => evt instanceof FocusEvent,
  27217. blur: (evt) => evt instanceof FocusEvent,
  27218. visibleChange: (val) => isBoolean(val),
  27219. expandChange: (val) => !!val,
  27220. removeTag: (val) => !!val
  27221. };
  27222. const _hoisted_1$Q = { key: 0 };
  27223. const _hoisted_2$y = ["placeholder", "onKeydown"];
  27224. const _hoisted_3$i = ["onClick"];
  27225. const COMPONENT_NAME$e = "ElCascader";
  27226. const __default__$14 = /* @__PURE__ */ defineComponent({
  27227. name: COMPONENT_NAME$e
  27228. });
  27229. const _sfc_main$1H = /* @__PURE__ */ defineComponent({
  27230. ...__default__$14,
  27231. props: cascaderProps,
  27232. emits: cascaderEmits,
  27233. setup(__props, { expose, emit: emit2 }) {
  27234. const props = __props;
  27235. const popperOptions = {
  27236. modifiers: [
  27237. {
  27238. name: "arrowPosition",
  27239. enabled: true,
  27240. phase: "main",
  27241. fn: ({ state }) => {
  27242. const { modifiersData, placement } = state;
  27243. if (["right", "left", "bottom", "top"].includes(placement))
  27244. return;
  27245. modifiersData.arrow.x = 35;
  27246. },
  27247. requires: ["arrow"]
  27248. }
  27249. ]
  27250. };
  27251. const attrs = useAttrs$1();
  27252. let inputInitialHeight = 0;
  27253. let pressDeleteCount = 0;
  27254. const nsCascader = useNamespace("cascader");
  27255. const nsInput = useNamespace("input");
  27256. const { t } = useLocale();
  27257. const { form, formItem } = useFormItem();
  27258. const tooltipRef = ref(null);
  27259. const input = ref(null);
  27260. const tagWrapper = ref(null);
  27261. const cascaderPanelRef = ref(null);
  27262. const suggestionPanel = ref(null);
  27263. const popperVisible = ref(false);
  27264. const inputHover = ref(false);
  27265. const filtering = ref(false);
  27266. const filterFocus = ref(false);
  27267. const inputValue = ref("");
  27268. const searchInputValue = ref("");
  27269. const presentTags = ref([]);
  27270. const allPresentTags = ref([]);
  27271. const suggestions = ref([]);
  27272. const isOnComposition = ref(false);
  27273. const cascaderStyle = computed(() => {
  27274. return attrs.style;
  27275. });
  27276. const isDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  27277. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  27278. const currentPlaceholder = computed(() => searchInputValue.value || presentTags.value.length > 0 || isOnComposition.value ? "" : inputPlaceholder.value);
  27279. const realSize = useFormSize();
  27280. const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  27281. const multiple = computed(() => !!props.props.multiple);
  27282. const readonly2 = computed(() => !props.filterable || multiple.value);
  27283. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  27284. const checkedNodes = computed(() => {
  27285. var _a2;
  27286. return ((_a2 = cascaderPanelRef.value) == null ? void 0 : _a2.checkedNodes) || [];
  27287. });
  27288. const clearBtnVisible = computed(() => {
  27289. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  27290. return false;
  27291. return !!checkedNodes.value.length;
  27292. });
  27293. const presentText = computed(() => {
  27294. const { showAllLevels, separator } = props;
  27295. const nodes = checkedNodes.value;
  27296. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  27297. });
  27298. const checkedValue = computed({
  27299. get() {
  27300. return cloneDeep(props.modelValue);
  27301. },
  27302. set(val) {
  27303. emit2(UPDATE_MODEL_EVENT, val);
  27304. emit2(CHANGE_EVENT, val);
  27305. if (props.validateEvent) {
  27306. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  27307. }
  27308. }
  27309. });
  27310. const cascaderKls = computed(() => {
  27311. return [
  27312. nsCascader.b(),
  27313. nsCascader.m(realSize.value),
  27314. nsCascader.is("disabled", isDisabled.value),
  27315. attrs.class
  27316. ];
  27317. });
  27318. const cascaderIconKls = computed(() => {
  27319. return [
  27320. nsInput.e("icon"),
  27321. "icon-arrow-down",
  27322. nsCascader.is("reverse", popperVisible.value)
  27323. ];
  27324. });
  27325. const inputClass = computed(() => {
  27326. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  27327. });
  27328. const contentRef = computed(() => {
  27329. var _a2, _b;
  27330. return (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  27331. });
  27332. const togglePopperVisible = (visible) => {
  27333. var _a2, _b, _c;
  27334. if (isDisabled.value)
  27335. return;
  27336. visible = visible != null ? visible : !popperVisible.value;
  27337. if (visible !== popperVisible.value) {
  27338. popperVisible.value = visible;
  27339. (_b = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  27340. if (visible) {
  27341. updatePopperPosition();
  27342. nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  27343. } else if (props.filterable) {
  27344. syncPresentTextValue();
  27345. }
  27346. emit2("visibleChange", visible);
  27347. }
  27348. };
  27349. const updatePopperPosition = () => {
  27350. nextTick(() => {
  27351. var _a2;
  27352. (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
  27353. });
  27354. };
  27355. const hideSuggestionPanel = () => {
  27356. filtering.value = false;
  27357. };
  27358. const genTag2 = (node) => {
  27359. const { showAllLevels, separator } = props;
  27360. return {
  27361. node,
  27362. key: node.uid,
  27363. text: node.calcText(showAllLevels, separator),
  27364. hitState: false,
  27365. closable: !isDisabled.value && !node.isDisabled,
  27366. isCollapseTag: false
  27367. };
  27368. };
  27369. const deleteTag = (tag) => {
  27370. var _a2;
  27371. const node = tag.node;
  27372. node.doCheck(false);
  27373. (_a2 = cascaderPanelRef.value) == null ? void 0 : _a2.calculateCheckedValue();
  27374. emit2("removeTag", node.valueByOption);
  27375. };
  27376. const calculatePresentTags = () => {
  27377. if (!multiple.value)
  27378. return;
  27379. const nodes = checkedNodes.value;
  27380. const tags = [];
  27381. const allTags = [];
  27382. nodes.forEach((node) => allTags.push(genTag2(node)));
  27383. allPresentTags.value = allTags;
  27384. if (nodes.length) {
  27385. nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag2(node)));
  27386. const rest = nodes.slice(props.maxCollapseTags);
  27387. const restCount = rest.length;
  27388. if (restCount) {
  27389. if (props.collapseTags) {
  27390. tags.push({
  27391. key: -1,
  27392. text: `+ ${restCount}`,
  27393. closable: false,
  27394. isCollapseTag: true
  27395. });
  27396. } else {
  27397. rest.forEach((node) => tags.push(genTag2(node)));
  27398. }
  27399. }
  27400. }
  27401. presentTags.value = tags;
  27402. };
  27403. const calculateSuggestions = () => {
  27404. var _a2, _b;
  27405. const { filterMethod, showAllLevels, separator } = props;
  27406. const res = (_b = (_a2 = cascaderPanelRef.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  27407. if (node.isDisabled)
  27408. return false;
  27409. node.calcText(showAllLevels, separator);
  27410. return filterMethod(node, searchKeyword.value);
  27411. });
  27412. if (multiple.value) {
  27413. presentTags.value.forEach((tag) => {
  27414. tag.hitState = false;
  27415. });
  27416. allPresentTags.value.forEach((tag) => {
  27417. tag.hitState = false;
  27418. });
  27419. }
  27420. filtering.value = true;
  27421. suggestions.value = res;
  27422. updatePopperPosition();
  27423. };
  27424. const focusFirstNode = () => {
  27425. var _a2;
  27426. let firstNode;
  27427. if (filtering.value && suggestionPanel.value) {
  27428. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  27429. } else {
  27430. firstNode = (_a2 = cascaderPanelRef.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  27431. }
  27432. if (firstNode) {
  27433. firstNode.focus();
  27434. !filtering.value && firstNode.click();
  27435. }
  27436. };
  27437. const updateStyle = () => {
  27438. var _a2, _b;
  27439. const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
  27440. const tagWrapperEl = tagWrapper.value;
  27441. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  27442. if (!isClient || !inputInner)
  27443. return;
  27444. if (suggestionPanelEl) {
  27445. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  27446. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  27447. }
  27448. if (tagWrapperEl) {
  27449. const { offsetHeight } = tagWrapperEl;
  27450. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  27451. inputInner.style.height = height;
  27452. updatePopperPosition();
  27453. }
  27454. };
  27455. const getCheckedNodes = (leafOnly) => {
  27456. var _a2;
  27457. return (_a2 = cascaderPanelRef.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
  27458. };
  27459. const handleExpandChange = (value) => {
  27460. updatePopperPosition();
  27461. emit2("expandChange", value);
  27462. };
  27463. const handleComposition = (event) => {
  27464. var _a2;
  27465. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  27466. if (event.type === "compositionend") {
  27467. isOnComposition.value = false;
  27468. nextTick(() => handleInput(text));
  27469. } else {
  27470. const lastCharacter = text[text.length - 1] || "";
  27471. isOnComposition.value = !isKorean(lastCharacter);
  27472. }
  27473. };
  27474. const handleKeyDown = (e) => {
  27475. if (isOnComposition.value)
  27476. return;
  27477. switch (e.code) {
  27478. case EVENT_CODE.enter:
  27479. togglePopperVisible();
  27480. break;
  27481. case EVENT_CODE.down:
  27482. togglePopperVisible(true);
  27483. nextTick(focusFirstNode);
  27484. e.preventDefault();
  27485. break;
  27486. case EVENT_CODE.esc:
  27487. if (popperVisible.value === true) {
  27488. e.preventDefault();
  27489. e.stopPropagation();
  27490. togglePopperVisible(false);
  27491. }
  27492. break;
  27493. case EVENT_CODE.tab:
  27494. togglePopperVisible(false);
  27495. break;
  27496. }
  27497. };
  27498. const handleClear = () => {
  27499. var _a2;
  27500. (_a2 = cascaderPanelRef.value) == null ? void 0 : _a2.clearCheckedNodes();
  27501. if (!popperVisible.value && props.filterable) {
  27502. syncPresentTextValue();
  27503. }
  27504. togglePopperVisible(false);
  27505. };
  27506. const syncPresentTextValue = () => {
  27507. const { value } = presentText;
  27508. inputValue.value = value;
  27509. searchInputValue.value = value;
  27510. };
  27511. const handleSuggestionClick = (node) => {
  27512. var _a2, _b;
  27513. const { checked } = node;
  27514. if (multiple.value) {
  27515. (_a2 = cascaderPanelRef.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
  27516. } else {
  27517. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  27518. togglePopperVisible(false);
  27519. }
  27520. };
  27521. const handleSuggestionKeyDown = (e) => {
  27522. const target = e.target;
  27523. const { code } = e;
  27524. switch (code) {
  27525. case EVENT_CODE.up:
  27526. case EVENT_CODE.down: {
  27527. const distance = code === EVENT_CODE.up ? -1 : 1;
  27528. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  27529. break;
  27530. }
  27531. case EVENT_CODE.enter:
  27532. target.click();
  27533. break;
  27534. }
  27535. };
  27536. const handleDelete = () => {
  27537. const tags = presentTags.value;
  27538. const lastTag = tags[tags.length - 1];
  27539. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  27540. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  27541. return;
  27542. if (lastTag.hitState) {
  27543. deleteTag(lastTag);
  27544. } else {
  27545. lastTag.hitState = true;
  27546. }
  27547. };
  27548. const handleFocus = (e) => {
  27549. const el = e.target;
  27550. const name = nsCascader.e("search-input");
  27551. if (el.className === name) {
  27552. filterFocus.value = true;
  27553. }
  27554. emit2("focus", e);
  27555. };
  27556. const handleBlur = (e) => {
  27557. filterFocus.value = false;
  27558. emit2("blur", e);
  27559. };
  27560. const handleFilter = debounce(() => {
  27561. const { value } = searchKeyword;
  27562. if (!value)
  27563. return;
  27564. const passed = props.beforeFilter(value);
  27565. if (isPromise(passed)) {
  27566. passed.then(calculateSuggestions).catch(() => {
  27567. });
  27568. } else if (passed !== false) {
  27569. calculateSuggestions();
  27570. } else {
  27571. hideSuggestionPanel();
  27572. }
  27573. }, props.debounce);
  27574. const handleInput = (val, e) => {
  27575. !popperVisible.value && togglePopperVisible(true);
  27576. if (e == null ? void 0 : e.isComposing)
  27577. return;
  27578. val ? handleFilter() : hideSuggestionPanel();
  27579. };
  27580. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  27581. watch(filtering, updatePopperPosition);
  27582. watch([checkedNodes, isDisabled], calculatePresentTags);
  27583. watch(presentTags, () => {
  27584. nextTick(() => updateStyle());
  27585. });
  27586. watch(realSize, async () => {
  27587. await nextTick();
  27588. const inputInner = input.value.input;
  27589. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  27590. updateStyle();
  27591. });
  27592. watch(presentText, syncPresentTextValue, { immediate: true });
  27593. onMounted(() => {
  27594. const inputInner = input.value.input;
  27595. const inputInnerHeight = getInputInnerHeight(inputInner);
  27596. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  27597. useResizeObserver(inputInner, updateStyle);
  27598. });
  27599. expose({
  27600. getCheckedNodes,
  27601. cascaderPanelRef,
  27602. togglePopperVisible,
  27603. contentRef
  27604. });
  27605. return (_ctx, _cache) => {
  27606. return openBlock(), createBlock(unref(ElTooltip), {
  27607. ref_key: "tooltipRef",
  27608. ref: tooltipRef,
  27609. visible: popperVisible.value,
  27610. teleported: _ctx.teleported,
  27611. "popper-class": [unref(nsCascader).e("dropdown"), _ctx.popperClass],
  27612. "popper-options": popperOptions,
  27613. "fallback-placements": [
  27614. "bottom-start",
  27615. "bottom",
  27616. "top-start",
  27617. "top",
  27618. "right",
  27619. "left"
  27620. ],
  27621. "stop-popper-mouse-event": false,
  27622. "gpu-acceleration": false,
  27623. placement: "bottom-start",
  27624. transition: `${unref(nsCascader).namespace.value}-zoom-in-top`,
  27625. effect: "light",
  27626. pure: "",
  27627. persistent: "",
  27628. onHide: hideSuggestionPanel
  27629. }, {
  27630. default: withCtx(() => [
  27631. withDirectives((openBlock(), createElementBlock("div", {
  27632. class: normalizeClass(unref(cascaderKls)),
  27633. style: normalizeStyle(unref(cascaderStyle)),
  27634. onClick: _cache[5] || (_cache[5] = () => togglePopperVisible(unref(readonly2) ? void 0 : true)),
  27635. onKeydown: handleKeyDown,
  27636. onMouseenter: _cache[6] || (_cache[6] = ($event) => inputHover.value = true),
  27637. onMouseleave: _cache[7] || (_cache[7] = ($event) => inputHover.value = false)
  27638. }, [
  27639. createVNode(unref(ElInput), {
  27640. ref_key: "input",
  27641. ref: input,
  27642. modelValue: inputValue.value,
  27643. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
  27644. placeholder: unref(currentPlaceholder),
  27645. readonly: unref(readonly2),
  27646. disabled: unref(isDisabled),
  27647. "validate-event": false,
  27648. size: unref(realSize),
  27649. class: normalizeClass(unref(inputClass)),
  27650. tabindex: unref(multiple) && _ctx.filterable && !unref(isDisabled) ? -1 : void 0,
  27651. onCompositionstart: handleComposition,
  27652. onCompositionupdate: handleComposition,
  27653. onCompositionend: handleComposition,
  27654. onFocus: handleFocus,
  27655. onBlur: handleBlur,
  27656. onInput: handleInput
  27657. }, {
  27658. suffix: withCtx(() => [
  27659. unref(clearBtnVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  27660. key: "clear",
  27661. class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
  27662. onClick: withModifiers(handleClear, ["stop"])
  27663. }, {
  27664. default: withCtx(() => [
  27665. createVNode(unref(circle_close_default))
  27666. ]),
  27667. _: 1
  27668. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(unref(ElIcon), {
  27669. key: "arrow-down",
  27670. class: normalizeClass(unref(cascaderIconKls)),
  27671. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => togglePopperVisible(), ["stop"]))
  27672. }, {
  27673. default: withCtx(() => [
  27674. createVNode(unref(arrow_down_default))
  27675. ]),
  27676. _: 1
  27677. }, 8, ["class"]))
  27678. ]),
  27679. _: 1
  27680. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex"]),
  27681. unref(multiple) ? (openBlock(), createElementBlock("div", {
  27682. key: 0,
  27683. ref_key: "tagWrapper",
  27684. ref: tagWrapper,
  27685. class: normalizeClass(unref(nsCascader).e("tags"))
  27686. }, [
  27687. (openBlock(true), createElementBlock(Fragment, null, renderList(presentTags.value, (tag) => {
  27688. return openBlock(), createBlock(unref(ElTag), {
  27689. key: tag.key,
  27690. type: _ctx.tagType,
  27691. size: unref(tagSize),
  27692. hit: tag.hitState,
  27693. closable: tag.closable,
  27694. "disable-transitions": "",
  27695. onClose: ($event) => deleteTag(tag)
  27696. }, {
  27697. default: withCtx(() => [
  27698. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$Q, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(unref(ElTooltip), {
  27699. key: 1,
  27700. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  27701. "fallback-placements": ["bottom", "top", "right", "left"],
  27702. placement: "bottom",
  27703. effect: "light"
  27704. }, {
  27705. default: withCtx(() => [
  27706. createBaseVNode("span", null, toDisplayString(tag.text), 1)
  27707. ]),
  27708. content: withCtx(() => [
  27709. createBaseVNode("div", {
  27710. class: normalizeClass(unref(nsCascader).e("collapse-tags"))
  27711. }, [
  27712. (openBlock(true), createElementBlock(Fragment, null, renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
  27713. return openBlock(), createElementBlock("div", {
  27714. key: idx,
  27715. class: normalizeClass(unref(nsCascader).e("collapse-tag"))
  27716. }, [
  27717. (openBlock(), createBlock(unref(ElTag), {
  27718. key: tag2.key,
  27719. class: "in-tooltip",
  27720. type: _ctx.tagType,
  27721. size: unref(tagSize),
  27722. hit: tag2.hitState,
  27723. closable: tag2.closable,
  27724. "disable-transitions": "",
  27725. onClose: ($event) => deleteTag(tag2)
  27726. }, {
  27727. default: withCtx(() => [
  27728. createBaseVNode("span", null, toDisplayString(tag2.text), 1)
  27729. ]),
  27730. _: 2
  27731. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  27732. ], 2);
  27733. }), 128))
  27734. ], 2)
  27735. ]),
  27736. _: 2
  27737. }, 1032, ["disabled"]))
  27738. ]),
  27739. _: 2
  27740. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  27741. }), 128)),
  27742. _ctx.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
  27743. key: 0,
  27744. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event),
  27745. type: "text",
  27746. class: normalizeClass(unref(nsCascader).e("search-input")),
  27747. placeholder: unref(presentText) ? "" : unref(inputPlaceholder),
  27748. onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)),
  27749. onClick: _cache[4] || (_cache[4] = withModifiers(($event) => togglePopperVisible(true), ["stop"])),
  27750. onKeydown: withKeys(handleDelete, ["delete"]),
  27751. onCompositionstart: handleComposition,
  27752. onCompositionupdate: handleComposition,
  27753. onCompositionend: handleComposition,
  27754. onFocus: handleFocus,
  27755. onBlur: handleBlur
  27756. }, null, 42, _hoisted_2$y)), [
  27757. [vModelText, searchInputValue.value]
  27758. ]) : createCommentVNode("v-if", true)
  27759. ], 2)) : createCommentVNode("v-if", true)
  27760. ], 38)), [
  27761. [unref(ClickOutside), () => togglePopperVisible(false), unref(contentRef)]
  27762. ])
  27763. ]),
  27764. content: withCtx(() => [
  27765. withDirectives(createVNode(unref(_CascaderPanel), {
  27766. ref_key: "cascaderPanelRef",
  27767. ref: cascaderPanelRef,
  27768. modelValue: unref(checkedValue),
  27769. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(checkedValue) ? checkedValue.value = $event : null),
  27770. options: _ctx.options,
  27771. props: props.props,
  27772. border: false,
  27773. "render-label": _ctx.$slots.default,
  27774. onExpandChange: handleExpandChange,
  27775. onClose: _cache[9] || (_cache[9] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false)))
  27776. }, null, 8, ["modelValue", "options", "props", "render-label"]), [
  27777. [vShow, !filtering.value]
  27778. ]),
  27779. _ctx.filterable ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
  27780. key: 0,
  27781. ref_key: "suggestionPanel",
  27782. ref: suggestionPanel,
  27783. tag: "ul",
  27784. class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
  27785. "view-class": unref(nsCascader).e("suggestion-list"),
  27786. onKeydown: handleSuggestionKeyDown
  27787. }, {
  27788. default: withCtx(() => [
  27789. suggestions.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(suggestions.value, (item) => {
  27790. return openBlock(), createElementBlock("li", {
  27791. key: item.uid,
  27792. class: normalizeClass([
  27793. unref(nsCascader).e("suggestion-item"),
  27794. unref(nsCascader).is("checked", item.checked)
  27795. ]),
  27796. tabindex: -1,
  27797. onClick: ($event) => handleSuggestionClick(item)
  27798. }, [
  27799. createBaseVNode("span", null, toDisplayString(item.text), 1),
  27800. item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  27801. default: withCtx(() => [
  27802. createVNode(unref(check_default))
  27803. ]),
  27804. _: 1
  27805. })) : createCommentVNode("v-if", true)
  27806. ], 10, _hoisted_3$i);
  27807. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  27808. createBaseVNode("li", {
  27809. class: normalizeClass(unref(nsCascader).e("empty-text"))
  27810. }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)
  27811. ])
  27812. ]),
  27813. _: 3
  27814. }, 8, ["class", "view-class"])), [
  27815. [vShow, filtering.value]
  27816. ]) : createCommentVNode("v-if", true)
  27817. ]),
  27818. _: 3
  27819. }, 8, ["visible", "teleported", "popper-class", "transition"]);
  27820. };
  27821. }
  27822. });
  27823. var Cascader = /* @__PURE__ */ _export_sfc$1(_sfc_main$1H, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/cascader.vue"]]);
  27824. Cascader.install = (app) => {
  27825. app.component(Cascader.name, Cascader);
  27826. };
  27827. const _Cascader = Cascader;
  27828. const ElCascader = _Cascader;
  27829. const checkTagProps = buildProps({
  27830. checked: {
  27831. type: Boolean,
  27832. default: false
  27833. }
  27834. });
  27835. const checkTagEmits = {
  27836. "update:checked": (value) => isBoolean(value),
  27837. [CHANGE_EVENT]: (value) => isBoolean(value)
  27838. };
  27839. const __default__$13 = /* @__PURE__ */ defineComponent({
  27840. name: "ElCheckTag"
  27841. });
  27842. const _sfc_main$1G = /* @__PURE__ */ defineComponent({
  27843. ...__default__$13,
  27844. props: checkTagProps,
  27845. emits: checkTagEmits,
  27846. setup(__props, { emit: emit2 }) {
  27847. const props = __props;
  27848. const ns = useNamespace("check-tag");
  27849. const containerKls = computed(() => [ns.b(), ns.is("checked", props.checked)]);
  27850. const handleChange = () => {
  27851. const checked = !props.checked;
  27852. emit2(CHANGE_EVENT, checked);
  27853. emit2("update:checked", checked);
  27854. };
  27855. return (_ctx, _cache) => {
  27856. return openBlock(), createElementBlock("span", {
  27857. class: normalizeClass(unref(containerKls)),
  27858. onClick: handleChange
  27859. }, [
  27860. renderSlot(_ctx.$slots, "default")
  27861. ], 2);
  27862. };
  27863. }
  27864. });
  27865. var CheckTag = /* @__PURE__ */ _export_sfc$1(_sfc_main$1G, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/check-tag/src/check-tag.vue"]]);
  27866. const ElCheckTag = withInstall(CheckTag);
  27867. const rowContextKey = Symbol("rowContextKey");
  27868. const RowJustify = [
  27869. "start",
  27870. "center",
  27871. "end",
  27872. "space-around",
  27873. "space-between",
  27874. "space-evenly"
  27875. ];
  27876. const RowAlign = ["top", "middle", "bottom"];
  27877. const rowProps = buildProps({
  27878. tag: {
  27879. type: String,
  27880. default: "div"
  27881. },
  27882. gutter: {
  27883. type: Number,
  27884. default: 0
  27885. },
  27886. justify: {
  27887. type: String,
  27888. values: RowJustify,
  27889. default: "start"
  27890. },
  27891. align: {
  27892. type: String,
  27893. values: RowAlign
  27894. }
  27895. });
  27896. const __default__$12 = /* @__PURE__ */ defineComponent({
  27897. name: "ElRow"
  27898. });
  27899. const _sfc_main$1F = /* @__PURE__ */ defineComponent({
  27900. ...__default__$12,
  27901. props: rowProps,
  27902. setup(__props) {
  27903. const props = __props;
  27904. const ns = useNamespace("row");
  27905. const gutter = computed(() => props.gutter);
  27906. provide(rowContextKey, {
  27907. gutter
  27908. });
  27909. const style = computed(() => {
  27910. const styles = {};
  27911. if (!props.gutter) {
  27912. return styles;
  27913. }
  27914. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  27915. return styles;
  27916. });
  27917. const rowKls = computed(() => [
  27918. ns.b(),
  27919. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  27920. ns.is(`align-${props.align}`, !!props.align)
  27921. ]);
  27922. return (_ctx, _cache) => {
  27923. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  27924. class: normalizeClass(unref(rowKls)),
  27925. style: normalizeStyle(unref(style))
  27926. }, {
  27927. default: withCtx(() => [
  27928. renderSlot(_ctx.$slots, "default")
  27929. ]),
  27930. _: 3
  27931. }, 8, ["class", "style"]);
  27932. };
  27933. }
  27934. });
  27935. var Row = /* @__PURE__ */ _export_sfc$1(_sfc_main$1F, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/row/src/row.vue"]]);
  27936. const ElRow = withInstall(Row);
  27937. const colProps = buildProps({
  27938. tag: {
  27939. type: String,
  27940. default: "div"
  27941. },
  27942. span: {
  27943. type: Number,
  27944. default: 24
  27945. },
  27946. offset: {
  27947. type: Number,
  27948. default: 0
  27949. },
  27950. pull: {
  27951. type: Number,
  27952. default: 0
  27953. },
  27954. push: {
  27955. type: Number,
  27956. default: 0
  27957. },
  27958. xs: {
  27959. type: definePropType([Number, Object]),
  27960. default: () => mutable({})
  27961. },
  27962. sm: {
  27963. type: definePropType([Number, Object]),
  27964. default: () => mutable({})
  27965. },
  27966. md: {
  27967. type: definePropType([Number, Object]),
  27968. default: () => mutable({})
  27969. },
  27970. lg: {
  27971. type: definePropType([Number, Object]),
  27972. default: () => mutable({})
  27973. },
  27974. xl: {
  27975. type: definePropType([Number, Object]),
  27976. default: () => mutable({})
  27977. }
  27978. });
  27979. const __default__$11 = /* @__PURE__ */ defineComponent({
  27980. name: "ElCol"
  27981. });
  27982. const _sfc_main$1E = /* @__PURE__ */ defineComponent({
  27983. ...__default__$11,
  27984. props: colProps,
  27985. setup(__props) {
  27986. const props = __props;
  27987. const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
  27988. const ns = useNamespace("col");
  27989. const style = computed(() => {
  27990. const styles = {};
  27991. if (gutter.value) {
  27992. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  27993. }
  27994. return styles;
  27995. });
  27996. const colKls = computed(() => {
  27997. const classes = [];
  27998. const pos = ["span", "offset", "pull", "push"];
  27999. pos.forEach((prop) => {
  28000. const size2 = props[prop];
  28001. if (isNumber(size2)) {
  28002. if (prop === "span")
  28003. classes.push(ns.b(`${props[prop]}`));
  28004. else if (size2 > 0)
  28005. classes.push(ns.b(`${prop}-${props[prop]}`));
  28006. }
  28007. });
  28008. const sizes = ["xs", "sm", "md", "lg", "xl"];
  28009. sizes.forEach((size2) => {
  28010. if (isNumber(props[size2])) {
  28011. classes.push(ns.b(`${size2}-${props[size2]}`));
  28012. } else if (isObject$1(props[size2])) {
  28013. Object.entries(props[size2]).forEach(([prop, sizeProp]) => {
  28014. classes.push(prop !== "span" ? ns.b(`${size2}-${prop}-${sizeProp}`) : ns.b(`${size2}-${sizeProp}`));
  28015. });
  28016. }
  28017. });
  28018. if (gutter.value) {
  28019. classes.push(ns.is("guttered"));
  28020. }
  28021. return [ns.b(), classes];
  28022. });
  28023. return (_ctx, _cache) => {
  28024. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  28025. class: normalizeClass(unref(colKls)),
  28026. style: normalizeStyle(unref(style))
  28027. }, {
  28028. default: withCtx(() => [
  28029. renderSlot(_ctx.$slots, "default")
  28030. ]),
  28031. _: 3
  28032. }, 8, ["class", "style"]);
  28033. };
  28034. }
  28035. });
  28036. var Col = /* @__PURE__ */ _export_sfc$1(_sfc_main$1E, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/col/src/col.vue"]]);
  28037. const ElCol = withInstall(Col);
  28038. const emitChangeFn = (value) => typeof isNumber(value);
  28039. const collapseProps = buildProps({
  28040. accordion: Boolean,
  28041. modelValue: {
  28042. type: definePropType([Array, String, Number]),
  28043. default: () => mutable([])
  28044. }
  28045. });
  28046. const collapseEmits = {
  28047. [UPDATE_MODEL_EVENT]: emitChangeFn,
  28048. [CHANGE_EVENT]: emitChangeFn
  28049. };
  28050. const collapseContextKey = Symbol("collapseContextKey");
  28051. const useCollapse = (props, emit2) => {
  28052. const activeNames = ref(castArray$1(props.modelValue));
  28053. const setActiveNames = (_activeNames) => {
  28054. activeNames.value = _activeNames;
  28055. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  28056. emit2(UPDATE_MODEL_EVENT, value);
  28057. emit2(CHANGE_EVENT, value);
  28058. };
  28059. const handleItemClick = (name) => {
  28060. if (props.accordion) {
  28061. setActiveNames([activeNames.value[0] === name ? "" : name]);
  28062. } else {
  28063. const _activeNames = [...activeNames.value];
  28064. const index2 = _activeNames.indexOf(name);
  28065. if (index2 > -1) {
  28066. _activeNames.splice(index2, 1);
  28067. } else {
  28068. _activeNames.push(name);
  28069. }
  28070. setActiveNames(_activeNames);
  28071. }
  28072. };
  28073. watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  28074. provide(collapseContextKey, {
  28075. activeNames,
  28076. handleItemClick
  28077. });
  28078. return {
  28079. activeNames,
  28080. setActiveNames
  28081. };
  28082. };
  28083. const useCollapseDOM = () => {
  28084. const ns = useNamespace("collapse");
  28085. const rootKls = computed(() => ns.b());
  28086. return {
  28087. rootKls
  28088. };
  28089. };
  28090. const __default__$10 = /* @__PURE__ */ defineComponent({
  28091. name: "ElCollapse"
  28092. });
  28093. const _sfc_main$1D = /* @__PURE__ */ defineComponent({
  28094. ...__default__$10,
  28095. props: collapseProps,
  28096. emits: collapseEmits,
  28097. setup(__props, { expose, emit: emit2 }) {
  28098. const props = __props;
  28099. const { activeNames, setActiveNames } = useCollapse(props, emit2);
  28100. const { rootKls } = useCollapseDOM();
  28101. expose({
  28102. activeNames,
  28103. setActiveNames
  28104. });
  28105. return (_ctx, _cache) => {
  28106. return openBlock(), createElementBlock("div", {
  28107. class: normalizeClass(unref(rootKls))
  28108. }, [
  28109. renderSlot(_ctx.$slots, "default")
  28110. ], 2);
  28111. };
  28112. }
  28113. });
  28114. var Collapse = /* @__PURE__ */ _export_sfc$1(_sfc_main$1D, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);
  28115. const __default__$$ = /* @__PURE__ */ defineComponent({
  28116. name: "ElCollapseTransition"
  28117. });
  28118. const _sfc_main$1C = /* @__PURE__ */ defineComponent({
  28119. ...__default__$$,
  28120. setup(__props) {
  28121. const ns = useNamespace("collapse-transition");
  28122. const reset = (el) => {
  28123. el.style.maxHeight = "";
  28124. el.style.overflow = el.dataset.oldOverflow;
  28125. el.style.paddingTop = el.dataset.oldPaddingTop;
  28126. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  28127. };
  28128. const on2 = {
  28129. beforeEnter(el) {
  28130. if (!el.dataset)
  28131. el.dataset = {};
  28132. el.dataset.oldPaddingTop = el.style.paddingTop;
  28133. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  28134. el.style.maxHeight = 0;
  28135. el.style.paddingTop = 0;
  28136. el.style.paddingBottom = 0;
  28137. },
  28138. enter(el) {
  28139. el.dataset.oldOverflow = el.style.overflow;
  28140. if (el.scrollHeight !== 0) {
  28141. el.style.maxHeight = `${el.scrollHeight}px`;
  28142. } else {
  28143. el.style.maxHeight = 0;
  28144. }
  28145. el.style.paddingTop = el.dataset.oldPaddingTop;
  28146. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  28147. el.style.overflow = "hidden";
  28148. },
  28149. afterEnter(el) {
  28150. el.style.maxHeight = "";
  28151. el.style.overflow = el.dataset.oldOverflow;
  28152. },
  28153. enterCancelled(el) {
  28154. reset(el);
  28155. },
  28156. beforeLeave(el) {
  28157. if (!el.dataset)
  28158. el.dataset = {};
  28159. el.dataset.oldPaddingTop = el.style.paddingTop;
  28160. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  28161. el.dataset.oldOverflow = el.style.overflow;
  28162. el.style.maxHeight = `${el.scrollHeight}px`;
  28163. el.style.overflow = "hidden";
  28164. },
  28165. leave(el) {
  28166. if (el.scrollHeight !== 0) {
  28167. el.style.maxHeight = 0;
  28168. el.style.paddingTop = 0;
  28169. el.style.paddingBottom = 0;
  28170. }
  28171. },
  28172. afterLeave(el) {
  28173. reset(el);
  28174. },
  28175. leaveCancelled(el) {
  28176. reset(el);
  28177. }
  28178. };
  28179. return (_ctx, _cache) => {
  28180. return openBlock(), createBlock(Transition, mergeProps({
  28181. name: unref(ns).b()
  28182. }, toHandlers(on2)), {
  28183. default: withCtx(() => [
  28184. renderSlot(_ctx.$slots, "default")
  28185. ]),
  28186. _: 3
  28187. }, 16, ["name"]);
  28188. };
  28189. }
  28190. });
  28191. var CollapseTransition = /* @__PURE__ */ _export_sfc$1(_sfc_main$1C, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse-transition/src/collapse-transition.vue"]]);
  28192. CollapseTransition.install = (app) => {
  28193. app.component(CollapseTransition.name, CollapseTransition);
  28194. };
  28195. const _CollapseTransition = CollapseTransition;
  28196. const ElCollapseTransition = _CollapseTransition;
  28197. const collapseItemProps = buildProps({
  28198. title: {
  28199. type: String,
  28200. default: ""
  28201. },
  28202. name: {
  28203. type: definePropType([String, Number]),
  28204. default: () => generateId()
  28205. },
  28206. disabled: Boolean
  28207. });
  28208. const useCollapseItem = (props) => {
  28209. const collapse = inject(collapseContextKey);
  28210. const focusing = ref(false);
  28211. const isClick = ref(false);
  28212. const id = ref(generateId());
  28213. const isActive = computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
  28214. const handleFocus = () => {
  28215. setTimeout(() => {
  28216. if (!isClick.value) {
  28217. focusing.value = true;
  28218. } else {
  28219. isClick.value = false;
  28220. }
  28221. }, 50);
  28222. };
  28223. const handleHeaderClick = () => {
  28224. if (props.disabled)
  28225. return;
  28226. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  28227. focusing.value = false;
  28228. isClick.value = true;
  28229. };
  28230. const handleEnterClick = () => {
  28231. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  28232. };
  28233. return {
  28234. focusing,
  28235. id,
  28236. isActive,
  28237. handleFocus,
  28238. handleHeaderClick,
  28239. handleEnterClick
  28240. };
  28241. };
  28242. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  28243. const ns = useNamespace("collapse");
  28244. const rootKls = computed(() => [
  28245. ns.b("item"),
  28246. ns.is("active", unref(isActive)),
  28247. ns.is("disabled", props.disabled)
  28248. ]);
  28249. const headKls = computed(() => [
  28250. ns.be("item", "header"),
  28251. ns.is("active", unref(isActive)),
  28252. { focusing: unref(focusing) && !props.disabled }
  28253. ]);
  28254. const arrowKls = computed(() => [
  28255. ns.be("item", "arrow"),
  28256. ns.is("active", unref(isActive))
  28257. ]);
  28258. const itemWrapperKls = computed(() => ns.be("item", "wrap"));
  28259. const itemContentKls = computed(() => ns.be("item", "content"));
  28260. const scopedContentId = computed(() => ns.b(`content-${unref(id)}`));
  28261. const scopedHeadId = computed(() => ns.b(`head-${unref(id)}`));
  28262. return {
  28263. arrowKls,
  28264. headKls,
  28265. rootKls,
  28266. itemWrapperKls,
  28267. itemContentKls,
  28268. scopedContentId,
  28269. scopedHeadId
  28270. };
  28271. };
  28272. const _hoisted_1$P = ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex"];
  28273. const _hoisted_2$x = ["id", "aria-hidden", "aria-labelledby"];
  28274. const __default__$_ = /* @__PURE__ */ defineComponent({
  28275. name: "ElCollapseItem"
  28276. });
  28277. const _sfc_main$1B = /* @__PURE__ */ defineComponent({
  28278. ...__default__$_,
  28279. props: collapseItemProps,
  28280. setup(__props, { expose }) {
  28281. const props = __props;
  28282. const {
  28283. focusing,
  28284. id,
  28285. isActive,
  28286. handleFocus,
  28287. handleHeaderClick,
  28288. handleEnterClick
  28289. } = useCollapseItem(props);
  28290. const {
  28291. arrowKls,
  28292. headKls,
  28293. rootKls,
  28294. itemWrapperKls,
  28295. itemContentKls,
  28296. scopedContentId,
  28297. scopedHeadId
  28298. } = useCollapseItemDOM(props, { focusing, isActive, id });
  28299. expose({
  28300. isActive
  28301. });
  28302. return (_ctx, _cache) => {
  28303. return openBlock(), createElementBlock("div", {
  28304. class: normalizeClass(unref(rootKls))
  28305. }, [
  28306. createBaseVNode("button", {
  28307. id: unref(scopedHeadId),
  28308. class: normalizeClass(unref(headKls)),
  28309. "aria-expanded": unref(isActive),
  28310. "aria-controls": unref(scopedContentId),
  28311. "aria-describedby": unref(scopedContentId),
  28312. tabindex: _ctx.disabled ? -1 : 0,
  28313. type: "button",
  28314. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
  28315. onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  28316. onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  28317. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  28318. }, [
  28319. renderSlot(_ctx.$slots, "title", {}, () => [
  28320. createTextVNode(toDisplayString(_ctx.title), 1)
  28321. ]),
  28322. createVNode(unref(ElIcon), {
  28323. class: normalizeClass(unref(arrowKls))
  28324. }, {
  28325. default: withCtx(() => [
  28326. createVNode(unref(arrow_right_default))
  28327. ]),
  28328. _: 1
  28329. }, 8, ["class"])
  28330. ], 42, _hoisted_1$P),
  28331. createVNode(unref(_CollapseTransition), null, {
  28332. default: withCtx(() => [
  28333. withDirectives(createBaseVNode("div", {
  28334. id: unref(scopedContentId),
  28335. role: "region",
  28336. class: normalizeClass(unref(itemWrapperKls)),
  28337. "aria-hidden": !unref(isActive),
  28338. "aria-labelledby": unref(scopedHeadId)
  28339. }, [
  28340. createBaseVNode("div", {
  28341. class: normalizeClass(unref(itemContentKls))
  28342. }, [
  28343. renderSlot(_ctx.$slots, "default")
  28344. ], 2)
  28345. ], 10, _hoisted_2$x), [
  28346. [vShow, unref(isActive)]
  28347. ])
  28348. ]),
  28349. _: 3
  28350. })
  28351. ], 2);
  28352. };
  28353. }
  28354. });
  28355. var CollapseItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$1B, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);
  28356. const ElCollapse = withInstall(Collapse, {
  28357. CollapseItem
  28358. });
  28359. const ElCollapseItem = withNoopInstall(CollapseItem);
  28360. const alphaSliderProps = buildProps({
  28361. color: {
  28362. type: definePropType(Object),
  28363. required: true
  28364. },
  28365. vertical: {
  28366. type: Boolean,
  28367. default: false
  28368. }
  28369. });
  28370. let isDragging = false;
  28371. function draggable(element, options) {
  28372. if (!isClient)
  28373. return;
  28374. const moveFn = function(event) {
  28375. var _a2;
  28376. (_a2 = options.drag) == null ? void 0 : _a2.call(options, event);
  28377. };
  28378. const upFn = function(event) {
  28379. var _a2;
  28380. document.removeEventListener("mousemove", moveFn);
  28381. document.removeEventListener("mouseup", upFn);
  28382. document.removeEventListener("touchmove", moveFn);
  28383. document.removeEventListener("touchend", upFn);
  28384. document.onselectstart = null;
  28385. document.ondragstart = null;
  28386. isDragging = false;
  28387. (_a2 = options.end) == null ? void 0 : _a2.call(options, event);
  28388. };
  28389. const downFn = function(event) {
  28390. var _a2;
  28391. if (isDragging)
  28392. return;
  28393. event.preventDefault();
  28394. document.onselectstart = () => false;
  28395. document.ondragstart = () => false;
  28396. document.addEventListener("mousemove", moveFn);
  28397. document.addEventListener("mouseup", upFn);
  28398. document.addEventListener("touchmove", moveFn);
  28399. document.addEventListener("touchend", upFn);
  28400. isDragging = true;
  28401. (_a2 = options.start) == null ? void 0 : _a2.call(options, event);
  28402. };
  28403. element.addEventListener("mousedown", downFn);
  28404. element.addEventListener("touchstart", downFn);
  28405. }
  28406. const useAlphaSlider = (props) => {
  28407. const instance = getCurrentInstance();
  28408. const thumb = shallowRef();
  28409. const bar = shallowRef();
  28410. function handleClick(event) {
  28411. const target = event.target;
  28412. if (target !== thumb.value) {
  28413. handleDrag(event);
  28414. }
  28415. }
  28416. function handleDrag(event) {
  28417. if (!bar.value || !thumb.value)
  28418. return;
  28419. const el = instance.vnode.el;
  28420. const rect = el.getBoundingClientRect();
  28421. const { clientX, clientY } = getClientXY(event);
  28422. if (!props.vertical) {
  28423. let left2 = clientX - rect.left;
  28424. left2 = Math.max(thumb.value.offsetWidth / 2, left2);
  28425. left2 = Math.min(left2, rect.width - thumb.value.offsetWidth / 2);
  28426. props.color.set("alpha", Math.round((left2 - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  28427. } else {
  28428. let top = clientY - rect.top;
  28429. top = Math.max(thumb.value.offsetHeight / 2, top);
  28430. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  28431. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  28432. }
  28433. }
  28434. return {
  28435. thumb,
  28436. bar,
  28437. handleDrag,
  28438. handleClick
  28439. };
  28440. };
  28441. const useAlphaSliderDOM = (props, {
  28442. bar,
  28443. thumb,
  28444. handleDrag
  28445. }) => {
  28446. const instance = getCurrentInstance();
  28447. const ns = useNamespace("color-alpha-slider");
  28448. const thumbLeft = ref(0);
  28449. const thumbTop = ref(0);
  28450. const background = ref();
  28451. function getThumbLeft() {
  28452. if (!thumb.value)
  28453. return 0;
  28454. if (props.vertical)
  28455. return 0;
  28456. const el = instance.vnode.el;
  28457. const alpha = props.color.get("alpha");
  28458. if (!el)
  28459. return 0;
  28460. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  28461. }
  28462. function getThumbTop() {
  28463. if (!thumb.value)
  28464. return 0;
  28465. const el = instance.vnode.el;
  28466. if (!props.vertical)
  28467. return 0;
  28468. const alpha = props.color.get("alpha");
  28469. if (!el)
  28470. return 0;
  28471. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  28472. }
  28473. function getBackground() {
  28474. if (props.color && props.color.value) {
  28475. const { r, g, b: b2 } = props.color.toRgb();
  28476. return `linear-gradient(to right, rgba(${r}, ${g}, ${b2}, 0) 0%, rgba(${r}, ${g}, ${b2}, 1) 100%)`;
  28477. }
  28478. return "";
  28479. }
  28480. function update() {
  28481. thumbLeft.value = getThumbLeft();
  28482. thumbTop.value = getThumbTop();
  28483. background.value = getBackground();
  28484. }
  28485. onMounted(() => {
  28486. if (!bar.value || !thumb.value)
  28487. return;
  28488. const dragConfig = {
  28489. drag: (event) => {
  28490. handleDrag(event);
  28491. },
  28492. end: (event) => {
  28493. handleDrag(event);
  28494. }
  28495. };
  28496. draggable(bar.value, dragConfig);
  28497. draggable(thumb.value, dragConfig);
  28498. update();
  28499. });
  28500. watch(() => props.color.get("alpha"), () => update());
  28501. watch(() => props.color.value, () => update());
  28502. const rootKls = computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  28503. const barKls = computed(() => ns.e("bar"));
  28504. const thumbKls = computed(() => ns.e("thumb"));
  28505. const barStyle = computed(() => ({ background: background.value }));
  28506. const thumbStyle = computed(() => ({
  28507. left: addUnit(thumbLeft.value),
  28508. top: addUnit(thumbTop.value)
  28509. }));
  28510. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  28511. };
  28512. const COMPONENT_NAME$d = "ElColorAlphaSlider";
  28513. const __default__$Z = /* @__PURE__ */ defineComponent({
  28514. name: COMPONENT_NAME$d
  28515. });
  28516. const _sfc_main$1A = /* @__PURE__ */ defineComponent({
  28517. ...__default__$Z,
  28518. props: alphaSliderProps,
  28519. setup(__props, { expose }) {
  28520. const props = __props;
  28521. const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props);
  28522. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  28523. bar,
  28524. thumb,
  28525. handleDrag
  28526. });
  28527. expose({
  28528. update,
  28529. bar,
  28530. thumb
  28531. });
  28532. return (_ctx, _cache) => {
  28533. return openBlock(), createElementBlock("div", {
  28534. class: normalizeClass(unref(rootKls))
  28535. }, [
  28536. createBaseVNode("div", {
  28537. ref_key: "bar",
  28538. ref: bar,
  28539. class: normalizeClass(unref(barKls)),
  28540. style: normalizeStyle(unref(barStyle)),
  28541. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  28542. }, null, 6),
  28543. createBaseVNode("div", {
  28544. ref_key: "thumb",
  28545. ref: thumb,
  28546. class: normalizeClass(unref(thumbKls)),
  28547. style: normalizeStyle(unref(thumbStyle))
  28548. }, null, 6)
  28549. ], 2);
  28550. };
  28551. }
  28552. });
  28553. var AlphaSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$1A, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/alpha-slider.vue"]]);
  28554. const _sfc_main$1z = /* @__PURE__ */ defineComponent({
  28555. name: "ElColorHueSlider",
  28556. props: {
  28557. color: {
  28558. type: Object,
  28559. required: true
  28560. },
  28561. vertical: Boolean
  28562. },
  28563. setup(props) {
  28564. const ns = useNamespace("color-hue-slider");
  28565. const instance = getCurrentInstance();
  28566. const thumb = ref();
  28567. const bar = ref();
  28568. const thumbLeft = ref(0);
  28569. const thumbTop = ref(0);
  28570. const hueValue = computed(() => {
  28571. return props.color.get("hue");
  28572. });
  28573. watch(() => hueValue.value, () => {
  28574. update();
  28575. });
  28576. function handleClick(event) {
  28577. const target = event.target;
  28578. if (target !== thumb.value) {
  28579. handleDrag(event);
  28580. }
  28581. }
  28582. function handleDrag(event) {
  28583. if (!bar.value || !thumb.value)
  28584. return;
  28585. const el = instance.vnode.el;
  28586. const rect = el.getBoundingClientRect();
  28587. const { clientX, clientY } = getClientXY(event);
  28588. let hue;
  28589. if (!props.vertical) {
  28590. let left2 = clientX - rect.left;
  28591. left2 = Math.min(left2, rect.width - thumb.value.offsetWidth / 2);
  28592. left2 = Math.max(thumb.value.offsetWidth / 2, left2);
  28593. hue = Math.round((left2 - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  28594. } else {
  28595. let top = clientY - rect.top;
  28596. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  28597. top = Math.max(thumb.value.offsetHeight / 2, top);
  28598. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  28599. }
  28600. props.color.set("hue", hue);
  28601. }
  28602. function getThumbLeft() {
  28603. if (!thumb.value)
  28604. return 0;
  28605. const el = instance.vnode.el;
  28606. if (props.vertical)
  28607. return 0;
  28608. const hue = props.color.get("hue");
  28609. if (!el)
  28610. return 0;
  28611. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  28612. }
  28613. function getThumbTop() {
  28614. if (!thumb.value)
  28615. return 0;
  28616. const el = instance.vnode.el;
  28617. if (!props.vertical)
  28618. return 0;
  28619. const hue = props.color.get("hue");
  28620. if (!el)
  28621. return 0;
  28622. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  28623. }
  28624. function update() {
  28625. thumbLeft.value = getThumbLeft();
  28626. thumbTop.value = getThumbTop();
  28627. }
  28628. onMounted(() => {
  28629. if (!bar.value || !thumb.value)
  28630. return;
  28631. const dragConfig = {
  28632. drag: (event) => {
  28633. handleDrag(event);
  28634. },
  28635. end: (event) => {
  28636. handleDrag(event);
  28637. }
  28638. };
  28639. draggable(bar.value, dragConfig);
  28640. draggable(thumb.value, dragConfig);
  28641. update();
  28642. });
  28643. return {
  28644. bar,
  28645. thumb,
  28646. thumbLeft,
  28647. thumbTop,
  28648. hueValue,
  28649. handleClick,
  28650. update,
  28651. ns
  28652. };
  28653. }
  28654. });
  28655. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  28656. return openBlock(), createElementBlock("div", {
  28657. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  28658. }, [
  28659. createBaseVNode("div", {
  28660. ref: "bar",
  28661. class: normalizeClass(_ctx.ns.e("bar")),
  28662. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  28663. }, null, 2),
  28664. createBaseVNode("div", {
  28665. ref: "thumb",
  28666. class: normalizeClass(_ctx.ns.e("thumb")),
  28667. style: normalizeStyle({
  28668. left: _ctx.thumbLeft + "px",
  28669. top: _ctx.thumbTop + "px"
  28670. })
  28671. }, null, 6)
  28672. ], 2);
  28673. }
  28674. var HueSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$1z, [["render", _sfc_render$r], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/hue-slider.vue"]]);
  28675. const colorPickerProps = buildProps({
  28676. modelValue: String,
  28677. id: String,
  28678. showAlpha: Boolean,
  28679. colorFormat: String,
  28680. disabled: Boolean,
  28681. size: useSizeProp,
  28682. popperClass: {
  28683. type: String,
  28684. default: ""
  28685. },
  28686. label: {
  28687. type: String,
  28688. default: void 0
  28689. },
  28690. tabindex: {
  28691. type: [String, Number],
  28692. default: 0
  28693. },
  28694. predefine: {
  28695. type: definePropType(Array)
  28696. },
  28697. validateEvent: {
  28698. type: Boolean,
  28699. default: true
  28700. }
  28701. });
  28702. const colorPickerEmits = {
  28703. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  28704. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  28705. activeChange: (val) => isString$1(val) || isNil(val),
  28706. focus: (event) => event instanceof FocusEvent,
  28707. blur: (event) => event instanceof FocusEvent
  28708. };
  28709. const colorPickerContextKey = Symbol("colorPickerContextKey");
  28710. const hsv2hsl = function(hue, sat, val) {
  28711. return [
  28712. hue,
  28713. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  28714. hue / 2
  28715. ];
  28716. };
  28717. const isOnePointZero = function(n) {
  28718. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  28719. };
  28720. const isPercentage = function(n) {
  28721. return typeof n === "string" && n.includes("%");
  28722. };
  28723. const bound01 = function(value, max2) {
  28724. if (isOnePointZero(value))
  28725. value = "100%";
  28726. const processPercent = isPercentage(value);
  28727. value = Math.min(max2, Math.max(0, Number.parseFloat(`${value}`)));
  28728. if (processPercent) {
  28729. value = Number.parseInt(`${value * max2}`, 10) / 100;
  28730. }
  28731. if (Math.abs(value - max2) < 1e-6) {
  28732. return 1;
  28733. }
  28734. return value % max2 / Number.parseFloat(max2);
  28735. };
  28736. const INT_HEX_MAP = {
  28737. 10: "A",
  28738. 11: "B",
  28739. 12: "C",
  28740. 13: "D",
  28741. 14: "E",
  28742. 15: "F"
  28743. };
  28744. const hexOne = (value) => {
  28745. value = Math.min(Math.round(value), 255);
  28746. const high = Math.floor(value / 16);
  28747. const low = value % 16;
  28748. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  28749. };
  28750. const toHex = function({ r, g, b: b2 }) {
  28751. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b2))
  28752. return "";
  28753. return `#${hexOne(r)}${hexOne(g)}${hexOne(b2)}`;
  28754. };
  28755. const HEX_INT_MAP = {
  28756. A: 10,
  28757. B: 11,
  28758. C: 12,
  28759. D: 13,
  28760. E: 14,
  28761. F: 15
  28762. };
  28763. const parseHexChannel = function(hex) {
  28764. if (hex.length === 2) {
  28765. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  28766. }
  28767. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  28768. };
  28769. const hsl2hsv = function(hue, sat, light) {
  28770. sat = sat / 100;
  28771. light = light / 100;
  28772. let smin = sat;
  28773. const lmin = Math.max(light, 0.01);
  28774. light *= 2;
  28775. sat *= light <= 1 ? light : 2 - light;
  28776. smin *= lmin <= 1 ? lmin : 2 - lmin;
  28777. const v2 = (light + sat) / 2;
  28778. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  28779. return {
  28780. h: hue,
  28781. s: sv * 100,
  28782. v: v2 * 100
  28783. };
  28784. };
  28785. const rgb2hsv = (r, g, b2) => {
  28786. r = bound01(r, 255);
  28787. g = bound01(g, 255);
  28788. b2 = bound01(b2, 255);
  28789. const max2 = Math.max(r, g, b2);
  28790. const min2 = Math.min(r, g, b2);
  28791. let h2;
  28792. const v2 = max2;
  28793. const d2 = max2 - min2;
  28794. const s2 = max2 === 0 ? 0 : d2 / max2;
  28795. if (max2 === min2) {
  28796. h2 = 0;
  28797. } else {
  28798. switch (max2) {
  28799. case r: {
  28800. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  28801. break;
  28802. }
  28803. case g: {
  28804. h2 = (b2 - r) / d2 + 2;
  28805. break;
  28806. }
  28807. case b2: {
  28808. h2 = (r - g) / d2 + 4;
  28809. break;
  28810. }
  28811. }
  28812. h2 /= 6;
  28813. }
  28814. return { h: h2 * 360, s: s2 * 100, v: v2 * 100 };
  28815. };
  28816. const hsv2rgb = function(h2, s2, v2) {
  28817. h2 = bound01(h2, 360) * 6;
  28818. s2 = bound01(s2, 100);
  28819. v2 = bound01(v2, 100);
  28820. const i = Math.floor(h2);
  28821. const f2 = h2 - i;
  28822. const p2 = v2 * (1 - s2);
  28823. const q2 = v2 * (1 - f2 * s2);
  28824. const t = v2 * (1 - (1 - f2) * s2);
  28825. const mod = i % 6;
  28826. const r = [v2, q2, p2, p2, t, v2][mod];
  28827. const g = [t, v2, v2, q2, p2, p2][mod];
  28828. const b2 = [p2, p2, t, v2, v2, q2][mod];
  28829. return {
  28830. r: Math.round(r * 255),
  28831. g: Math.round(g * 255),
  28832. b: Math.round(b2 * 255)
  28833. };
  28834. };
  28835. class Color {
  28836. constructor(options = {}) {
  28837. this._hue = 0;
  28838. this._saturation = 100;
  28839. this._value = 100;
  28840. this._alpha = 100;
  28841. this.enableAlpha = false;
  28842. this.format = "hex";
  28843. this.value = "";
  28844. for (const option in options) {
  28845. if (hasOwn(options, option)) {
  28846. this[option] = options[option];
  28847. }
  28848. }
  28849. if (options.value) {
  28850. this.fromString(options.value);
  28851. } else {
  28852. this.doOnChange();
  28853. }
  28854. }
  28855. set(prop, value) {
  28856. if (arguments.length === 1 && typeof prop === "object") {
  28857. for (const p2 in prop) {
  28858. if (hasOwn(prop, p2)) {
  28859. this.set(p2, prop[p2]);
  28860. }
  28861. }
  28862. return;
  28863. }
  28864. this[`_${prop}`] = value;
  28865. this.doOnChange();
  28866. }
  28867. get(prop) {
  28868. if (prop === "alpha") {
  28869. return Math.floor(this[`_${prop}`]);
  28870. }
  28871. return this[`_${prop}`];
  28872. }
  28873. toRgb() {
  28874. return hsv2rgb(this._hue, this._saturation, this._value);
  28875. }
  28876. fromString(value) {
  28877. if (!value) {
  28878. this._hue = 0;
  28879. this._saturation = 100;
  28880. this._value = 100;
  28881. this.doOnChange();
  28882. return;
  28883. }
  28884. const fromHSV = (h2, s2, v2) => {
  28885. this._hue = Math.max(0, Math.min(360, h2));
  28886. this._saturation = Math.max(0, Math.min(100, s2));
  28887. this._value = Math.max(0, Math.min(100, v2));
  28888. this.doOnChange();
  28889. };
  28890. if (value.includes("hsl")) {
  28891. const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  28892. if (parts.length === 4) {
  28893. this._alpha = Number.parseFloat(parts[3]) * 100;
  28894. } else if (parts.length === 3) {
  28895. this._alpha = 100;
  28896. }
  28897. if (parts.length >= 3) {
  28898. const { h: h2, s: s2, v: v2 } = hsl2hsv(parts[0], parts[1], parts[2]);
  28899. fromHSV(h2, s2, v2);
  28900. }
  28901. } else if (value.includes("hsv")) {
  28902. const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  28903. if (parts.length === 4) {
  28904. this._alpha = Number.parseFloat(parts[3]) * 100;
  28905. } else if (parts.length === 3) {
  28906. this._alpha = 100;
  28907. }
  28908. if (parts.length >= 3) {
  28909. fromHSV(parts[0], parts[1], parts[2]);
  28910. }
  28911. } else if (value.includes("rgb")) {
  28912. const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  28913. if (parts.length === 4) {
  28914. this._alpha = Number.parseFloat(parts[3]) * 100;
  28915. } else if (parts.length === 3) {
  28916. this._alpha = 100;
  28917. }
  28918. if (parts.length >= 3) {
  28919. const { h: h2, s: s2, v: v2 } = rgb2hsv(parts[0], parts[1], parts[2]);
  28920. fromHSV(h2, s2, v2);
  28921. }
  28922. } else if (value.includes("#")) {
  28923. const hex = value.replace("#", "").trim();
  28924. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  28925. return;
  28926. let r, g, b2;
  28927. if (hex.length === 3) {
  28928. r = parseHexChannel(hex[0] + hex[0]);
  28929. g = parseHexChannel(hex[1] + hex[1]);
  28930. b2 = parseHexChannel(hex[2] + hex[2]);
  28931. } else if (hex.length === 6 || hex.length === 8) {
  28932. r = parseHexChannel(hex.slice(0, 2));
  28933. g = parseHexChannel(hex.slice(2, 4));
  28934. b2 = parseHexChannel(hex.slice(4, 6));
  28935. }
  28936. if (hex.length === 8) {
  28937. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  28938. } else if (hex.length === 3 || hex.length === 6) {
  28939. this._alpha = 100;
  28940. }
  28941. const { h: h2, s: s2, v: v2 } = rgb2hsv(r, g, b2);
  28942. fromHSV(h2, s2, v2);
  28943. }
  28944. }
  28945. compare(color) {
  28946. return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1;
  28947. }
  28948. doOnChange() {
  28949. const { _hue, _saturation, _value, _alpha, format: format2 } = this;
  28950. if (this.enableAlpha) {
  28951. switch (format2) {
  28952. case "hsl": {
  28953. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  28954. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  28955. break;
  28956. }
  28957. case "hsv": {
  28958. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  28959. break;
  28960. }
  28961. case "hex": {
  28962. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  28963. break;
  28964. }
  28965. default: {
  28966. const { r, g, b: b2 } = hsv2rgb(_hue, _saturation, _value);
  28967. this.value = `rgba(${r}, ${g}, ${b2}, ${this.get("alpha") / 100})`;
  28968. }
  28969. }
  28970. } else {
  28971. switch (format2) {
  28972. case "hsl": {
  28973. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  28974. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  28975. break;
  28976. }
  28977. case "hsv": {
  28978. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  28979. break;
  28980. }
  28981. case "rgb": {
  28982. const { r, g, b: b2 } = hsv2rgb(_hue, _saturation, _value);
  28983. this.value = `rgb(${r}, ${g}, ${b2})`;
  28984. break;
  28985. }
  28986. default: {
  28987. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  28988. }
  28989. }
  28990. }
  28991. }
  28992. }
  28993. const _sfc_main$1y = /* @__PURE__ */ defineComponent({
  28994. props: {
  28995. colors: {
  28996. type: Array,
  28997. required: true
  28998. },
  28999. color: {
  29000. type: Object,
  29001. required: true
  29002. }
  29003. },
  29004. setup(props) {
  29005. const ns = useNamespace("color-predefine");
  29006. const { currentColor } = inject(colorPickerContextKey);
  29007. const rgbaColors = ref(parseColors(props.colors, props.color));
  29008. watch(() => currentColor.value, (val) => {
  29009. const color = new Color();
  29010. color.fromString(val);
  29011. rgbaColors.value.forEach((item) => {
  29012. item.selected = color.compare(item);
  29013. });
  29014. });
  29015. watchEffect(() => {
  29016. rgbaColors.value = parseColors(props.colors, props.color);
  29017. });
  29018. function handleSelect(index2) {
  29019. props.color.fromString(props.colors[index2]);
  29020. }
  29021. function parseColors(colors, color) {
  29022. return colors.map((value) => {
  29023. const c2 = new Color();
  29024. c2.enableAlpha = true;
  29025. c2.format = "rgba";
  29026. c2.fromString(value);
  29027. c2.selected = c2.value === color.value;
  29028. return c2;
  29029. });
  29030. }
  29031. return {
  29032. rgbaColors,
  29033. handleSelect,
  29034. ns
  29035. };
  29036. }
  29037. });
  29038. const _hoisted_1$O = ["onClick"];
  29039. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  29040. return openBlock(), createElementBlock("div", {
  29041. class: normalizeClass(_ctx.ns.b())
  29042. }, [
  29043. createBaseVNode("div", {
  29044. class: normalizeClass(_ctx.ns.e("colors"))
  29045. }, [
  29046. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index2) => {
  29047. return openBlock(), createElementBlock("div", {
  29048. key: _ctx.colors[index2],
  29049. class: normalizeClass([
  29050. _ctx.ns.e("color-selector"),
  29051. _ctx.ns.is("alpha", item._alpha < 100),
  29052. { selected: item.selected }
  29053. ]),
  29054. onClick: ($event) => _ctx.handleSelect(index2)
  29055. }, [
  29056. createBaseVNode("div", {
  29057. style: normalizeStyle({ backgroundColor: item.value })
  29058. }, null, 4)
  29059. ], 10, _hoisted_1$O);
  29060. }), 128))
  29061. ], 2)
  29062. ], 2);
  29063. }
  29064. var Predefine = /* @__PURE__ */ _export_sfc$1(_sfc_main$1y, [["render", _sfc_render$q], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/predefine.vue"]]);
  29065. const _sfc_main$1x = /* @__PURE__ */ defineComponent({
  29066. name: "ElSlPanel",
  29067. props: {
  29068. color: {
  29069. type: Object,
  29070. required: true
  29071. }
  29072. },
  29073. setup(props) {
  29074. const ns = useNamespace("color-svpanel");
  29075. const instance = getCurrentInstance();
  29076. const cursorTop = ref(0);
  29077. const cursorLeft = ref(0);
  29078. const background = ref("hsl(0, 100%, 50%)");
  29079. const colorValue = computed(() => {
  29080. const hue = props.color.get("hue");
  29081. const value = props.color.get("value");
  29082. return { hue, value };
  29083. });
  29084. function update() {
  29085. const saturation = props.color.get("saturation");
  29086. const value = props.color.get("value");
  29087. const el = instance.vnode.el;
  29088. const { clientWidth: width, clientHeight: height } = el;
  29089. cursorLeft.value = saturation * width / 100;
  29090. cursorTop.value = (100 - value) * height / 100;
  29091. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  29092. }
  29093. function handleDrag(event) {
  29094. const el = instance.vnode.el;
  29095. const rect = el.getBoundingClientRect();
  29096. const { clientX, clientY } = getClientXY(event);
  29097. let left2 = clientX - rect.left;
  29098. let top = clientY - rect.top;
  29099. left2 = Math.max(0, left2);
  29100. left2 = Math.min(left2, rect.width);
  29101. top = Math.max(0, top);
  29102. top = Math.min(top, rect.height);
  29103. cursorLeft.value = left2;
  29104. cursorTop.value = top;
  29105. props.color.set({
  29106. saturation: left2 / rect.width * 100,
  29107. value: 100 - top / rect.height * 100
  29108. });
  29109. }
  29110. watch(() => colorValue.value, () => {
  29111. update();
  29112. });
  29113. onMounted(() => {
  29114. draggable(instance.vnode.el, {
  29115. drag: (event) => {
  29116. handleDrag(event);
  29117. },
  29118. end: (event) => {
  29119. handleDrag(event);
  29120. }
  29121. });
  29122. update();
  29123. });
  29124. return {
  29125. cursorTop,
  29126. cursorLeft,
  29127. background,
  29128. colorValue,
  29129. handleDrag,
  29130. update,
  29131. ns
  29132. };
  29133. }
  29134. });
  29135. const _hoisted_1$N = /* @__PURE__ */ createBaseVNode("div", null, null, -1);
  29136. const _hoisted_2$w = [
  29137. _hoisted_1$N
  29138. ];
  29139. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  29140. return openBlock(), createElementBlock("div", {
  29141. class: normalizeClass(_ctx.ns.b()),
  29142. style: normalizeStyle({
  29143. backgroundColor: _ctx.background
  29144. })
  29145. }, [
  29146. createBaseVNode("div", {
  29147. class: normalizeClass(_ctx.ns.e("white"))
  29148. }, null, 2),
  29149. createBaseVNode("div", {
  29150. class: normalizeClass(_ctx.ns.e("black"))
  29151. }, null, 2),
  29152. createBaseVNode("div", {
  29153. class: normalizeClass(_ctx.ns.e("cursor")),
  29154. style: normalizeStyle({
  29155. top: _ctx.cursorTop + "px",
  29156. left: _ctx.cursorLeft + "px"
  29157. })
  29158. }, _hoisted_2$w, 6)
  29159. ], 6);
  29160. }
  29161. var SvPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1x, [["render", _sfc_render$p], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/sv-panel.vue"]]);
  29162. const _hoisted_1$M = ["onKeydown"];
  29163. const _hoisted_2$v = ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex"];
  29164. const __default__$Y = /* @__PURE__ */ defineComponent({
  29165. name: "ElColorPicker"
  29166. });
  29167. const _sfc_main$1w = /* @__PURE__ */ defineComponent({
  29168. ...__default__$Y,
  29169. props: colorPickerProps,
  29170. emits: colorPickerEmits,
  29171. setup(__props, { expose, emit: emit2 }) {
  29172. const props = __props;
  29173. const { t } = useLocale();
  29174. const ns = useNamespace("color");
  29175. const { formItem } = useFormItem();
  29176. const colorSize = useFormSize();
  29177. const colorDisabled = useFormDisabled();
  29178. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  29179. formItemContext: formItem
  29180. });
  29181. const hue = ref();
  29182. const sv = ref();
  29183. const alpha = ref();
  29184. const popper = ref();
  29185. const triggerRef2 = ref();
  29186. const inputRef = ref();
  29187. const {
  29188. isFocused,
  29189. handleFocus: _handleFocus,
  29190. handleBlur
  29191. } = useFocusController(triggerRef2, {
  29192. beforeBlur(event) {
  29193. var _a2;
  29194. return (_a2 = popper.value) == null ? void 0 : _a2.isFocusInsideContent(event);
  29195. },
  29196. afterBlur() {
  29197. setShowPicker(false);
  29198. resetColor();
  29199. }
  29200. });
  29201. const handleFocus = (event) => {
  29202. if (colorDisabled.value)
  29203. return blur();
  29204. _handleFocus(event);
  29205. };
  29206. let shouldActiveChange = true;
  29207. const color = reactive(new Color({
  29208. enableAlpha: props.showAlpha,
  29209. format: props.colorFormat || "",
  29210. value: props.modelValue
  29211. }));
  29212. const showPicker = ref(false);
  29213. const showPanelColor = ref(false);
  29214. const customInput = ref("");
  29215. const displayedColor = computed(() => {
  29216. if (!props.modelValue && !showPanelColor.value) {
  29217. return "transparent";
  29218. }
  29219. return displayedRgb(color, props.showAlpha);
  29220. });
  29221. const currentColor = computed(() => {
  29222. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  29223. });
  29224. const buttonAriaLabel = computed(() => {
  29225. return !isLabeledByFormItem.value ? props.label || t("el.colorpicker.defaultLabel") : void 0;
  29226. });
  29227. const buttonAriaLabelledby = computed(() => {
  29228. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  29229. });
  29230. const btnKls = computed(() => {
  29231. return [
  29232. ns.b("picker"),
  29233. ns.is("disabled", colorDisabled.value),
  29234. ns.bm("picker", colorSize.value),
  29235. ns.is("focused", isFocused.value)
  29236. ];
  29237. });
  29238. function displayedRgb(color2, showAlpha) {
  29239. if (!(color2 instanceof Color)) {
  29240. throw new TypeError("color should be instance of _color Class");
  29241. }
  29242. const { r, g, b: b2 } = color2.toRgb();
  29243. return showAlpha ? `rgba(${r}, ${g}, ${b2}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b2})`;
  29244. }
  29245. function setShowPicker(value) {
  29246. showPicker.value = value;
  29247. }
  29248. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  29249. function show() {
  29250. if (colorDisabled.value)
  29251. return;
  29252. setShowPicker(true);
  29253. }
  29254. function hide() {
  29255. debounceSetShowPicker(false);
  29256. resetColor();
  29257. }
  29258. function resetColor() {
  29259. nextTick(() => {
  29260. if (props.modelValue) {
  29261. color.fromString(props.modelValue);
  29262. } else {
  29263. color.value = "";
  29264. nextTick(() => {
  29265. showPanelColor.value = false;
  29266. });
  29267. }
  29268. });
  29269. }
  29270. function handleTrigger() {
  29271. if (colorDisabled.value)
  29272. return;
  29273. debounceSetShowPicker(!showPicker.value);
  29274. }
  29275. function handleConfirm() {
  29276. color.fromString(customInput.value);
  29277. }
  29278. function confirmValue() {
  29279. const value = color.value;
  29280. emit2(UPDATE_MODEL_EVENT, value);
  29281. emit2("change", value);
  29282. if (props.validateEvent) {
  29283. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  29284. }
  29285. debounceSetShowPicker(false);
  29286. nextTick(() => {
  29287. const newColor = new Color({
  29288. enableAlpha: props.showAlpha,
  29289. format: props.colorFormat || "",
  29290. value: props.modelValue
  29291. });
  29292. if (!color.compare(newColor)) {
  29293. resetColor();
  29294. }
  29295. });
  29296. }
  29297. function clear2() {
  29298. debounceSetShowPicker(false);
  29299. emit2(UPDATE_MODEL_EVENT, null);
  29300. emit2("change", null);
  29301. if (props.modelValue !== null && props.validateEvent) {
  29302. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  29303. }
  29304. resetColor();
  29305. }
  29306. function handleClickOutside(event) {
  29307. if (!showPicker.value)
  29308. return;
  29309. hide();
  29310. if (isFocused.value) {
  29311. const _event2 = new FocusEvent("focus", event);
  29312. handleBlur(_event2);
  29313. }
  29314. }
  29315. function handleEsc(event) {
  29316. event.preventDefault();
  29317. event.stopPropagation();
  29318. setShowPicker(false);
  29319. resetColor();
  29320. }
  29321. function handleKeyDown(event) {
  29322. switch (event.code) {
  29323. case EVENT_CODE.enter:
  29324. case EVENT_CODE.space:
  29325. event.preventDefault();
  29326. event.stopPropagation();
  29327. show();
  29328. inputRef.value.focus();
  29329. break;
  29330. case EVENT_CODE.esc:
  29331. handleEsc(event);
  29332. break;
  29333. }
  29334. }
  29335. function focus() {
  29336. triggerRef2.value.focus();
  29337. }
  29338. function blur() {
  29339. triggerRef2.value.blur();
  29340. }
  29341. onMounted(() => {
  29342. if (props.modelValue) {
  29343. customInput.value = currentColor.value;
  29344. }
  29345. });
  29346. watch(() => props.modelValue, (newVal) => {
  29347. if (!newVal) {
  29348. showPanelColor.value = false;
  29349. } else if (newVal && newVal !== color.value) {
  29350. shouldActiveChange = false;
  29351. color.fromString(newVal);
  29352. }
  29353. });
  29354. watch(() => currentColor.value, (val) => {
  29355. customInput.value = val;
  29356. shouldActiveChange && emit2("activeChange", val);
  29357. shouldActiveChange = true;
  29358. });
  29359. watch(() => color.value, () => {
  29360. if (!props.modelValue && !showPanelColor.value) {
  29361. showPanelColor.value = true;
  29362. }
  29363. });
  29364. watch(() => showPicker.value, () => {
  29365. nextTick(() => {
  29366. var _a2, _b, _c;
  29367. (_a2 = hue.value) == null ? void 0 : _a2.update();
  29368. (_b = sv.value) == null ? void 0 : _b.update();
  29369. (_c = alpha.value) == null ? void 0 : _c.update();
  29370. });
  29371. });
  29372. provide(colorPickerContextKey, {
  29373. currentColor
  29374. });
  29375. expose({
  29376. color,
  29377. show,
  29378. hide,
  29379. focus,
  29380. blur
  29381. });
  29382. return (_ctx, _cache) => {
  29383. return openBlock(), createBlock(unref(ElTooltip), {
  29384. ref_key: "popper",
  29385. ref: popper,
  29386. visible: showPicker.value,
  29387. "show-arrow": false,
  29388. "fallback-placements": ["bottom", "top", "right", "left"],
  29389. offset: 0,
  29390. "gpu-acceleration": false,
  29391. "popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
  29392. "stop-popper-mouse-event": false,
  29393. effect: "light",
  29394. trigger: "click",
  29395. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  29396. persistent: "",
  29397. onHide: _cache[2] || (_cache[2] = ($event) => setShowPicker(false))
  29398. }, {
  29399. content: withCtx(() => [
  29400. withDirectives((openBlock(), createElementBlock("div", {
  29401. onKeydown: withKeys(handleEsc, ["esc"])
  29402. }, [
  29403. createBaseVNode("div", {
  29404. class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
  29405. }, [
  29406. createVNode(HueSlider, {
  29407. ref_key: "hue",
  29408. ref: hue,
  29409. class: "hue-slider",
  29410. color: unref(color),
  29411. vertical: ""
  29412. }, null, 8, ["color"]),
  29413. createVNode(SvPanel, {
  29414. ref_key: "sv",
  29415. ref: sv,
  29416. color: unref(color)
  29417. }, null, 8, ["color"])
  29418. ], 2),
  29419. _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
  29420. key: 0,
  29421. ref_key: "alpha",
  29422. ref: alpha,
  29423. color: unref(color)
  29424. }, null, 8, ["color"])) : createCommentVNode("v-if", true),
  29425. _ctx.predefine ? (openBlock(), createBlock(Predefine, {
  29426. key: 1,
  29427. ref: "predefine",
  29428. color: unref(color),
  29429. colors: _ctx.predefine
  29430. }, null, 8, ["color", "colors"])) : createCommentVNode("v-if", true),
  29431. createBaseVNode("div", {
  29432. class: normalizeClass(unref(ns).be("dropdown", "btns"))
  29433. }, [
  29434. createBaseVNode("span", {
  29435. class: normalizeClass(unref(ns).be("dropdown", "value"))
  29436. }, [
  29437. createVNode(unref(ElInput), {
  29438. ref_key: "inputRef",
  29439. ref: inputRef,
  29440. modelValue: customInput.value,
  29441. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  29442. "validate-event": false,
  29443. size: "small",
  29444. onKeyup: withKeys(handleConfirm, ["enter"]),
  29445. onBlur: handleConfirm
  29446. }, null, 8, ["modelValue", "onKeyup"])
  29447. ], 2),
  29448. createVNode(unref(ElButton), {
  29449. class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
  29450. text: "",
  29451. size: "small",
  29452. onClick: clear2
  29453. }, {
  29454. default: withCtx(() => [
  29455. createTextVNode(toDisplayString(unref(t)("el.colorpicker.clear")), 1)
  29456. ]),
  29457. _: 1
  29458. }, 8, ["class"]),
  29459. createVNode(unref(ElButton), {
  29460. plain: "",
  29461. size: "small",
  29462. class: normalizeClass(unref(ns).be("dropdown", "btn")),
  29463. onClick: confirmValue
  29464. }, {
  29465. default: withCtx(() => [
  29466. createTextVNode(toDisplayString(unref(t)("el.colorpicker.confirm")), 1)
  29467. ]),
  29468. _: 1
  29469. }, 8, ["class"])
  29470. ], 2)
  29471. ], 40, _hoisted_1$M)), [
  29472. [unref(ClickOutside), handleClickOutside]
  29473. ])
  29474. ]),
  29475. default: withCtx(() => [
  29476. createBaseVNode("div", {
  29477. id: unref(buttonId),
  29478. ref_key: "triggerRef",
  29479. ref: triggerRef2,
  29480. class: normalizeClass(unref(btnKls)),
  29481. role: "button",
  29482. "aria-label": unref(buttonAriaLabel),
  29483. "aria-labelledby": unref(buttonAriaLabelledby),
  29484. "aria-description": unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  29485. "aria-disabled": unref(colorDisabled),
  29486. tabindex: unref(colorDisabled) ? -1 : _ctx.tabindex,
  29487. onKeydown: handleKeyDown,
  29488. onFocus: handleFocus,
  29489. onBlur: _cache[1] || (_cache[1] = (...args) => unref(handleBlur) && unref(handleBlur)(...args))
  29490. }, [
  29491. unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
  29492. key: 0,
  29493. class: normalizeClass(unref(ns).be("picker", "mask"))
  29494. }, null, 2)) : createCommentVNode("v-if", true),
  29495. createBaseVNode("div", {
  29496. class: normalizeClass(unref(ns).be("picker", "trigger")),
  29497. onClick: handleTrigger
  29498. }, [
  29499. createBaseVNode("span", {
  29500. class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
  29501. }, [
  29502. createBaseVNode("span", {
  29503. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  29504. style: normalizeStyle({
  29505. backgroundColor: unref(displayedColor)
  29506. })
  29507. }, [
  29508. withDirectives(createVNode(unref(ElIcon), {
  29509. class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
  29510. }, {
  29511. default: withCtx(() => [
  29512. createVNode(unref(arrow_down_default))
  29513. ]),
  29514. _: 1
  29515. }, 8, ["class"]), [
  29516. [vShow, _ctx.modelValue || showPanelColor.value]
  29517. ]),
  29518. withDirectives(createVNode(unref(ElIcon), {
  29519. class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
  29520. }, {
  29521. default: withCtx(() => [
  29522. createVNode(unref(close_default))
  29523. ]),
  29524. _: 1
  29525. }, 8, ["class"]), [
  29526. [vShow, !_ctx.modelValue && !showPanelColor.value]
  29527. ])
  29528. ], 6)
  29529. ], 2)
  29530. ], 2)
  29531. ], 42, _hoisted_2$v)
  29532. ]),
  29533. _: 1
  29534. }, 8, ["visible", "popper-class", "transition"]);
  29535. };
  29536. }
  29537. });
  29538. var ColorPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$1w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/color-picker.vue"]]);
  29539. const ElColorPicker = withInstall(ColorPicker);
  29540. const __default__$X = /* @__PURE__ */ defineComponent({
  29541. name: "ElContainer"
  29542. });
  29543. const _sfc_main$1v = /* @__PURE__ */ defineComponent({
  29544. ...__default__$X,
  29545. props: {
  29546. direction: {
  29547. type: String
  29548. }
  29549. },
  29550. setup(__props) {
  29551. const props = __props;
  29552. const slots = useSlots();
  29553. const ns = useNamespace("container");
  29554. const isVertical = computed(() => {
  29555. if (props.direction === "vertical") {
  29556. return true;
  29557. } else if (props.direction === "horizontal") {
  29558. return false;
  29559. }
  29560. if (slots && slots.default) {
  29561. const vNodes = slots.default();
  29562. return vNodes.some((vNode) => {
  29563. const tag = vNode.type.name;
  29564. return tag === "ElHeader" || tag === "ElFooter";
  29565. });
  29566. } else {
  29567. return false;
  29568. }
  29569. });
  29570. return (_ctx, _cache) => {
  29571. return openBlock(), createElementBlock("section", {
  29572. class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", unref(isVertical))])
  29573. }, [
  29574. renderSlot(_ctx.$slots, "default")
  29575. ], 2);
  29576. };
  29577. }
  29578. });
  29579. var Container = /* @__PURE__ */ _export_sfc$1(_sfc_main$1v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/container/src/container.vue"]]);
  29580. const __default__$W = /* @__PURE__ */ defineComponent({
  29581. name: "ElAside"
  29582. });
  29583. const _sfc_main$1u = /* @__PURE__ */ defineComponent({
  29584. ...__default__$W,
  29585. props: {
  29586. width: {
  29587. type: String,
  29588. default: null
  29589. }
  29590. },
  29591. setup(__props) {
  29592. const props = __props;
  29593. const ns = useNamespace("aside");
  29594. const style = computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  29595. return (_ctx, _cache) => {
  29596. return openBlock(), createElementBlock("aside", {
  29597. class: normalizeClass(unref(ns).b()),
  29598. style: normalizeStyle(unref(style))
  29599. }, [
  29600. renderSlot(_ctx.$slots, "default")
  29601. ], 6);
  29602. };
  29603. }
  29604. });
  29605. var Aside = /* @__PURE__ */ _export_sfc$1(_sfc_main$1u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/container/src/aside.vue"]]);
  29606. const __default__$V = /* @__PURE__ */ defineComponent({
  29607. name: "ElFooter"
  29608. });
  29609. const _sfc_main$1t = /* @__PURE__ */ defineComponent({
  29610. ...__default__$V,
  29611. props: {
  29612. height: {
  29613. type: String,
  29614. default: null
  29615. }
  29616. },
  29617. setup(__props) {
  29618. const props = __props;
  29619. const ns = useNamespace("footer");
  29620. const style = computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  29621. return (_ctx, _cache) => {
  29622. return openBlock(), createElementBlock("footer", {
  29623. class: normalizeClass(unref(ns).b()),
  29624. style: normalizeStyle(unref(style))
  29625. }, [
  29626. renderSlot(_ctx.$slots, "default")
  29627. ], 6);
  29628. };
  29629. }
  29630. });
  29631. var Footer$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/container/src/footer.vue"]]);
  29632. const __default__$U = /* @__PURE__ */ defineComponent({
  29633. name: "ElHeader"
  29634. });
  29635. const _sfc_main$1s = /* @__PURE__ */ defineComponent({
  29636. ...__default__$U,
  29637. props: {
  29638. height: {
  29639. type: String,
  29640. default: null
  29641. }
  29642. },
  29643. setup(__props) {
  29644. const props = __props;
  29645. const ns = useNamespace("header");
  29646. const style = computed(() => {
  29647. return props.height ? ns.cssVarBlock({
  29648. height: props.height
  29649. }) : {};
  29650. });
  29651. return (_ctx, _cache) => {
  29652. return openBlock(), createElementBlock("header", {
  29653. class: normalizeClass(unref(ns).b()),
  29654. style: normalizeStyle(unref(style))
  29655. }, [
  29656. renderSlot(_ctx.$slots, "default")
  29657. ], 6);
  29658. };
  29659. }
  29660. });
  29661. var Header = /* @__PURE__ */ _export_sfc$1(_sfc_main$1s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/container/src/header.vue"]]);
  29662. const __default__$T = /* @__PURE__ */ defineComponent({
  29663. name: "ElMain"
  29664. });
  29665. const _sfc_main$1r = /* @__PURE__ */ defineComponent({
  29666. ...__default__$T,
  29667. setup(__props) {
  29668. const ns = useNamespace("main");
  29669. return (_ctx, _cache) => {
  29670. return openBlock(), createElementBlock("main", {
  29671. class: normalizeClass(unref(ns).b())
  29672. }, [
  29673. renderSlot(_ctx.$slots, "default")
  29674. ], 2);
  29675. };
  29676. }
  29677. });
  29678. var Main = /* @__PURE__ */ _export_sfc$1(_sfc_main$1r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/container/src/main.vue"]]);
  29679. const ElContainer = withInstall(Container, {
  29680. Aside,
  29681. Footer: Footer$2,
  29682. Header,
  29683. Main
  29684. });
  29685. const ElAside = withNoopInstall(Aside);
  29686. const ElFooter = withNoopInstall(Footer$2);
  29687. const ElHeader = withNoopInstall(Header);
  29688. const ElMain = withNoopInstall(Main);
  29689. var advancedFormat$1 = { exports: {} };
  29690. (function(module2, exports2) {
  29691. !function(e, t) {
  29692. module2.exports = t();
  29693. }(commonjsGlobal, function() {
  29694. return function(e, t) {
  29695. var r = t.prototype, n = r.format;
  29696. r.format = function(e2) {
  29697. var t2 = this, r2 = this.$locale();
  29698. if (!this.isValid())
  29699. return n.bind(this)(e2);
  29700. var s2 = this.$utils(), a2 = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  29701. switch (e3) {
  29702. case "Q":
  29703. return Math.ceil((t2.$M + 1) / 3);
  29704. case "Do":
  29705. return r2.ordinal(t2.$D);
  29706. case "gggg":
  29707. return t2.weekYear();
  29708. case "GGGG":
  29709. return t2.isoWeekYear();
  29710. case "wo":
  29711. return r2.ordinal(t2.week(), "W");
  29712. case "w":
  29713. case "ww":
  29714. return s2.s(t2.week(), "w" === e3 ? 1 : 2, "0");
  29715. case "W":
  29716. case "WW":
  29717. return s2.s(t2.isoWeek(), "W" === e3 ? 1 : 2, "0");
  29718. case "k":
  29719. case "kk":
  29720. return s2.s(String(0 === t2.$H ? 24 : t2.$H), "k" === e3 ? 1 : 2, "0");
  29721. case "X":
  29722. return Math.floor(t2.$d.getTime() / 1e3);
  29723. case "x":
  29724. return t2.$d.getTime();
  29725. case "z":
  29726. return "[" + t2.offsetName() + "]";
  29727. case "zzz":
  29728. return "[" + t2.offsetName("long") + "]";
  29729. default:
  29730. return e3;
  29731. }
  29732. });
  29733. return n.bind(this)(a2);
  29734. };
  29735. };
  29736. });
  29737. })(advancedFormat$1);
  29738. var advancedFormatExports = advancedFormat$1.exports;
  29739. const advancedFormat = /* @__PURE__ */ getDefaultExportFromCjs(advancedFormatExports);
  29740. var weekOfYear$1 = { exports: {} };
  29741. (function(module2, exports2) {
  29742. !function(e, t) {
  29743. module2.exports = t();
  29744. }(commonjsGlobal, function() {
  29745. var e = "week", t = "year";
  29746. return function(i, n, r) {
  29747. var f2 = n.prototype;
  29748. f2.week = function(i2) {
  29749. if (void 0 === i2 && (i2 = null), null !== i2)
  29750. return this.add(7 * (i2 - this.week()), "day");
  29751. var n2 = this.$locale().yearStart || 1;
  29752. if (11 === this.month() && this.date() > 25) {
  29753. var f3 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
  29754. if (f3.isBefore(s2))
  29755. return 1;
  29756. }
  29757. var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
  29758. return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
  29759. }, f2.weeks = function(e2) {
  29760. return void 0 === e2 && (e2 = null), this.week(e2);
  29761. };
  29762. };
  29763. });
  29764. })(weekOfYear$1);
  29765. var weekOfYearExports = weekOfYear$1.exports;
  29766. const weekOfYear = /* @__PURE__ */ getDefaultExportFromCjs(weekOfYearExports);
  29767. var weekYear$1 = { exports: {} };
  29768. (function(module2, exports2) {
  29769. !function(e, t) {
  29770. module2.exports = t();
  29771. }(commonjsGlobal, function() {
  29772. return function(e, t) {
  29773. t.prototype.weekYear = function() {
  29774. var e2 = this.month(), t2 = this.week(), n = this.year();
  29775. return 1 === t2 && 11 === e2 ? n + 1 : 0 === e2 && t2 >= 52 ? n - 1 : n;
  29776. };
  29777. };
  29778. });
  29779. })(weekYear$1);
  29780. var weekYearExports = weekYear$1.exports;
  29781. const weekYear = /* @__PURE__ */ getDefaultExportFromCjs(weekYearExports);
  29782. var dayOfYear$1 = { exports: {} };
  29783. (function(module2, exports2) {
  29784. !function(e, t) {
  29785. module2.exports = t();
  29786. }(commonjsGlobal, function() {
  29787. return function(e, t, n) {
  29788. t.prototype.dayOfYear = function(e2) {
  29789. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  29790. return null == e2 ? t2 : this.add(e2 - t2, "day");
  29791. };
  29792. };
  29793. });
  29794. })(dayOfYear$1);
  29795. var dayOfYearExports = dayOfYear$1.exports;
  29796. const dayOfYear = /* @__PURE__ */ getDefaultExportFromCjs(dayOfYearExports);
  29797. var isSameOrAfter$1 = { exports: {} };
  29798. (function(module2, exports2) {
  29799. !function(e, t) {
  29800. module2.exports = t();
  29801. }(commonjsGlobal, function() {
  29802. return function(e, t) {
  29803. t.prototype.isSameOrAfter = function(e2, t2) {
  29804. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  29805. };
  29806. };
  29807. });
  29808. })(isSameOrAfter$1);
  29809. var isSameOrAfterExports = isSameOrAfter$1.exports;
  29810. const isSameOrAfter = /* @__PURE__ */ getDefaultExportFromCjs(isSameOrAfterExports);
  29811. var isSameOrBefore$1 = { exports: {} };
  29812. (function(module2, exports2) {
  29813. !function(e, i) {
  29814. module2.exports = i();
  29815. }(commonjsGlobal, function() {
  29816. return function(e, i) {
  29817. i.prototype.isSameOrBefore = function(e2, i2) {
  29818. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  29819. };
  29820. };
  29821. });
  29822. })(isSameOrBefore$1);
  29823. var isSameOrBeforeExports = isSameOrBefore$1.exports;
  29824. const isSameOrBefore = /* @__PURE__ */ getDefaultExportFromCjs(isSameOrBeforeExports);
  29825. const ROOT_PICKER_INJECTION_KEY = Symbol();
  29826. const datePickerProps = buildProps({
  29827. ...timePickerDefaultProps,
  29828. type: {
  29829. type: definePropType(String),
  29830. default: "date"
  29831. }
  29832. });
  29833. const selectionModes = ["date", "dates", "year", "month", "week", "range"];
  29834. const datePickerSharedProps = buildProps({
  29835. disabledDate: {
  29836. type: definePropType(Function)
  29837. },
  29838. date: {
  29839. type: definePropType(Object),
  29840. required: true
  29841. },
  29842. minDate: {
  29843. type: definePropType(Object)
  29844. },
  29845. maxDate: {
  29846. type: definePropType(Object)
  29847. },
  29848. parsedValue: {
  29849. type: definePropType([Object, Array])
  29850. },
  29851. rangeState: {
  29852. type: definePropType(Object),
  29853. default: () => ({
  29854. endDate: null,
  29855. selecting: false
  29856. })
  29857. }
  29858. });
  29859. const panelSharedProps = buildProps({
  29860. type: {
  29861. type: definePropType(String),
  29862. required: true,
  29863. values: datePickTypes
  29864. },
  29865. dateFormat: String,
  29866. timeFormat: String
  29867. });
  29868. const panelRangeSharedProps = buildProps({
  29869. unlinkPanels: Boolean,
  29870. parsedValue: {
  29871. type: definePropType(Array)
  29872. }
  29873. });
  29874. const selectionModeWithDefault = (mode) => {
  29875. return {
  29876. type: String,
  29877. values: selectionModes,
  29878. default: mode
  29879. };
  29880. };
  29881. const panelDatePickProps = buildProps({
  29882. ...panelSharedProps,
  29883. parsedValue: {
  29884. type: definePropType([Object, Array])
  29885. },
  29886. visible: {
  29887. type: Boolean
  29888. },
  29889. format: {
  29890. type: String,
  29891. default: ""
  29892. }
  29893. });
  29894. const basicDateTableProps = buildProps({
  29895. ...datePickerSharedProps,
  29896. cellClassName: {
  29897. type: definePropType(Function)
  29898. },
  29899. showWeekNumber: Boolean,
  29900. selectionMode: selectionModeWithDefault("date")
  29901. });
  29902. const basicDateTableEmits = ["changerange", "pick", "select"];
  29903. const isValidRange = (range2) => {
  29904. if (!isArray$3(range2))
  29905. return false;
  29906. const [left2, right2] = range2;
  29907. return dayjs.isDayjs(left2) && dayjs.isDayjs(right2) && left2.isSameOrBefore(right2);
  29908. };
  29909. const getDefaultValue = (defaultValue, { lang, unit: unit2, unlinkPanels }) => {
  29910. let start;
  29911. if (isArray$3(defaultValue)) {
  29912. let [left2, right2] = defaultValue.map((d2) => dayjs(d2).locale(lang));
  29913. if (!unlinkPanels) {
  29914. right2 = left2.add(1, unit2);
  29915. }
  29916. return [left2, right2];
  29917. } else if (defaultValue) {
  29918. start = dayjs(defaultValue);
  29919. } else {
  29920. start = dayjs();
  29921. }
  29922. start = start.locale(lang);
  29923. return [start, start.add(1, unit2)];
  29924. };
  29925. const buildPickerTable = (dimension, rows, {
  29926. columnIndexOffset,
  29927. startDate,
  29928. nextEndDate,
  29929. now: now2,
  29930. unit: unit2,
  29931. relativeDateGetter,
  29932. setCellMetadata,
  29933. setRowMetadata
  29934. }) => {
  29935. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  29936. const row = rows[rowIndex];
  29937. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  29938. let cell = row[columnIndex + columnIndexOffset];
  29939. if (!cell) {
  29940. cell = {
  29941. row: rowIndex,
  29942. column: columnIndex,
  29943. type: "normal",
  29944. inRange: false,
  29945. start: false,
  29946. end: false
  29947. };
  29948. }
  29949. const index2 = rowIndex * dimension.column + columnIndex;
  29950. const nextStartDate = relativeDateGetter(index2);
  29951. cell.dayjs = nextStartDate;
  29952. cell.date = nextStartDate.toDate();
  29953. cell.timestamp = nextStartDate.valueOf();
  29954. cell.type = "normal";
  29955. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit2) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit2)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit2) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit2));
  29956. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  29957. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit2);
  29958. cell.end = startDate && nextStartDate.isSame(startDate, unit2);
  29959. } else {
  29960. cell.start = !!startDate && nextStartDate.isSame(startDate, unit2);
  29961. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit2);
  29962. }
  29963. const isToday = nextStartDate.isSame(now2, unit2);
  29964. if (isToday) {
  29965. cell.type = "today";
  29966. }
  29967. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  29968. row[columnIndex + columnIndexOffset] = cell;
  29969. }
  29970. setRowMetadata == null ? void 0 : setRowMetadata(row);
  29971. }
  29972. };
  29973. const isNormalDay = (type2 = "") => {
  29974. return ["normal", "today"].includes(type2);
  29975. };
  29976. const useBasicDateTable = (props, emit2) => {
  29977. const { lang } = useLocale();
  29978. const tbodyRef = ref();
  29979. const currentCellRef = ref();
  29980. const lastRow = ref();
  29981. const lastColumn = ref();
  29982. const tableRows = ref([[], [], [], [], [], []]);
  29983. let focusWithClick = false;
  29984. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  29985. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
  29986. const offsetDay = computed(() => {
  29987. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  29988. });
  29989. const startDate = computed(() => {
  29990. const startDayOfMonth = props.date.startOf("month");
  29991. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  29992. });
  29993. const WEEKS = computed(() => {
  29994. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  29995. });
  29996. const hasCurrent = computed(() => {
  29997. return flatten(unref(rows)).some((row) => {
  29998. return row.isCurrent;
  29999. });
  30000. });
  30001. const days = computed(() => {
  30002. const startOfMonth = props.date.startOf("month");
  30003. const startOfMonthDay = startOfMonth.day() || 7;
  30004. const dateCountOfMonth = startOfMonth.daysInMonth();
  30005. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  30006. return {
  30007. startOfMonthDay,
  30008. dateCountOfMonth,
  30009. dateCountOfLastMonth
  30010. };
  30011. });
  30012. const selectedDate = computed(() => {
  30013. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  30014. });
  30015. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  30016. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
  30017. const offset2 = unref(offsetDay);
  30018. if (rowIndex >= 0 && rowIndex <= 1) {
  30019. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
  30020. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  30021. cell.text = count;
  30022. return true;
  30023. } else {
  30024. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  30025. cell.type = "prev-month";
  30026. }
  30027. } else {
  30028. if (count <= dateCountOfMonth) {
  30029. cell.text = count;
  30030. } else {
  30031. cell.text = count - dateCountOfMonth;
  30032. cell.type = "next-month";
  30033. }
  30034. return true;
  30035. }
  30036. return false;
  30037. };
  30038. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  30039. const { disabledDate: disabledDate2, cellClassName } = props;
  30040. const _selectedDate = unref(selectedDate);
  30041. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  30042. const cellDate = cell.dayjs.toDate();
  30043. cell.selected = _selectedDate.find((d2) => d2.valueOf() === cell.dayjs.valueOf());
  30044. cell.isSelected = !!cell.selected;
  30045. cell.isCurrent = isCurrent(cell);
  30046. cell.disabled = disabledDate2 == null ? void 0 : disabledDate2(cellDate);
  30047. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  30048. return shouldIncrement;
  30049. };
  30050. const setRowMetadata = (row) => {
  30051. if (props.selectionMode === "week") {
  30052. const [start, end2] = props.showWeekNumber ? [1, 7] : [0, 6];
  30053. const isActive = isWeekActive(row[start + 1]);
  30054. row[start].inRange = isActive;
  30055. row[start].start = isActive;
  30056. row[end2].inRange = isActive;
  30057. row[end2].end = isActive;
  30058. }
  30059. };
  30060. const rows = computed(() => {
  30061. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  30062. const offset2 = unref(offsetDay);
  30063. const rows_ = unref(tableRows);
  30064. const dateUnit = "day";
  30065. let count = 1;
  30066. if (showWeekNumber) {
  30067. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  30068. if (!rows_[rowIndex][0]) {
  30069. rows_[rowIndex][0] = {
  30070. type: "week",
  30071. text: unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
  30072. };
  30073. }
  30074. }
  30075. }
  30076. buildPickerTable({ row: 6, column: 7 }, rows_, {
  30077. startDate: minDate,
  30078. columnIndexOffset: showWeekNumber ? 1 : 0,
  30079. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  30080. now: dayjs().locale(unref(lang)).startOf(dateUnit),
  30081. unit: dateUnit,
  30082. relativeDateGetter: (idx) => unref(startDate).add(idx - offset2, dateUnit),
  30083. setCellMetadata: (...args) => {
  30084. if (setCellMetadata(...args, count)) {
  30085. count += 1;
  30086. }
  30087. },
  30088. setRowMetadata
  30089. });
  30090. return rows_;
  30091. });
  30092. watch(() => props.date, async () => {
  30093. var _a2;
  30094. if ((_a2 = unref(tbodyRef)) == null ? void 0 : _a2.contains(document.activeElement)) {
  30095. await nextTick();
  30096. await focus();
  30097. }
  30098. });
  30099. const focus = async () => {
  30100. var _a2;
  30101. return (_a2 = unref(currentCellRef)) == null ? void 0 : _a2.focus();
  30102. };
  30103. const isCurrent = (cell) => {
  30104. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  30105. };
  30106. const cellMatchesDate = (cell, date2) => {
  30107. if (!date2)
  30108. return false;
  30109. return dayjs(date2).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  30110. };
  30111. const getDateOfCell = (row, column) => {
  30112. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay);
  30113. return unref(startDate).add(offsetFromStart, "day");
  30114. };
  30115. const handleMouseMove = (event) => {
  30116. var _a2;
  30117. if (!props.rangeState.selecting)
  30118. return;
  30119. let target = event.target;
  30120. if (target.tagName === "SPAN") {
  30121. target = (_a2 = target.parentNode) == null ? void 0 : _a2.parentNode;
  30122. }
  30123. if (target.tagName === "DIV") {
  30124. target = target.parentNode;
  30125. }
  30126. if (target.tagName !== "TD")
  30127. return;
  30128. const row = target.parentNode.rowIndex - 1;
  30129. const column = target.cellIndex;
  30130. if (unref(rows)[row][column].disabled)
  30131. return;
  30132. if (row !== unref(lastRow) || column !== unref(lastColumn)) {
  30133. lastRow.value = row;
  30134. lastColumn.value = column;
  30135. emit2("changerange", {
  30136. selecting: true,
  30137. endDate: getDateOfCell(row, column)
  30138. });
  30139. }
  30140. };
  30141. const isSelectedCell = (cell) => {
  30142. return !unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  30143. };
  30144. const handleFocus = (event) => {
  30145. if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date")
  30146. return;
  30147. handlePickDate(event, true);
  30148. };
  30149. const handleMouseDown = (event) => {
  30150. const target = event.target.closest("td");
  30151. if (!target)
  30152. return;
  30153. focusWithClick = true;
  30154. };
  30155. const handleMouseUp = (event) => {
  30156. const target = event.target.closest("td");
  30157. if (!target)
  30158. return;
  30159. focusWithClick = false;
  30160. };
  30161. const handleRangePick = (newDate) => {
  30162. if (!props.rangeState.selecting || !props.minDate) {
  30163. emit2("pick", { minDate: newDate, maxDate: null });
  30164. emit2("select", true);
  30165. } else {
  30166. if (newDate >= props.minDate) {
  30167. emit2("pick", { minDate: props.minDate, maxDate: newDate });
  30168. } else {
  30169. emit2("pick", { minDate: newDate, maxDate: props.minDate });
  30170. }
  30171. emit2("select", false);
  30172. }
  30173. };
  30174. const handleWeekPick = (newDate) => {
  30175. const weekNumber = newDate.week();
  30176. const value = `${newDate.year()}w${weekNumber}`;
  30177. emit2("pick", {
  30178. year: newDate.year(),
  30179. week: weekNumber,
  30180. value,
  30181. date: newDate.startOf("week")
  30182. });
  30183. };
  30184. const handleDatesPick = (newDate, selected) => {
  30185. const newValue = selected ? castArray(props.parsedValue).filter((d2) => (d2 == null ? void 0 : d2.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  30186. emit2("pick", newValue);
  30187. };
  30188. const handlePickDate = (event, isKeyboardMovement = false) => {
  30189. const target = event.target.closest("td");
  30190. if (!target)
  30191. return;
  30192. const row = target.parentNode.rowIndex - 1;
  30193. const column = target.cellIndex;
  30194. const cell = unref(rows)[row][column];
  30195. if (cell.disabled || cell.type === "week")
  30196. return;
  30197. const newDate = getDateOfCell(row, column);
  30198. switch (props.selectionMode) {
  30199. case "range": {
  30200. handleRangePick(newDate);
  30201. break;
  30202. }
  30203. case "date": {
  30204. emit2("pick", newDate, isKeyboardMovement);
  30205. break;
  30206. }
  30207. case "week": {
  30208. handleWeekPick(newDate);
  30209. break;
  30210. }
  30211. case "dates": {
  30212. handleDatesPick(newDate, !!cell.selected);
  30213. break;
  30214. }
  30215. }
  30216. };
  30217. const isWeekActive = (cell) => {
  30218. if (props.selectionMode !== "week")
  30219. return false;
  30220. let newDate = props.date.startOf("day");
  30221. if (cell.type === "prev-month") {
  30222. newDate = newDate.subtract(1, "month");
  30223. }
  30224. if (cell.type === "next-month") {
  30225. newDate = newDate.add(1, "month");
  30226. }
  30227. newDate = newDate.date(Number.parseInt(cell.text, 10));
  30228. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  30229. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  30230. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  30231. return weekDate.isSame(newDate, "day");
  30232. }
  30233. return false;
  30234. };
  30235. return {
  30236. WEEKS,
  30237. rows,
  30238. tbodyRef,
  30239. currentCellRef,
  30240. focus,
  30241. isCurrent,
  30242. isWeekActive,
  30243. isSelectedCell,
  30244. handlePickDate,
  30245. handleMouseUp,
  30246. handleMouseDown,
  30247. handleMouseMove,
  30248. handleFocus
  30249. };
  30250. };
  30251. const useBasicDateTableDOM = (props, {
  30252. isCurrent,
  30253. isWeekActive
  30254. }) => {
  30255. const ns = useNamespace("date-table");
  30256. const { t } = useLocale();
  30257. const tableKls = computed(() => [
  30258. ns.b(),
  30259. { "is-week-mode": props.selectionMode === "week" }
  30260. ]);
  30261. const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
  30262. const weekLabel = computed(() => t("el.datepicker.week"));
  30263. const getCellClasses = (cell) => {
  30264. const classes = [];
  30265. if (isNormalDay(cell.type) && !cell.disabled) {
  30266. classes.push("available");
  30267. if (cell.type === "today") {
  30268. classes.push("today");
  30269. }
  30270. } else {
  30271. classes.push(cell.type);
  30272. }
  30273. if (isCurrent(cell)) {
  30274. classes.push("current");
  30275. }
  30276. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  30277. classes.push("in-range");
  30278. if (cell.start) {
  30279. classes.push("start-date");
  30280. }
  30281. if (cell.end) {
  30282. classes.push("end-date");
  30283. }
  30284. }
  30285. if (cell.disabled) {
  30286. classes.push("disabled");
  30287. }
  30288. if (cell.selected) {
  30289. classes.push("selected");
  30290. }
  30291. if (cell.customClass) {
  30292. classes.push(cell.customClass);
  30293. }
  30294. return classes.join(" ");
  30295. };
  30296. const getRowKls = (cell) => [
  30297. ns.e("row"),
  30298. { current: isWeekActive(cell) }
  30299. ];
  30300. return {
  30301. tableKls,
  30302. tableLabel,
  30303. weekLabel,
  30304. getCellClasses,
  30305. getRowKls,
  30306. t
  30307. };
  30308. };
  30309. const basicCellProps = buildProps({
  30310. cell: {
  30311. type: definePropType(Object)
  30312. }
  30313. });
  30314. var ElDatePickerCell = /* @__PURE__ */ defineComponent({
  30315. name: "ElDatePickerCell",
  30316. props: basicCellProps,
  30317. setup(props) {
  30318. const ns = useNamespace("date-table-cell");
  30319. const {
  30320. slots
  30321. } = inject(ROOT_PICKER_INJECTION_KEY);
  30322. return () => {
  30323. const {
  30324. cell
  30325. } = props;
  30326. if (slots.default) {
  30327. const list = slots.default(cell).filter((item) => {
  30328. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)" && item.type.toString() !== "Symbol(v-cmt)";
  30329. });
  30330. if (list.length) {
  30331. return list;
  30332. }
  30333. }
  30334. return createVNode("div", {
  30335. "class": ns.b()
  30336. }, [createVNode("span", {
  30337. "class": ns.e("text")
  30338. }, [cell == null ? void 0 : cell.text])]);
  30339. };
  30340. }
  30341. });
  30342. const _hoisted_1$L = ["aria-label"];
  30343. const _hoisted_2$u = {
  30344. key: 0,
  30345. scope: "col"
  30346. };
  30347. const _hoisted_3$h = ["aria-label"];
  30348. const _hoisted_4$b = ["aria-current", "aria-selected", "tabindex"];
  30349. const _sfc_main$1q = /* @__PURE__ */ defineComponent({
  30350. __name: "basic-date-table",
  30351. props: basicDateTableProps,
  30352. emits: basicDateTableEmits,
  30353. setup(__props, { expose, emit: emit2 }) {
  30354. const props = __props;
  30355. const {
  30356. WEEKS,
  30357. rows,
  30358. tbodyRef,
  30359. currentCellRef,
  30360. focus,
  30361. isCurrent,
  30362. isWeekActive,
  30363. isSelectedCell,
  30364. handlePickDate,
  30365. handleMouseUp,
  30366. handleMouseDown,
  30367. handleMouseMove,
  30368. handleFocus
  30369. } = useBasicDateTable(props, emit2);
  30370. const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
  30371. isCurrent,
  30372. isWeekActive
  30373. });
  30374. expose({
  30375. focus
  30376. });
  30377. return (_ctx, _cache) => {
  30378. return openBlock(), createElementBlock("table", {
  30379. "aria-label": unref(tableLabel),
  30380. class: normalizeClass(unref(tableKls)),
  30381. cellspacing: "0",
  30382. cellpadding: "0",
  30383. role: "grid",
  30384. onClick: _cache[1] || (_cache[1] = (...args) => unref(handlePickDate) && unref(handlePickDate)(...args)),
  30385. onMousemove: _cache[2] || (_cache[2] = (...args) => unref(handleMouseMove) && unref(handleMouseMove)(...args)),
  30386. onMousedown: _cache[3] || (_cache[3] = withModifiers((...args) => unref(handleMouseDown) && unref(handleMouseDown)(...args), ["prevent"])),
  30387. onMouseup: _cache[4] || (_cache[4] = (...args) => unref(handleMouseUp) && unref(handleMouseUp)(...args))
  30388. }, [
  30389. createBaseVNode("tbody", {
  30390. ref_key: "tbodyRef",
  30391. ref: tbodyRef
  30392. }, [
  30393. createBaseVNode("tr", null, [
  30394. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_2$u, toDisplayString(unref(weekLabel)), 1)) : createCommentVNode("v-if", true),
  30395. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
  30396. return openBlock(), createElementBlock("th", {
  30397. key,
  30398. "aria-label": unref(t)("el.datepicker.weeksFull." + week),
  30399. scope: "col"
  30400. }, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_3$h);
  30401. }), 128))
  30402. ]),
  30403. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey2) => {
  30404. return openBlock(), createElementBlock("tr", {
  30405. key: rowKey2,
  30406. class: normalizeClass(unref(getRowKls)(row[1]))
  30407. }, [
  30408. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
  30409. return openBlock(), createElementBlock("td", {
  30410. key: `${rowKey2}.${columnKey}`,
  30411. ref_for: true,
  30412. ref: (el) => unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  30413. class: normalizeClass(unref(getCellClasses)(cell)),
  30414. "aria-current": cell.isCurrent ? "date" : void 0,
  30415. "aria-selected": cell.isCurrent,
  30416. tabindex: unref(isSelectedCell)(cell) ? 0 : -1,
  30417. onFocus: _cache[0] || (_cache[0] = (...args) => unref(handleFocus) && unref(handleFocus)(...args))
  30418. }, [
  30419. createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  30420. ], 42, _hoisted_4$b);
  30421. }), 128))
  30422. ], 2);
  30423. }), 128))
  30424. ], 512)
  30425. ], 42, _hoisted_1$L);
  30426. };
  30427. }
  30428. });
  30429. var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$1q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
  30430. const basicMonthTableProps = buildProps({
  30431. ...datePickerSharedProps,
  30432. selectionMode: selectionModeWithDefault("month")
  30433. });
  30434. const _hoisted_1$K = ["aria-label"];
  30435. const _hoisted_2$t = ["aria-selected", "aria-label", "tabindex", "onKeydown"];
  30436. const _hoisted_3$g = { class: "cell" };
  30437. const _sfc_main$1p = /* @__PURE__ */ defineComponent({
  30438. __name: "basic-month-table",
  30439. props: basicMonthTableProps,
  30440. emits: ["changerange", "pick", "select"],
  30441. setup(__props, { expose, emit: emit2 }) {
  30442. const props = __props;
  30443. const datesInMonth = (year, month, lang2) => {
  30444. const firstDay = dayjs().locale(lang2).startOf("month").month(month).year(year);
  30445. const numOfDays = firstDay.daysInMonth();
  30446. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  30447. };
  30448. const ns = useNamespace("month-table");
  30449. const { t, lang } = useLocale();
  30450. const tbodyRef = ref();
  30451. const currentCellRef = ref();
  30452. const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
  30453. const tableRows = ref([
  30454. [],
  30455. [],
  30456. []
  30457. ]);
  30458. const lastRow = ref();
  30459. const lastColumn = ref();
  30460. const rows = computed(() => {
  30461. var _a2, _b;
  30462. const rows2 = tableRows.value;
  30463. const now2 = dayjs().locale(lang.value).startOf("month");
  30464. for (let i = 0; i < 3; i++) {
  30465. const row = rows2[i];
  30466. for (let j = 0; j < 4; j++) {
  30467. const cell = row[j] || (row[j] = {
  30468. row: i,
  30469. column: j,
  30470. type: "normal",
  30471. inRange: false,
  30472. start: false,
  30473. end: false,
  30474. text: -1,
  30475. disabled: false
  30476. });
  30477. cell.type = "normal";
  30478. const index2 = i * 4 + j;
  30479. const calTime = props.date.startOf("year").month(index2);
  30480. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  30481. cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month"));
  30482. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  30483. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  30484. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  30485. } else {
  30486. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  30487. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  30488. }
  30489. const isToday = now2.isSame(calTime);
  30490. if (isToday) {
  30491. cell.type = "today";
  30492. }
  30493. cell.text = index2;
  30494. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  30495. }
  30496. }
  30497. return rows2;
  30498. });
  30499. const focus = () => {
  30500. var _a2;
  30501. (_a2 = currentCellRef.value) == null ? void 0 : _a2.focus();
  30502. };
  30503. const getCellStyle = (cell) => {
  30504. const style = {};
  30505. const year = props.date.year();
  30506. const today = /* @__PURE__ */ new Date();
  30507. const month = cell.text;
  30508. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  30509. style.current = castArray(props.parsedValue).findIndex((date2) => dayjs.isDayjs(date2) && date2.year() === year && date2.month() === month) >= 0;
  30510. style.today = today.getFullYear() === year && today.getMonth() === month;
  30511. if (cell.inRange) {
  30512. style["in-range"] = true;
  30513. if (cell.start) {
  30514. style["start-date"] = true;
  30515. }
  30516. if (cell.end) {
  30517. style["end-date"] = true;
  30518. }
  30519. }
  30520. return style;
  30521. };
  30522. const isSelectedCell = (cell) => {
  30523. const year = props.date.year();
  30524. const month = cell.text;
  30525. return castArray(props.date).findIndex((date2) => date2.year() === year && date2.month() === month) >= 0;
  30526. };
  30527. const handleMouseMove = (event) => {
  30528. var _a2;
  30529. if (!props.rangeState.selecting)
  30530. return;
  30531. let target = event.target;
  30532. if (target.tagName === "A") {
  30533. target = (_a2 = target.parentNode) == null ? void 0 : _a2.parentNode;
  30534. }
  30535. if (target.tagName === "DIV") {
  30536. target = target.parentNode;
  30537. }
  30538. if (target.tagName !== "TD")
  30539. return;
  30540. const row = target.parentNode.rowIndex;
  30541. const column = target.cellIndex;
  30542. if (rows.value[row][column].disabled)
  30543. return;
  30544. if (row !== lastRow.value || column !== lastColumn.value) {
  30545. lastRow.value = row;
  30546. lastColumn.value = column;
  30547. emit2("changerange", {
  30548. selecting: true,
  30549. endDate: props.date.startOf("year").month(row * 4 + column)
  30550. });
  30551. }
  30552. };
  30553. const handleMonthTableClick = (event) => {
  30554. var _a2;
  30555. const target = (_a2 = event.target) == null ? void 0 : _a2.closest("td");
  30556. if ((target == null ? void 0 : target.tagName) !== "TD")
  30557. return;
  30558. if (hasClass(target, "disabled"))
  30559. return;
  30560. const column = target.cellIndex;
  30561. const row = target.parentNode.rowIndex;
  30562. const month = row * 4 + column;
  30563. const newDate = props.date.startOf("year").month(month);
  30564. if (props.selectionMode === "range") {
  30565. if (!props.rangeState.selecting) {
  30566. emit2("pick", { minDate: newDate, maxDate: null });
  30567. emit2("select", true);
  30568. } else {
  30569. if (props.minDate && newDate >= props.minDate) {
  30570. emit2("pick", { minDate: props.minDate, maxDate: newDate });
  30571. } else {
  30572. emit2("pick", { minDate: newDate, maxDate: props.minDate });
  30573. }
  30574. emit2("select", false);
  30575. }
  30576. } else {
  30577. emit2("pick", month);
  30578. }
  30579. };
  30580. watch(() => props.date, async () => {
  30581. var _a2, _b;
  30582. if ((_a2 = tbodyRef.value) == null ? void 0 : _a2.contains(document.activeElement)) {
  30583. await nextTick();
  30584. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  30585. }
  30586. });
  30587. expose({
  30588. focus
  30589. });
  30590. return (_ctx, _cache) => {
  30591. return openBlock(), createElementBlock("table", {
  30592. role: "grid",
  30593. "aria-label": unref(t)("el.datepicker.monthTablePrompt"),
  30594. class: normalizeClass(unref(ns).b()),
  30595. onClick: handleMonthTableClick,
  30596. onMousemove: handleMouseMove
  30597. }, [
  30598. createBaseVNode("tbody", {
  30599. ref_key: "tbodyRef",
  30600. ref: tbodyRef
  30601. }, [
  30602. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, key) => {
  30603. return openBlock(), createElementBlock("tr", { key }, [
  30604. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  30605. return openBlock(), createElementBlock("td", {
  30606. key: key_,
  30607. ref_for: true,
  30608. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  30609. class: normalizeClass(getCellStyle(cell)),
  30610. "aria-selected": `${isSelectedCell(cell)}`,
  30611. "aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
  30612. tabindex: isSelectedCell(cell) ? 0 : -1,
  30613. onKeydown: [
  30614. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  30615. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  30616. ]
  30617. }, [
  30618. createBaseVNode("div", null, [
  30619. createBaseVNode("span", _hoisted_3$g, toDisplayString(unref(t)("el.datepicker.months." + months.value[cell.text])), 1)
  30620. ])
  30621. ], 42, _hoisted_2$t);
  30622. }), 128))
  30623. ]);
  30624. }), 128))
  30625. ], 512)
  30626. ], 42, _hoisted_1$K);
  30627. };
  30628. }
  30629. });
  30630. var MonthTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$1p, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
  30631. const { date, disabledDate, parsedValue } = datePickerSharedProps;
  30632. const basicYearTableProps = buildProps({
  30633. date,
  30634. disabledDate,
  30635. parsedValue
  30636. });
  30637. const _hoisted_1$J = ["aria-label"];
  30638. const _hoisted_2$s = ["aria-selected", "tabindex", "onKeydown"];
  30639. const _hoisted_3$f = { class: "cell" };
  30640. const _hoisted_4$a = { key: 1 };
  30641. const _sfc_main$1o = /* @__PURE__ */ defineComponent({
  30642. __name: "basic-year-table",
  30643. props: basicYearTableProps,
  30644. emits: ["pick"],
  30645. setup(__props, { expose, emit: emit2 }) {
  30646. const props = __props;
  30647. const datesInYear = (year, lang2) => {
  30648. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  30649. const lastDay = firstDay.endOf("year");
  30650. const numOfDays = lastDay.dayOfYear();
  30651. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  30652. };
  30653. const ns = useNamespace("year-table");
  30654. const { t, lang } = useLocale();
  30655. const tbodyRef = ref();
  30656. const currentCellRef = ref();
  30657. const startYear = computed(() => {
  30658. return Math.floor(props.date.year() / 10) * 10;
  30659. });
  30660. const focus = () => {
  30661. var _a2;
  30662. (_a2 = currentCellRef.value) == null ? void 0 : _a2.focus();
  30663. };
  30664. const getCellKls = (year) => {
  30665. const kls = {};
  30666. const today = dayjs().locale(lang.value);
  30667. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  30668. kls.current = castArray(props.parsedValue).findIndex((d2) => d2.year() === year) >= 0;
  30669. kls.today = today.year() === year;
  30670. return kls;
  30671. };
  30672. const isSelectedCell = (year) => {
  30673. return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date2) => date2.year() === year) >= 0;
  30674. };
  30675. const handleYearTableClick = (event) => {
  30676. const clickTarget = event.target;
  30677. const target = clickTarget.closest("td");
  30678. if (target && target.textContent) {
  30679. if (hasClass(target, "disabled"))
  30680. return;
  30681. const year = target.textContent || target.innerText;
  30682. emit2("pick", Number(year));
  30683. }
  30684. };
  30685. watch(() => props.date, async () => {
  30686. var _a2, _b;
  30687. if ((_a2 = tbodyRef.value) == null ? void 0 : _a2.contains(document.activeElement)) {
  30688. await nextTick();
  30689. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  30690. }
  30691. });
  30692. expose({
  30693. focus
  30694. });
  30695. return (_ctx, _cache) => {
  30696. return openBlock(), createElementBlock("table", {
  30697. role: "grid",
  30698. "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
  30699. class: normalizeClass(unref(ns).b()),
  30700. onClick: handleYearTableClick
  30701. }, [
  30702. createBaseVNode("tbody", {
  30703. ref_key: "tbodyRef",
  30704. ref: tbodyRef
  30705. }, [
  30706. (openBlock(), createElementBlock(Fragment, null, renderList(3, (_2, i) => {
  30707. return createBaseVNode("tr", { key: i }, [
  30708. (openBlock(), createElementBlock(Fragment, null, renderList(4, (__, j) => {
  30709. return openBlock(), createElementBlock(Fragment, {
  30710. key: i + "_" + j
  30711. }, [
  30712. i * 4 + j < 10 ? (openBlock(), createElementBlock("td", {
  30713. key: 0,
  30714. ref_for: true,
  30715. ref: (el) => isSelectedCell(unref(startYear) + i * 4 + j) && (currentCellRef.value = el),
  30716. class: normalizeClass(["available", getCellKls(unref(startYear) + i * 4 + j)]),
  30717. "aria-selected": `${isSelectedCell(unref(startYear) + i * 4 + j)}`,
  30718. tabindex: isSelectedCell(unref(startYear) + i * 4 + j) ? 0 : -1,
  30719. onKeydown: [
  30720. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  30721. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  30722. ]
  30723. }, [
  30724. createBaseVNode("span", _hoisted_3$f, toDisplayString(unref(startYear) + i * 4 + j), 1)
  30725. ], 42, _hoisted_2$s)) : (openBlock(), createElementBlock("td", _hoisted_4$a))
  30726. ], 64);
  30727. }), 64))
  30728. ]);
  30729. }), 64))
  30730. ], 512)
  30731. ], 10, _hoisted_1$J);
  30732. };
  30733. }
  30734. });
  30735. var YearTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$1o, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
  30736. const _hoisted_1$I = ["onClick"];
  30737. const _hoisted_2$r = ["aria-label"];
  30738. const _hoisted_3$e = ["aria-label"];
  30739. const _hoisted_4$9 = ["aria-label"];
  30740. const _hoisted_5$7 = ["aria-label"];
  30741. const _sfc_main$1n = /* @__PURE__ */ defineComponent({
  30742. __name: "panel-date-pick",
  30743. props: panelDatePickProps,
  30744. emits: ["pick", "set-picker-option", "panel-change"],
  30745. setup(__props, { emit: contextEmit }) {
  30746. const props = __props;
  30747. const timeWithinRange = (_2, __, ___) => true;
  30748. const ppNs = useNamespace("picker-panel");
  30749. const dpNs = useNamespace("date-picker");
  30750. const attrs = useAttrs$1();
  30751. const slots = useSlots();
  30752. const { t, lang } = useLocale();
  30753. const pickerBase = inject("EP_PICKER_BASE");
  30754. const popper = inject(TOOLTIP_INJECTION_KEY);
  30755. const { shortcuts, disabledDate: disabledDate2, cellClassName, defaultTime } = pickerBase.props;
  30756. const defaultValue = toRef(pickerBase.props, "defaultValue");
  30757. const currentViewRef = ref();
  30758. const innerDate = ref(dayjs().locale(lang.value));
  30759. const isChangeToNow = ref(false);
  30760. let isShortcut = false;
  30761. const defaultTimeD = computed(() => {
  30762. return dayjs(defaultTime).locale(lang.value);
  30763. });
  30764. const month = computed(() => {
  30765. return innerDate.value.month();
  30766. });
  30767. const year = computed(() => {
  30768. return innerDate.value.year();
  30769. });
  30770. const selectableRange = ref([]);
  30771. const userInputDate = ref(null);
  30772. const userInputTime = ref(null);
  30773. const checkDateWithinRange = (date2) => {
  30774. return selectableRange.value.length > 0 ? timeWithinRange(date2, selectableRange.value, props.format || "HH:mm:ss") : true;
  30775. };
  30776. const formatEmit = (emitDayjs) => {
  30777. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  30778. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  30779. }
  30780. if (showTime.value)
  30781. return emitDayjs.millisecond(0);
  30782. return emitDayjs.startOf("day");
  30783. };
  30784. const emit2 = (value, ...args) => {
  30785. if (!value) {
  30786. contextEmit("pick", value, ...args);
  30787. } else if (isArray$3(value)) {
  30788. const dates = value.map(formatEmit);
  30789. contextEmit("pick", dates, ...args);
  30790. } else {
  30791. contextEmit("pick", formatEmit(value), ...args);
  30792. }
  30793. userInputDate.value = null;
  30794. userInputTime.value = null;
  30795. isChangeToNow.value = false;
  30796. isShortcut = false;
  30797. };
  30798. const handleDatePick = (value, keepOpen) => {
  30799. if (selectionMode.value === "date") {
  30800. value = value;
  30801. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  30802. if (!checkDateWithinRange(newDate)) {
  30803. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  30804. }
  30805. innerDate.value = newDate;
  30806. emit2(newDate, showTime.value || keepOpen);
  30807. } else if (selectionMode.value === "week") {
  30808. emit2(value.date);
  30809. } else if (selectionMode.value === "dates") {
  30810. emit2(value, true);
  30811. }
  30812. };
  30813. const moveByMonth = (forward) => {
  30814. const action = forward ? "add" : "subtract";
  30815. innerDate.value = innerDate.value[action](1, "month");
  30816. handlePanelChange("month");
  30817. };
  30818. const moveByYear = (forward) => {
  30819. const currentDate = innerDate.value;
  30820. const action = forward ? "add" : "subtract";
  30821. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  30822. handlePanelChange("year");
  30823. };
  30824. const currentView = ref("date");
  30825. const yearLabel = computed(() => {
  30826. const yearTranslation = t("el.datepicker.year");
  30827. if (currentView.value === "year") {
  30828. const startYear = Math.floor(year.value / 10) * 10;
  30829. if (yearTranslation) {
  30830. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  30831. }
  30832. return `${startYear} - ${startYear + 9}`;
  30833. }
  30834. return `${year.value} ${yearTranslation}`;
  30835. });
  30836. const handleShortcutClick = (shortcut) => {
  30837. const shortcutValue = isFunction$2(shortcut.value) ? shortcut.value() : shortcut.value;
  30838. if (shortcutValue) {
  30839. isShortcut = true;
  30840. emit2(dayjs(shortcutValue).locale(lang.value));
  30841. return;
  30842. }
  30843. if (shortcut.onClick) {
  30844. shortcut.onClick({
  30845. attrs,
  30846. slots,
  30847. emit: contextEmit
  30848. });
  30849. }
  30850. };
  30851. const selectionMode = computed(() => {
  30852. const { type: type2 } = props;
  30853. if (["week", "month", "year", "dates"].includes(type2))
  30854. return type2;
  30855. return "date";
  30856. });
  30857. const keyboardMode = computed(() => {
  30858. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  30859. });
  30860. const hasShortcuts = computed(() => !!shortcuts.length);
  30861. const handleMonthPick = async (month2) => {
  30862. innerDate.value = innerDate.value.startOf("month").month(month2);
  30863. if (selectionMode.value === "month") {
  30864. emit2(innerDate.value, false);
  30865. } else {
  30866. currentView.value = "date";
  30867. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  30868. emit2(innerDate.value, true);
  30869. await nextTick();
  30870. handleFocusPicker();
  30871. }
  30872. }
  30873. handlePanelChange("month");
  30874. };
  30875. const handleYearPick = async (year2) => {
  30876. if (selectionMode.value === "year") {
  30877. innerDate.value = innerDate.value.startOf("year").year(year2);
  30878. emit2(innerDate.value, false);
  30879. } else {
  30880. innerDate.value = innerDate.value.year(year2);
  30881. currentView.value = "month";
  30882. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  30883. emit2(innerDate.value, true);
  30884. await nextTick();
  30885. handleFocusPicker();
  30886. }
  30887. }
  30888. handlePanelChange("year");
  30889. };
  30890. const showPicker = async (view) => {
  30891. currentView.value = view;
  30892. await nextTick();
  30893. handleFocusPicker();
  30894. };
  30895. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  30896. const footerVisible = computed(() => {
  30897. return showTime.value || selectionMode.value === "dates";
  30898. });
  30899. const disabledConfirm = computed(() => {
  30900. if (!disabledDate2)
  30901. return false;
  30902. if (!props.parsedValue)
  30903. return true;
  30904. if (isArray$3(props.parsedValue)) {
  30905. return disabledDate2(props.parsedValue[0].toDate());
  30906. }
  30907. return disabledDate2(props.parsedValue.toDate());
  30908. });
  30909. const onConfirm = () => {
  30910. if (selectionMode.value === "dates") {
  30911. emit2(props.parsedValue);
  30912. } else {
  30913. let result = props.parsedValue;
  30914. if (!result) {
  30915. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  30916. const defaultValueD = getDefaultValue2();
  30917. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  30918. }
  30919. innerDate.value = result;
  30920. emit2(result);
  30921. }
  30922. };
  30923. const disabledNow = computed(() => {
  30924. if (!disabledDate2)
  30925. return false;
  30926. return disabledDate2(dayjs().locale(lang.value).toDate());
  30927. });
  30928. const changeToNow = () => {
  30929. const now2 = dayjs().locale(lang.value);
  30930. const nowDate = now2.toDate();
  30931. isChangeToNow.value = true;
  30932. if ((!disabledDate2 || !disabledDate2(nowDate)) && checkDateWithinRange(nowDate)) {
  30933. innerDate.value = dayjs().locale(lang.value);
  30934. emit2(innerDate.value);
  30935. }
  30936. };
  30937. const timeFormat = computed(() => {
  30938. return props.timeFormat || extractTimeFormat(props.format);
  30939. });
  30940. const dateFormat = computed(() => {
  30941. return props.dateFormat || extractDateFormat(props.format);
  30942. });
  30943. const visibleTime = computed(() => {
  30944. if (userInputTime.value)
  30945. return userInputTime.value;
  30946. if (!props.parsedValue && !defaultValue.value)
  30947. return;
  30948. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  30949. });
  30950. const visibleDate = computed(() => {
  30951. if (userInputDate.value)
  30952. return userInputDate.value;
  30953. if (!props.parsedValue && !defaultValue.value)
  30954. return;
  30955. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  30956. });
  30957. const timePickerVisible = ref(false);
  30958. const onTimePickerInputFocus = () => {
  30959. timePickerVisible.value = true;
  30960. };
  30961. const handleTimePickClose = () => {
  30962. timePickerVisible.value = false;
  30963. };
  30964. const getUnits = (date2) => {
  30965. return {
  30966. hour: date2.hour(),
  30967. minute: date2.minute(),
  30968. second: date2.second(),
  30969. year: date2.year(),
  30970. month: date2.month(),
  30971. date: date2.date()
  30972. };
  30973. };
  30974. const handleTimePick = (value, visible, first) => {
  30975. const { hour, minute, second } = getUnits(value);
  30976. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  30977. innerDate.value = newDate;
  30978. emit2(innerDate.value, true);
  30979. if (!first) {
  30980. timePickerVisible.value = visible;
  30981. }
  30982. };
  30983. const handleVisibleTimeChange = (value) => {
  30984. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  30985. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  30986. const { year: year2, month: month2, date: date2 } = getUnits(innerDate.value);
  30987. innerDate.value = newDate.year(year2).month(month2).date(date2);
  30988. userInputTime.value = null;
  30989. timePickerVisible.value = false;
  30990. emit2(innerDate.value, true);
  30991. }
  30992. };
  30993. const handleVisibleDateChange = (value) => {
  30994. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  30995. if (newDate.isValid()) {
  30996. if (disabledDate2 && disabledDate2(newDate.toDate())) {
  30997. return;
  30998. }
  30999. const { hour, minute, second } = getUnits(innerDate.value);
  31000. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  31001. userInputDate.value = null;
  31002. emit2(innerDate.value, true);
  31003. }
  31004. };
  31005. const isValidValue2 = (date2) => {
  31006. return dayjs.isDayjs(date2) && date2.isValid() && (disabledDate2 ? !disabledDate2(date2.toDate()) : true);
  31007. };
  31008. const formatToString = (value) => {
  31009. if (selectionMode.value === "dates") {
  31010. return value.map((_2) => _2.format(props.format));
  31011. }
  31012. return value.format(props.format);
  31013. };
  31014. const parseUserInput = (value) => {
  31015. return dayjs(value, props.format).locale(lang.value);
  31016. };
  31017. const getDefaultValue2 = () => {
  31018. const parseDate2 = dayjs(defaultValue.value).locale(lang.value);
  31019. if (!defaultValue.value) {
  31020. const defaultTimeDValue = defaultTimeD.value;
  31021. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  31022. }
  31023. return parseDate2;
  31024. };
  31025. const handleFocusPicker = async () => {
  31026. var _a2;
  31027. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  31028. (_a2 = currentViewRef.value) == null ? void 0 : _a2.focus();
  31029. if (selectionMode.value === "week") {
  31030. handleKeyControl(EVENT_CODE.down);
  31031. }
  31032. }
  31033. };
  31034. const handleKeydownTable = (event) => {
  31035. const { code } = event;
  31036. const validCode = [
  31037. EVENT_CODE.up,
  31038. EVENT_CODE.down,
  31039. EVENT_CODE.left,
  31040. EVENT_CODE.right,
  31041. EVENT_CODE.home,
  31042. EVENT_CODE.end,
  31043. EVENT_CODE.pageUp,
  31044. EVENT_CODE.pageDown
  31045. ];
  31046. if (validCode.includes(code)) {
  31047. handleKeyControl(code);
  31048. event.stopPropagation();
  31049. event.preventDefault();
  31050. }
  31051. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  31052. event.preventDefault();
  31053. emit2(innerDate.value, false);
  31054. }
  31055. };
  31056. const handleKeyControl = (code) => {
  31057. var _a2;
  31058. const { up: up2, down: down2, left: left2, right: right2, home: home2, end: end2, pageUp: pageUp2, pageDown: pageDown2 } = EVENT_CODE;
  31059. const mapping = {
  31060. year: {
  31061. [up2]: -4,
  31062. [down2]: 4,
  31063. [left2]: -1,
  31064. [right2]: 1,
  31065. offset: (date2, step) => date2.setFullYear(date2.getFullYear() + step)
  31066. },
  31067. month: {
  31068. [up2]: -4,
  31069. [down2]: 4,
  31070. [left2]: -1,
  31071. [right2]: 1,
  31072. offset: (date2, step) => date2.setMonth(date2.getMonth() + step)
  31073. },
  31074. week: {
  31075. [up2]: -1,
  31076. [down2]: 1,
  31077. [left2]: -1,
  31078. [right2]: 1,
  31079. offset: (date2, step) => date2.setDate(date2.getDate() + step * 7)
  31080. },
  31081. date: {
  31082. [up2]: -7,
  31083. [down2]: 7,
  31084. [left2]: -1,
  31085. [right2]: 1,
  31086. [home2]: (date2) => -date2.getDay(),
  31087. [end2]: (date2) => -date2.getDay() + 6,
  31088. [pageUp2]: (date2) => -new Date(date2.getFullYear(), date2.getMonth(), 0).getDate(),
  31089. [pageDown2]: (date2) => new Date(date2.getFullYear(), date2.getMonth() + 1, 0).getDate(),
  31090. offset: (date2, step) => date2.setDate(date2.getDate() + step)
  31091. }
  31092. };
  31093. const newDate = innerDate.value.toDate();
  31094. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  31095. const map2 = mapping[keyboardMode.value];
  31096. if (!map2)
  31097. return;
  31098. map2.offset(newDate, isFunction$2(map2[code]) ? map2[code](newDate) : (_a2 = map2[code]) != null ? _a2 : 0);
  31099. if (disabledDate2 && disabledDate2(newDate)) {
  31100. break;
  31101. }
  31102. const result = dayjs(newDate).locale(lang.value);
  31103. innerDate.value = result;
  31104. contextEmit("pick", result, true);
  31105. break;
  31106. }
  31107. };
  31108. const handlePanelChange = (mode) => {
  31109. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  31110. };
  31111. watch(() => selectionMode.value, (val) => {
  31112. if (["month", "year"].includes(val)) {
  31113. currentView.value = val;
  31114. return;
  31115. }
  31116. currentView.value = "date";
  31117. }, { immediate: true });
  31118. watch(() => currentView.value, () => {
  31119. popper == null ? void 0 : popper.updatePopper();
  31120. });
  31121. watch(() => defaultValue.value, (val) => {
  31122. if (val) {
  31123. innerDate.value = getDefaultValue2();
  31124. }
  31125. }, { immediate: true });
  31126. watch(() => props.parsedValue, (val) => {
  31127. if (val) {
  31128. if (selectionMode.value === "dates")
  31129. return;
  31130. if (Array.isArray(val))
  31131. return;
  31132. innerDate.value = val;
  31133. } else {
  31134. innerDate.value = getDefaultValue2();
  31135. }
  31136. }, { immediate: true });
  31137. contextEmit("set-picker-option", ["isValidValue", isValidValue2]);
  31138. contextEmit("set-picker-option", ["formatToString", formatToString]);
  31139. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  31140. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  31141. return (_ctx, _cache) => {
  31142. return openBlock(), createElementBlock("div", {
  31143. class: normalizeClass([
  31144. unref(ppNs).b(),
  31145. unref(dpNs).b(),
  31146. {
  31147. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  31148. "has-time": unref(showTime)
  31149. }
  31150. ])
  31151. }, [
  31152. createBaseVNode("div", {
  31153. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  31154. }, [
  31155. renderSlot(_ctx.$slots, "sidebar", {
  31156. class: normalizeClass(unref(ppNs).e("sidebar"))
  31157. }),
  31158. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  31159. key: 0,
  31160. class: normalizeClass(unref(ppNs).e("sidebar"))
  31161. }, [
  31162. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  31163. return openBlock(), createElementBlock("button", {
  31164. key,
  31165. type: "button",
  31166. class: normalizeClass(unref(ppNs).e("shortcut")),
  31167. onClick: ($event) => handleShortcutClick(shortcut)
  31168. }, toDisplayString(shortcut.text), 11, _hoisted_1$I);
  31169. }), 128))
  31170. ], 2)) : createCommentVNode("v-if", true),
  31171. createBaseVNode("div", {
  31172. class: normalizeClass(unref(ppNs).e("body"))
  31173. }, [
  31174. unref(showTime) ? (openBlock(), createElementBlock("div", {
  31175. key: 0,
  31176. class: normalizeClass(unref(dpNs).e("time-header"))
  31177. }, [
  31178. createBaseVNode("span", {
  31179. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  31180. }, [
  31181. createVNode(unref(ElInput), {
  31182. placeholder: unref(t)("el.datepicker.selectDate"),
  31183. "model-value": unref(visibleDate),
  31184. size: "small",
  31185. "validate-event": false,
  31186. onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
  31187. onChange: handleVisibleDateChange
  31188. }, null, 8, ["placeholder", "model-value"])
  31189. ], 2),
  31190. withDirectives((openBlock(), createElementBlock("span", {
  31191. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  31192. }, [
  31193. createVNode(unref(ElInput), {
  31194. placeholder: unref(t)("el.datepicker.selectTime"),
  31195. "model-value": unref(visibleTime),
  31196. size: "small",
  31197. "validate-event": false,
  31198. onFocus: onTimePickerInputFocus,
  31199. onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
  31200. onChange: handleVisibleTimeChange
  31201. }, null, 8, ["placeholder", "model-value"]),
  31202. createVNode(unref(TimePickPanel), {
  31203. visible: timePickerVisible.value,
  31204. format: unref(timeFormat),
  31205. "parsed-value": innerDate.value,
  31206. onPick: handleTimePick
  31207. }, null, 8, ["visible", "format", "parsed-value"])
  31208. ], 2)), [
  31209. [unref(ClickOutside), handleTimePickClose]
  31210. ])
  31211. ], 2)) : createCommentVNode("v-if", true),
  31212. withDirectives(createBaseVNode("div", {
  31213. class: normalizeClass([
  31214. unref(dpNs).e("header"),
  31215. (currentView.value === "year" || currentView.value === "month") && unref(dpNs).e("header--bordered")
  31216. ])
  31217. }, [
  31218. createBaseVNode("span", {
  31219. class: normalizeClass(unref(dpNs).e("prev-btn"))
  31220. }, [
  31221. createBaseVNode("button", {
  31222. type: "button",
  31223. "aria-label": unref(t)(`el.datepicker.prevYear`),
  31224. class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
  31225. onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
  31226. }, [
  31227. createVNode(unref(ElIcon), null, {
  31228. default: withCtx(() => [
  31229. createVNode(unref(d_arrow_left_default))
  31230. ]),
  31231. _: 1
  31232. })
  31233. ], 10, _hoisted_2$r),
  31234. withDirectives(createBaseVNode("button", {
  31235. type: "button",
  31236. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  31237. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  31238. onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
  31239. }, [
  31240. createVNode(unref(ElIcon), null, {
  31241. default: withCtx(() => [
  31242. createVNode(unref(arrow_left_default))
  31243. ]),
  31244. _: 1
  31245. })
  31246. ], 10, _hoisted_3$e), [
  31247. [vShow, currentView.value === "date"]
  31248. ])
  31249. ], 2),
  31250. createBaseVNode("span", {
  31251. role: "button",
  31252. class: normalizeClass(unref(dpNs).e("header-label")),
  31253. "aria-live": "polite",
  31254. tabindex: "0",
  31255. onKeydown: _cache[4] || (_cache[4] = withKeys(($event) => showPicker("year"), ["enter"])),
  31256. onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
  31257. }, toDisplayString(unref(yearLabel)), 35),
  31258. withDirectives(createBaseVNode("span", {
  31259. role: "button",
  31260. "aria-live": "polite",
  31261. tabindex: "0",
  31262. class: normalizeClass([
  31263. unref(dpNs).e("header-label"),
  31264. { active: currentView.value === "month" }
  31265. ]),
  31266. onKeydown: _cache[6] || (_cache[6] = withKeys(($event) => showPicker("month"), ["enter"])),
  31267. onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
  31268. }, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 35), [
  31269. [vShow, currentView.value === "date"]
  31270. ]),
  31271. createBaseVNode("span", {
  31272. class: normalizeClass(unref(dpNs).e("next-btn"))
  31273. }, [
  31274. withDirectives(createBaseVNode("button", {
  31275. type: "button",
  31276. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  31277. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  31278. onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
  31279. }, [
  31280. createVNode(unref(ElIcon), null, {
  31281. default: withCtx(() => [
  31282. createVNode(unref(arrow_right_default))
  31283. ]),
  31284. _: 1
  31285. })
  31286. ], 10, _hoisted_4$9), [
  31287. [vShow, currentView.value === "date"]
  31288. ]),
  31289. createBaseVNode("button", {
  31290. type: "button",
  31291. "aria-label": unref(t)(`el.datepicker.nextYear`),
  31292. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  31293. onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
  31294. }, [
  31295. createVNode(unref(ElIcon), null, {
  31296. default: withCtx(() => [
  31297. createVNode(unref(d_arrow_right_default))
  31298. ]),
  31299. _: 1
  31300. })
  31301. ], 10, _hoisted_5$7)
  31302. ], 2)
  31303. ], 2), [
  31304. [vShow, currentView.value !== "time"]
  31305. ]),
  31306. createBaseVNode("div", {
  31307. class: normalizeClass(unref(ppNs).e("content")),
  31308. onKeydown: handleKeydownTable
  31309. }, [
  31310. currentView.value === "date" ? (openBlock(), createBlock(DateTable, {
  31311. key: 0,
  31312. ref_key: "currentViewRef",
  31313. ref: currentViewRef,
  31314. "selection-mode": unref(selectionMode),
  31315. date: innerDate.value,
  31316. "parsed-value": _ctx.parsedValue,
  31317. "disabled-date": unref(disabledDate2),
  31318. "cell-class-name": unref(cellClassName),
  31319. onPick: handleDatePick
  31320. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : createCommentVNode("v-if", true),
  31321. currentView.value === "year" ? (openBlock(), createBlock(YearTable, {
  31322. key: 1,
  31323. ref_key: "currentViewRef",
  31324. ref: currentViewRef,
  31325. date: innerDate.value,
  31326. "disabled-date": unref(disabledDate2),
  31327. "parsed-value": _ctx.parsedValue,
  31328. onPick: handleYearPick
  31329. }, null, 8, ["date", "disabled-date", "parsed-value"])) : createCommentVNode("v-if", true),
  31330. currentView.value === "month" ? (openBlock(), createBlock(MonthTable, {
  31331. key: 2,
  31332. ref_key: "currentViewRef",
  31333. ref: currentViewRef,
  31334. date: innerDate.value,
  31335. "parsed-value": _ctx.parsedValue,
  31336. "disabled-date": unref(disabledDate2),
  31337. onPick: handleMonthPick
  31338. }, null, 8, ["date", "parsed-value", "disabled-date"])) : createCommentVNode("v-if", true)
  31339. ], 34)
  31340. ], 2)
  31341. ], 2),
  31342. withDirectives(createBaseVNode("div", {
  31343. class: normalizeClass(unref(ppNs).e("footer"))
  31344. }, [
  31345. withDirectives(createVNode(unref(ElButton), {
  31346. text: "",
  31347. size: "small",
  31348. class: normalizeClass(unref(ppNs).e("link-btn")),
  31349. disabled: unref(disabledNow),
  31350. onClick: changeToNow
  31351. }, {
  31352. default: withCtx(() => [
  31353. createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)
  31354. ]),
  31355. _: 1
  31356. }, 8, ["class", "disabled"]), [
  31357. [vShow, unref(selectionMode) !== "dates"]
  31358. ]),
  31359. createVNode(unref(ElButton), {
  31360. plain: "",
  31361. size: "small",
  31362. class: normalizeClass(unref(ppNs).e("link-btn")),
  31363. disabled: unref(disabledConfirm),
  31364. onClick: onConfirm
  31365. }, {
  31366. default: withCtx(() => [
  31367. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  31368. ]),
  31369. _: 1
  31370. }, 8, ["class", "disabled"])
  31371. ], 2), [
  31372. [vShow, unref(footerVisible) && currentView.value === "date"]
  31373. ])
  31374. ], 2);
  31375. };
  31376. }
  31377. });
  31378. var DatePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1n, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
  31379. const panelDateRangeProps = buildProps({
  31380. ...panelSharedProps,
  31381. ...panelRangeSharedProps
  31382. });
  31383. const useShortcut = (lang) => {
  31384. const { emit: emit2 } = getCurrentInstance();
  31385. const attrs = useAttrs$1();
  31386. const slots = useSlots();
  31387. const handleShortcutClick = (shortcut) => {
  31388. const shortcutValues = isFunction$2(shortcut.value) ? shortcut.value() : shortcut.value;
  31389. if (shortcutValues) {
  31390. emit2("pick", [
  31391. dayjs(shortcutValues[0]).locale(lang.value),
  31392. dayjs(shortcutValues[1]).locale(lang.value)
  31393. ]);
  31394. return;
  31395. }
  31396. if (shortcut.onClick) {
  31397. shortcut.onClick({
  31398. attrs,
  31399. slots,
  31400. emit: emit2
  31401. });
  31402. }
  31403. };
  31404. return handleShortcutClick;
  31405. };
  31406. const useRangePicker = (props, {
  31407. defaultValue,
  31408. leftDate,
  31409. rightDate,
  31410. unit: unit2,
  31411. onParsedValueChanged
  31412. }) => {
  31413. const { emit: emit2 } = getCurrentInstance();
  31414. const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
  31415. const drpNs = useNamespace("date-range-picker");
  31416. const { t, lang } = useLocale();
  31417. const handleShortcutClick = useShortcut(lang);
  31418. const minDate = ref();
  31419. const maxDate = ref();
  31420. const rangeState = ref({
  31421. endDate: null,
  31422. selecting: false
  31423. });
  31424. const handleChangeRange = (val) => {
  31425. rangeState.value = val;
  31426. };
  31427. const handleRangeConfirm = (visible = false) => {
  31428. const _minDate = unref(minDate);
  31429. const _maxDate = unref(maxDate);
  31430. if (isValidRange([_minDate, _maxDate])) {
  31431. emit2("pick", [_minDate, _maxDate], visible);
  31432. }
  31433. };
  31434. const onSelect = (selecting) => {
  31435. rangeState.value.selecting = selecting;
  31436. if (!selecting) {
  31437. rangeState.value.endDate = null;
  31438. }
  31439. };
  31440. const restoreDefault = () => {
  31441. const [start, end2] = getDefaultValue(unref(defaultValue), {
  31442. lang: unref(lang),
  31443. unit: unit2,
  31444. unlinkPanels: props.unlinkPanels
  31445. });
  31446. minDate.value = void 0;
  31447. maxDate.value = void 0;
  31448. leftDate.value = start;
  31449. rightDate.value = end2;
  31450. };
  31451. watch(defaultValue, (val) => {
  31452. if (val) {
  31453. restoreDefault();
  31454. }
  31455. }, { immediate: true });
  31456. watch(() => props.parsedValue, (parsedValue2) => {
  31457. if (isArray$3(parsedValue2) && parsedValue2.length === 2) {
  31458. const [start, end2] = parsedValue2;
  31459. minDate.value = start;
  31460. leftDate.value = start;
  31461. maxDate.value = end2;
  31462. onParsedValueChanged(unref(minDate), unref(maxDate));
  31463. } else {
  31464. restoreDefault();
  31465. }
  31466. }, { immediate: true });
  31467. return {
  31468. minDate,
  31469. maxDate,
  31470. rangeState,
  31471. lang,
  31472. ppNs: pickerNs,
  31473. drpNs,
  31474. handleChangeRange,
  31475. handleRangeConfirm,
  31476. handleShortcutClick,
  31477. onSelect,
  31478. t
  31479. };
  31480. };
  31481. const _hoisted_1$H = ["onClick"];
  31482. const _hoisted_2$q = ["aria-label"];
  31483. const _hoisted_3$d = ["aria-label"];
  31484. const _hoisted_4$8 = ["disabled", "aria-label"];
  31485. const _hoisted_5$6 = ["disabled", "aria-label"];
  31486. const _hoisted_6$3 = ["disabled", "aria-label"];
  31487. const _hoisted_7$1 = ["disabled", "aria-label"];
  31488. const _hoisted_8$1 = ["aria-label"];
  31489. const _hoisted_9$1 = ["aria-label"];
  31490. const unit$1 = "month";
  31491. const _sfc_main$1m = /* @__PURE__ */ defineComponent({
  31492. __name: "panel-date-range",
  31493. props: panelDateRangeProps,
  31494. emits: [
  31495. "pick",
  31496. "set-picker-option",
  31497. "calendar-change",
  31498. "panel-change"
  31499. ],
  31500. setup(__props, { emit: emit2 }) {
  31501. const props = __props;
  31502. const pickerBase = inject("EP_PICKER_BASE");
  31503. const { disabledDate: disabledDate2, cellClassName, format: format2, defaultTime, clearable } = pickerBase.props;
  31504. const shortcuts = toRef(pickerBase.props, "shortcuts");
  31505. const defaultValue = toRef(pickerBase.props, "defaultValue");
  31506. const { lang } = useLocale();
  31507. const leftDate = ref(dayjs().locale(lang.value));
  31508. const rightDate = ref(dayjs().locale(lang.value).add(1, unit$1));
  31509. const {
  31510. minDate,
  31511. maxDate,
  31512. rangeState,
  31513. ppNs,
  31514. drpNs,
  31515. handleChangeRange,
  31516. handleRangeConfirm,
  31517. handleShortcutClick,
  31518. onSelect,
  31519. t
  31520. } = useRangePicker(props, {
  31521. defaultValue,
  31522. leftDate,
  31523. rightDate,
  31524. unit: unit$1,
  31525. onParsedValueChanged
  31526. });
  31527. const dateUserInput = ref({
  31528. min: null,
  31529. max: null
  31530. });
  31531. const timeUserInput = ref({
  31532. min: null,
  31533. max: null
  31534. });
  31535. const leftLabel = computed(() => {
  31536. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  31537. });
  31538. const rightLabel = computed(() => {
  31539. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  31540. });
  31541. const leftYear = computed(() => {
  31542. return leftDate.value.year();
  31543. });
  31544. const leftMonth = computed(() => {
  31545. return leftDate.value.month();
  31546. });
  31547. const rightYear = computed(() => {
  31548. return rightDate.value.year();
  31549. });
  31550. const rightMonth = computed(() => {
  31551. return rightDate.value.month();
  31552. });
  31553. const hasShortcuts = computed(() => !!shortcuts.value.length);
  31554. const minVisibleDate = computed(() => {
  31555. if (dateUserInput.value.min !== null)
  31556. return dateUserInput.value.min;
  31557. if (minDate.value)
  31558. return minDate.value.format(dateFormat.value);
  31559. return "";
  31560. });
  31561. const maxVisibleDate = computed(() => {
  31562. if (dateUserInput.value.max !== null)
  31563. return dateUserInput.value.max;
  31564. if (maxDate.value || minDate.value)
  31565. return (maxDate.value || minDate.value).format(dateFormat.value);
  31566. return "";
  31567. });
  31568. const minVisibleTime = computed(() => {
  31569. if (timeUserInput.value.min !== null)
  31570. return timeUserInput.value.min;
  31571. if (minDate.value)
  31572. return minDate.value.format(timeFormat.value);
  31573. return "";
  31574. });
  31575. const maxVisibleTime = computed(() => {
  31576. if (timeUserInput.value.max !== null)
  31577. return timeUserInput.value.max;
  31578. if (maxDate.value || minDate.value)
  31579. return (maxDate.value || minDate.value).format(timeFormat.value);
  31580. return "";
  31581. });
  31582. const timeFormat = computed(() => {
  31583. return props.timeFormat || extractTimeFormat(format2);
  31584. });
  31585. const dateFormat = computed(() => {
  31586. return props.dateFormat || extractDateFormat(format2);
  31587. });
  31588. const isValidValue2 = (date2) => {
  31589. return isValidRange(date2) && (disabledDate2 ? !disabledDate2(date2[0].toDate()) && !disabledDate2(date2[1].toDate()) : true);
  31590. };
  31591. const leftPrevYear = () => {
  31592. leftDate.value = leftDate.value.subtract(1, "year");
  31593. if (!props.unlinkPanels) {
  31594. rightDate.value = leftDate.value.add(1, "month");
  31595. }
  31596. handlePanelChange("year");
  31597. };
  31598. const leftPrevMonth = () => {
  31599. leftDate.value = leftDate.value.subtract(1, "month");
  31600. if (!props.unlinkPanels) {
  31601. rightDate.value = leftDate.value.add(1, "month");
  31602. }
  31603. handlePanelChange("month");
  31604. };
  31605. const rightNextYear = () => {
  31606. if (!props.unlinkPanels) {
  31607. leftDate.value = leftDate.value.add(1, "year");
  31608. rightDate.value = leftDate.value.add(1, "month");
  31609. } else {
  31610. rightDate.value = rightDate.value.add(1, "year");
  31611. }
  31612. handlePanelChange("year");
  31613. };
  31614. const rightNextMonth = () => {
  31615. if (!props.unlinkPanels) {
  31616. leftDate.value = leftDate.value.add(1, "month");
  31617. rightDate.value = leftDate.value.add(1, "month");
  31618. } else {
  31619. rightDate.value = rightDate.value.add(1, "month");
  31620. }
  31621. handlePanelChange("month");
  31622. };
  31623. const leftNextYear = () => {
  31624. leftDate.value = leftDate.value.add(1, "year");
  31625. handlePanelChange("year");
  31626. };
  31627. const leftNextMonth = () => {
  31628. leftDate.value = leftDate.value.add(1, "month");
  31629. handlePanelChange("month");
  31630. };
  31631. const rightPrevYear = () => {
  31632. rightDate.value = rightDate.value.subtract(1, "year");
  31633. handlePanelChange("year");
  31634. };
  31635. const rightPrevMonth = () => {
  31636. rightDate.value = rightDate.value.subtract(1, "month");
  31637. handlePanelChange("month");
  31638. };
  31639. const handlePanelChange = (mode) => {
  31640. emit2("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  31641. };
  31642. const enableMonthArrow = computed(() => {
  31643. const nextMonth = (leftMonth.value + 1) % 12;
  31644. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  31645. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  31646. });
  31647. const enableYearArrow = computed(() => {
  31648. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  31649. });
  31650. const btnDisabled = computed(() => {
  31651. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  31652. });
  31653. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  31654. const formatEmit = (emitDayjs, index2) => {
  31655. if (!emitDayjs)
  31656. return;
  31657. if (defaultTime) {
  31658. const defaultTimeD = dayjs(defaultTime[index2] || defaultTime).locale(lang.value);
  31659. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  31660. }
  31661. return emitDayjs;
  31662. };
  31663. const handleRangePick = (val, close2 = true) => {
  31664. const min_ = val.minDate;
  31665. const max_ = val.maxDate;
  31666. const minDate_ = formatEmit(min_, 0);
  31667. const maxDate_ = formatEmit(max_, 1);
  31668. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  31669. return;
  31670. }
  31671. emit2("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  31672. maxDate.value = maxDate_;
  31673. minDate.value = minDate_;
  31674. if (!close2 || showTime.value)
  31675. return;
  31676. handleRangeConfirm();
  31677. };
  31678. const minTimePickerVisible = ref(false);
  31679. const maxTimePickerVisible = ref(false);
  31680. const handleMinTimeClose = () => {
  31681. minTimePickerVisible.value = false;
  31682. };
  31683. const handleMaxTimeClose = () => {
  31684. maxTimePickerVisible.value = false;
  31685. };
  31686. const handleDateInput = (value, type2) => {
  31687. dateUserInput.value[type2] = value;
  31688. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  31689. if (parsedValueD.isValid()) {
  31690. if (disabledDate2 && disabledDate2(parsedValueD.toDate())) {
  31691. return;
  31692. }
  31693. if (type2 === "min") {
  31694. leftDate.value = parsedValueD;
  31695. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  31696. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  31697. rightDate.value = parsedValueD.add(1, "month");
  31698. maxDate.value = minDate.value.add(1, "month");
  31699. }
  31700. } else {
  31701. rightDate.value = parsedValueD;
  31702. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  31703. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  31704. leftDate.value = parsedValueD.subtract(1, "month");
  31705. minDate.value = maxDate.value.subtract(1, "month");
  31706. }
  31707. }
  31708. }
  31709. };
  31710. const handleDateChange = (_2, type2) => {
  31711. dateUserInput.value[type2] = null;
  31712. };
  31713. const handleTimeInput = (value, type2) => {
  31714. timeUserInput.value[type2] = value;
  31715. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  31716. if (parsedValueD.isValid()) {
  31717. if (type2 === "min") {
  31718. minTimePickerVisible.value = true;
  31719. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  31720. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  31721. maxDate.value = minDate.value;
  31722. }
  31723. } else {
  31724. maxTimePickerVisible.value = true;
  31725. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  31726. rightDate.value = maxDate.value;
  31727. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  31728. minDate.value = maxDate.value;
  31729. }
  31730. }
  31731. }
  31732. };
  31733. const handleTimeChange = (value, type2) => {
  31734. timeUserInput.value[type2] = null;
  31735. if (type2 === "min") {
  31736. leftDate.value = minDate.value;
  31737. minTimePickerVisible.value = false;
  31738. } else {
  31739. rightDate.value = maxDate.value;
  31740. maxTimePickerVisible.value = false;
  31741. }
  31742. };
  31743. const handleMinTimePick = (value, visible, first) => {
  31744. if (timeUserInput.value.min)
  31745. return;
  31746. if (value) {
  31747. leftDate.value = value;
  31748. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  31749. }
  31750. if (!first) {
  31751. minTimePickerVisible.value = visible;
  31752. }
  31753. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  31754. maxDate.value = minDate.value;
  31755. rightDate.value = value;
  31756. }
  31757. };
  31758. const handleMaxTimePick = (value, visible, first) => {
  31759. if (timeUserInput.value.max)
  31760. return;
  31761. if (value) {
  31762. rightDate.value = value;
  31763. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  31764. }
  31765. if (!first) {
  31766. maxTimePickerVisible.value = visible;
  31767. }
  31768. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  31769. minDate.value = maxDate.value;
  31770. }
  31771. };
  31772. const handleClear = () => {
  31773. leftDate.value = getDefaultValue(unref(defaultValue), {
  31774. lang: unref(lang),
  31775. unit: "month",
  31776. unlinkPanels: props.unlinkPanels
  31777. })[0];
  31778. rightDate.value = leftDate.value.add(1, "month");
  31779. emit2("pick", null);
  31780. };
  31781. const formatToString = (value) => {
  31782. return isArray$3(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
  31783. };
  31784. const parseUserInput = (value) => {
  31785. return isArray$3(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
  31786. };
  31787. function onParsedValueChanged(minDate2, maxDate2) {
  31788. if (props.unlinkPanels && maxDate2) {
  31789. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  31790. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  31791. const maxDateYear = maxDate2.year();
  31792. const maxDateMonth = maxDate2.month();
  31793. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$1) : maxDate2;
  31794. } else {
  31795. rightDate.value = leftDate.value.add(1, unit$1);
  31796. if (maxDate2) {
  31797. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  31798. }
  31799. }
  31800. }
  31801. emit2("set-picker-option", ["isValidValue", isValidValue2]);
  31802. emit2("set-picker-option", ["parseUserInput", parseUserInput]);
  31803. emit2("set-picker-option", ["formatToString", formatToString]);
  31804. emit2("set-picker-option", ["handleClear", handleClear]);
  31805. return (_ctx, _cache) => {
  31806. return openBlock(), createElementBlock("div", {
  31807. class: normalizeClass([
  31808. unref(ppNs).b(),
  31809. unref(drpNs).b(),
  31810. {
  31811. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  31812. "has-time": unref(showTime)
  31813. }
  31814. ])
  31815. }, [
  31816. createBaseVNode("div", {
  31817. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  31818. }, [
  31819. renderSlot(_ctx.$slots, "sidebar", {
  31820. class: normalizeClass(unref(ppNs).e("sidebar"))
  31821. }),
  31822. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  31823. key: 0,
  31824. class: normalizeClass(unref(ppNs).e("sidebar"))
  31825. }, [
  31826. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  31827. return openBlock(), createElementBlock("button", {
  31828. key,
  31829. type: "button",
  31830. class: normalizeClass(unref(ppNs).e("shortcut")),
  31831. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  31832. }, toDisplayString(shortcut.text), 11, _hoisted_1$H);
  31833. }), 128))
  31834. ], 2)) : createCommentVNode("v-if", true),
  31835. createBaseVNode("div", {
  31836. class: normalizeClass(unref(ppNs).e("body"))
  31837. }, [
  31838. unref(showTime) ? (openBlock(), createElementBlock("div", {
  31839. key: 0,
  31840. class: normalizeClass(unref(drpNs).e("time-header"))
  31841. }, [
  31842. createBaseVNode("span", {
  31843. class: normalizeClass(unref(drpNs).e("editors-wrap"))
  31844. }, [
  31845. createBaseVNode("span", {
  31846. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  31847. }, [
  31848. createVNode(unref(ElInput), {
  31849. size: "small",
  31850. disabled: unref(rangeState).selecting,
  31851. placeholder: unref(t)("el.datepicker.startDate"),
  31852. class: normalizeClass(unref(drpNs).e("editor")),
  31853. "model-value": unref(minVisibleDate),
  31854. "validate-event": false,
  31855. onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
  31856. onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
  31857. }, null, 8, ["disabled", "placeholder", "class", "model-value"])
  31858. ], 2),
  31859. withDirectives((openBlock(), createElementBlock("span", {
  31860. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  31861. }, [
  31862. createVNode(unref(ElInput), {
  31863. size: "small",
  31864. class: normalizeClass(unref(drpNs).e("editor")),
  31865. disabled: unref(rangeState).selecting,
  31866. placeholder: unref(t)("el.datepicker.startTime"),
  31867. "model-value": unref(minVisibleTime),
  31868. "validate-event": false,
  31869. onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
  31870. onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
  31871. onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
  31872. }, null, 8, ["class", "disabled", "placeholder", "model-value"]),
  31873. createVNode(unref(TimePickPanel), {
  31874. visible: minTimePickerVisible.value,
  31875. format: unref(timeFormat),
  31876. "datetime-role": "start",
  31877. "parsed-value": leftDate.value,
  31878. onPick: handleMinTimePick
  31879. }, null, 8, ["visible", "format", "parsed-value"])
  31880. ], 2)), [
  31881. [unref(ClickOutside), handleMinTimeClose]
  31882. ])
  31883. ], 2),
  31884. createBaseVNode("span", null, [
  31885. createVNode(unref(ElIcon), null, {
  31886. default: withCtx(() => [
  31887. createVNode(unref(arrow_right_default))
  31888. ]),
  31889. _: 1
  31890. })
  31891. ]),
  31892. createBaseVNode("span", {
  31893. class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"])
  31894. }, [
  31895. createBaseVNode("span", {
  31896. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  31897. }, [
  31898. createVNode(unref(ElInput), {
  31899. size: "small",
  31900. class: normalizeClass(unref(drpNs).e("editor")),
  31901. disabled: unref(rangeState).selecting,
  31902. placeholder: unref(t)("el.datepicker.endDate"),
  31903. "model-value": unref(maxVisibleDate),
  31904. readonly: !unref(minDate),
  31905. "validate-event": false,
  31906. onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
  31907. onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
  31908. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"])
  31909. ], 2),
  31910. withDirectives((openBlock(), createElementBlock("span", {
  31911. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  31912. }, [
  31913. createVNode(unref(ElInput), {
  31914. size: "small",
  31915. class: normalizeClass(unref(drpNs).e("editor")),
  31916. disabled: unref(rangeState).selecting,
  31917. placeholder: unref(t)("el.datepicker.endTime"),
  31918. "model-value": unref(maxVisibleTime),
  31919. readonly: !unref(minDate),
  31920. "validate-event": false,
  31921. onFocus: _cache[7] || (_cache[7] = ($event) => unref(minDate) && (maxTimePickerVisible.value = true)),
  31922. onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
  31923. onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
  31924. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]),
  31925. createVNode(unref(TimePickPanel), {
  31926. "datetime-role": "end",
  31927. visible: maxTimePickerVisible.value,
  31928. format: unref(timeFormat),
  31929. "parsed-value": rightDate.value,
  31930. onPick: handleMaxTimePick
  31931. }, null, 8, ["visible", "format", "parsed-value"])
  31932. ], 2)), [
  31933. [unref(ClickOutside), handleMaxTimeClose]
  31934. ])
  31935. ], 2)
  31936. ], 2)) : createCommentVNode("v-if", true),
  31937. createBaseVNode("div", {
  31938. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  31939. }, [
  31940. createBaseVNode("div", {
  31941. class: normalizeClass(unref(drpNs).e("header"))
  31942. }, [
  31943. createBaseVNode("button", {
  31944. type: "button",
  31945. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  31946. "aria-label": unref(t)(`el.datepicker.prevYear`),
  31947. onClick: leftPrevYear
  31948. }, [
  31949. createVNode(unref(ElIcon), null, {
  31950. default: withCtx(() => [
  31951. createVNode(unref(d_arrow_left_default))
  31952. ]),
  31953. _: 1
  31954. })
  31955. ], 10, _hoisted_2$q),
  31956. createBaseVNode("button", {
  31957. type: "button",
  31958. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  31959. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  31960. onClick: leftPrevMonth
  31961. }, [
  31962. createVNode(unref(ElIcon), null, {
  31963. default: withCtx(() => [
  31964. createVNode(unref(arrow_left_default))
  31965. ]),
  31966. _: 1
  31967. })
  31968. ], 10, _hoisted_3$d),
  31969. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  31970. key: 0,
  31971. type: "button",
  31972. disabled: !unref(enableYearArrow),
  31973. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-right"]),
  31974. "aria-label": unref(t)(`el.datepicker.nextYear`),
  31975. onClick: leftNextYear
  31976. }, [
  31977. createVNode(unref(ElIcon), null, {
  31978. default: withCtx(() => [
  31979. createVNode(unref(d_arrow_right_default))
  31980. ]),
  31981. _: 1
  31982. })
  31983. ], 10, _hoisted_4$8)) : createCommentVNode("v-if", true),
  31984. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  31985. key: 1,
  31986. type: "button",
  31987. disabled: !unref(enableMonthArrow),
  31988. class: normalizeClass([[
  31989. unref(ppNs).e("icon-btn"),
  31990. { "is-disabled": !unref(enableMonthArrow) }
  31991. ], "arrow-right"]),
  31992. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  31993. onClick: leftNextMonth
  31994. }, [
  31995. createVNode(unref(ElIcon), null, {
  31996. default: withCtx(() => [
  31997. createVNode(unref(arrow_right_default))
  31998. ]),
  31999. _: 1
  32000. })
  32001. ], 10, _hoisted_5$6)) : createCommentVNode("v-if", true),
  32002. createBaseVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  32003. ], 2),
  32004. createVNode(DateTable, {
  32005. "selection-mode": "range",
  32006. date: leftDate.value,
  32007. "min-date": unref(minDate),
  32008. "max-date": unref(maxDate),
  32009. "range-state": unref(rangeState),
  32010. "disabled-date": unref(disabledDate2),
  32011. "cell-class-name": unref(cellClassName),
  32012. onChangerange: unref(handleChangeRange),
  32013. onPick: handleRangePick,
  32014. onSelect: unref(onSelect)
  32015. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  32016. ], 2),
  32017. createBaseVNode("div", {
  32018. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  32019. }, [
  32020. createBaseVNode("div", {
  32021. class: normalizeClass(unref(drpNs).e("header"))
  32022. }, [
  32023. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  32024. key: 0,
  32025. type: "button",
  32026. disabled: !unref(enableYearArrow),
  32027. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
  32028. "aria-label": unref(t)(`el.datepicker.prevYear`),
  32029. onClick: rightPrevYear
  32030. }, [
  32031. createVNode(unref(ElIcon), null, {
  32032. default: withCtx(() => [
  32033. createVNode(unref(d_arrow_left_default))
  32034. ]),
  32035. _: 1
  32036. })
  32037. ], 10, _hoisted_6$3)) : createCommentVNode("v-if", true),
  32038. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  32039. key: 1,
  32040. type: "button",
  32041. disabled: !unref(enableMonthArrow),
  32042. class: normalizeClass([[
  32043. unref(ppNs).e("icon-btn"),
  32044. { "is-disabled": !unref(enableMonthArrow) }
  32045. ], "arrow-left"]),
  32046. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  32047. onClick: rightPrevMonth
  32048. }, [
  32049. createVNode(unref(ElIcon), null, {
  32050. default: withCtx(() => [
  32051. createVNode(unref(arrow_left_default))
  32052. ]),
  32053. _: 1
  32054. })
  32055. ], 10, _hoisted_7$1)) : createCommentVNode("v-if", true),
  32056. createBaseVNode("button", {
  32057. type: "button",
  32058. "aria-label": unref(t)(`el.datepicker.nextYear`),
  32059. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  32060. onClick: rightNextYear
  32061. }, [
  32062. createVNode(unref(ElIcon), null, {
  32063. default: withCtx(() => [
  32064. createVNode(unref(d_arrow_right_default))
  32065. ]),
  32066. _: 1
  32067. })
  32068. ], 10, _hoisted_8$1),
  32069. createBaseVNode("button", {
  32070. type: "button",
  32071. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  32072. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  32073. onClick: rightNextMonth
  32074. }, [
  32075. createVNode(unref(ElIcon), null, {
  32076. default: withCtx(() => [
  32077. createVNode(unref(arrow_right_default))
  32078. ]),
  32079. _: 1
  32080. })
  32081. ], 10, _hoisted_9$1),
  32082. createBaseVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  32083. ], 2),
  32084. createVNode(DateTable, {
  32085. "selection-mode": "range",
  32086. date: rightDate.value,
  32087. "min-date": unref(minDate),
  32088. "max-date": unref(maxDate),
  32089. "range-state": unref(rangeState),
  32090. "disabled-date": unref(disabledDate2),
  32091. "cell-class-name": unref(cellClassName),
  32092. onChangerange: unref(handleChangeRange),
  32093. onPick: handleRangePick,
  32094. onSelect: unref(onSelect)
  32095. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  32096. ], 2)
  32097. ], 2)
  32098. ], 2),
  32099. unref(showTime) ? (openBlock(), createElementBlock("div", {
  32100. key: 0,
  32101. class: normalizeClass(unref(ppNs).e("footer"))
  32102. }, [
  32103. unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
  32104. key: 0,
  32105. text: "",
  32106. size: "small",
  32107. class: normalizeClass(unref(ppNs).e("link-btn")),
  32108. onClick: handleClear
  32109. }, {
  32110. default: withCtx(() => [
  32111. createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)
  32112. ]),
  32113. _: 1
  32114. }, 8, ["class"])) : createCommentVNode("v-if", true),
  32115. createVNode(unref(ElButton), {
  32116. plain: "",
  32117. size: "small",
  32118. class: normalizeClass(unref(ppNs).e("link-btn")),
  32119. disabled: unref(btnDisabled),
  32120. onClick: _cache[10] || (_cache[10] = ($event) => unref(handleRangeConfirm)(false))
  32121. }, {
  32122. default: withCtx(() => [
  32123. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  32124. ]),
  32125. _: 1
  32126. }, 8, ["class", "disabled"])
  32127. ], 2)) : createCommentVNode("v-if", true)
  32128. ], 2);
  32129. };
  32130. }
  32131. });
  32132. var DateRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
  32133. const panelMonthRangeProps = buildProps({
  32134. ...panelRangeSharedProps
  32135. });
  32136. const panelMonthRangeEmits = [
  32137. "pick",
  32138. "set-picker-option",
  32139. "calendar-change"
  32140. ];
  32141. const useMonthRangeHeader = ({
  32142. unlinkPanels,
  32143. leftDate,
  32144. rightDate
  32145. }) => {
  32146. const { t } = useLocale();
  32147. const leftPrevYear = () => {
  32148. leftDate.value = leftDate.value.subtract(1, "year");
  32149. if (!unlinkPanels.value) {
  32150. rightDate.value = rightDate.value.subtract(1, "year");
  32151. }
  32152. };
  32153. const rightNextYear = () => {
  32154. if (!unlinkPanels.value) {
  32155. leftDate.value = leftDate.value.add(1, "year");
  32156. }
  32157. rightDate.value = rightDate.value.add(1, "year");
  32158. };
  32159. const leftNextYear = () => {
  32160. leftDate.value = leftDate.value.add(1, "year");
  32161. };
  32162. const rightPrevYear = () => {
  32163. rightDate.value = rightDate.value.subtract(1, "year");
  32164. };
  32165. const leftLabel = computed(() => {
  32166. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  32167. });
  32168. const rightLabel = computed(() => {
  32169. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  32170. });
  32171. const leftYear = computed(() => {
  32172. return leftDate.value.year();
  32173. });
  32174. const rightYear = computed(() => {
  32175. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  32176. });
  32177. return {
  32178. leftPrevYear,
  32179. rightNextYear,
  32180. leftNextYear,
  32181. rightPrevYear,
  32182. leftLabel,
  32183. rightLabel,
  32184. leftYear,
  32185. rightYear
  32186. };
  32187. };
  32188. const _hoisted_1$G = ["onClick"];
  32189. const _hoisted_2$p = ["disabled"];
  32190. const _hoisted_3$c = ["disabled"];
  32191. const unit = "year";
  32192. const __default__$S = /* @__PURE__ */ defineComponent({
  32193. name: "DatePickerMonthRange"
  32194. });
  32195. const _sfc_main$1l = /* @__PURE__ */ defineComponent({
  32196. ...__default__$S,
  32197. props: panelMonthRangeProps,
  32198. emits: panelMonthRangeEmits,
  32199. setup(__props, { emit: emit2 }) {
  32200. const props = __props;
  32201. const { lang } = useLocale();
  32202. const pickerBase = inject("EP_PICKER_BASE");
  32203. const { shortcuts, disabledDate: disabledDate2, format: format2 } = pickerBase.props;
  32204. const defaultValue = toRef(pickerBase.props, "defaultValue");
  32205. const leftDate = ref(dayjs().locale(lang.value));
  32206. const rightDate = ref(dayjs().locale(lang.value).add(1, unit));
  32207. const {
  32208. minDate,
  32209. maxDate,
  32210. rangeState,
  32211. ppNs,
  32212. drpNs,
  32213. handleChangeRange,
  32214. handleRangeConfirm,
  32215. handleShortcutClick,
  32216. onSelect
  32217. } = useRangePicker(props, {
  32218. defaultValue,
  32219. leftDate,
  32220. rightDate,
  32221. unit,
  32222. onParsedValueChanged
  32223. });
  32224. const hasShortcuts = computed(() => !!shortcuts.length);
  32225. const {
  32226. leftPrevYear,
  32227. rightNextYear,
  32228. leftNextYear,
  32229. rightPrevYear,
  32230. leftLabel,
  32231. rightLabel,
  32232. leftYear,
  32233. rightYear
  32234. } = useMonthRangeHeader({
  32235. unlinkPanels: toRef(props, "unlinkPanels"),
  32236. leftDate,
  32237. rightDate
  32238. });
  32239. const enableYearArrow = computed(() => {
  32240. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  32241. });
  32242. const handleRangePick = (val, close2 = true) => {
  32243. const minDate_ = val.minDate;
  32244. const maxDate_ = val.maxDate;
  32245. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  32246. return;
  32247. }
  32248. emit2("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  32249. maxDate.value = maxDate_;
  32250. minDate.value = minDate_;
  32251. if (!close2)
  32252. return;
  32253. handleRangeConfirm();
  32254. };
  32255. const formatToString = (days) => {
  32256. return days.map((day) => day.format(format2));
  32257. };
  32258. function onParsedValueChanged(minDate2, maxDate2) {
  32259. if (props.unlinkPanels && maxDate2) {
  32260. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  32261. const maxDateYear = maxDate2.year();
  32262. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit) : maxDate2;
  32263. } else {
  32264. rightDate.value = leftDate.value.add(1, unit);
  32265. }
  32266. }
  32267. emit2("set-picker-option", ["formatToString", formatToString]);
  32268. return (_ctx, _cache) => {
  32269. return openBlock(), createElementBlock("div", {
  32270. class: normalizeClass([
  32271. unref(ppNs).b(),
  32272. unref(drpNs).b(),
  32273. {
  32274. "has-sidebar": Boolean(_ctx.$slots.sidebar) || unref(hasShortcuts)
  32275. }
  32276. ])
  32277. }, [
  32278. createBaseVNode("div", {
  32279. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  32280. }, [
  32281. renderSlot(_ctx.$slots, "sidebar", {
  32282. class: normalizeClass(unref(ppNs).e("sidebar"))
  32283. }),
  32284. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  32285. key: 0,
  32286. class: normalizeClass(unref(ppNs).e("sidebar"))
  32287. }, [
  32288. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  32289. return openBlock(), createElementBlock("button", {
  32290. key,
  32291. type: "button",
  32292. class: normalizeClass(unref(ppNs).e("shortcut")),
  32293. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  32294. }, toDisplayString(shortcut.text), 11, _hoisted_1$G);
  32295. }), 128))
  32296. ], 2)) : createCommentVNode("v-if", true),
  32297. createBaseVNode("div", {
  32298. class: normalizeClass(unref(ppNs).e("body"))
  32299. }, [
  32300. createBaseVNode("div", {
  32301. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  32302. }, [
  32303. createBaseVNode("div", {
  32304. class: normalizeClass(unref(drpNs).e("header"))
  32305. }, [
  32306. createBaseVNode("button", {
  32307. type: "button",
  32308. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  32309. onClick: _cache[0] || (_cache[0] = (...args) => unref(leftPrevYear) && unref(leftPrevYear)(...args))
  32310. }, [
  32311. createVNode(unref(ElIcon), null, {
  32312. default: withCtx(() => [
  32313. createVNode(unref(d_arrow_left_default))
  32314. ]),
  32315. _: 1
  32316. })
  32317. ], 2),
  32318. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  32319. key: 0,
  32320. type: "button",
  32321. disabled: !unref(enableYearArrow),
  32322. class: normalizeClass([[
  32323. unref(ppNs).e("icon-btn"),
  32324. { [unref(ppNs).is("disabled")]: !unref(enableYearArrow) }
  32325. ], "d-arrow-right"]),
  32326. onClick: _cache[1] || (_cache[1] = (...args) => unref(leftNextYear) && unref(leftNextYear)(...args))
  32327. }, [
  32328. createVNode(unref(ElIcon), null, {
  32329. default: withCtx(() => [
  32330. createVNode(unref(d_arrow_right_default))
  32331. ]),
  32332. _: 1
  32333. })
  32334. ], 10, _hoisted_2$p)) : createCommentVNode("v-if", true),
  32335. createBaseVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  32336. ], 2),
  32337. createVNode(MonthTable, {
  32338. "selection-mode": "range",
  32339. date: leftDate.value,
  32340. "min-date": unref(minDate),
  32341. "max-date": unref(maxDate),
  32342. "range-state": unref(rangeState),
  32343. "disabled-date": unref(disabledDate2),
  32344. onChangerange: unref(handleChangeRange),
  32345. onPick: handleRangePick,
  32346. onSelect: unref(onSelect)
  32347. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  32348. ], 2),
  32349. createBaseVNode("div", {
  32350. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  32351. }, [
  32352. createBaseVNode("div", {
  32353. class: normalizeClass(unref(drpNs).e("header"))
  32354. }, [
  32355. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  32356. key: 0,
  32357. type: "button",
  32358. disabled: !unref(enableYearArrow),
  32359. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
  32360. onClick: _cache[2] || (_cache[2] = (...args) => unref(rightPrevYear) && unref(rightPrevYear)(...args))
  32361. }, [
  32362. createVNode(unref(ElIcon), null, {
  32363. default: withCtx(() => [
  32364. createVNode(unref(d_arrow_left_default))
  32365. ]),
  32366. _: 1
  32367. })
  32368. ], 10, _hoisted_3$c)) : createCommentVNode("v-if", true),
  32369. createBaseVNode("button", {
  32370. type: "button",
  32371. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  32372. onClick: _cache[3] || (_cache[3] = (...args) => unref(rightNextYear) && unref(rightNextYear)(...args))
  32373. }, [
  32374. createVNode(unref(ElIcon), null, {
  32375. default: withCtx(() => [
  32376. createVNode(unref(d_arrow_right_default))
  32377. ]),
  32378. _: 1
  32379. })
  32380. ], 2),
  32381. createBaseVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  32382. ], 2),
  32383. createVNode(MonthTable, {
  32384. "selection-mode": "range",
  32385. date: rightDate.value,
  32386. "min-date": unref(minDate),
  32387. "max-date": unref(maxDate),
  32388. "range-state": unref(rangeState),
  32389. "disabled-date": unref(disabledDate2),
  32390. onChangerange: unref(handleChangeRange),
  32391. onPick: handleRangePick,
  32392. onSelect: unref(onSelect)
  32393. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  32394. ], 2)
  32395. ], 2)
  32396. ], 2)
  32397. ], 2);
  32398. };
  32399. }
  32400. });
  32401. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$1l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
  32402. const getPanel = function(type2) {
  32403. switch (type2) {
  32404. case "daterange":
  32405. case "datetimerange": {
  32406. return DateRangePickPanel;
  32407. }
  32408. case "monthrange": {
  32409. return MonthRangePickPanel;
  32410. }
  32411. default: {
  32412. return DatePickPanel;
  32413. }
  32414. }
  32415. };
  32416. dayjs.extend(localeData);
  32417. dayjs.extend(advancedFormat);
  32418. dayjs.extend(customParseFormat);
  32419. dayjs.extend(weekOfYear);
  32420. dayjs.extend(weekYear);
  32421. dayjs.extend(dayOfYear);
  32422. dayjs.extend(isSameOrAfter);
  32423. dayjs.extend(isSameOrBefore);
  32424. var DatePicker = /* @__PURE__ */ defineComponent({
  32425. name: "ElDatePicker",
  32426. install: null,
  32427. props: datePickerProps,
  32428. emits: ["update:modelValue"],
  32429. setup(props, {
  32430. expose,
  32431. emit: emit2,
  32432. slots
  32433. }) {
  32434. const ns = useNamespace("picker-panel");
  32435. provide("ElPopperOptions", reactive(toRef(props, "popperOptions")));
  32436. provide(ROOT_PICKER_INJECTION_KEY, {
  32437. slots,
  32438. pickerNs: ns
  32439. });
  32440. const commonPicker = ref();
  32441. const refProps = {
  32442. focus: (focusStartInput = true) => {
  32443. var _a2;
  32444. (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
  32445. },
  32446. handleOpen: () => {
  32447. var _a2;
  32448. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleOpen();
  32449. },
  32450. handleClose: () => {
  32451. var _a2;
  32452. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleClose();
  32453. }
  32454. };
  32455. expose(refProps);
  32456. const onModelValueUpdated = (val) => {
  32457. emit2("update:modelValue", val);
  32458. };
  32459. return () => {
  32460. var _a2;
  32461. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  32462. const Component = getPanel(props.type);
  32463. return createVNode(CommonPicker, mergeProps(props, {
  32464. "format": format2,
  32465. "type": props.type,
  32466. "ref": commonPicker,
  32467. "onUpdate:modelValue": onModelValueUpdated
  32468. }), {
  32469. default: (scopedProps) => createVNode(Component, scopedProps, null),
  32470. "range-separator": slots["range-separator"]
  32471. });
  32472. };
  32473. }
  32474. });
  32475. const _DatePicker = DatePicker;
  32476. _DatePicker.install = (app) => {
  32477. app.component(_DatePicker.name, _DatePicker);
  32478. };
  32479. const ElDatePicker = _DatePicker;
  32480. const descriptionsKey = Symbol("elDescriptions");
  32481. var ElDescriptionsCell = /* @__PURE__ */ defineComponent({
  32482. name: "ElDescriptionsCell",
  32483. props: {
  32484. cell: {
  32485. type: Object
  32486. },
  32487. tag: {
  32488. type: String,
  32489. default: "td"
  32490. },
  32491. type: {
  32492. type: String
  32493. }
  32494. },
  32495. setup() {
  32496. const descriptions = inject(descriptionsKey, {});
  32497. return {
  32498. descriptions
  32499. };
  32500. },
  32501. render() {
  32502. var _a2, _b, _c, _d, _e, _f, _g;
  32503. const item = getNormalizedProps(this.cell);
  32504. const directives = (((_a2 = this.cell) == null ? void 0 : _a2.dirs) || []).map((dire) => {
  32505. const { dir, arg, modifiers, value } = dire;
  32506. return [dir, value, arg, modifiers];
  32507. });
  32508. const { border, direction: direction2 } = this.descriptions;
  32509. const isVertical = direction2 === "vertical";
  32510. const label = ((_d = (_c = (_b = this.cell) == null ? void 0 : _b.children) == null ? void 0 : _c.label) == null ? void 0 : _d.call(_c)) || item.label;
  32511. const content = (_g = (_f = (_e = this.cell) == null ? void 0 : _e.children) == null ? void 0 : _f.default) == null ? void 0 : _g.call(_f);
  32512. const span = item.span;
  32513. const align = item.align ? `is-${item.align}` : "";
  32514. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  32515. const className = item.className;
  32516. const labelClassName = item.labelClassName;
  32517. const style = {
  32518. width: addUnit(item.width),
  32519. minWidth: addUnit(item.minWidth)
  32520. };
  32521. const ns = useNamespace("descriptions");
  32522. switch (this.type) {
  32523. case "label":
  32524. return withDirectives(h$1(this.tag, {
  32525. style,
  32526. class: [
  32527. ns.e("cell"),
  32528. ns.e("label"),
  32529. ns.is("bordered-label", border),
  32530. ns.is("vertical-label", isVertical),
  32531. labelAlign,
  32532. labelClassName
  32533. ],
  32534. colSpan: isVertical ? span : 1
  32535. }, label), directives);
  32536. case "content":
  32537. return withDirectives(h$1(this.tag, {
  32538. style,
  32539. class: [
  32540. ns.e("cell"),
  32541. ns.e("content"),
  32542. ns.is("bordered-content", border),
  32543. ns.is("vertical-content", isVertical),
  32544. align,
  32545. className
  32546. ],
  32547. colSpan: isVertical ? span : span * 2 - 1
  32548. }, content), directives);
  32549. default:
  32550. return withDirectives(h$1("td", {
  32551. style,
  32552. class: [ns.e("cell"), align],
  32553. colSpan: span
  32554. }, [
  32555. !isNil(label) ? h$1("span", {
  32556. class: [ns.e("label"), labelClassName]
  32557. }, label) : void 0,
  32558. h$1("span", {
  32559. class: [ns.e("content"), className]
  32560. }, content)
  32561. ]), directives);
  32562. }
  32563. }
  32564. });
  32565. const descriptionsRowProps = buildProps({
  32566. row: {
  32567. type: definePropType(Array),
  32568. default: () => []
  32569. }
  32570. });
  32571. const _hoisted_1$F = { key: 1 };
  32572. const __default__$R = /* @__PURE__ */ defineComponent({
  32573. name: "ElDescriptionsRow"
  32574. });
  32575. const _sfc_main$1k = /* @__PURE__ */ defineComponent({
  32576. ...__default__$R,
  32577. props: descriptionsRowProps,
  32578. setup(__props) {
  32579. const descriptions = inject(descriptionsKey, {});
  32580. return (_ctx, _cache) => {
  32581. return unref(descriptions).direction === "vertical" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  32582. createBaseVNode("tr", null, [
  32583. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  32584. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  32585. key: `tr1-${_index}`,
  32586. cell,
  32587. tag: "th",
  32588. type: "label"
  32589. }, null, 8, ["cell"]);
  32590. }), 128))
  32591. ]),
  32592. createBaseVNode("tr", null, [
  32593. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  32594. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  32595. key: `tr2-${_index}`,
  32596. cell,
  32597. tag: "td",
  32598. type: "content"
  32599. }, null, 8, ["cell"]);
  32600. }), 128))
  32601. ])
  32602. ], 64)) : (openBlock(), createElementBlock("tr", _hoisted_1$F, [
  32603. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  32604. return openBlock(), createElementBlock(Fragment, {
  32605. key: `tr3-${_index}`
  32606. }, [
  32607. unref(descriptions).border ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  32608. createVNode(unref(ElDescriptionsCell), {
  32609. cell,
  32610. tag: "td",
  32611. type: "label"
  32612. }, null, 8, ["cell"]),
  32613. createVNode(unref(ElDescriptionsCell), {
  32614. cell,
  32615. tag: "td",
  32616. type: "content"
  32617. }, null, 8, ["cell"])
  32618. ], 64)) : (openBlock(), createBlock(unref(ElDescriptionsCell), {
  32619. key: 1,
  32620. cell,
  32621. tag: "td",
  32622. type: "both"
  32623. }, null, 8, ["cell"]))
  32624. ], 64);
  32625. }), 128))
  32626. ]));
  32627. };
  32628. }
  32629. });
  32630. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc$1(_sfc_main$1k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/descriptions/src/descriptions-row.vue"]]);
  32631. const descriptionProps = buildProps({
  32632. border: {
  32633. type: Boolean,
  32634. default: false
  32635. },
  32636. column: {
  32637. type: Number,
  32638. default: 3
  32639. },
  32640. direction: {
  32641. type: String,
  32642. values: ["horizontal", "vertical"],
  32643. default: "horizontal"
  32644. },
  32645. size: useSizeProp,
  32646. title: {
  32647. type: String,
  32648. default: ""
  32649. },
  32650. extra: {
  32651. type: String,
  32652. default: ""
  32653. }
  32654. });
  32655. const __default__$Q = /* @__PURE__ */ defineComponent({
  32656. name: "ElDescriptions"
  32657. });
  32658. const _sfc_main$1j = /* @__PURE__ */ defineComponent({
  32659. ...__default__$Q,
  32660. props: descriptionProps,
  32661. setup(__props) {
  32662. const props = __props;
  32663. const ns = useNamespace("descriptions");
  32664. const descriptionsSize = useFormSize();
  32665. const slots = useSlots();
  32666. provide(descriptionsKey, props);
  32667. const descriptionKls = computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  32668. const filledNode = (node, span, count, isLast = false) => {
  32669. if (!node.props) {
  32670. node.props = {};
  32671. }
  32672. if (span > count) {
  32673. node.props.span = count;
  32674. }
  32675. if (isLast) {
  32676. node.props.span = span;
  32677. }
  32678. return node;
  32679. };
  32680. const getRows = () => {
  32681. if (!slots.default)
  32682. return [];
  32683. const children = flattedChildren(slots.default()).filter((node) => {
  32684. var _a2;
  32685. return ((_a2 = node == null ? void 0 : node.type) == null ? void 0 : _a2.name) === "ElDescriptionsItem";
  32686. });
  32687. const rows = [];
  32688. let temp = [];
  32689. let count = props.column;
  32690. let totalSpan = 0;
  32691. children.forEach((node, index2) => {
  32692. var _a2;
  32693. const span = ((_a2 = node.props) == null ? void 0 : _a2.span) || 1;
  32694. if (index2 < children.length - 1) {
  32695. totalSpan += span > count ? count : span;
  32696. }
  32697. if (index2 === children.length - 1) {
  32698. const lastSpan = props.column - totalSpan % props.column;
  32699. temp.push(filledNode(node, lastSpan, count, true));
  32700. rows.push(temp);
  32701. return;
  32702. }
  32703. if (span < count) {
  32704. count -= span;
  32705. temp.push(node);
  32706. } else {
  32707. temp.push(filledNode(node, span, count));
  32708. rows.push(temp);
  32709. count = props.column;
  32710. temp = [];
  32711. }
  32712. });
  32713. return rows;
  32714. };
  32715. return (_ctx, _cache) => {
  32716. return openBlock(), createElementBlock("div", {
  32717. class: normalizeClass(unref(descriptionKls))
  32718. }, [
  32719. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  32720. key: 0,
  32721. class: normalizeClass(unref(ns).e("header"))
  32722. }, [
  32723. createBaseVNode("div", {
  32724. class: normalizeClass(unref(ns).e("title"))
  32725. }, [
  32726. renderSlot(_ctx.$slots, "title", {}, () => [
  32727. createTextVNode(toDisplayString(_ctx.title), 1)
  32728. ])
  32729. ], 2),
  32730. createBaseVNode("div", {
  32731. class: normalizeClass(unref(ns).e("extra"))
  32732. }, [
  32733. renderSlot(_ctx.$slots, "extra", {}, () => [
  32734. createTextVNode(toDisplayString(_ctx.extra), 1)
  32735. ])
  32736. ], 2)
  32737. ], 2)) : createCommentVNode("v-if", true),
  32738. createBaseVNode("div", {
  32739. class: normalizeClass(unref(ns).e("body"))
  32740. }, [
  32741. createBaseVNode("table", {
  32742. class: normalizeClass([unref(ns).e("table"), unref(ns).is("bordered", _ctx.border)])
  32743. }, [
  32744. createBaseVNode("tbody", null, [
  32745. (openBlock(true), createElementBlock(Fragment, null, renderList(getRows(), (row, _index) => {
  32746. return openBlock(), createBlock(ElDescriptionsRow, {
  32747. key: _index,
  32748. row
  32749. }, null, 8, ["row"]);
  32750. }), 128))
  32751. ])
  32752. ], 2)
  32753. ], 2)
  32754. ], 2);
  32755. };
  32756. }
  32757. });
  32758. var Descriptions = /* @__PURE__ */ _export_sfc$1(_sfc_main$1j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/descriptions/src/description.vue"]]);
  32759. const descriptionItemProps = buildProps({
  32760. label: {
  32761. type: String,
  32762. default: ""
  32763. },
  32764. span: {
  32765. type: Number,
  32766. default: 1
  32767. },
  32768. width: {
  32769. type: [String, Number],
  32770. default: ""
  32771. },
  32772. minWidth: {
  32773. type: [String, Number],
  32774. default: ""
  32775. },
  32776. align: {
  32777. type: String,
  32778. default: "left"
  32779. },
  32780. labelAlign: {
  32781. type: String,
  32782. default: ""
  32783. },
  32784. className: {
  32785. type: String,
  32786. default: ""
  32787. },
  32788. labelClassName: {
  32789. type: String,
  32790. default: ""
  32791. }
  32792. });
  32793. const DescriptionItem = /* @__PURE__ */ defineComponent({
  32794. name: "ElDescriptionsItem",
  32795. props: descriptionItemProps
  32796. });
  32797. const ElDescriptions = withInstall(Descriptions, {
  32798. DescriptionsItem: DescriptionItem
  32799. });
  32800. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  32801. const overlayProps = buildProps({
  32802. mask: {
  32803. type: Boolean,
  32804. default: true
  32805. },
  32806. customMaskEvent: {
  32807. type: Boolean,
  32808. default: false
  32809. },
  32810. overlayClass: {
  32811. type: definePropType([
  32812. String,
  32813. Array,
  32814. Object
  32815. ])
  32816. },
  32817. zIndex: {
  32818. type: definePropType([String, Number])
  32819. }
  32820. });
  32821. const overlayEmits = {
  32822. click: (evt) => evt instanceof MouseEvent
  32823. };
  32824. const BLOCK = "overlay";
  32825. var Overlay$1 = /* @__PURE__ */ defineComponent({
  32826. name: "ElOverlay",
  32827. props: overlayProps,
  32828. emits: overlayEmits,
  32829. setup(props, { slots, emit: emit2 }) {
  32830. const ns = useNamespace(BLOCK);
  32831. const onMaskClick = (e) => {
  32832. emit2("click", e);
  32833. };
  32834. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  32835. return () => {
  32836. return props.mask ? createVNode("div", {
  32837. class: [ns.b(), props.overlayClass],
  32838. style: {
  32839. zIndex: props.zIndex
  32840. },
  32841. onClick,
  32842. onMousedown,
  32843. onMouseup
  32844. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  32845. class: props.overlayClass,
  32846. style: {
  32847. zIndex: props.zIndex,
  32848. position: "fixed",
  32849. top: "0px",
  32850. right: "0px",
  32851. bottom: "0px",
  32852. left: "0px"
  32853. }
  32854. }, [renderSlot(slots, "default")]);
  32855. };
  32856. }
  32857. });
  32858. const ElOverlay = Overlay$1;
  32859. const dialogInjectionKey = Symbol("dialogInjectionKey");
  32860. const dialogContentProps = buildProps({
  32861. center: Boolean,
  32862. alignCenter: Boolean,
  32863. closeIcon: {
  32864. type: iconPropType
  32865. },
  32866. customClass: {
  32867. type: String,
  32868. default: ""
  32869. },
  32870. draggable: Boolean,
  32871. fullscreen: Boolean,
  32872. showClose: {
  32873. type: Boolean,
  32874. default: true
  32875. },
  32876. title: {
  32877. type: String,
  32878. default: ""
  32879. },
  32880. ariaLevel: {
  32881. type: String,
  32882. default: "2"
  32883. }
  32884. });
  32885. const dialogContentEmits = {
  32886. close: () => true
  32887. };
  32888. const _hoisted_1$E = ["aria-level"];
  32889. const _hoisted_2$o = ["aria-label"];
  32890. const _hoisted_3$b = ["id"];
  32891. const __default__$P = /* @__PURE__ */ defineComponent({ name: "ElDialogContent" });
  32892. const _sfc_main$1i = /* @__PURE__ */ defineComponent({
  32893. ...__default__$P,
  32894. props: dialogContentProps,
  32895. emits: dialogContentEmits,
  32896. setup(__props) {
  32897. const props = __props;
  32898. const { t } = useLocale();
  32899. const { Close } = CloseComponents;
  32900. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  32901. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  32902. const dialogKls = computed(() => [
  32903. ns.b(),
  32904. ns.is("fullscreen", props.fullscreen),
  32905. ns.is("draggable", props.draggable),
  32906. ns.is("align-center", props.alignCenter),
  32907. { [ns.m("center")]: props.center },
  32908. props.customClass
  32909. ]);
  32910. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  32911. const draggable2 = computed(() => props.draggable);
  32912. useDraggable(dialogRef, headerRef, draggable2);
  32913. return (_ctx, _cache) => {
  32914. return openBlock(), createElementBlock("div", {
  32915. ref: unref(composedDialogRef),
  32916. class: normalizeClass(unref(dialogKls)),
  32917. style: normalizeStyle(unref(style)),
  32918. tabindex: "-1"
  32919. }, [
  32920. createBaseVNode("header", {
  32921. ref_key: "headerRef",
  32922. ref: headerRef,
  32923. class: normalizeClass(unref(ns).e("header"))
  32924. }, [
  32925. renderSlot(_ctx.$slots, "header", {}, () => [
  32926. createBaseVNode("span", {
  32927. role: "heading",
  32928. "aria-level": _ctx.ariaLevel,
  32929. class: normalizeClass(unref(ns).e("title"))
  32930. }, toDisplayString(_ctx.title), 11, _hoisted_1$E)
  32931. ]),
  32932. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  32933. key: 0,
  32934. "aria-label": unref(t)("el.dialog.close"),
  32935. class: normalizeClass(unref(ns).e("headerbtn")),
  32936. type: "button",
  32937. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  32938. }, [
  32939. createVNode(unref(ElIcon), {
  32940. class: normalizeClass(unref(ns).e("close"))
  32941. }, {
  32942. default: withCtx(() => [
  32943. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  32944. ]),
  32945. _: 1
  32946. }, 8, ["class"])
  32947. ], 10, _hoisted_2$o)) : createCommentVNode("v-if", true)
  32948. ], 2),
  32949. createBaseVNode("div", {
  32950. id: unref(bodyId),
  32951. class: normalizeClass(unref(ns).e("body"))
  32952. }, [
  32953. renderSlot(_ctx.$slots, "default")
  32954. ], 10, _hoisted_3$b),
  32955. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  32956. key: 0,
  32957. class: normalizeClass(unref(ns).e("footer"))
  32958. }, [
  32959. renderSlot(_ctx.$slots, "footer")
  32960. ], 2)) : createCommentVNode("v-if", true)
  32961. ], 6);
  32962. };
  32963. }
  32964. });
  32965. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$1i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  32966. const dialogProps = buildProps({
  32967. ...dialogContentProps,
  32968. appendToBody: Boolean,
  32969. appendTo: {
  32970. type: definePropType(String),
  32971. default: "body"
  32972. },
  32973. beforeClose: {
  32974. type: definePropType(Function)
  32975. },
  32976. destroyOnClose: Boolean,
  32977. closeOnClickModal: {
  32978. type: Boolean,
  32979. default: true
  32980. },
  32981. closeOnPressEscape: {
  32982. type: Boolean,
  32983. default: true
  32984. },
  32985. lockScroll: {
  32986. type: Boolean,
  32987. default: true
  32988. },
  32989. modal: {
  32990. type: Boolean,
  32991. default: true
  32992. },
  32993. openDelay: {
  32994. type: Number,
  32995. default: 0
  32996. },
  32997. closeDelay: {
  32998. type: Number,
  32999. default: 0
  33000. },
  33001. top: {
  33002. type: String
  33003. },
  33004. modelValue: Boolean,
  33005. modalClass: String,
  33006. width: {
  33007. type: [String, Number]
  33008. },
  33009. zIndex: {
  33010. type: Number
  33011. },
  33012. trapFocus: {
  33013. type: Boolean,
  33014. default: false
  33015. },
  33016. headerAriaLevel: {
  33017. type: String,
  33018. default: "2"
  33019. }
  33020. });
  33021. const dialogEmits = {
  33022. open: () => true,
  33023. opened: () => true,
  33024. close: () => true,
  33025. closed: () => true,
  33026. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  33027. openAutoFocus: () => true,
  33028. closeAutoFocus: () => true
  33029. };
  33030. const useDialog = (props, targetRef) => {
  33031. var _a2;
  33032. const instance = getCurrentInstance();
  33033. const emit2 = instance.emit;
  33034. const { nextZIndex } = useZIndex();
  33035. let lastPosition = "";
  33036. const titleId = useId();
  33037. const bodyId = useId();
  33038. const visible = ref(false);
  33039. const closed = ref(false);
  33040. const rendered = ref(false);
  33041. const zIndex2 = ref((_a2 = props.zIndex) != null ? _a2 : nextZIndex());
  33042. let openTimer = void 0;
  33043. let closeTimer = void 0;
  33044. const namespace = useGlobalConfig("namespace", defaultNamespace);
  33045. const style = computed(() => {
  33046. const style2 = {};
  33047. const varPrefix = `--${namespace.value}-dialog`;
  33048. if (!props.fullscreen) {
  33049. if (props.top) {
  33050. style2[`${varPrefix}-margin-top`] = props.top;
  33051. }
  33052. if (props.width) {
  33053. style2[`${varPrefix}-width`] = addUnit(props.width);
  33054. }
  33055. }
  33056. return style2;
  33057. });
  33058. const overlayDialogStyle = computed(() => {
  33059. if (props.alignCenter) {
  33060. return { display: "flex" };
  33061. }
  33062. return {};
  33063. });
  33064. function afterEnter() {
  33065. emit2("opened");
  33066. }
  33067. function afterLeave() {
  33068. emit2("closed");
  33069. emit2(UPDATE_MODEL_EVENT, false);
  33070. if (props.destroyOnClose) {
  33071. rendered.value = false;
  33072. }
  33073. }
  33074. function beforeLeave() {
  33075. emit2("close");
  33076. }
  33077. function open() {
  33078. closeTimer == null ? void 0 : closeTimer();
  33079. openTimer == null ? void 0 : openTimer();
  33080. if (props.openDelay && props.openDelay > 0) {
  33081. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  33082. } else {
  33083. doOpen();
  33084. }
  33085. }
  33086. function close2() {
  33087. openTimer == null ? void 0 : openTimer();
  33088. closeTimer == null ? void 0 : closeTimer();
  33089. if (props.closeDelay && props.closeDelay > 0) {
  33090. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  33091. } else {
  33092. doClose();
  33093. }
  33094. }
  33095. function handleClose() {
  33096. function hide(shouldCancel) {
  33097. if (shouldCancel)
  33098. return;
  33099. closed.value = true;
  33100. visible.value = false;
  33101. }
  33102. if (props.beforeClose) {
  33103. props.beforeClose(hide);
  33104. } else {
  33105. close2();
  33106. }
  33107. }
  33108. function onModalClick() {
  33109. if (props.closeOnClickModal) {
  33110. handleClose();
  33111. }
  33112. }
  33113. function doOpen() {
  33114. if (!isClient)
  33115. return;
  33116. visible.value = true;
  33117. }
  33118. function doClose() {
  33119. visible.value = false;
  33120. }
  33121. function onOpenAutoFocus() {
  33122. emit2("openAutoFocus");
  33123. }
  33124. function onCloseAutoFocus() {
  33125. emit2("closeAutoFocus");
  33126. }
  33127. function onFocusoutPrevented(event) {
  33128. var _a22;
  33129. if (((_a22 = event.detail) == null ? void 0 : _a22.focusReason) === "pointer") {
  33130. event.preventDefault();
  33131. }
  33132. }
  33133. if (props.lockScroll) {
  33134. useLockscreen(visible);
  33135. }
  33136. function onCloseRequested() {
  33137. if (props.closeOnPressEscape) {
  33138. handleClose();
  33139. }
  33140. }
  33141. watch(() => props.modelValue, (val) => {
  33142. if (val) {
  33143. closed.value = false;
  33144. open();
  33145. rendered.value = true;
  33146. zIndex2.value = isUndefined$1(props.zIndex) ? nextZIndex() : zIndex2.value++;
  33147. nextTick(() => {
  33148. emit2("open");
  33149. if (targetRef.value) {
  33150. targetRef.value.scrollTop = 0;
  33151. }
  33152. });
  33153. } else {
  33154. if (visible.value) {
  33155. close2();
  33156. }
  33157. }
  33158. });
  33159. watch(() => props.fullscreen, (val) => {
  33160. if (!targetRef.value)
  33161. return;
  33162. if (val) {
  33163. lastPosition = targetRef.value.style.transform;
  33164. targetRef.value.style.transform = "";
  33165. } else {
  33166. targetRef.value.style.transform = lastPosition;
  33167. }
  33168. });
  33169. onMounted(() => {
  33170. if (props.modelValue) {
  33171. visible.value = true;
  33172. rendered.value = true;
  33173. open();
  33174. }
  33175. });
  33176. return {
  33177. afterEnter,
  33178. afterLeave,
  33179. beforeLeave,
  33180. handleClose,
  33181. onModalClick,
  33182. close: close2,
  33183. doClose,
  33184. onOpenAutoFocus,
  33185. onCloseAutoFocus,
  33186. onCloseRequested,
  33187. onFocusoutPrevented,
  33188. titleId,
  33189. bodyId,
  33190. closed,
  33191. style,
  33192. overlayDialogStyle,
  33193. rendered,
  33194. visible,
  33195. zIndex: zIndex2
  33196. };
  33197. };
  33198. const _hoisted_1$D = ["aria-label", "aria-labelledby", "aria-describedby"];
  33199. const __default__$O = /* @__PURE__ */ defineComponent({
  33200. name: "ElDialog",
  33201. inheritAttrs: false
  33202. });
  33203. const _sfc_main$1h = /* @__PURE__ */ defineComponent({
  33204. ...__default__$O,
  33205. props: dialogProps,
  33206. emits: dialogEmits,
  33207. setup(__props, { expose }) {
  33208. const props = __props;
  33209. const slots = useSlots();
  33210. useDeprecated({
  33211. scope: "el-dialog",
  33212. from: "the title slot",
  33213. replacement: "the header slot",
  33214. version: "3.0.0",
  33215. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  33216. }, computed(() => !!slots.title));
  33217. useDeprecated({
  33218. scope: "el-dialog",
  33219. from: "custom-class",
  33220. replacement: "class",
  33221. version: "2.3.0",
  33222. ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
  33223. type: "Attribute"
  33224. }, computed(() => !!props.customClass));
  33225. const ns = useNamespace("dialog");
  33226. const dialogRef = ref();
  33227. const headerRef = ref();
  33228. const dialogContentRef = ref();
  33229. const {
  33230. visible,
  33231. titleId,
  33232. bodyId,
  33233. style,
  33234. overlayDialogStyle,
  33235. rendered,
  33236. zIndex: zIndex2,
  33237. afterEnter,
  33238. afterLeave,
  33239. beforeLeave,
  33240. handleClose,
  33241. onModalClick,
  33242. onOpenAutoFocus,
  33243. onCloseAutoFocus,
  33244. onCloseRequested,
  33245. onFocusoutPrevented
  33246. } = useDialog(props, dialogRef);
  33247. provide(dialogInjectionKey, {
  33248. dialogRef,
  33249. headerRef,
  33250. bodyId,
  33251. ns,
  33252. rendered,
  33253. style
  33254. });
  33255. const overlayEvent = useSameTarget(onModalClick);
  33256. const draggable2 = computed(() => props.draggable && !props.fullscreen);
  33257. expose({
  33258. visible,
  33259. dialogContentRef
  33260. });
  33261. return (_ctx, _cache) => {
  33262. return openBlock(), createBlock(Teleport, {
  33263. to: _ctx.appendTo,
  33264. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  33265. }, [
  33266. createVNode(Transition, {
  33267. name: "dialog-fade",
  33268. onAfterEnter: unref(afterEnter),
  33269. onAfterLeave: unref(afterLeave),
  33270. onBeforeLeave: unref(beforeLeave),
  33271. persisted: ""
  33272. }, {
  33273. default: withCtx(() => [
  33274. withDirectives(createVNode(unref(ElOverlay), {
  33275. "custom-mask-event": "",
  33276. mask: _ctx.modal,
  33277. "overlay-class": _ctx.modalClass,
  33278. "z-index": unref(zIndex2)
  33279. }, {
  33280. default: withCtx(() => [
  33281. createBaseVNode("div", {
  33282. role: "dialog",
  33283. "aria-modal": "true",
  33284. "aria-label": _ctx.title || void 0,
  33285. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  33286. "aria-describedby": unref(bodyId),
  33287. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  33288. style: normalizeStyle(unref(overlayDialogStyle)),
  33289. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  33290. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  33291. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  33292. }, [
  33293. createVNode(unref(ElFocusTrap), {
  33294. loop: "",
  33295. trapped: unref(visible),
  33296. "focus-start-el": "container",
  33297. onFocusAfterTrapped: unref(onOpenAutoFocus),
  33298. onFocusAfterReleased: unref(onCloseAutoFocus),
  33299. onFocusoutPrevented: unref(onFocusoutPrevented),
  33300. onReleaseRequested: unref(onCloseRequested)
  33301. }, {
  33302. default: withCtx(() => [
  33303. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
  33304. key: 0,
  33305. ref_key: "dialogContentRef",
  33306. ref: dialogContentRef
  33307. }, _ctx.$attrs, {
  33308. "custom-class": _ctx.customClass,
  33309. center: _ctx.center,
  33310. "align-center": _ctx.alignCenter,
  33311. "close-icon": _ctx.closeIcon,
  33312. draggable: unref(draggable2),
  33313. fullscreen: _ctx.fullscreen,
  33314. "show-close": _ctx.showClose,
  33315. title: _ctx.title,
  33316. "aria-level": _ctx.headerAriaLevel,
  33317. onClose: unref(handleClose)
  33318. }), createSlots({
  33319. header: withCtx(() => [
  33320. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  33321. key: 0,
  33322. close: unref(handleClose),
  33323. titleId: unref(titleId),
  33324. titleClass: unref(ns).e("title")
  33325. }) : renderSlot(_ctx.$slots, "title", { key: 1 })
  33326. ]),
  33327. default: withCtx(() => [
  33328. renderSlot(_ctx.$slots, "default")
  33329. ]),
  33330. _: 2
  33331. }, [
  33332. _ctx.$slots.footer ? {
  33333. name: "footer",
  33334. fn: withCtx(() => [
  33335. renderSlot(_ctx.$slots, "footer")
  33336. ])
  33337. } : void 0
  33338. ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : createCommentVNode("v-if", true)
  33339. ]),
  33340. _: 3
  33341. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  33342. ], 46, _hoisted_1$D)
  33343. ]),
  33344. _: 3
  33345. }, 8, ["mask", "overlay-class", "z-index"]), [
  33346. [vShow, unref(visible)]
  33347. ])
  33348. ]),
  33349. _: 3
  33350. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  33351. ], 8, ["to", "disabled"]);
  33352. };
  33353. }
  33354. });
  33355. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$1h, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  33356. const ElDialog = withInstall(Dialog);
  33357. const dividerProps = buildProps({
  33358. direction: {
  33359. type: String,
  33360. values: ["horizontal", "vertical"],
  33361. default: "horizontal"
  33362. },
  33363. contentPosition: {
  33364. type: String,
  33365. values: ["left", "center", "right"],
  33366. default: "center"
  33367. },
  33368. borderStyle: {
  33369. type: definePropType(String),
  33370. default: "solid"
  33371. }
  33372. });
  33373. const __default__$N = /* @__PURE__ */ defineComponent({
  33374. name: "ElDivider"
  33375. });
  33376. const _sfc_main$1g = /* @__PURE__ */ defineComponent({
  33377. ...__default__$N,
  33378. props: dividerProps,
  33379. setup(__props) {
  33380. const props = __props;
  33381. const ns = useNamespace("divider");
  33382. const dividerStyle = computed(() => {
  33383. return ns.cssVar({
  33384. "border-style": props.borderStyle
  33385. });
  33386. });
  33387. return (_ctx, _cache) => {
  33388. return openBlock(), createElementBlock("div", {
  33389. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  33390. style: normalizeStyle(unref(dividerStyle)),
  33391. role: "separator"
  33392. }, [
  33393. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  33394. key: 0,
  33395. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  33396. }, [
  33397. renderSlot(_ctx.$slots, "default")
  33398. ], 2)) : createCommentVNode("v-if", true)
  33399. ], 6);
  33400. };
  33401. }
  33402. });
  33403. var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$1g, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
  33404. const ElDivider = withInstall(Divider);
  33405. const drawerProps = buildProps({
  33406. ...dialogProps,
  33407. direction: {
  33408. type: String,
  33409. default: "rtl",
  33410. values: ["ltr", "rtl", "ttb", "btt"]
  33411. },
  33412. size: {
  33413. type: [String, Number],
  33414. default: "30%"
  33415. },
  33416. withHeader: {
  33417. type: Boolean,
  33418. default: true
  33419. },
  33420. modalFade: {
  33421. type: Boolean,
  33422. default: true
  33423. },
  33424. headerAriaLevel: {
  33425. type: String,
  33426. default: "2"
  33427. }
  33428. });
  33429. const drawerEmits = dialogEmits;
  33430. const _sfc_main$1f = /* @__PURE__ */ defineComponent({
  33431. name: "ElDrawer",
  33432. components: {
  33433. ElOverlay,
  33434. ElFocusTrap,
  33435. ElIcon,
  33436. Close: close_default
  33437. },
  33438. inheritAttrs: false,
  33439. props: drawerProps,
  33440. emits: drawerEmits,
  33441. setup(props, { slots }) {
  33442. useDeprecated({
  33443. scope: "el-drawer",
  33444. from: "the title slot",
  33445. replacement: "the header slot",
  33446. version: "3.0.0",
  33447. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  33448. }, computed(() => !!slots.title));
  33449. useDeprecated({
  33450. scope: "el-drawer",
  33451. from: "custom-class",
  33452. replacement: "class",
  33453. version: "2.3.0",
  33454. ref: "https://element-plus.org/en-US/component/drawer.html#attributes",
  33455. type: "Attribute"
  33456. }, computed(() => !!props.customClass));
  33457. const drawerRef = ref();
  33458. const focusStartRef = ref();
  33459. const ns = useNamespace("drawer");
  33460. const { t } = useLocale();
  33461. const isHorizontal2 = computed(() => props.direction === "rtl" || props.direction === "ltr");
  33462. const drawerSize = computed(() => addUnit(props.size));
  33463. return {
  33464. ...useDialog(props, drawerRef),
  33465. drawerRef,
  33466. focusStartRef,
  33467. isHorizontal: isHorizontal2,
  33468. drawerSize,
  33469. ns,
  33470. t
  33471. };
  33472. }
  33473. });
  33474. const _hoisted_1$C = ["aria-label", "aria-labelledby", "aria-describedby"];
  33475. const _hoisted_2$n = ["id", "aria-level"];
  33476. const _hoisted_3$a = ["aria-label"];
  33477. const _hoisted_4$7 = ["id"];
  33478. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  33479. const _component_close = resolveComponent("close");
  33480. const _component_el_icon = resolveComponent("el-icon");
  33481. const _component_el_focus_trap = resolveComponent("el-focus-trap");
  33482. const _component_el_overlay = resolveComponent("el-overlay");
  33483. return openBlock(), createBlock(Teleport, {
  33484. to: "body",
  33485. disabled: !_ctx.appendToBody
  33486. }, [
  33487. createVNode(Transition, {
  33488. name: _ctx.ns.b("fade"),
  33489. onAfterEnter: _ctx.afterEnter,
  33490. onAfterLeave: _ctx.afterLeave,
  33491. onBeforeLeave: _ctx.beforeLeave,
  33492. persisted: ""
  33493. }, {
  33494. default: withCtx(() => [
  33495. withDirectives(createVNode(_component_el_overlay, {
  33496. mask: _ctx.modal,
  33497. "overlay-class": _ctx.modalClass,
  33498. "z-index": _ctx.zIndex,
  33499. onClick: _ctx.onModalClick
  33500. }, {
  33501. default: withCtx(() => [
  33502. createVNode(_component_el_focus_trap, {
  33503. loop: "",
  33504. trapped: _ctx.visible,
  33505. "focus-trap-el": _ctx.drawerRef,
  33506. "focus-start-el": _ctx.focusStartRef,
  33507. onReleaseRequested: _ctx.onCloseRequested
  33508. }, {
  33509. default: withCtx(() => [
  33510. createBaseVNode("div", mergeProps({
  33511. ref: "drawerRef",
  33512. "aria-modal": "true",
  33513. "aria-label": _ctx.title || void 0,
  33514. "aria-labelledby": !_ctx.title ? _ctx.titleId : void 0,
  33515. "aria-describedby": _ctx.bodyId
  33516. }, _ctx.$attrs, {
  33517. class: [_ctx.ns.b(), _ctx.direction, _ctx.visible && "open", _ctx.customClass],
  33518. style: _ctx.isHorizontal ? "width: " + _ctx.drawerSize : "height: " + _ctx.drawerSize,
  33519. role: "dialog",
  33520. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  33521. }, ["stop"]))
  33522. }), [
  33523. createBaseVNode("span", {
  33524. ref: "focusStartRef",
  33525. class: normalizeClass(_ctx.ns.e("sr-focus")),
  33526. tabindex: "-1"
  33527. }, null, 2),
  33528. _ctx.withHeader ? (openBlock(), createElementBlock("header", {
  33529. key: 0,
  33530. class: normalizeClass(_ctx.ns.e("header"))
  33531. }, [
  33532. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  33533. key: 0,
  33534. close: _ctx.handleClose,
  33535. titleId: _ctx.titleId,
  33536. titleClass: _ctx.ns.e("title")
  33537. }, () => [
  33538. !_ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  33539. key: 0,
  33540. id: _ctx.titleId,
  33541. role: "heading",
  33542. "aria-level": _ctx.headerAriaLevel,
  33543. class: normalizeClass(_ctx.ns.e("title"))
  33544. }, toDisplayString(_ctx.title), 11, _hoisted_2$n)) : createCommentVNode("v-if", true)
  33545. ]) : renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  33546. createCommentVNode(" DEPRECATED SLOT ")
  33547. ]),
  33548. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  33549. key: 2,
  33550. "aria-label": _ctx.t("el.drawer.close"),
  33551. class: normalizeClass(_ctx.ns.e("close-btn")),
  33552. type: "button",
  33553. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClose && _ctx.handleClose(...args))
  33554. }, [
  33555. createVNode(_component_el_icon, {
  33556. class: normalizeClass(_ctx.ns.e("close"))
  33557. }, {
  33558. default: withCtx(() => [
  33559. createVNode(_component_close)
  33560. ]),
  33561. _: 1
  33562. }, 8, ["class"])
  33563. ], 10, _hoisted_3$a)) : createCommentVNode("v-if", true)
  33564. ], 2)) : createCommentVNode("v-if", true),
  33565. _ctx.rendered ? (openBlock(), createElementBlock("div", {
  33566. key: 1,
  33567. id: _ctx.bodyId,
  33568. class: normalizeClass(_ctx.ns.e("body"))
  33569. }, [
  33570. renderSlot(_ctx.$slots, "default")
  33571. ], 10, _hoisted_4$7)) : createCommentVNode("v-if", true),
  33572. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  33573. key: 2,
  33574. class: normalizeClass(_ctx.ns.e("footer"))
  33575. }, [
  33576. renderSlot(_ctx.$slots, "footer")
  33577. ], 2)) : createCommentVNode("v-if", true)
  33578. ], 16, _hoisted_1$C)
  33579. ]),
  33580. _: 3
  33581. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  33582. ]),
  33583. _: 3
  33584. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  33585. [vShow, _ctx.visible]
  33586. ])
  33587. ]),
  33588. _: 3
  33589. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  33590. ], 8, ["disabled"]);
  33591. }
  33592. var Drawer = /* @__PURE__ */ _export_sfc$1(_sfc_main$1f, [["render", _sfc_render$o], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/drawer/src/drawer.vue"]]);
  33593. const ElDrawer = withInstall(Drawer);
  33594. const _sfc_main$1e = /* @__PURE__ */ defineComponent({
  33595. inheritAttrs: false
  33596. });
  33597. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  33598. return renderSlot(_ctx.$slots, "default");
  33599. }
  33600. var Collection = /* @__PURE__ */ _export_sfc$1(_sfc_main$1e, [["render", _sfc_render$n], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/collection/src/collection.vue"]]);
  33601. const _sfc_main$1d = /* @__PURE__ */ defineComponent({
  33602. name: "ElCollectionItem",
  33603. inheritAttrs: false
  33604. });
  33605. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  33606. return renderSlot(_ctx.$slots, "default");
  33607. }
  33608. var CollectionItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$1d, [["render", _sfc_render$m], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/collection/src/collection-item.vue"]]);
  33609. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  33610. const createCollectionWithScope = (name) => {
  33611. const COLLECTION_NAME = `El${name}Collection`;
  33612. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  33613. const COLLECTION_INJECTION_KEY2 = Symbol(COLLECTION_NAME);
  33614. const COLLECTION_ITEM_INJECTION_KEY2 = Symbol(COLLECTION_ITEM_NAME);
  33615. const ElCollection2 = {
  33616. ...Collection,
  33617. name: COLLECTION_NAME,
  33618. setup() {
  33619. const collectionRef = ref(null);
  33620. const itemMap = /* @__PURE__ */ new Map();
  33621. const getItems = () => {
  33622. const collectionEl = unref(collectionRef);
  33623. if (!collectionEl)
  33624. return [];
  33625. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  33626. const items = [...itemMap.values()];
  33627. return items.sort((a2, b2) => orderedNodes.indexOf(a2.ref) - orderedNodes.indexOf(b2.ref));
  33628. };
  33629. provide(COLLECTION_INJECTION_KEY2, {
  33630. itemMap,
  33631. getItems,
  33632. collectionRef
  33633. });
  33634. }
  33635. };
  33636. const ElCollectionItem2 = {
  33637. ...CollectionItem,
  33638. name: COLLECTION_ITEM_NAME,
  33639. setup(_2, { attrs }) {
  33640. const collectionItemRef = ref(null);
  33641. const collectionInjection = inject(COLLECTION_INJECTION_KEY2, void 0);
  33642. provide(COLLECTION_ITEM_INJECTION_KEY2, {
  33643. collectionItemRef
  33644. });
  33645. onMounted(() => {
  33646. const collectionItemEl = unref(collectionItemRef);
  33647. if (collectionItemEl) {
  33648. collectionInjection.itemMap.set(collectionItemEl, {
  33649. ref: collectionItemEl,
  33650. ...attrs
  33651. });
  33652. }
  33653. });
  33654. onBeforeUnmount(() => {
  33655. const collectionItemEl = unref(collectionItemRef);
  33656. collectionInjection.itemMap.delete(collectionItemEl);
  33657. });
  33658. }
  33659. };
  33660. return {
  33661. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY2,
  33662. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY2,
  33663. ElCollection: ElCollection2,
  33664. ElCollectionItem: ElCollectionItem2
  33665. };
  33666. };
  33667. const rovingFocusGroupProps = buildProps({
  33668. style: { type: definePropType([String, Array, Object]) },
  33669. currentTabId: {
  33670. type: definePropType(String)
  33671. },
  33672. defaultCurrentTabId: String,
  33673. loop: Boolean,
  33674. dir: {
  33675. type: String,
  33676. values: ["ltr", "rtl"],
  33677. default: "ltr"
  33678. },
  33679. orientation: {
  33680. type: definePropType(String)
  33681. },
  33682. onBlur: Function,
  33683. onFocus: Function,
  33684. onMousedown: Function
  33685. });
  33686. const {
  33687. ElCollection: ElCollection$1,
  33688. ElCollectionItem: ElCollectionItem$1,
  33689. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  33690. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  33691. } = createCollectionWithScope("RovingFocusGroup");
  33692. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  33693. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  33694. const MAP_KEY_TO_FOCUS_INTENT = {
  33695. ArrowLeft: "prev",
  33696. ArrowUp: "prev",
  33697. ArrowRight: "next",
  33698. ArrowDown: "next",
  33699. PageUp: "first",
  33700. Home: "first",
  33701. PageDown: "last",
  33702. End: "last"
  33703. };
  33704. const getDirectionAwareKey = (key, dir) => {
  33705. if (dir !== "rtl")
  33706. return key;
  33707. switch (key) {
  33708. case EVENT_CODE.right:
  33709. return EVENT_CODE.left;
  33710. case EVENT_CODE.left:
  33711. return EVENT_CODE.right;
  33712. default:
  33713. return key;
  33714. }
  33715. };
  33716. const getFocusIntent = (event, orientation, dir) => {
  33717. const key = getDirectionAwareKey(event.key, dir);
  33718. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  33719. return void 0;
  33720. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  33721. return void 0;
  33722. return MAP_KEY_TO_FOCUS_INTENT[key];
  33723. };
  33724. const reorderArray = (array2, atIdx) => {
  33725. return array2.map((_2, idx) => array2[(idx + atIdx) % array2.length]);
  33726. };
  33727. const focusFirst = (elements) => {
  33728. const { activeElement: prevActive } = document;
  33729. for (const element of elements) {
  33730. if (element === prevActive)
  33731. return;
  33732. element.focus();
  33733. if (prevActive !== document.activeElement)
  33734. return;
  33735. }
  33736. };
  33737. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  33738. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  33739. const EVT_OPTS = { bubbles: false, cancelable: true };
  33740. const _sfc_main$1c = /* @__PURE__ */ defineComponent({
  33741. name: "ElRovingFocusGroupImpl",
  33742. inheritAttrs: false,
  33743. props: rovingFocusGroupProps,
  33744. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  33745. setup(props, { emit: emit2 }) {
  33746. var _a2;
  33747. const currentTabbedId = ref((_a2 = props.currentTabId || props.defaultCurrentTabId) != null ? _a2 : null);
  33748. const isBackingOut = ref(false);
  33749. const isClickFocus = ref(false);
  33750. const rovingFocusGroupRef = ref(null);
  33751. const { getItems } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  33752. const rovingFocusGroupRootStyle = computed(() => {
  33753. return [
  33754. {
  33755. outline: "none"
  33756. },
  33757. props.style
  33758. ];
  33759. });
  33760. const onItemFocus = (tabbedId) => {
  33761. emit2(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  33762. };
  33763. const onItemShiftTab = () => {
  33764. isBackingOut.value = true;
  33765. };
  33766. const onMousedown = composeEventHandlers((e) => {
  33767. var _a22;
  33768. (_a22 = props.onMousedown) == null ? void 0 : _a22.call(props, e);
  33769. }, () => {
  33770. isClickFocus.value = true;
  33771. });
  33772. const onFocus = composeEventHandlers((e) => {
  33773. var _a22;
  33774. (_a22 = props.onFocus) == null ? void 0 : _a22.call(props, e);
  33775. }, (e) => {
  33776. const isKeyboardFocus = !unref(isClickFocus);
  33777. const { target, currentTarget } = e;
  33778. if (target === currentTarget && isKeyboardFocus && !unref(isBackingOut)) {
  33779. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  33780. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  33781. if (!entryFocusEvt.defaultPrevented) {
  33782. const items = getItems().filter((item) => item.focusable);
  33783. const activeItem = items.find((item) => item.active);
  33784. const currentItem = items.find((item) => item.id === unref(currentTabbedId));
  33785. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  33786. const candidateNodes = candidates.map((item) => item.ref);
  33787. focusFirst(candidateNodes);
  33788. }
  33789. }
  33790. isClickFocus.value = false;
  33791. });
  33792. const onBlur = composeEventHandlers((e) => {
  33793. var _a22;
  33794. (_a22 = props.onBlur) == null ? void 0 : _a22.call(props, e);
  33795. }, () => {
  33796. isBackingOut.value = false;
  33797. });
  33798. const handleEntryFocus = (...args) => {
  33799. emit2("entryFocus", ...args);
  33800. };
  33801. provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  33802. currentTabbedId: readonly(currentTabbedId),
  33803. loop: toRef(props, "loop"),
  33804. tabIndex: computed(() => {
  33805. return unref(isBackingOut) ? -1 : 0;
  33806. }),
  33807. rovingFocusGroupRef,
  33808. rovingFocusGroupRootStyle,
  33809. orientation: toRef(props, "orientation"),
  33810. dir: toRef(props, "dir"),
  33811. onItemFocus,
  33812. onItemShiftTab,
  33813. onBlur,
  33814. onFocus,
  33815. onMousedown
  33816. });
  33817. watch(() => props.currentTabId, (val) => {
  33818. currentTabbedId.value = val != null ? val : null;
  33819. });
  33820. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  33821. }
  33822. });
  33823. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  33824. return renderSlot(_ctx.$slots, "default");
  33825. }
  33826. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc$1(_sfc_main$1c, [["render", _sfc_render$l], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-group-impl.vue"]]);
  33827. const _sfc_main$1b = /* @__PURE__ */ defineComponent({
  33828. name: "ElRovingFocusGroup",
  33829. components: {
  33830. ElFocusGroupCollection: ElCollection$1,
  33831. ElRovingFocusGroupImpl
  33832. }
  33833. });
  33834. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  33835. const _component_el_roving_focus_group_impl = resolveComponent("el-roving-focus-group-impl");
  33836. const _component_el_focus_group_collection = resolveComponent("el-focus-group-collection");
  33837. return openBlock(), createBlock(_component_el_focus_group_collection, null, {
  33838. default: withCtx(() => [
  33839. createVNode(_component_el_roving_focus_group_impl, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
  33840. default: withCtx(() => [
  33841. renderSlot(_ctx.$slots, "default")
  33842. ]),
  33843. _: 3
  33844. }, 16)
  33845. ]),
  33846. _: 3
  33847. });
  33848. }
  33849. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$1b, [["render", _sfc_render$k], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-group.vue"]]);
  33850. const _sfc_main$1a = /* @__PURE__ */ defineComponent({
  33851. components: {
  33852. ElRovingFocusCollectionItem: ElCollectionItem$1
  33853. },
  33854. props: {
  33855. focusable: {
  33856. type: Boolean,
  33857. default: true
  33858. },
  33859. active: {
  33860. type: Boolean,
  33861. default: false
  33862. }
  33863. },
  33864. emits: ["mousedown", "focus", "keydown"],
  33865. setup(props, { emit: emit2 }) {
  33866. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  33867. const { getItems } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  33868. const id = useId();
  33869. const rovingFocusGroupItemRef = ref(null);
  33870. const handleMousedown = composeEventHandlers((e) => {
  33871. emit2("mousedown", e);
  33872. }, (e) => {
  33873. if (!props.focusable) {
  33874. e.preventDefault();
  33875. } else {
  33876. onItemFocus(unref(id));
  33877. }
  33878. });
  33879. const handleFocus = composeEventHandlers((e) => {
  33880. emit2("focus", e);
  33881. }, () => {
  33882. onItemFocus(unref(id));
  33883. });
  33884. const handleKeydown = composeEventHandlers((e) => {
  33885. emit2("keydown", e);
  33886. }, (e) => {
  33887. const { key, shiftKey, target, currentTarget } = e;
  33888. if (key === EVENT_CODE.tab && shiftKey) {
  33889. onItemShiftTab();
  33890. return;
  33891. }
  33892. if (target !== currentTarget)
  33893. return;
  33894. const focusIntent = getFocusIntent(e);
  33895. if (focusIntent) {
  33896. e.preventDefault();
  33897. const items = getItems().filter((item) => item.focusable);
  33898. let elements = items.map((item) => item.ref);
  33899. switch (focusIntent) {
  33900. case "last": {
  33901. elements.reverse();
  33902. break;
  33903. }
  33904. case "prev":
  33905. case "next": {
  33906. if (focusIntent === "prev") {
  33907. elements.reverse();
  33908. }
  33909. const currentIdx = elements.indexOf(currentTarget);
  33910. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  33911. break;
  33912. }
  33913. }
  33914. nextTick(() => {
  33915. focusFirst(elements);
  33916. });
  33917. }
  33918. });
  33919. const isCurrentTab = computed(() => currentTabbedId.value === unref(id));
  33920. provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  33921. rovingFocusGroupItemRef,
  33922. tabIndex: computed(() => unref(isCurrentTab) ? 0 : -1),
  33923. handleMousedown,
  33924. handleFocus,
  33925. handleKeydown
  33926. });
  33927. return {
  33928. id,
  33929. handleKeydown,
  33930. handleFocus,
  33931. handleMousedown
  33932. };
  33933. }
  33934. });
  33935. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  33936. const _component_el_roving_focus_collection_item = resolveComponent("el-roving-focus-collection-item");
  33937. return openBlock(), createBlock(_component_el_roving_focus_collection_item, {
  33938. id: _ctx.id,
  33939. focusable: _ctx.focusable,
  33940. active: _ctx.active
  33941. }, {
  33942. default: withCtx(() => [
  33943. renderSlot(_ctx.$slots, "default")
  33944. ]),
  33945. _: 3
  33946. }, 8, ["id", "focusable", "active"]);
  33947. }
  33948. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$1a, [["render", _sfc_render$j], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-item.vue"]]);
  33949. const dropdownProps = buildProps({
  33950. trigger: useTooltipTriggerProps.trigger,
  33951. effect: {
  33952. ...useTooltipContentProps.effect,
  33953. default: "light"
  33954. },
  33955. type: {
  33956. type: definePropType(String)
  33957. },
  33958. placement: {
  33959. type: definePropType(String),
  33960. default: "bottom"
  33961. },
  33962. popperOptions: {
  33963. type: definePropType(Object),
  33964. default: () => ({})
  33965. },
  33966. id: String,
  33967. size: {
  33968. type: String,
  33969. default: ""
  33970. },
  33971. splitButton: Boolean,
  33972. hideOnClick: {
  33973. type: Boolean,
  33974. default: true
  33975. },
  33976. loop: {
  33977. type: Boolean,
  33978. default: true
  33979. },
  33980. showTimeout: {
  33981. type: Number,
  33982. default: 150
  33983. },
  33984. hideTimeout: {
  33985. type: Number,
  33986. default: 150
  33987. },
  33988. tabindex: {
  33989. type: definePropType([Number, String]),
  33990. default: 0
  33991. },
  33992. maxHeight: {
  33993. type: definePropType([Number, String]),
  33994. default: ""
  33995. },
  33996. popperClass: {
  33997. type: String,
  33998. default: ""
  33999. },
  34000. disabled: {
  34001. type: Boolean,
  34002. default: false
  34003. },
  34004. role: {
  34005. type: String,
  34006. default: "menu"
  34007. },
  34008. buttonProps: {
  34009. type: definePropType(Object)
  34010. },
  34011. teleported: useTooltipContentProps.teleported
  34012. });
  34013. const dropdownItemProps = buildProps({
  34014. command: {
  34015. type: [Object, String, Number],
  34016. default: () => ({})
  34017. },
  34018. disabled: Boolean,
  34019. divided: Boolean,
  34020. textValue: String,
  34021. icon: {
  34022. type: iconPropType
  34023. }
  34024. });
  34025. const dropdownMenuProps = buildProps({
  34026. onKeydown: { type: definePropType(Function) }
  34027. });
  34028. const FIRST_KEYS = [
  34029. EVENT_CODE.down,
  34030. EVENT_CODE.pageDown,
  34031. EVENT_CODE.home
  34032. ];
  34033. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  34034. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  34035. const {
  34036. ElCollection,
  34037. ElCollectionItem,
  34038. COLLECTION_INJECTION_KEY,
  34039. COLLECTION_ITEM_INJECTION_KEY
  34040. } = createCollectionWithScope("Dropdown");
  34041. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  34042. const { ButtonGroup: ElButtonGroup } = ElButton;
  34043. const _sfc_main$19 = /* @__PURE__ */ defineComponent({
  34044. name: "ElDropdown",
  34045. components: {
  34046. ElButton,
  34047. ElButtonGroup,
  34048. ElScrollbar,
  34049. ElDropdownCollection: ElCollection,
  34050. ElTooltip,
  34051. ElRovingFocusGroup,
  34052. ElOnlyChild: OnlyChild,
  34053. ElIcon,
  34054. ArrowDown: arrow_down_default
  34055. },
  34056. props: dropdownProps,
  34057. emits: ["visible-change", "click", "command"],
  34058. setup(props, { emit: emit2 }) {
  34059. const _instance = getCurrentInstance();
  34060. const ns = useNamespace("dropdown");
  34061. const { t } = useLocale();
  34062. const triggeringElementRef = ref();
  34063. const referenceElementRef = ref();
  34064. const popperRef = ref(null);
  34065. const contentRef = ref(null);
  34066. const scrollbar = ref(null);
  34067. const currentTabId = ref(null);
  34068. const isUsingKeyboard = ref(false);
  34069. const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down];
  34070. const wrapStyle = computed(() => ({
  34071. maxHeight: addUnit(props.maxHeight)
  34072. }));
  34073. const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)]);
  34074. const trigger2 = computed(() => castArray$1(props.trigger));
  34075. const defaultTriggerId = useId().value;
  34076. const triggerId = computed(() => {
  34077. return props.id || defaultTriggerId;
  34078. });
  34079. watch([triggeringElementRef, trigger2], ([triggeringElement, trigger22], [prevTriggeringElement]) => {
  34080. var _a2, _b, _c;
  34081. if ((_a2 = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a2.removeEventListener) {
  34082. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  34083. }
  34084. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  34085. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  34086. }
  34087. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger22.includes("hover")) {
  34088. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  34089. }
  34090. }, { immediate: true });
  34091. onBeforeUnmount(() => {
  34092. var _a2, _b;
  34093. if ((_b = (_a2 = triggeringElementRef.value) == null ? void 0 : _a2.$el) == null ? void 0 : _b.removeEventListener) {
  34094. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  34095. }
  34096. });
  34097. function handleClick() {
  34098. handleClose();
  34099. }
  34100. function handleClose() {
  34101. var _a2;
  34102. (_a2 = popperRef.value) == null ? void 0 : _a2.onClose();
  34103. }
  34104. function handleOpen() {
  34105. var _a2;
  34106. (_a2 = popperRef.value) == null ? void 0 : _a2.onOpen();
  34107. }
  34108. const dropdownSize = useFormSize();
  34109. function commandHandler(...args) {
  34110. emit2("command", ...args);
  34111. }
  34112. function onAutofocusTriggerEnter() {
  34113. var _a2, _b;
  34114. (_b = (_a2 = triggeringElementRef.value) == null ? void 0 : _a2.$el) == null ? void 0 : _b.focus();
  34115. }
  34116. function onItemEnter() {
  34117. }
  34118. function onItemLeave() {
  34119. const contentEl = unref(contentRef);
  34120. trigger2.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus());
  34121. currentTabId.value = null;
  34122. }
  34123. function handleCurrentTabIdChange(id) {
  34124. currentTabId.value = id;
  34125. }
  34126. function handleEntryFocus(e) {
  34127. if (!isUsingKeyboard.value) {
  34128. e.preventDefault();
  34129. e.stopImmediatePropagation();
  34130. }
  34131. }
  34132. function handleBeforeShowTooltip() {
  34133. emit2("visible-change", true);
  34134. }
  34135. function handleShowTooltip(event) {
  34136. if ((event == null ? void 0 : event.type) === "keydown") {
  34137. contentRef.value.focus();
  34138. }
  34139. }
  34140. function handleBeforeHideTooltip() {
  34141. emit2("visible-change", false);
  34142. }
  34143. provide(DROPDOWN_INJECTION_KEY, {
  34144. contentRef,
  34145. role: computed(() => props.role),
  34146. triggerId,
  34147. isUsingKeyboard,
  34148. onItemEnter,
  34149. onItemLeave
  34150. });
  34151. provide("elDropdown", {
  34152. instance: _instance,
  34153. dropdownSize,
  34154. handleClick,
  34155. commandHandler,
  34156. trigger: toRef(props, "trigger"),
  34157. hideOnClick: toRef(props, "hideOnClick")
  34158. });
  34159. const onFocusAfterTrapped = (e) => {
  34160. var _a2, _b;
  34161. e.preventDefault();
  34162. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2, {
  34163. preventScroll: true
  34164. });
  34165. };
  34166. const handlerMainButtonClick = (event) => {
  34167. emit2("click", event);
  34168. };
  34169. return {
  34170. t,
  34171. ns,
  34172. scrollbar,
  34173. wrapStyle,
  34174. dropdownTriggerKls,
  34175. dropdownSize,
  34176. triggerId,
  34177. triggerKeys,
  34178. currentTabId,
  34179. handleCurrentTabIdChange,
  34180. handlerMainButtonClick,
  34181. handleEntryFocus,
  34182. handleClose,
  34183. handleOpen,
  34184. handleBeforeShowTooltip,
  34185. handleShowTooltip,
  34186. handleBeforeHideTooltip,
  34187. onFocusAfterTrapped,
  34188. popperRef,
  34189. contentRef,
  34190. triggeringElementRef,
  34191. referenceElementRef
  34192. };
  34193. }
  34194. });
  34195. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  34196. var _a2;
  34197. const _component_el_dropdown_collection = resolveComponent("el-dropdown-collection");
  34198. const _component_el_roving_focus_group = resolveComponent("el-roving-focus-group");
  34199. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  34200. const _component_el_only_child = resolveComponent("el-only-child");
  34201. const _component_el_tooltip = resolveComponent("el-tooltip");
  34202. const _component_el_button = resolveComponent("el-button");
  34203. const _component_arrow_down = resolveComponent("arrow-down");
  34204. const _component_el_icon = resolveComponent("el-icon");
  34205. const _component_el_button_group = resolveComponent("el-button-group");
  34206. return openBlock(), createElementBlock("div", {
  34207. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  34208. }, [
  34209. createVNode(_component_el_tooltip, {
  34210. ref: "popperRef",
  34211. role: _ctx.role,
  34212. effect: _ctx.effect,
  34213. "fallback-placements": ["bottom", "top"],
  34214. "popper-options": _ctx.popperOptions,
  34215. "gpu-acceleration": false,
  34216. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  34217. "manual-mode": true,
  34218. placement: _ctx.placement,
  34219. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  34220. "reference-element": (_a2 = _ctx.referenceElementRef) == null ? void 0 : _a2.$el,
  34221. trigger: _ctx.trigger,
  34222. "trigger-keys": _ctx.triggerKeys,
  34223. "trigger-target-el": _ctx.contentRef,
  34224. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  34225. "stop-popper-mouse-event": false,
  34226. "virtual-ref": _ctx.triggeringElementRef,
  34227. "virtual-triggering": _ctx.splitButton,
  34228. disabled: _ctx.disabled,
  34229. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  34230. teleported: _ctx.teleported,
  34231. pure: "",
  34232. persistent: "",
  34233. onBeforeShow: _ctx.handleBeforeShowTooltip,
  34234. onShow: _ctx.handleShowTooltip,
  34235. onBeforeHide: _ctx.handleBeforeHideTooltip
  34236. }, createSlots({
  34237. content: withCtx(() => [
  34238. createVNode(_component_el_scrollbar, {
  34239. ref: "scrollbar",
  34240. "wrap-style": _ctx.wrapStyle,
  34241. tag: "div",
  34242. "view-class": _ctx.ns.e("list")
  34243. }, {
  34244. default: withCtx(() => [
  34245. createVNode(_component_el_roving_focus_group, {
  34246. loop: _ctx.loop,
  34247. "current-tab-id": _ctx.currentTabId,
  34248. orientation: "horizontal",
  34249. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  34250. onEntryFocus: _ctx.handleEntryFocus
  34251. }, {
  34252. default: withCtx(() => [
  34253. createVNode(_component_el_dropdown_collection, null, {
  34254. default: withCtx(() => [
  34255. renderSlot(_ctx.$slots, "dropdown")
  34256. ]),
  34257. _: 3
  34258. })
  34259. ]),
  34260. _: 3
  34261. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  34262. ]),
  34263. _: 3
  34264. }, 8, ["wrap-style", "view-class"])
  34265. ]),
  34266. _: 2
  34267. }, [
  34268. !_ctx.splitButton ? {
  34269. name: "default",
  34270. fn: withCtx(() => [
  34271. createVNode(_component_el_only_child, {
  34272. id: _ctx.triggerId,
  34273. ref: "triggeringElementRef",
  34274. role: "button",
  34275. tabindex: _ctx.tabindex
  34276. }, {
  34277. default: withCtx(() => [
  34278. renderSlot(_ctx.$slots, "default")
  34279. ]),
  34280. _: 3
  34281. }, 8, ["id", "tabindex"])
  34282. ])
  34283. } : void 0
  34284. ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "onBeforeShow", "onShow", "onBeforeHide"]),
  34285. _ctx.splitButton ? (openBlock(), createBlock(_component_el_button_group, { key: 0 }, {
  34286. default: withCtx(() => [
  34287. createVNode(_component_el_button, mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  34288. size: _ctx.dropdownSize,
  34289. type: _ctx.type,
  34290. disabled: _ctx.disabled,
  34291. tabindex: _ctx.tabindex,
  34292. onClick: _ctx.handlerMainButtonClick
  34293. }), {
  34294. default: withCtx(() => [
  34295. renderSlot(_ctx.$slots, "default")
  34296. ]),
  34297. _: 3
  34298. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  34299. createVNode(_component_el_button, mergeProps({
  34300. id: _ctx.triggerId,
  34301. ref: "triggeringElementRef"
  34302. }, _ctx.buttonProps, {
  34303. role: "button",
  34304. size: _ctx.dropdownSize,
  34305. type: _ctx.type,
  34306. class: _ctx.ns.e("caret-button"),
  34307. disabled: _ctx.disabled,
  34308. tabindex: _ctx.tabindex,
  34309. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  34310. }), {
  34311. default: withCtx(() => [
  34312. createVNode(_component_el_icon, {
  34313. class: normalizeClass(_ctx.ns.e("icon"))
  34314. }, {
  34315. default: withCtx(() => [
  34316. createVNode(_component_arrow_down)
  34317. ]),
  34318. _: 1
  34319. }, 8, ["class"])
  34320. ]),
  34321. _: 1
  34322. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  34323. ]),
  34324. _: 3
  34325. })) : createCommentVNode("v-if", true)
  34326. ], 2);
  34327. }
  34328. var Dropdown = /* @__PURE__ */ _export_sfc$1(_sfc_main$19, [["render", _sfc_render$i], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown.vue"]]);
  34329. const _sfc_main$18 = /* @__PURE__ */ defineComponent({
  34330. name: "DropdownItemImpl",
  34331. components: {
  34332. ElIcon
  34333. },
  34334. props: dropdownItemProps,
  34335. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  34336. setup(_2, { emit: emit2 }) {
  34337. const ns = useNamespace("dropdown");
  34338. const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, void 0);
  34339. const { collectionItemRef: dropdownCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  34340. const { collectionItemRef: rovingFocusCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  34341. const {
  34342. rovingFocusGroupItemRef,
  34343. tabIndex,
  34344. handleFocus,
  34345. handleKeydown: handleItemKeydown,
  34346. handleMousedown
  34347. } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  34348. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  34349. const role = computed(() => {
  34350. if (menuRole.value === "menu") {
  34351. return "menuitem";
  34352. } else if (menuRole.value === "navigation") {
  34353. return "link";
  34354. }
  34355. return "button";
  34356. });
  34357. const handleKeydown = composeEventHandlers((e) => {
  34358. const { code } = e;
  34359. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  34360. e.preventDefault();
  34361. e.stopImmediatePropagation();
  34362. emit2("clickimpl", e);
  34363. return true;
  34364. }
  34365. }, handleItemKeydown);
  34366. return {
  34367. ns,
  34368. itemRef,
  34369. dataset: {
  34370. [COLLECTION_ITEM_SIGN]: ""
  34371. },
  34372. role,
  34373. tabIndex,
  34374. handleFocus,
  34375. handleKeydown,
  34376. handleMousedown
  34377. };
  34378. }
  34379. });
  34380. const _hoisted_1$B = ["aria-disabled", "tabindex", "role"];
  34381. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  34382. const _component_el_icon = resolveComponent("el-icon");
  34383. return openBlock(), createElementBlock(Fragment, null, [
  34384. _ctx.divided ? (openBlock(), createElementBlock("li", mergeProps({
  34385. key: 0,
  34386. role: "separator",
  34387. class: _ctx.ns.bem("menu", "item", "divided")
  34388. }, _ctx.$attrs), null, 16)) : createCommentVNode("v-if", true),
  34389. createBaseVNode("li", mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  34390. "aria-disabled": _ctx.disabled,
  34391. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  34392. tabindex: _ctx.tabIndex,
  34393. role: _ctx.role,
  34394. onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)),
  34395. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  34396. onKeydown: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  34397. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  34398. onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)),
  34399. onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e))
  34400. }), [
  34401. _ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  34402. default: withCtx(() => [
  34403. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  34404. ]),
  34405. _: 1
  34406. })) : createCommentVNode("v-if", true),
  34407. renderSlot(_ctx.$slots, "default")
  34408. ], 16, _hoisted_1$B)
  34409. ], 64);
  34410. }
  34411. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc$1(_sfc_main$18, [["render", _sfc_render$h], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-item-impl.vue"]]);
  34412. const useDropdown = () => {
  34413. const elDropdown = inject("elDropdown", {});
  34414. const _elDropdownSize = computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  34415. return {
  34416. elDropdown,
  34417. _elDropdownSize
  34418. };
  34419. };
  34420. const _sfc_main$17 = /* @__PURE__ */ defineComponent({
  34421. name: "ElDropdownItem",
  34422. components: {
  34423. ElDropdownCollectionItem: ElCollectionItem,
  34424. ElRovingFocusItem,
  34425. ElDropdownItemImpl
  34426. },
  34427. inheritAttrs: false,
  34428. props: dropdownItemProps,
  34429. emits: ["pointermove", "pointerleave", "click"],
  34430. setup(props, { emit: emit2, attrs }) {
  34431. const { elDropdown } = useDropdown();
  34432. const _instance = getCurrentInstance();
  34433. const itemRef = ref(null);
  34434. const textContent = computed(() => {
  34435. var _a2, _b;
  34436. return (_b = (_a2 = unref(itemRef)) == null ? void 0 : _a2.textContent) != null ? _b : "";
  34437. });
  34438. const { onItemEnter, onItemLeave } = inject(DROPDOWN_INJECTION_KEY, void 0);
  34439. const handlePointerMove = composeEventHandlers((e) => {
  34440. emit2("pointermove", e);
  34441. return e.defaultPrevented;
  34442. }, whenMouse((e) => {
  34443. if (props.disabled) {
  34444. onItemLeave(e);
  34445. return;
  34446. }
  34447. const target = e.currentTarget;
  34448. if (target === document.activeElement || target.contains(document.activeElement)) {
  34449. return;
  34450. }
  34451. onItemEnter(e);
  34452. if (!e.defaultPrevented) {
  34453. target == null ? void 0 : target.focus();
  34454. }
  34455. }));
  34456. const handlePointerLeave = composeEventHandlers((e) => {
  34457. emit2("pointerleave", e);
  34458. return e.defaultPrevented;
  34459. }, whenMouse((e) => {
  34460. onItemLeave(e);
  34461. }));
  34462. const handleClick = composeEventHandlers((e) => {
  34463. if (props.disabled) {
  34464. return;
  34465. }
  34466. emit2("click", e);
  34467. return e.type !== "keydown" && e.defaultPrevented;
  34468. }, (e) => {
  34469. var _a2, _b, _c;
  34470. if (props.disabled) {
  34471. e.stopImmediatePropagation();
  34472. return;
  34473. }
  34474. if ((_a2 = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a2.value) {
  34475. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  34476. }
  34477. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  34478. });
  34479. const propsAndAttrs = computed(() => {
  34480. return { ...props, ...attrs };
  34481. });
  34482. return {
  34483. handleClick,
  34484. handlePointerMove,
  34485. handlePointerLeave,
  34486. textContent,
  34487. propsAndAttrs
  34488. };
  34489. }
  34490. });
  34491. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  34492. var _a2;
  34493. const _component_el_dropdown_item_impl = resolveComponent("el-dropdown-item-impl");
  34494. const _component_el_roving_focus_item = resolveComponent("el-roving-focus-item");
  34495. const _component_el_dropdown_collection_item = resolveComponent("el-dropdown-collection-item");
  34496. return openBlock(), createBlock(_component_el_dropdown_collection_item, {
  34497. disabled: _ctx.disabled,
  34498. "text-value": (_a2 = _ctx.textValue) != null ? _a2 : _ctx.textContent
  34499. }, {
  34500. default: withCtx(() => [
  34501. createVNode(_component_el_roving_focus_item, {
  34502. focusable: !_ctx.disabled
  34503. }, {
  34504. default: withCtx(() => [
  34505. createVNode(_component_el_dropdown_item_impl, mergeProps(_ctx.propsAndAttrs, {
  34506. onPointerleave: _ctx.handlePointerLeave,
  34507. onPointermove: _ctx.handlePointerMove,
  34508. onClickimpl: _ctx.handleClick
  34509. }), {
  34510. default: withCtx(() => [
  34511. renderSlot(_ctx.$slots, "default")
  34512. ]),
  34513. _: 3
  34514. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  34515. ]),
  34516. _: 3
  34517. }, 8, ["focusable"])
  34518. ]),
  34519. _: 3
  34520. }, 8, ["disabled", "text-value"]);
  34521. }
  34522. var DropdownItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$17, [["render", _sfc_render$g], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-item.vue"]]);
  34523. const _sfc_main$16 = /* @__PURE__ */ defineComponent({
  34524. name: "ElDropdownMenu",
  34525. props: dropdownMenuProps,
  34526. setup(props) {
  34527. const ns = useNamespace("dropdown");
  34528. const { _elDropdownSize } = useDropdown();
  34529. const size2 = _elDropdownSize.value;
  34530. const { focusTrapRef, onKeydown } = inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  34531. const { contentRef, role, triggerId } = inject(DROPDOWN_INJECTION_KEY, void 0);
  34532. const { collectionRef: dropdownCollectionRef, getItems } = inject(COLLECTION_INJECTION_KEY, void 0);
  34533. const {
  34534. rovingFocusGroupRef,
  34535. rovingFocusGroupRootStyle,
  34536. tabIndex,
  34537. onBlur,
  34538. onFocus,
  34539. onMousedown
  34540. } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  34541. const { collectionRef: rovingFocusGroupCollectionRef } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  34542. const dropdownKls = computed(() => {
  34543. return [ns.b("menu"), ns.bm("menu", size2 == null ? void 0 : size2.value)];
  34544. });
  34545. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  34546. const composedKeydown = composeEventHandlers((e) => {
  34547. var _a2;
  34548. (_a2 = props.onKeydown) == null ? void 0 : _a2.call(props, e);
  34549. }, (e) => {
  34550. const { currentTarget, code, target } = e;
  34551. currentTarget.contains(target);
  34552. if (EVENT_CODE.tab === code) {
  34553. e.stopImmediatePropagation();
  34554. }
  34555. e.preventDefault();
  34556. if (target !== unref(contentRef))
  34557. return;
  34558. if (!FIRST_LAST_KEYS.includes(code))
  34559. return;
  34560. const items = getItems().filter((item) => !item.disabled);
  34561. const targets = items.map((item) => item.ref);
  34562. if (LAST_KEYS.includes(code)) {
  34563. targets.reverse();
  34564. }
  34565. focusFirst(targets);
  34566. });
  34567. const handleKeydown = (e) => {
  34568. composedKeydown(e);
  34569. onKeydown(e);
  34570. };
  34571. return {
  34572. size: size2,
  34573. rovingFocusGroupRootStyle,
  34574. tabIndex,
  34575. dropdownKls,
  34576. role,
  34577. triggerId,
  34578. dropdownListWrapperRef,
  34579. handleKeydown,
  34580. onBlur,
  34581. onFocus,
  34582. onMousedown
  34583. };
  34584. }
  34585. });
  34586. const _hoisted_1$A = ["role", "aria-labelledby"];
  34587. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  34588. return openBlock(), createElementBlock("ul", {
  34589. ref: _ctx.dropdownListWrapperRef,
  34590. class: normalizeClass(_ctx.dropdownKls),
  34591. style: normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  34592. tabindex: -1,
  34593. role: _ctx.role,
  34594. "aria-labelledby": _ctx.triggerId,
  34595. onBlur: _cache[0] || (_cache[0] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
  34596. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
  34597. onKeydown: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  34598. onMousedown: _cache[3] || (_cache[3] = withModifiers((...args) => _ctx.onMousedown && _ctx.onMousedown(...args), ["self"]))
  34599. }, [
  34600. renderSlot(_ctx.$slots, "default")
  34601. ], 46, _hoisted_1$A);
  34602. }
  34603. var DropdownMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$16, [["render", _sfc_render$f], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-menu.vue"]]);
  34604. const ElDropdown = withInstall(Dropdown, {
  34605. DropdownItem,
  34606. DropdownMenu
  34607. });
  34608. const ElDropdownItem = withNoopInstall(DropdownItem);
  34609. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  34610. const _hoisted_1$z = {
  34611. viewBox: "0 0 79 86",
  34612. version: "1.1",
  34613. xmlns: "http://www.w3.org/2000/svg",
  34614. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  34615. };
  34616. const _hoisted_2$m = ["id"];
  34617. const _hoisted_3$9 = ["stop-color"];
  34618. const _hoisted_4$6 = ["stop-color"];
  34619. const _hoisted_5$5 = ["id"];
  34620. const _hoisted_6$2 = ["stop-color"];
  34621. const _hoisted_7 = ["stop-color"];
  34622. const _hoisted_8 = ["id"];
  34623. const _hoisted_9 = {
  34624. id: "Illustrations",
  34625. stroke: "none",
  34626. "stroke-width": "1",
  34627. fill: "none",
  34628. "fill-rule": "evenodd"
  34629. };
  34630. const _hoisted_10 = {
  34631. id: "B-type",
  34632. transform: "translate(-1268.000000, -535.000000)"
  34633. };
  34634. const _hoisted_11 = {
  34635. id: "Group-2",
  34636. transform: "translate(1268.000000, 535.000000)"
  34637. };
  34638. const _hoisted_12 = ["fill"];
  34639. const _hoisted_13 = ["fill"];
  34640. const _hoisted_14 = {
  34641. id: "Group-Copy",
  34642. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  34643. };
  34644. const _hoisted_15 = ["fill"];
  34645. const _hoisted_16 = ["fill"];
  34646. const _hoisted_17 = ["fill"];
  34647. const _hoisted_18 = ["fill"];
  34648. const _hoisted_19 = ["fill"];
  34649. const _hoisted_20 = {
  34650. id: "Rectangle-Copy-17",
  34651. transform: "translate(53.000000, 45.000000)"
  34652. };
  34653. const _hoisted_21 = ["fill", "xlink:href"];
  34654. const _hoisted_22 = ["fill", "mask"];
  34655. const _hoisted_23 = ["fill"];
  34656. const __default__$M = /* @__PURE__ */ defineComponent({
  34657. name: "ImgEmpty"
  34658. });
  34659. const _sfc_main$15 = /* @__PURE__ */ defineComponent({
  34660. ...__default__$M,
  34661. setup(__props) {
  34662. const ns = useNamespace("empty");
  34663. const id = useId();
  34664. return (_ctx, _cache) => {
  34665. return openBlock(), createElementBlock("svg", _hoisted_1$z, [
  34666. createBaseVNode("defs", null, [
  34667. createBaseVNode("linearGradient", {
  34668. id: `linearGradient-1-${unref(id)}`,
  34669. x1: "38.8503086%",
  34670. y1: "0%",
  34671. x2: "61.1496914%",
  34672. y2: "100%"
  34673. }, [
  34674. createBaseVNode("stop", {
  34675. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  34676. offset: "0%"
  34677. }, null, 8, _hoisted_3$9),
  34678. createBaseVNode("stop", {
  34679. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-4")})`,
  34680. offset: "100%"
  34681. }, null, 8, _hoisted_4$6)
  34682. ], 8, _hoisted_2$m),
  34683. createBaseVNode("linearGradient", {
  34684. id: `linearGradient-2-${unref(id)}`,
  34685. x1: "0%",
  34686. y1: "9.5%",
  34687. x2: "100%",
  34688. y2: "90.5%"
  34689. }, [
  34690. createBaseVNode("stop", {
  34691. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  34692. offset: "0%"
  34693. }, null, 8, _hoisted_6$2),
  34694. createBaseVNode("stop", {
  34695. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-6")})`,
  34696. offset: "100%"
  34697. }, null, 8, _hoisted_7)
  34698. ], 8, _hoisted_5$5),
  34699. createBaseVNode("rect", {
  34700. id: `path-3-${unref(id)}`,
  34701. x: "0",
  34702. y: "0",
  34703. width: "17",
  34704. height: "36"
  34705. }, null, 8, _hoisted_8)
  34706. ]),
  34707. createBaseVNode("g", _hoisted_9, [
  34708. createBaseVNode("g", _hoisted_10, [
  34709. createBaseVNode("g", _hoisted_11, [
  34710. createBaseVNode("path", {
  34711. id: "Oval-Copy-2",
  34712. d: "M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z",
  34713. fill: `var(${unref(ns).cssVarBlockName("fill-color-3")})`
  34714. }, null, 8, _hoisted_12),
  34715. createBaseVNode("polygon", {
  34716. id: "Rectangle-Copy-14",
  34717. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  34718. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  34719. points: "13 58 53 58 42 45 2 45"
  34720. }, null, 8, _hoisted_13),
  34721. createBaseVNode("g", _hoisted_14, [
  34722. createBaseVNode("polygon", {
  34723. id: "Rectangle-Copy-10",
  34724. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  34725. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  34726. points: "2.84078316e-14 3 18 3 23 7 5 7"
  34727. }, null, 8, _hoisted_15),
  34728. createBaseVNode("polygon", {
  34729. id: "Rectangle-Copy-11",
  34730. fill: `var(${unref(ns).cssVarBlockName("fill-color-5")})`,
  34731. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  34732. }, null, 8, _hoisted_16),
  34733. createBaseVNode("rect", {
  34734. id: "Rectangle-Copy-12",
  34735. fill: `url(#linearGradient-1-${unref(id)})`,
  34736. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  34737. x: "38",
  34738. y: "7",
  34739. width: "17",
  34740. height: "36"
  34741. }, null, 8, _hoisted_17),
  34742. createBaseVNode("polygon", {
  34743. id: "Rectangle-Copy-13",
  34744. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  34745. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  34746. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  34747. }, null, 8, _hoisted_18)
  34748. ]),
  34749. createBaseVNode("rect", {
  34750. id: "Rectangle-Copy-15",
  34751. fill: `url(#linearGradient-2-${unref(id)})`,
  34752. x: "13",
  34753. y: "45",
  34754. width: "40",
  34755. height: "36"
  34756. }, null, 8, _hoisted_19),
  34757. createBaseVNode("g", _hoisted_20, [
  34758. createBaseVNode("use", {
  34759. id: "Mask",
  34760. fill: `var(${unref(ns).cssVarBlockName("fill-color-8")})`,
  34761. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  34762. "xlink:href": `#path-3-${unref(id)}`
  34763. }, null, 8, _hoisted_21),
  34764. createBaseVNode("polygon", {
  34765. id: "Rectangle-Copy",
  34766. fill: `var(${unref(ns).cssVarBlockName("fill-color-9")})`,
  34767. mask: `url(#mask-4-${unref(id)})`,
  34768. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  34769. points: "7 0 24 0 20 18 7 16.5"
  34770. }, null, 8, _hoisted_22)
  34771. ]),
  34772. createBaseVNode("polygon", {
  34773. id: "Rectangle-Copy-18",
  34774. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  34775. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  34776. points: "62 45 79 45 70 58 53 58"
  34777. }, null, 8, _hoisted_23)
  34778. ])
  34779. ])
  34780. ])
  34781. ]);
  34782. };
  34783. }
  34784. });
  34785. var ImgEmpty = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/empty/src/img-empty.vue"]]);
  34786. const emptyProps = buildProps({
  34787. image: {
  34788. type: String,
  34789. default: ""
  34790. },
  34791. imageSize: Number,
  34792. description: {
  34793. type: String,
  34794. default: ""
  34795. }
  34796. });
  34797. const _hoisted_1$y = ["src"];
  34798. const _hoisted_2$l = { key: 1 };
  34799. const __default__$L = /* @__PURE__ */ defineComponent({
  34800. name: "ElEmpty"
  34801. });
  34802. const _sfc_main$14 = /* @__PURE__ */ defineComponent({
  34803. ...__default__$L,
  34804. props: emptyProps,
  34805. setup(__props) {
  34806. const props = __props;
  34807. const { t } = useLocale();
  34808. const ns = useNamespace("empty");
  34809. const emptyDescription = computed(() => props.description || t("el.table.emptyText"));
  34810. const imageStyle = computed(() => ({
  34811. width: addUnit(props.imageSize)
  34812. }));
  34813. return (_ctx, _cache) => {
  34814. return openBlock(), createElementBlock("div", {
  34815. class: normalizeClass(unref(ns).b())
  34816. }, [
  34817. createBaseVNode("div", {
  34818. class: normalizeClass(unref(ns).e("image")),
  34819. style: normalizeStyle(unref(imageStyle))
  34820. }, [
  34821. _ctx.image ? (openBlock(), createElementBlock("img", {
  34822. key: 0,
  34823. src: _ctx.image,
  34824. ondragstart: "return false"
  34825. }, null, 8, _hoisted_1$y)) : renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  34826. createVNode(ImgEmpty)
  34827. ])
  34828. ], 6),
  34829. createBaseVNode("div", {
  34830. class: normalizeClass(unref(ns).e("description"))
  34831. }, [
  34832. _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("p", _hoisted_2$l, toDisplayString(unref(emptyDescription)), 1))
  34833. ], 2),
  34834. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  34835. key: 0,
  34836. class: normalizeClass(unref(ns).e("bottom"))
  34837. }, [
  34838. renderSlot(_ctx.$slots, "default")
  34839. ], 2)) : createCommentVNode("v-if", true)
  34840. ], 2);
  34841. };
  34842. }
  34843. });
  34844. var Empty = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/empty/src/empty.vue"]]);
  34845. const ElEmpty = withInstall(Empty);
  34846. const imageViewerProps = buildProps({
  34847. urlList: {
  34848. type: definePropType(Array),
  34849. default: () => mutable([])
  34850. },
  34851. zIndex: {
  34852. type: Number
  34853. },
  34854. initialIndex: {
  34855. type: Number,
  34856. default: 0
  34857. },
  34858. infinite: {
  34859. type: Boolean,
  34860. default: true
  34861. },
  34862. hideOnClickModal: Boolean,
  34863. teleported: Boolean,
  34864. closeOnPressEscape: {
  34865. type: Boolean,
  34866. default: true
  34867. },
  34868. zoomRate: {
  34869. type: Number,
  34870. default: 1.2
  34871. },
  34872. minScale: {
  34873. type: Number,
  34874. default: 0.2
  34875. },
  34876. maxScale: {
  34877. type: Number,
  34878. default: 7
  34879. }
  34880. });
  34881. const imageViewerEmits = {
  34882. close: () => true,
  34883. switch: (index2) => isNumber(index2),
  34884. rotate: (deg) => isNumber(deg)
  34885. };
  34886. const _hoisted_1$x = ["src"];
  34887. const __default__$K = /* @__PURE__ */ defineComponent({
  34888. name: "ElImageViewer"
  34889. });
  34890. const _sfc_main$13 = /* @__PURE__ */ defineComponent({
  34891. ...__default__$K,
  34892. props: imageViewerProps,
  34893. emits: imageViewerEmits,
  34894. setup(__props, { expose, emit: emit2 }) {
  34895. const props = __props;
  34896. const modes = {
  34897. CONTAIN: {
  34898. name: "contain",
  34899. icon: markRaw(full_screen_default)
  34900. },
  34901. ORIGINAL: {
  34902. name: "original",
  34903. icon: markRaw(scale_to_original_default)
  34904. }
  34905. };
  34906. const { t } = useLocale();
  34907. const ns = useNamespace("image-viewer");
  34908. const { nextZIndex } = useZIndex();
  34909. const wrapper = ref();
  34910. const imgRefs = ref([]);
  34911. const scopeEventListener = effectScope();
  34912. const loading = ref(true);
  34913. const activeIndex = ref(props.initialIndex);
  34914. const mode = shallowRef(modes.CONTAIN);
  34915. const transform = ref({
  34916. scale: 1,
  34917. deg: 0,
  34918. offsetX: 0,
  34919. offsetY: 0,
  34920. enableTransition: false
  34921. });
  34922. const isSingle = computed(() => {
  34923. const { urlList } = props;
  34924. return urlList.length <= 1;
  34925. });
  34926. const isFirst = computed(() => {
  34927. return activeIndex.value === 0;
  34928. });
  34929. const isLast = computed(() => {
  34930. return activeIndex.value === props.urlList.length - 1;
  34931. });
  34932. const currentImg = computed(() => {
  34933. return props.urlList[activeIndex.value];
  34934. });
  34935. const arrowPrevKls = computed(() => [
  34936. ns.e("btn"),
  34937. ns.e("prev"),
  34938. ns.is("disabled", !props.infinite && isFirst.value)
  34939. ]);
  34940. const arrowNextKls = computed(() => [
  34941. ns.e("btn"),
  34942. ns.e("next"),
  34943. ns.is("disabled", !props.infinite && isLast.value)
  34944. ]);
  34945. const imgStyle = computed(() => {
  34946. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  34947. let translateX = offsetX / scale;
  34948. let translateY = offsetY / scale;
  34949. switch (deg % 360) {
  34950. case 90:
  34951. case -270:
  34952. [translateX, translateY] = [translateY, -translateX];
  34953. break;
  34954. case 180:
  34955. case -180:
  34956. [translateX, translateY] = [-translateX, -translateY];
  34957. break;
  34958. case 270:
  34959. case -90:
  34960. [translateX, translateY] = [-translateY, translateX];
  34961. break;
  34962. }
  34963. const style = {
  34964. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  34965. transition: enableTransition ? "transform .3s" : ""
  34966. };
  34967. if (mode.value.name === modes.CONTAIN.name) {
  34968. style.maxWidth = style.maxHeight = "100%";
  34969. }
  34970. return style;
  34971. });
  34972. const computedZIndex = computed(() => {
  34973. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  34974. });
  34975. function hide() {
  34976. unregisterEventListener();
  34977. emit2("close");
  34978. }
  34979. function registerEventListener() {
  34980. const keydownHandler = throttle((e) => {
  34981. switch (e.code) {
  34982. case EVENT_CODE.esc:
  34983. props.closeOnPressEscape && hide();
  34984. break;
  34985. case EVENT_CODE.space:
  34986. toggleMode();
  34987. break;
  34988. case EVENT_CODE.left:
  34989. prev();
  34990. break;
  34991. case EVENT_CODE.up:
  34992. handleActions("zoomIn");
  34993. break;
  34994. case EVENT_CODE.right:
  34995. next();
  34996. break;
  34997. case EVENT_CODE.down:
  34998. handleActions("zoomOut");
  34999. break;
  35000. }
  35001. });
  35002. const mousewheelHandler = throttle((e) => {
  35003. const delta = e.deltaY || e.deltaX;
  35004. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  35005. zoomRate: props.zoomRate,
  35006. enableTransition: false
  35007. });
  35008. });
  35009. scopeEventListener.run(() => {
  35010. useEventListener(document, "keydown", keydownHandler);
  35011. useEventListener(document, "wheel", mousewheelHandler);
  35012. });
  35013. }
  35014. function unregisterEventListener() {
  35015. scopeEventListener.stop();
  35016. }
  35017. function handleImgLoad() {
  35018. loading.value = false;
  35019. }
  35020. function handleImgError(e) {
  35021. loading.value = false;
  35022. e.target.alt = t("el.image.error");
  35023. }
  35024. function handleMouseDown(e) {
  35025. if (loading.value || e.button !== 0 || !wrapper.value)
  35026. return;
  35027. transform.value.enableTransition = false;
  35028. const { offsetX, offsetY } = transform.value;
  35029. const startX = e.pageX;
  35030. const startY = e.pageY;
  35031. const dragHandler = throttle((ev) => {
  35032. transform.value = {
  35033. ...transform.value,
  35034. offsetX: offsetX + ev.pageX - startX,
  35035. offsetY: offsetY + ev.pageY - startY
  35036. };
  35037. });
  35038. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  35039. useEventListener(document, "mouseup", () => {
  35040. removeMousemove();
  35041. });
  35042. e.preventDefault();
  35043. }
  35044. function reset() {
  35045. transform.value = {
  35046. scale: 1,
  35047. deg: 0,
  35048. offsetX: 0,
  35049. offsetY: 0,
  35050. enableTransition: false
  35051. };
  35052. }
  35053. function toggleMode() {
  35054. if (loading.value)
  35055. return;
  35056. const modeNames = keysOf(modes);
  35057. const modeValues = Object.values(modes);
  35058. const currentMode = mode.value.name;
  35059. const index2 = modeValues.findIndex((i) => i.name === currentMode);
  35060. const nextIndex = (index2 + 1) % modeNames.length;
  35061. mode.value = modes[modeNames[nextIndex]];
  35062. reset();
  35063. }
  35064. function setActiveItem(index2) {
  35065. const len = props.urlList.length;
  35066. activeIndex.value = (index2 + len) % len;
  35067. }
  35068. function prev() {
  35069. if (isFirst.value && !props.infinite)
  35070. return;
  35071. setActiveItem(activeIndex.value - 1);
  35072. }
  35073. function next() {
  35074. if (isLast.value && !props.infinite)
  35075. return;
  35076. setActiveItem(activeIndex.value + 1);
  35077. }
  35078. function handleActions(action, options = {}) {
  35079. if (loading.value)
  35080. return;
  35081. const { minScale, maxScale } = props;
  35082. const { zoomRate, rotateDeg, enableTransition } = {
  35083. zoomRate: props.zoomRate,
  35084. rotateDeg: 90,
  35085. enableTransition: true,
  35086. ...options
  35087. };
  35088. switch (action) {
  35089. case "zoomOut":
  35090. if (transform.value.scale > minScale) {
  35091. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  35092. }
  35093. break;
  35094. case "zoomIn":
  35095. if (transform.value.scale < maxScale) {
  35096. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  35097. }
  35098. break;
  35099. case "clockwise":
  35100. transform.value.deg += rotateDeg;
  35101. emit2("rotate", transform.value.deg);
  35102. break;
  35103. case "anticlockwise":
  35104. transform.value.deg -= rotateDeg;
  35105. emit2("rotate", transform.value.deg);
  35106. break;
  35107. }
  35108. transform.value.enableTransition = enableTransition;
  35109. }
  35110. watch(currentImg, () => {
  35111. nextTick(() => {
  35112. const $img = imgRefs.value[0];
  35113. if (!($img == null ? void 0 : $img.complete)) {
  35114. loading.value = true;
  35115. }
  35116. });
  35117. });
  35118. watch(activeIndex, (val) => {
  35119. reset();
  35120. emit2("switch", val);
  35121. });
  35122. onMounted(() => {
  35123. var _a2, _b;
  35124. registerEventListener();
  35125. (_b = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  35126. });
  35127. expose({
  35128. setActiveItem
  35129. });
  35130. return (_ctx, _cache) => {
  35131. return openBlock(), createBlock(Teleport, {
  35132. to: "body",
  35133. disabled: !_ctx.teleported
  35134. }, [
  35135. createVNode(Transition, {
  35136. name: "viewer-fade",
  35137. appear: ""
  35138. }, {
  35139. default: withCtx(() => [
  35140. createBaseVNode("div", {
  35141. ref_key: "wrapper",
  35142. ref: wrapper,
  35143. tabindex: -1,
  35144. class: normalizeClass(unref(ns).e("wrapper")),
  35145. style: normalizeStyle({ zIndex: unref(computedZIndex) })
  35146. }, [
  35147. createBaseVNode("div", {
  35148. class: normalizeClass(unref(ns).e("mask")),
  35149. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"]))
  35150. }, null, 2),
  35151. createCommentVNode(" CLOSE "),
  35152. createBaseVNode("span", {
  35153. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  35154. onClick: hide
  35155. }, [
  35156. createVNode(unref(ElIcon), null, {
  35157. default: withCtx(() => [
  35158. createVNode(unref(close_default))
  35159. ]),
  35160. _: 1
  35161. })
  35162. ], 2),
  35163. createCommentVNode(" ARROW "),
  35164. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  35165. createBaseVNode("span", {
  35166. class: normalizeClass(unref(arrowPrevKls)),
  35167. onClick: prev
  35168. }, [
  35169. createVNode(unref(ElIcon), null, {
  35170. default: withCtx(() => [
  35171. createVNode(unref(arrow_left_default))
  35172. ]),
  35173. _: 1
  35174. })
  35175. ], 2),
  35176. createBaseVNode("span", {
  35177. class: normalizeClass(unref(arrowNextKls)),
  35178. onClick: next
  35179. }, [
  35180. createVNode(unref(ElIcon), null, {
  35181. default: withCtx(() => [
  35182. createVNode(unref(arrow_right_default))
  35183. ]),
  35184. _: 1
  35185. })
  35186. ], 2)
  35187. ], 64)) : createCommentVNode("v-if", true),
  35188. createCommentVNode(" ACTIONS "),
  35189. createBaseVNode("div", {
  35190. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  35191. }, [
  35192. createBaseVNode("div", {
  35193. class: normalizeClass(unref(ns).e("actions__inner"))
  35194. }, [
  35195. createVNode(unref(ElIcon), {
  35196. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  35197. }, {
  35198. default: withCtx(() => [
  35199. createVNode(unref(zoom_out_default))
  35200. ]),
  35201. _: 1
  35202. }),
  35203. createVNode(unref(ElIcon), {
  35204. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  35205. }, {
  35206. default: withCtx(() => [
  35207. createVNode(unref(zoom_in_default))
  35208. ]),
  35209. _: 1
  35210. }),
  35211. createBaseVNode("i", {
  35212. class: normalizeClass(unref(ns).e("actions__divider"))
  35213. }, null, 2),
  35214. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  35215. default: withCtx(() => [
  35216. (openBlock(), createBlock(resolveDynamicComponent(unref(mode).icon)))
  35217. ]),
  35218. _: 1
  35219. }),
  35220. createBaseVNode("i", {
  35221. class: normalizeClass(unref(ns).e("actions__divider"))
  35222. }, null, 2),
  35223. createVNode(unref(ElIcon), {
  35224. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  35225. }, {
  35226. default: withCtx(() => [
  35227. createVNode(unref(refresh_left_default))
  35228. ]),
  35229. _: 1
  35230. }),
  35231. createVNode(unref(ElIcon), {
  35232. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  35233. }, {
  35234. default: withCtx(() => [
  35235. createVNode(unref(refresh_right_default))
  35236. ]),
  35237. _: 1
  35238. })
  35239. ], 2)
  35240. ], 2),
  35241. createCommentVNode(" CANVAS "),
  35242. createBaseVNode("div", {
  35243. class: normalizeClass(unref(ns).e("canvas"))
  35244. }, [
  35245. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url, i) => {
  35246. return withDirectives((openBlock(), createElementBlock("img", {
  35247. ref_for: true,
  35248. ref: (el) => imgRefs.value[i] = el,
  35249. key: url,
  35250. src: url,
  35251. style: normalizeStyle(unref(imgStyle)),
  35252. class: normalizeClass(unref(ns).e("img")),
  35253. onLoad: handleImgLoad,
  35254. onError: handleImgError,
  35255. onMousedown: handleMouseDown
  35256. }, null, 46, _hoisted_1$x)), [
  35257. [vShow, i === activeIndex.value]
  35258. ]);
  35259. }), 128))
  35260. ], 2),
  35261. renderSlot(_ctx.$slots, "default")
  35262. ], 6)
  35263. ]),
  35264. _: 3
  35265. })
  35266. ], 8, ["disabled"]);
  35267. };
  35268. }
  35269. });
  35270. var ImageViewer = /* @__PURE__ */ _export_sfc$1(_sfc_main$13, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image-viewer/src/image-viewer.vue"]]);
  35271. const ElImageViewer = withInstall(ImageViewer);
  35272. const imageProps = buildProps({
  35273. hideOnClickModal: Boolean,
  35274. src: {
  35275. type: String,
  35276. default: ""
  35277. },
  35278. fit: {
  35279. type: String,
  35280. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  35281. default: ""
  35282. },
  35283. loading: {
  35284. type: String,
  35285. values: ["eager", "lazy"]
  35286. },
  35287. lazy: Boolean,
  35288. scrollContainer: {
  35289. type: definePropType([String, Object])
  35290. },
  35291. previewSrcList: {
  35292. type: definePropType(Array),
  35293. default: () => mutable([])
  35294. },
  35295. previewTeleported: Boolean,
  35296. zIndex: {
  35297. type: Number
  35298. },
  35299. initialIndex: {
  35300. type: Number,
  35301. default: 0
  35302. },
  35303. infinite: {
  35304. type: Boolean,
  35305. default: true
  35306. },
  35307. closeOnPressEscape: {
  35308. type: Boolean,
  35309. default: true
  35310. },
  35311. zoomRate: {
  35312. type: Number,
  35313. default: 1.2
  35314. },
  35315. minScale: {
  35316. type: Number,
  35317. default: 0.2
  35318. },
  35319. maxScale: {
  35320. type: Number,
  35321. default: 7
  35322. }
  35323. });
  35324. const imageEmits = {
  35325. load: (evt) => evt instanceof Event,
  35326. error: (evt) => evt instanceof Event,
  35327. switch: (val) => isNumber(val),
  35328. close: () => true,
  35329. show: () => true
  35330. };
  35331. const _hoisted_1$w = ["src", "loading"];
  35332. const _hoisted_2$k = { key: 0 };
  35333. const __default__$J = /* @__PURE__ */ defineComponent({
  35334. name: "ElImage",
  35335. inheritAttrs: false
  35336. });
  35337. const _sfc_main$12 = /* @__PURE__ */ defineComponent({
  35338. ...__default__$J,
  35339. props: imageProps,
  35340. emits: imageEmits,
  35341. setup(__props, { emit: emit2 }) {
  35342. const props = __props;
  35343. let prevOverflow = "";
  35344. const { t } = useLocale();
  35345. const ns = useNamespace("image");
  35346. const rawAttrs = useAttrs$1();
  35347. const attrs = useAttrs();
  35348. const imageSrc = ref();
  35349. const hasLoadError = ref(false);
  35350. const isLoading = ref(true);
  35351. const showViewer = ref(false);
  35352. const container = ref();
  35353. const _scrollContainer = ref();
  35354. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  35355. let stopScrollListener;
  35356. let stopWheelListener;
  35357. const imageKls = computed(() => [
  35358. ns.e("inner"),
  35359. preview.value && ns.e("preview"),
  35360. isLoading.value && ns.is("loading")
  35361. ]);
  35362. const containerStyle = computed(() => rawAttrs.style);
  35363. const imageStyle = computed(() => {
  35364. const { fit } = props;
  35365. if (isClient && fit) {
  35366. return { objectFit: fit };
  35367. }
  35368. return {};
  35369. });
  35370. const preview = computed(() => {
  35371. const { previewSrcList } = props;
  35372. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  35373. });
  35374. const imageIndex = computed(() => {
  35375. const { previewSrcList, initialIndex } = props;
  35376. let previewIndex = initialIndex;
  35377. if (initialIndex > previewSrcList.length - 1) {
  35378. previewIndex = 0;
  35379. }
  35380. return previewIndex;
  35381. });
  35382. const isManual = computed(() => {
  35383. if (props.loading === "eager")
  35384. return false;
  35385. return !supportLoading && props.loading === "lazy" || props.lazy;
  35386. });
  35387. const loadImage = () => {
  35388. if (!isClient)
  35389. return;
  35390. isLoading.value = true;
  35391. hasLoadError.value = false;
  35392. imageSrc.value = props.src;
  35393. };
  35394. function handleLoad(event) {
  35395. isLoading.value = false;
  35396. hasLoadError.value = false;
  35397. emit2("load", event);
  35398. }
  35399. function handleError2(event) {
  35400. isLoading.value = false;
  35401. hasLoadError.value = true;
  35402. emit2("error", event);
  35403. }
  35404. function handleLazyLoad() {
  35405. if (isInContainer(container.value, _scrollContainer.value)) {
  35406. loadImage();
  35407. removeLazyLoadListener();
  35408. }
  35409. }
  35410. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  35411. async function addLazyLoadListener() {
  35412. var _a2;
  35413. if (!isClient)
  35414. return;
  35415. await nextTick();
  35416. const { scrollContainer } = props;
  35417. if (isElement$1(scrollContainer)) {
  35418. _scrollContainer.value = scrollContainer;
  35419. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  35420. _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
  35421. } else if (container.value) {
  35422. _scrollContainer.value = getScrollContainer(container.value);
  35423. }
  35424. if (_scrollContainer.value) {
  35425. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  35426. setTimeout(() => handleLazyLoad(), 100);
  35427. }
  35428. }
  35429. function removeLazyLoadListener() {
  35430. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  35431. return;
  35432. stopScrollListener == null ? void 0 : stopScrollListener();
  35433. _scrollContainer.value = void 0;
  35434. }
  35435. function wheelHandler(e) {
  35436. if (!e.ctrlKey)
  35437. return;
  35438. if (e.deltaY < 0) {
  35439. e.preventDefault();
  35440. return false;
  35441. } else if (e.deltaY > 0) {
  35442. e.preventDefault();
  35443. return false;
  35444. }
  35445. }
  35446. function clickHandler() {
  35447. if (!preview.value)
  35448. return;
  35449. stopWheelListener = useEventListener("wheel", wheelHandler, {
  35450. passive: false
  35451. });
  35452. prevOverflow = document.body.style.overflow;
  35453. document.body.style.overflow = "hidden";
  35454. showViewer.value = true;
  35455. emit2("show");
  35456. }
  35457. function closeViewer() {
  35458. stopWheelListener == null ? void 0 : stopWheelListener();
  35459. document.body.style.overflow = prevOverflow;
  35460. showViewer.value = false;
  35461. emit2("close");
  35462. }
  35463. function switchViewer(val) {
  35464. emit2("switch", val);
  35465. }
  35466. watch(() => props.src, () => {
  35467. if (isManual.value) {
  35468. isLoading.value = true;
  35469. hasLoadError.value = false;
  35470. removeLazyLoadListener();
  35471. addLazyLoadListener();
  35472. } else {
  35473. loadImage();
  35474. }
  35475. });
  35476. onMounted(() => {
  35477. if (isManual.value) {
  35478. addLazyLoadListener();
  35479. } else {
  35480. loadImage();
  35481. }
  35482. });
  35483. return (_ctx, _cache) => {
  35484. return openBlock(), createElementBlock("div", {
  35485. ref_key: "container",
  35486. ref: container,
  35487. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  35488. style: normalizeStyle(unref(containerStyle))
  35489. }, [
  35490. hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  35491. createBaseVNode("div", {
  35492. class: normalizeClass(unref(ns).e("error"))
  35493. }, toDisplayString(unref(t)("el.image.error")), 3)
  35494. ]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  35495. imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(attrs), {
  35496. src: imageSrc.value,
  35497. loading: _ctx.loading,
  35498. style: unref(imageStyle),
  35499. class: unref(imageKls),
  35500. onClick: clickHandler,
  35501. onLoad: handleLoad,
  35502. onError: handleError2
  35503. }), null, 16, _hoisted_1$w)) : createCommentVNode("v-if", true),
  35504. isLoading.value ? (openBlock(), createElementBlock("div", {
  35505. key: 1,
  35506. class: normalizeClass(unref(ns).e("wrapper"))
  35507. }, [
  35508. renderSlot(_ctx.$slots, "placeholder", {}, () => [
  35509. createBaseVNode("div", {
  35510. class: normalizeClass(unref(ns).e("placeholder"))
  35511. }, null, 2)
  35512. ])
  35513. ], 2)) : createCommentVNode("v-if", true)
  35514. ], 64)),
  35515. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  35516. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  35517. key: 0,
  35518. "z-index": _ctx.zIndex,
  35519. "initial-index": unref(imageIndex),
  35520. infinite: _ctx.infinite,
  35521. "zoom-rate": _ctx.zoomRate,
  35522. "min-scale": _ctx.minScale,
  35523. "max-scale": _ctx.maxScale,
  35524. "url-list": _ctx.previewSrcList,
  35525. "hide-on-click-modal": _ctx.hideOnClickModal,
  35526. teleported: _ctx.previewTeleported,
  35527. "close-on-press-escape": _ctx.closeOnPressEscape,
  35528. onClose: closeViewer,
  35529. onSwitch: switchViewer
  35530. }, {
  35531. default: withCtx(() => [
  35532. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$k, [
  35533. renderSlot(_ctx.$slots, "viewer")
  35534. ])) : createCommentVNode("v-if", true)
  35535. ]),
  35536. _: 3
  35537. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "url-list", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : createCommentVNode("v-if", true)
  35538. ], 64)) : createCommentVNode("v-if", true)
  35539. ], 6);
  35540. };
  35541. }
  35542. });
  35543. var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
  35544. const ElImage = withInstall(Image$1);
  35545. const inputNumberProps = buildProps({
  35546. id: {
  35547. type: String,
  35548. default: void 0
  35549. },
  35550. step: {
  35551. type: Number,
  35552. default: 1
  35553. },
  35554. stepStrictly: Boolean,
  35555. max: {
  35556. type: Number,
  35557. default: Number.POSITIVE_INFINITY
  35558. },
  35559. min: {
  35560. type: Number,
  35561. default: Number.NEGATIVE_INFINITY
  35562. },
  35563. modelValue: Number,
  35564. readonly: Boolean,
  35565. disabled: Boolean,
  35566. size: useSizeProp,
  35567. controls: {
  35568. type: Boolean,
  35569. default: true
  35570. },
  35571. controlsPosition: {
  35572. type: String,
  35573. default: "",
  35574. values: ["", "right"]
  35575. },
  35576. valueOnClear: {
  35577. type: [String, Number, null],
  35578. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  35579. default: null
  35580. },
  35581. name: String,
  35582. label: String,
  35583. placeholder: String,
  35584. precision: {
  35585. type: Number,
  35586. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  35587. },
  35588. validateEvent: {
  35589. type: Boolean,
  35590. default: true
  35591. }
  35592. });
  35593. const inputNumberEmits = {
  35594. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  35595. blur: (e) => e instanceof FocusEvent,
  35596. focus: (e) => e instanceof FocusEvent,
  35597. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  35598. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  35599. };
  35600. const _hoisted_1$v = ["aria-label", "onKeydown"];
  35601. const _hoisted_2$j = ["aria-label", "onKeydown"];
  35602. const __default__$I = /* @__PURE__ */ defineComponent({
  35603. name: "ElInputNumber"
  35604. });
  35605. const _sfc_main$11 = /* @__PURE__ */ defineComponent({
  35606. ...__default__$I,
  35607. props: inputNumberProps,
  35608. emits: inputNumberEmits,
  35609. setup(__props, { expose, emit: emit2 }) {
  35610. const props = __props;
  35611. const { t } = useLocale();
  35612. const ns = useNamespace("input-number");
  35613. const input = ref();
  35614. const data = reactive({
  35615. currentValue: props.modelValue,
  35616. userInput: null
  35617. });
  35618. const { formItem } = useFormItem();
  35619. const minDisabled = computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  35620. const maxDisabled = computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  35621. const numPrecision = computed(() => {
  35622. const stepPrecision = getPrecision(props.step);
  35623. if (!isUndefined(props.precision)) {
  35624. if (stepPrecision > props.precision)
  35625. ;
  35626. return props.precision;
  35627. } else {
  35628. return Math.max(getPrecision(props.modelValue), stepPrecision);
  35629. }
  35630. });
  35631. const controlsAtRight = computed(() => {
  35632. return props.controls && props.controlsPosition === "right";
  35633. });
  35634. const inputNumberSize = useFormSize();
  35635. const inputNumberDisabled = useFormDisabled();
  35636. const displayValue = computed(() => {
  35637. if (data.userInput !== null) {
  35638. return data.userInput;
  35639. }
  35640. let currentValue = data.currentValue;
  35641. if (isNil(currentValue))
  35642. return "";
  35643. if (isNumber(currentValue)) {
  35644. if (Number.isNaN(currentValue))
  35645. return "";
  35646. if (!isUndefined(props.precision)) {
  35647. currentValue = currentValue.toFixed(props.precision);
  35648. }
  35649. }
  35650. return currentValue;
  35651. });
  35652. const toPrecision = (num, pre) => {
  35653. if (isUndefined(pre))
  35654. pre = numPrecision.value;
  35655. if (pre === 0)
  35656. return Math.round(num);
  35657. let snum = String(num);
  35658. const pointPos = snum.indexOf(".");
  35659. if (pointPos === -1)
  35660. return num;
  35661. const nums = snum.replace(".", "").split("");
  35662. const datum = nums[pointPos + pre];
  35663. if (!datum)
  35664. return num;
  35665. const length = snum.length;
  35666. if (snum.charAt(length - 1) === "5") {
  35667. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  35668. }
  35669. return Number.parseFloat(Number(snum).toFixed(pre));
  35670. };
  35671. const getPrecision = (value) => {
  35672. if (isNil(value))
  35673. return 0;
  35674. const valueString = value.toString();
  35675. const dotPosition = valueString.indexOf(".");
  35676. let precision = 0;
  35677. if (dotPosition !== -1) {
  35678. precision = valueString.length - dotPosition - 1;
  35679. }
  35680. return precision;
  35681. };
  35682. const ensurePrecision = (val, coefficient = 1) => {
  35683. if (!isNumber(val))
  35684. return data.currentValue;
  35685. return toPrecision(val + props.step * coefficient);
  35686. };
  35687. const increase = () => {
  35688. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  35689. return;
  35690. const value = Number(displayValue.value) || 0;
  35691. const newVal = ensurePrecision(value);
  35692. setCurrentValue(newVal);
  35693. emit2(INPUT_EVENT, data.currentValue);
  35694. };
  35695. const decrease = () => {
  35696. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  35697. return;
  35698. const value = Number(displayValue.value) || 0;
  35699. const newVal = ensurePrecision(value, -1);
  35700. setCurrentValue(newVal);
  35701. emit2(INPUT_EVENT, data.currentValue);
  35702. };
  35703. const verifyValue = (value, update) => {
  35704. const { max: max2, min: min2, step, precision, stepStrictly, valueOnClear } = props;
  35705. if (max2 < min2) {
  35706. throwError("InputNumber", "min should not be greater than max.");
  35707. }
  35708. let newVal = Number(value);
  35709. if (isNil(value) || Number.isNaN(newVal)) {
  35710. return null;
  35711. }
  35712. if (value === "") {
  35713. if (valueOnClear === null) {
  35714. return null;
  35715. }
  35716. newVal = isString$1(valueOnClear) ? { min: min2, max: max2 }[valueOnClear] : valueOnClear;
  35717. }
  35718. if (stepStrictly) {
  35719. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  35720. }
  35721. if (!isUndefined(precision)) {
  35722. newVal = toPrecision(newVal, precision);
  35723. }
  35724. if (newVal > max2 || newVal < min2) {
  35725. newVal = newVal > max2 ? max2 : min2;
  35726. update && emit2(UPDATE_MODEL_EVENT, newVal);
  35727. }
  35728. return newVal;
  35729. };
  35730. const setCurrentValue = (value, emitChange = true) => {
  35731. var _a2;
  35732. const oldVal = data.currentValue;
  35733. const newVal = verifyValue(value);
  35734. if (!emitChange) {
  35735. emit2(UPDATE_MODEL_EVENT, newVal);
  35736. return;
  35737. }
  35738. if (oldVal === newVal)
  35739. return;
  35740. data.userInput = null;
  35741. emit2(UPDATE_MODEL_EVENT, newVal);
  35742. emit2(CHANGE_EVENT, newVal, oldVal);
  35743. if (props.validateEvent) {
  35744. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  35745. }
  35746. data.currentValue = newVal;
  35747. };
  35748. const handleInput = (value) => {
  35749. data.userInput = value;
  35750. const newVal = value === "" ? null : Number(value);
  35751. emit2(INPUT_EVENT, newVal);
  35752. setCurrentValue(newVal, false);
  35753. };
  35754. const handleInputChange = (value) => {
  35755. const newVal = value !== "" ? Number(value) : "";
  35756. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  35757. setCurrentValue(newVal);
  35758. }
  35759. data.userInput = null;
  35760. };
  35761. const focus = () => {
  35762. var _a2, _b;
  35763. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  35764. };
  35765. const blur = () => {
  35766. var _a2, _b;
  35767. (_b = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
  35768. };
  35769. const handleFocus = (event) => {
  35770. emit2("focus", event);
  35771. };
  35772. const handleBlur = (event) => {
  35773. var _a2;
  35774. emit2("blur", event);
  35775. if (props.validateEvent) {
  35776. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  35777. }
  35778. };
  35779. watch(() => props.modelValue, (value) => {
  35780. const userInput = verifyValue(data.userInput);
  35781. const newValue = verifyValue(value, true);
  35782. if (!isNumber(userInput) && (!userInput || userInput !== newValue)) {
  35783. data.currentValue = newValue;
  35784. data.userInput = null;
  35785. }
  35786. }, { immediate: true });
  35787. onMounted(() => {
  35788. var _a2;
  35789. const { min: min2, max: max2, modelValue } = props;
  35790. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  35791. innerInput.setAttribute("role", "spinbutton");
  35792. if (Number.isFinite(max2)) {
  35793. innerInput.setAttribute("aria-valuemax", String(max2));
  35794. } else {
  35795. innerInput.removeAttribute("aria-valuemax");
  35796. }
  35797. if (Number.isFinite(min2)) {
  35798. innerInput.setAttribute("aria-valuemin", String(min2));
  35799. } else {
  35800. innerInput.removeAttribute("aria-valuemin");
  35801. }
  35802. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  35803. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  35804. if (!isNumber(modelValue) && modelValue != null) {
  35805. let val = Number(modelValue);
  35806. if (Number.isNaN(val)) {
  35807. val = null;
  35808. }
  35809. emit2(UPDATE_MODEL_EVENT, val);
  35810. }
  35811. });
  35812. onUpdated(() => {
  35813. var _a2, _b;
  35814. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  35815. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  35816. });
  35817. expose({
  35818. focus,
  35819. blur
  35820. });
  35821. return (_ctx, _cache) => {
  35822. return openBlock(), createElementBlock("div", {
  35823. class: normalizeClass([
  35824. unref(ns).b(),
  35825. unref(ns).m(unref(inputNumberSize)),
  35826. unref(ns).is("disabled", unref(inputNumberDisabled)),
  35827. unref(ns).is("without-controls", !_ctx.controls),
  35828. unref(ns).is("controls-right", unref(controlsAtRight))
  35829. ]),
  35830. onDragstart: _cache[1] || (_cache[1] = withModifiers(() => {
  35831. }, ["prevent"]))
  35832. }, [
  35833. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  35834. key: 0,
  35835. role: "button",
  35836. "aria-label": unref(t)("el.inputNumber.decrease"),
  35837. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
  35838. onKeydown: withKeys(decrease, ["enter"])
  35839. }, [
  35840. createVNode(unref(ElIcon), null, {
  35841. default: withCtx(() => [
  35842. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
  35843. ]),
  35844. _: 1
  35845. })
  35846. ], 42, _hoisted_1$v)), [
  35847. [unref(vRepeatClick), decrease]
  35848. ]) : createCommentVNode("v-if", true),
  35849. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  35850. key: 1,
  35851. role: "button",
  35852. "aria-label": unref(t)("el.inputNumber.increase"),
  35853. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
  35854. onKeydown: withKeys(increase, ["enter"])
  35855. }, [
  35856. createVNode(unref(ElIcon), null, {
  35857. default: withCtx(() => [
  35858. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
  35859. ]),
  35860. _: 1
  35861. })
  35862. ], 42, _hoisted_2$j)), [
  35863. [unref(vRepeatClick), increase]
  35864. ]) : createCommentVNode("v-if", true),
  35865. createVNode(unref(ElInput), {
  35866. id: _ctx.id,
  35867. ref_key: "input",
  35868. ref: input,
  35869. type: "number",
  35870. step: _ctx.step,
  35871. "model-value": unref(displayValue),
  35872. placeholder: _ctx.placeholder,
  35873. readonly: _ctx.readonly,
  35874. disabled: unref(inputNumberDisabled),
  35875. size: unref(inputNumberSize),
  35876. max: _ctx.max,
  35877. min: _ctx.min,
  35878. name: _ctx.name,
  35879. label: _ctx.label,
  35880. "validate-event": false,
  35881. onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
  35882. }, ["prevent"])),
  35883. onKeydown: [
  35884. withKeys(withModifiers(increase, ["prevent"]), ["up"]),
  35885. withKeys(withModifiers(decrease, ["prevent"]), ["down"])
  35886. ],
  35887. onBlur: handleBlur,
  35888. onFocus: handleFocus,
  35889. onInput: handleInput,
  35890. onChange: handleInputChange
  35891. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
  35892. ], 34);
  35893. };
  35894. }
  35895. });
  35896. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  35897. const ElInputNumber = withInstall(InputNumber);
  35898. const linkProps = buildProps({
  35899. type: {
  35900. type: String,
  35901. values: ["primary", "success", "warning", "info", "danger", "default"],
  35902. default: "default"
  35903. },
  35904. underline: {
  35905. type: Boolean,
  35906. default: true
  35907. },
  35908. disabled: { type: Boolean, default: false },
  35909. href: { type: String, default: "" },
  35910. icon: {
  35911. type: iconPropType
  35912. }
  35913. });
  35914. const linkEmits = {
  35915. click: (evt) => evt instanceof MouseEvent
  35916. };
  35917. const _hoisted_1$u = ["href"];
  35918. const __default__$H = /* @__PURE__ */ defineComponent({
  35919. name: "ElLink"
  35920. });
  35921. const _sfc_main$10 = /* @__PURE__ */ defineComponent({
  35922. ...__default__$H,
  35923. props: linkProps,
  35924. emits: linkEmits,
  35925. setup(__props, { emit: emit2 }) {
  35926. const props = __props;
  35927. const ns = useNamespace("link");
  35928. const linkKls = computed(() => [
  35929. ns.b(),
  35930. ns.m(props.type),
  35931. ns.is("disabled", props.disabled),
  35932. ns.is("underline", props.underline && !props.disabled)
  35933. ]);
  35934. function handleClick(event) {
  35935. if (!props.disabled)
  35936. emit2("click", event);
  35937. }
  35938. return (_ctx, _cache) => {
  35939. return openBlock(), createElementBlock("a", {
  35940. class: normalizeClass(unref(linkKls)),
  35941. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  35942. onClick: handleClick
  35943. }, [
  35944. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  35945. default: withCtx(() => [
  35946. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  35947. ]),
  35948. _: 1
  35949. })) : createCommentVNode("v-if", true),
  35950. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  35951. key: 1,
  35952. class: normalizeClass(unref(ns).e("inner"))
  35953. }, [
  35954. renderSlot(_ctx.$slots, "default")
  35955. ], 2)) : createCommentVNode("v-if", true),
  35956. _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true)
  35957. ], 10, _hoisted_1$u);
  35958. };
  35959. }
  35960. });
  35961. var Link = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/link/src/link.vue"]]);
  35962. const ElLink = withInstall(Link);
  35963. let SubMenu$1 = class SubMenu {
  35964. constructor(parent, domNode) {
  35965. this.parent = parent;
  35966. this.domNode = domNode;
  35967. this.subIndex = 0;
  35968. this.subIndex = 0;
  35969. this.init();
  35970. }
  35971. init() {
  35972. this.subMenuItems = this.domNode.querySelectorAll("li");
  35973. this.addListeners();
  35974. }
  35975. gotoSubIndex(idx) {
  35976. if (idx === this.subMenuItems.length) {
  35977. idx = 0;
  35978. } else if (idx < 0) {
  35979. idx = this.subMenuItems.length - 1;
  35980. }
  35981. this.subMenuItems[idx].focus();
  35982. this.subIndex = idx;
  35983. }
  35984. addListeners() {
  35985. const parentNode = this.parent.domNode;
  35986. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  35987. el.addEventListener("keydown", (event) => {
  35988. let prevDef = false;
  35989. switch (event.code) {
  35990. case EVENT_CODE.down: {
  35991. this.gotoSubIndex(this.subIndex + 1);
  35992. prevDef = true;
  35993. break;
  35994. }
  35995. case EVENT_CODE.up: {
  35996. this.gotoSubIndex(this.subIndex - 1);
  35997. prevDef = true;
  35998. break;
  35999. }
  36000. case EVENT_CODE.tab: {
  36001. triggerEvent(parentNode, "mouseleave");
  36002. break;
  36003. }
  36004. case EVENT_CODE.enter:
  36005. case EVENT_CODE.space: {
  36006. prevDef = true;
  36007. event.currentTarget.click();
  36008. break;
  36009. }
  36010. }
  36011. if (prevDef) {
  36012. event.preventDefault();
  36013. event.stopPropagation();
  36014. }
  36015. return false;
  36016. });
  36017. });
  36018. }
  36019. };
  36020. let MenuItem$1 = class MenuItem {
  36021. constructor(domNode, namespace) {
  36022. this.domNode = domNode;
  36023. this.submenu = null;
  36024. this.submenu = null;
  36025. this.init(namespace);
  36026. }
  36027. init(namespace) {
  36028. this.domNode.setAttribute("tabindex", "0");
  36029. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  36030. if (menuChild) {
  36031. this.submenu = new SubMenu$1(this, menuChild);
  36032. }
  36033. this.addListeners();
  36034. }
  36035. addListeners() {
  36036. this.domNode.addEventListener("keydown", (event) => {
  36037. let prevDef = false;
  36038. switch (event.code) {
  36039. case EVENT_CODE.down: {
  36040. triggerEvent(event.currentTarget, "mouseenter");
  36041. this.submenu && this.submenu.gotoSubIndex(0);
  36042. prevDef = true;
  36043. break;
  36044. }
  36045. case EVENT_CODE.up: {
  36046. triggerEvent(event.currentTarget, "mouseenter");
  36047. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  36048. prevDef = true;
  36049. break;
  36050. }
  36051. case EVENT_CODE.tab: {
  36052. triggerEvent(event.currentTarget, "mouseleave");
  36053. break;
  36054. }
  36055. case EVENT_CODE.enter:
  36056. case EVENT_CODE.space: {
  36057. prevDef = true;
  36058. event.currentTarget.click();
  36059. break;
  36060. }
  36061. }
  36062. if (prevDef) {
  36063. event.preventDefault();
  36064. }
  36065. });
  36066. }
  36067. };
  36068. let Menu$1 = class Menu {
  36069. constructor(domNode, namespace) {
  36070. this.domNode = domNode;
  36071. this.init(namespace);
  36072. }
  36073. init(namespace) {
  36074. const menuChildren = this.domNode.childNodes;
  36075. Array.from(menuChildren).forEach((child) => {
  36076. if (child.nodeType === 1) {
  36077. new MenuItem$1(child, namespace);
  36078. }
  36079. });
  36080. }
  36081. };
  36082. const _sfc_main$$ = /* @__PURE__ */ defineComponent({
  36083. name: "ElMenuCollapseTransition",
  36084. setup() {
  36085. const ns = useNamespace("menu");
  36086. const listeners = {
  36087. onBeforeEnter: (el) => el.style.opacity = "0.2",
  36088. onEnter(el, done) {
  36089. addClass(el, `${ns.namespace.value}-opacity-transition`);
  36090. el.style.opacity = "1";
  36091. done();
  36092. },
  36093. onAfterEnter(el) {
  36094. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  36095. el.style.opacity = "";
  36096. },
  36097. onBeforeLeave(el) {
  36098. if (!el.dataset) {
  36099. el.dataset = {};
  36100. }
  36101. if (hasClass(el, ns.m("collapse"))) {
  36102. removeClass(el, ns.m("collapse"));
  36103. el.dataset.oldOverflow = el.style.overflow;
  36104. el.dataset.scrollWidth = el.clientWidth.toString();
  36105. addClass(el, ns.m("collapse"));
  36106. } else {
  36107. addClass(el, ns.m("collapse"));
  36108. el.dataset.oldOverflow = el.style.overflow;
  36109. el.dataset.scrollWidth = el.clientWidth.toString();
  36110. removeClass(el, ns.m("collapse"));
  36111. }
  36112. el.style.width = `${el.scrollWidth}px`;
  36113. el.style.overflow = "hidden";
  36114. },
  36115. onLeave(el) {
  36116. addClass(el, "horizontal-collapse-transition");
  36117. el.style.width = `${el.dataset.scrollWidth}px`;
  36118. }
  36119. };
  36120. return {
  36121. listeners
  36122. };
  36123. }
  36124. });
  36125. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  36126. return openBlock(), createBlock(Transition, mergeProps({ mode: "out-in" }, _ctx.listeners), {
  36127. default: withCtx(() => [
  36128. renderSlot(_ctx.$slots, "default")
  36129. ]),
  36130. _: 3
  36131. }, 16);
  36132. }
  36133. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["render", _sfc_render$e], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/menu/src/menu-collapse-transition.vue"]]);
  36134. function useMenu(instance, currentIndex) {
  36135. const indexPath = computed(() => {
  36136. let parent = instance.parent;
  36137. const path = [currentIndex.value];
  36138. while (parent.type.name !== "ElMenu") {
  36139. if (parent.props.index) {
  36140. path.unshift(parent.props.index);
  36141. }
  36142. parent = parent.parent;
  36143. }
  36144. return path;
  36145. });
  36146. const parentMenu = computed(() => {
  36147. let parent = instance.parent;
  36148. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  36149. parent = parent.parent;
  36150. }
  36151. return parent;
  36152. });
  36153. return {
  36154. parentMenu,
  36155. indexPath
  36156. };
  36157. }
  36158. function useMenuColor(props) {
  36159. const menuBarColor = computed(() => {
  36160. const color = props.backgroundColor;
  36161. if (!color) {
  36162. return "";
  36163. } else {
  36164. return new TinyColor(color).shade(20).toString();
  36165. }
  36166. });
  36167. return menuBarColor;
  36168. }
  36169. const useMenuCssVar = (props, level) => {
  36170. const ns = useNamespace("menu");
  36171. return computed(() => {
  36172. return ns.cssVarBlock({
  36173. "text-color": props.textColor || "",
  36174. "hover-text-color": props.textColor || "",
  36175. "bg-color": props.backgroundColor || "",
  36176. "hover-bg-color": useMenuColor(props).value || "",
  36177. "active-color": props.activeTextColor || "",
  36178. level: `${level}`
  36179. });
  36180. });
  36181. };
  36182. const subMenuProps = buildProps({
  36183. index: {
  36184. type: String,
  36185. required: true
  36186. },
  36187. showTimeout: {
  36188. type: Number,
  36189. default: 300
  36190. },
  36191. hideTimeout: {
  36192. type: Number,
  36193. default: 300
  36194. },
  36195. popperClass: String,
  36196. disabled: Boolean,
  36197. popperAppendToBody: {
  36198. type: Boolean,
  36199. default: void 0
  36200. },
  36201. teleported: {
  36202. type: Boolean,
  36203. default: void 0
  36204. },
  36205. popperOffset: {
  36206. type: Number,
  36207. default: 6
  36208. },
  36209. expandCloseIcon: {
  36210. type: iconPropType
  36211. },
  36212. expandOpenIcon: {
  36213. type: iconPropType
  36214. },
  36215. collapseCloseIcon: {
  36216. type: iconPropType
  36217. },
  36218. collapseOpenIcon: {
  36219. type: iconPropType
  36220. }
  36221. });
  36222. const COMPONENT_NAME$c = "ElSubMenu";
  36223. var SubMenu = /* @__PURE__ */ defineComponent({
  36224. name: COMPONENT_NAME$c,
  36225. props: subMenuProps,
  36226. setup(props, { slots, expose }) {
  36227. useDeprecated({
  36228. from: "popper-append-to-body",
  36229. replacement: "teleported",
  36230. scope: COMPONENT_NAME$c,
  36231. version: "2.3.0",
  36232. ref: "https://element-plus.org/en-US/component/menu.html#submenu-attributes"
  36233. }, computed(() => props.popperAppendToBody !== void 0));
  36234. const instance = getCurrentInstance();
  36235. const { indexPath, parentMenu } = useMenu(instance, computed(() => props.index));
  36236. const nsMenu = useNamespace("menu");
  36237. const nsSubMenu = useNamespace("sub-menu");
  36238. const rootMenu = inject("rootMenu");
  36239. if (!rootMenu)
  36240. throwError(COMPONENT_NAME$c, "can not inject root menu");
  36241. const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
  36242. if (!subMenu)
  36243. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  36244. const items = ref({});
  36245. const subMenus = ref({});
  36246. let timeout;
  36247. const mouseInChild = ref(false);
  36248. const verticalTitleRef = ref();
  36249. const vPopper = ref(null);
  36250. const currentPlacement = computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  36251. const subMenuTitleIcon = computed(() => {
  36252. return mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse ? props.expandCloseIcon && props.expandOpenIcon ? opened.value ? props.expandOpenIcon : props.expandCloseIcon : arrow_down_default : props.collapseCloseIcon && props.collapseOpenIcon ? opened.value ? props.collapseOpenIcon : props.collapseCloseIcon : arrow_right_default;
  36253. });
  36254. const isFirstLevel = computed(() => {
  36255. return subMenu.level === 0;
  36256. });
  36257. const appendToBody = computed(() => {
  36258. var _a2;
  36259. const value = (_a2 = props.teleported) != null ? _a2 : props.popperAppendToBody;
  36260. return value === void 0 ? isFirstLevel.value : value;
  36261. });
  36262. const menuTransitionName = computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  36263. const fallbackPlacements = computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  36264. "bottom-start",
  36265. "bottom-end",
  36266. "top-start",
  36267. "top-end",
  36268. "right-start",
  36269. "left-start"
  36270. ] : [
  36271. "right-start",
  36272. "right",
  36273. "right-end",
  36274. "left-start",
  36275. "bottom-start",
  36276. "bottom-end",
  36277. "top-start",
  36278. "top-end"
  36279. ]);
  36280. const opened = computed(() => rootMenu.openedMenus.includes(props.index));
  36281. const active = computed(() => {
  36282. let isActive = false;
  36283. Object.values(items.value).forEach((item2) => {
  36284. if (item2.active) {
  36285. isActive = true;
  36286. }
  36287. });
  36288. Object.values(subMenus.value).forEach((subItem) => {
  36289. if (subItem.active) {
  36290. isActive = true;
  36291. }
  36292. });
  36293. return isActive;
  36294. });
  36295. const mode = computed(() => rootMenu.props.mode);
  36296. const item = reactive({
  36297. index: props.index,
  36298. indexPath,
  36299. active
  36300. });
  36301. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  36302. const doDestroy = () => {
  36303. var _a2, _b, _c;
  36304. return (_c = (_b = (_a2 = vPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  36305. };
  36306. const handleCollapseToggle = (value) => {
  36307. if (!value) {
  36308. doDestroy();
  36309. }
  36310. };
  36311. const handleClick = () => {
  36312. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  36313. return;
  36314. rootMenu.handleSubMenuClick({
  36315. index: props.index,
  36316. indexPath: indexPath.value,
  36317. active: active.value
  36318. });
  36319. };
  36320. const handleMouseenter = (event, showTimeout = props.showTimeout) => {
  36321. var _a2;
  36322. if (event.type === "focus") {
  36323. return;
  36324. }
  36325. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  36326. return;
  36327. }
  36328. subMenu.mouseInChild.value = true;
  36329. timeout == null ? void 0 : timeout();
  36330. ({ stop: timeout } = useTimeoutFn(() => {
  36331. rootMenu.openMenu(props.index, indexPath.value);
  36332. }, showTimeout));
  36333. if (appendToBody.value) {
  36334. (_a2 = parentMenu.value.vnode.el) == null ? void 0 : _a2.dispatchEvent(new MouseEvent("mouseenter"));
  36335. }
  36336. };
  36337. const handleMouseleave = (deepDispatch = false) => {
  36338. var _a2, _b;
  36339. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  36340. return;
  36341. }
  36342. timeout == null ? void 0 : timeout();
  36343. subMenu.mouseInChild.value = false;
  36344. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), props.hideTimeout));
  36345. if (appendToBody.value && deepDispatch) {
  36346. if (((_a2 = instance.parent) == null ? void 0 : _a2.type.name) === "ElSubMenu") {
  36347. (_b = subMenu.handleMouseleave) == null ? void 0 : _b.call(subMenu, true);
  36348. }
  36349. }
  36350. };
  36351. watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  36352. {
  36353. const addSubMenu = (item2) => {
  36354. subMenus.value[item2.index] = item2;
  36355. };
  36356. const removeSubMenu = (item2) => {
  36357. delete subMenus.value[item2.index];
  36358. };
  36359. provide(`subMenu:${instance.uid}`, {
  36360. addSubMenu,
  36361. removeSubMenu,
  36362. handleMouseleave,
  36363. mouseInChild,
  36364. level: subMenu.level + 1
  36365. });
  36366. }
  36367. expose({
  36368. opened
  36369. });
  36370. onMounted(() => {
  36371. rootMenu.addSubMenu(item);
  36372. subMenu.addSubMenu(item);
  36373. });
  36374. onBeforeUnmount(() => {
  36375. subMenu.removeSubMenu(item);
  36376. rootMenu.removeSubMenu(item);
  36377. });
  36378. return () => {
  36379. var _a2;
  36380. const titleTag = [
  36381. (_a2 = slots.title) == null ? void 0 : _a2.call(slots),
  36382. h$1(ElIcon, {
  36383. class: nsSubMenu.e("icon-arrow"),
  36384. style: {
  36385. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  36386. }
  36387. }, {
  36388. default: () => isString$1(subMenuTitleIcon.value) ? h$1(instance.appContext.components[subMenuTitleIcon.value]) : h$1(subMenuTitleIcon.value)
  36389. })
  36390. ];
  36391. const child = rootMenu.isMenuPopup ? h$1(ElTooltip, {
  36392. ref: vPopper,
  36393. visible: opened.value,
  36394. effect: "light",
  36395. pure: true,
  36396. offset: props.popperOffset,
  36397. showArrow: false,
  36398. persistent: true,
  36399. popperClass: props.popperClass,
  36400. placement: currentPlacement.value,
  36401. teleported: appendToBody.value,
  36402. fallbackPlacements: fallbackPlacements.value,
  36403. transition: menuTransitionName.value,
  36404. gpuAcceleration: false
  36405. }, {
  36406. content: () => {
  36407. var _a22;
  36408. return h$1("div", {
  36409. class: [
  36410. nsMenu.m(mode.value),
  36411. nsMenu.m("popup-container"),
  36412. props.popperClass
  36413. ],
  36414. onMouseenter: (evt) => handleMouseenter(evt, 100),
  36415. onMouseleave: () => handleMouseleave(true),
  36416. onFocus: (evt) => handleMouseenter(evt, 100)
  36417. }, [
  36418. h$1("ul", {
  36419. class: [
  36420. nsMenu.b(),
  36421. nsMenu.m("popup"),
  36422. nsMenu.m(`popup-${currentPlacement.value}`)
  36423. ],
  36424. style: ulStyle.value
  36425. }, [(_a22 = slots.default) == null ? void 0 : _a22.call(slots)])
  36426. ]);
  36427. },
  36428. default: () => h$1("div", {
  36429. class: nsSubMenu.e("title"),
  36430. onClick: handleClick
  36431. }, titleTag)
  36432. }) : h$1(Fragment, {}, [
  36433. h$1("div", {
  36434. class: nsSubMenu.e("title"),
  36435. ref: verticalTitleRef,
  36436. onClick: handleClick
  36437. }, titleTag),
  36438. h$1(_CollapseTransition, {}, {
  36439. default: () => {
  36440. var _a22;
  36441. return withDirectives(h$1("ul", {
  36442. role: "menu",
  36443. class: [nsMenu.b(), nsMenu.m("inline")],
  36444. style: ulStyle.value
  36445. }, [(_a22 = slots.default) == null ? void 0 : _a22.call(slots)]), [[vShow, opened.value]]);
  36446. }
  36447. })
  36448. ]);
  36449. return h$1("li", {
  36450. class: [
  36451. nsSubMenu.b(),
  36452. nsSubMenu.is("active", active.value),
  36453. nsSubMenu.is("opened", opened.value),
  36454. nsSubMenu.is("disabled", props.disabled)
  36455. ],
  36456. role: "menuitem",
  36457. ariaHaspopup: true,
  36458. ariaExpanded: opened.value,
  36459. onMouseenter: handleMouseenter,
  36460. onMouseleave: () => handleMouseleave(true),
  36461. onFocus: handleMouseenter
  36462. }, [child]);
  36463. };
  36464. }
  36465. });
  36466. const menuProps = buildProps({
  36467. mode: {
  36468. type: String,
  36469. values: ["horizontal", "vertical"],
  36470. default: "vertical"
  36471. },
  36472. defaultActive: {
  36473. type: String,
  36474. default: ""
  36475. },
  36476. defaultOpeneds: {
  36477. type: definePropType(Array),
  36478. default: () => mutable([])
  36479. },
  36480. uniqueOpened: Boolean,
  36481. router: Boolean,
  36482. menuTrigger: {
  36483. type: String,
  36484. values: ["hover", "click"],
  36485. default: "hover"
  36486. },
  36487. collapse: Boolean,
  36488. backgroundColor: String,
  36489. textColor: String,
  36490. activeTextColor: String,
  36491. collapseTransition: {
  36492. type: Boolean,
  36493. default: true
  36494. },
  36495. ellipsis: {
  36496. type: Boolean,
  36497. default: true
  36498. },
  36499. popperEffect: {
  36500. type: String,
  36501. values: ["dark", "light"],
  36502. default: "dark"
  36503. }
  36504. });
  36505. const checkIndexPath = (indexPath) => Array.isArray(indexPath) && indexPath.every((path) => isString$1(path));
  36506. const menuEmits = {
  36507. close: (index2, indexPath) => isString$1(index2) && checkIndexPath(indexPath),
  36508. open: (index2, indexPath) => isString$1(index2) && checkIndexPath(indexPath),
  36509. select: (index2, indexPath, item, routerResult) => isString$1(index2) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  36510. };
  36511. var Menu = /* @__PURE__ */ defineComponent({
  36512. name: "ElMenu",
  36513. props: menuProps,
  36514. emits: menuEmits,
  36515. setup(props, { emit: emit2, slots, expose }) {
  36516. const instance = getCurrentInstance();
  36517. const router2 = instance.appContext.config.globalProperties.$router;
  36518. const menu = ref();
  36519. const nsMenu = useNamespace("menu");
  36520. const nsSubMenu = useNamespace("sub-menu");
  36521. const sliceIndex = ref(-1);
  36522. const openedMenus = ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  36523. const activeIndex = ref(props.defaultActive);
  36524. const items = ref({});
  36525. const subMenus = ref({});
  36526. const isMenuPopup = computed(() => {
  36527. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  36528. });
  36529. const initMenu = () => {
  36530. const activeItem = activeIndex.value && items.value[activeIndex.value];
  36531. if (!activeItem || props.mode === "horizontal" || props.collapse)
  36532. return;
  36533. const indexPath = activeItem.indexPath;
  36534. indexPath.forEach((index2) => {
  36535. const subMenu = subMenus.value[index2];
  36536. subMenu && openMenu(index2, subMenu.indexPath);
  36537. });
  36538. };
  36539. const openMenu = (index2, indexPath) => {
  36540. if (openedMenus.value.includes(index2))
  36541. return;
  36542. if (props.uniqueOpened) {
  36543. openedMenus.value = openedMenus.value.filter((index22) => indexPath.includes(index22));
  36544. }
  36545. openedMenus.value.push(index2);
  36546. emit2("open", index2, indexPath);
  36547. };
  36548. const close2 = (index2) => {
  36549. const i = openedMenus.value.indexOf(index2);
  36550. if (i !== -1) {
  36551. openedMenus.value.splice(i, 1);
  36552. }
  36553. };
  36554. const closeMenu = (index2, indexPath) => {
  36555. close2(index2);
  36556. emit2("close", index2, indexPath);
  36557. };
  36558. const handleSubMenuClick = ({
  36559. index: index2,
  36560. indexPath
  36561. }) => {
  36562. const isOpened = openedMenus.value.includes(index2);
  36563. if (isOpened) {
  36564. closeMenu(index2, indexPath);
  36565. } else {
  36566. openMenu(index2, indexPath);
  36567. }
  36568. };
  36569. const handleMenuItemClick = (menuItem) => {
  36570. if (props.mode === "horizontal" || props.collapse) {
  36571. openedMenus.value = [];
  36572. }
  36573. const { index: index2, indexPath } = menuItem;
  36574. if (isNil(index2) || isNil(indexPath))
  36575. return;
  36576. if (props.router && router2) {
  36577. const route = menuItem.route || index2;
  36578. const routerResult = router2.push(route).then((res) => {
  36579. if (!res)
  36580. activeIndex.value = index2;
  36581. return res;
  36582. });
  36583. emit2("select", index2, indexPath, { index: index2, indexPath, route }, routerResult);
  36584. } else {
  36585. activeIndex.value = index2;
  36586. emit2("select", index2, indexPath, { index: index2, indexPath });
  36587. }
  36588. };
  36589. const updateActiveIndex = (val) => {
  36590. const itemsInData = items.value;
  36591. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  36592. if (item) {
  36593. activeIndex.value = item.index;
  36594. } else {
  36595. activeIndex.value = val;
  36596. }
  36597. };
  36598. const calcSliceIndex = () => {
  36599. var _a2, _b;
  36600. if (!menu.value)
  36601. return -1;
  36602. const items2 = Array.from((_b = (_a2 = menu.value) == null ? void 0 : _a2.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue));
  36603. const moreItemWidth = 64;
  36604. const paddingLeft = Number.parseInt(getComputedStyle(menu.value).paddingLeft, 10);
  36605. const paddingRight = Number.parseInt(getComputedStyle(menu.value).paddingRight, 10);
  36606. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  36607. let calcWidth = 0;
  36608. let sliceIndex2 = 0;
  36609. items2.forEach((item, index2) => {
  36610. calcWidth += item.offsetWidth || 0;
  36611. if (calcWidth <= menuWidth - moreItemWidth) {
  36612. sliceIndex2 = index2 + 1;
  36613. }
  36614. });
  36615. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  36616. };
  36617. const debounce2 = (fn2, wait = 33.34) => {
  36618. let timmer;
  36619. return () => {
  36620. timmer && clearTimeout(timmer);
  36621. timmer = setTimeout(() => {
  36622. fn2();
  36623. }, wait);
  36624. };
  36625. };
  36626. let isFirstTimeRender = true;
  36627. const handleResize = () => {
  36628. const callback = () => {
  36629. sliceIndex.value = -1;
  36630. nextTick(() => {
  36631. sliceIndex.value = calcSliceIndex();
  36632. });
  36633. };
  36634. isFirstTimeRender ? callback() : debounce2(callback)();
  36635. isFirstTimeRender = false;
  36636. };
  36637. watch(() => props.defaultActive, (currentActive) => {
  36638. if (!items.value[currentActive]) {
  36639. activeIndex.value = "";
  36640. }
  36641. updateActiveIndex(currentActive);
  36642. });
  36643. watch(() => props.collapse, (value) => {
  36644. if (value)
  36645. openedMenus.value = [];
  36646. });
  36647. watch(items.value, initMenu);
  36648. let resizeStopper;
  36649. watchEffect(() => {
  36650. if (props.mode === "horizontal" && props.ellipsis)
  36651. resizeStopper = useResizeObserver(menu, handleResize).stop;
  36652. else
  36653. resizeStopper == null ? void 0 : resizeStopper();
  36654. });
  36655. {
  36656. const addSubMenu = (item) => {
  36657. subMenus.value[item.index] = item;
  36658. };
  36659. const removeSubMenu = (item) => {
  36660. delete subMenus.value[item.index];
  36661. };
  36662. const addMenuItem = (item) => {
  36663. items.value[item.index] = item;
  36664. };
  36665. const removeMenuItem = (item) => {
  36666. delete items.value[item.index];
  36667. };
  36668. provide("rootMenu", reactive({
  36669. props,
  36670. openedMenus,
  36671. items,
  36672. subMenus,
  36673. activeIndex,
  36674. isMenuPopup,
  36675. addMenuItem,
  36676. removeMenuItem,
  36677. addSubMenu,
  36678. removeSubMenu,
  36679. openMenu,
  36680. closeMenu,
  36681. handleMenuItemClick,
  36682. handleSubMenuClick
  36683. }));
  36684. provide(`subMenu:${instance.uid}`, {
  36685. addSubMenu,
  36686. removeSubMenu,
  36687. mouseInChild: ref(false),
  36688. level: 0
  36689. });
  36690. }
  36691. onMounted(() => {
  36692. if (props.mode === "horizontal") {
  36693. new Menu$1(instance.vnode.el, nsMenu.namespace.value);
  36694. }
  36695. });
  36696. {
  36697. const open = (index2) => {
  36698. const { indexPath } = subMenus.value[index2];
  36699. indexPath.forEach((i) => openMenu(i, indexPath));
  36700. };
  36701. expose({
  36702. open,
  36703. close: close2,
  36704. handleResize
  36705. });
  36706. }
  36707. return () => {
  36708. var _a2, _b;
  36709. let slot = (_b = (_a2 = slots.default) == null ? void 0 : _a2.call(slots)) != null ? _b : [];
  36710. const vShowMore = [];
  36711. if (props.mode === "horizontal" && menu.value) {
  36712. const originalSlot = flattedChildren(slot);
  36713. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  36714. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  36715. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  36716. slot = slotDefault;
  36717. vShowMore.push(h$1(SubMenu, {
  36718. index: "sub-menu-more",
  36719. class: nsSubMenu.e("hide-arrow")
  36720. }, {
  36721. title: () => h$1(ElIcon, {
  36722. class: nsSubMenu.e("icon-more")
  36723. }, { default: () => h$1(more_default) }),
  36724. default: () => slotMore
  36725. }));
  36726. }
  36727. }
  36728. const ulStyle = useMenuCssVar(props, 0);
  36729. const vMenu = h$1("ul", {
  36730. key: String(props.collapse),
  36731. role: "menubar",
  36732. ref: menu,
  36733. style: ulStyle.value,
  36734. class: {
  36735. [nsMenu.b()]: true,
  36736. [nsMenu.m(props.mode)]: true,
  36737. [nsMenu.m("collapse")]: props.collapse
  36738. }
  36739. }, [...slot, ...vShowMore]);
  36740. if (props.collapseTransition && props.mode === "vertical") {
  36741. return h$1(ElMenuCollapseTransition, () => vMenu);
  36742. }
  36743. return vMenu;
  36744. };
  36745. }
  36746. });
  36747. const menuItemProps = buildProps({
  36748. index: {
  36749. type: definePropType([String, null]),
  36750. default: null
  36751. },
  36752. route: {
  36753. type: definePropType([String, Object])
  36754. },
  36755. disabled: Boolean
  36756. });
  36757. const menuItemEmits = {
  36758. click: (item) => isString$1(item.index) && Array.isArray(item.indexPath)
  36759. };
  36760. const COMPONENT_NAME$b = "ElMenuItem";
  36761. const _sfc_main$_ = /* @__PURE__ */ defineComponent({
  36762. name: COMPONENT_NAME$b,
  36763. components: {
  36764. ElTooltip
  36765. },
  36766. props: menuItemProps,
  36767. emits: menuItemEmits,
  36768. setup(props, { emit: emit2 }) {
  36769. const instance = getCurrentInstance();
  36770. const rootMenu = inject("rootMenu");
  36771. const nsMenu = useNamespace("menu");
  36772. const nsMenuItem = useNamespace("menu-item");
  36773. if (!rootMenu)
  36774. throwError(COMPONENT_NAME$b, "can not inject root menu");
  36775. const { parentMenu, indexPath } = useMenu(instance, toRef(props, "index"));
  36776. const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
  36777. if (!subMenu)
  36778. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  36779. const active = computed(() => props.index === rootMenu.activeIndex);
  36780. const item = reactive({
  36781. index: props.index,
  36782. indexPath,
  36783. active
  36784. });
  36785. const handleClick = () => {
  36786. if (!props.disabled) {
  36787. rootMenu.handleMenuItemClick({
  36788. index: props.index,
  36789. indexPath: indexPath.value,
  36790. route: props.route
  36791. });
  36792. emit2("click", item);
  36793. }
  36794. };
  36795. onMounted(() => {
  36796. subMenu.addSubMenu(item);
  36797. rootMenu.addMenuItem(item);
  36798. });
  36799. onBeforeUnmount(() => {
  36800. subMenu.removeSubMenu(item);
  36801. rootMenu.removeMenuItem(item);
  36802. });
  36803. return {
  36804. parentMenu,
  36805. rootMenu,
  36806. active,
  36807. nsMenu,
  36808. nsMenuItem,
  36809. handleClick
  36810. };
  36811. }
  36812. });
  36813. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  36814. const _component_el_tooltip = resolveComponent("el-tooltip");
  36815. return openBlock(), createElementBlock("li", {
  36816. class: normalizeClass([
  36817. _ctx.nsMenuItem.b(),
  36818. _ctx.nsMenuItem.is("active", _ctx.active),
  36819. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  36820. ]),
  36821. role: "menuitem",
  36822. tabindex: "-1",
  36823. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  36824. }, [
  36825. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (openBlock(), createBlock(_component_el_tooltip, {
  36826. key: 0,
  36827. effect: _ctx.rootMenu.props.popperEffect,
  36828. placement: "right",
  36829. "fallback-placements": ["left"],
  36830. persistent: ""
  36831. }, {
  36832. content: withCtx(() => [
  36833. renderSlot(_ctx.$slots, "title")
  36834. ]),
  36835. default: withCtx(() => [
  36836. createBaseVNode("div", {
  36837. class: normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  36838. }, [
  36839. renderSlot(_ctx.$slots, "default")
  36840. ], 2)
  36841. ]),
  36842. _: 3
  36843. }, 8, ["effect"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  36844. renderSlot(_ctx.$slots, "default"),
  36845. renderSlot(_ctx.$slots, "title")
  36846. ], 64))
  36847. ], 2);
  36848. }
  36849. var MenuItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["render", _sfc_render$d], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/menu/src/menu-item.vue"]]);
  36850. const menuItemGroupProps = {
  36851. title: String
  36852. };
  36853. const COMPONENT_NAME$a = "ElMenuItemGroup";
  36854. const _sfc_main$Z = /* @__PURE__ */ defineComponent({
  36855. name: COMPONENT_NAME$a,
  36856. props: menuItemGroupProps,
  36857. setup() {
  36858. const ns = useNamespace("menu-item-group");
  36859. return {
  36860. ns
  36861. };
  36862. }
  36863. });
  36864. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  36865. return openBlock(), createElementBlock("li", {
  36866. class: normalizeClass(_ctx.ns.b())
  36867. }, [
  36868. createBaseVNode("div", {
  36869. class: normalizeClass(_ctx.ns.e("title"))
  36870. }, [
  36871. !_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  36872. createTextVNode(toDisplayString(_ctx.title), 1)
  36873. ], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })
  36874. ], 2),
  36875. createBaseVNode("ul", null, [
  36876. renderSlot(_ctx.$slots, "default")
  36877. ])
  36878. ], 2);
  36879. }
  36880. var MenuItemGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["render", _sfc_render$c], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/menu/src/menu-item-group.vue"]]);
  36881. const ElMenu = withInstall(Menu, {
  36882. MenuItem,
  36883. MenuItemGroup,
  36884. SubMenu
  36885. });
  36886. const ElMenuItem = withNoopInstall(MenuItem);
  36887. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  36888. const ElSubMenu = withNoopInstall(SubMenu);
  36889. const pageHeaderProps = buildProps({
  36890. icon: {
  36891. type: iconPropType,
  36892. default: () => back_default
  36893. },
  36894. title: String,
  36895. content: {
  36896. type: String,
  36897. default: ""
  36898. }
  36899. });
  36900. const pageHeaderEmits = {
  36901. back: () => true
  36902. };
  36903. const _hoisted_1$t = ["aria-label"];
  36904. const __default__$G = /* @__PURE__ */ defineComponent({
  36905. name: "ElPageHeader"
  36906. });
  36907. const _sfc_main$Y = /* @__PURE__ */ defineComponent({
  36908. ...__default__$G,
  36909. props: pageHeaderProps,
  36910. emits: pageHeaderEmits,
  36911. setup(__props, { emit: emit2 }) {
  36912. const slots = useSlots();
  36913. const { t } = useLocale();
  36914. const ns = useNamespace("page-header");
  36915. const kls = computed(() => {
  36916. return [
  36917. ns.b(),
  36918. {
  36919. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  36920. [ns.m("has-extra")]: !!slots.extra,
  36921. [ns.is("contentful")]: !!slots.default
  36922. }
  36923. ];
  36924. });
  36925. function handleClick() {
  36926. emit2("back");
  36927. }
  36928. return (_ctx, _cache) => {
  36929. return openBlock(), createElementBlock("div", {
  36930. class: normalizeClass(unref(kls))
  36931. }, [
  36932. _ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", {
  36933. key: 0,
  36934. class: normalizeClass(unref(ns).e("breadcrumb"))
  36935. }, [
  36936. renderSlot(_ctx.$slots, "breadcrumb")
  36937. ], 2)) : createCommentVNode("v-if", true),
  36938. createBaseVNode("div", {
  36939. class: normalizeClass(unref(ns).e("header"))
  36940. }, [
  36941. createBaseVNode("div", {
  36942. class: normalizeClass(unref(ns).e("left"))
  36943. }, [
  36944. createBaseVNode("div", {
  36945. class: normalizeClass(unref(ns).e("back")),
  36946. role: "button",
  36947. tabindex: "0",
  36948. onClick: handleClick
  36949. }, [
  36950. _ctx.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", {
  36951. key: 0,
  36952. "aria-label": _ctx.title || unref(t)("el.pageHeader.title"),
  36953. class: normalizeClass(unref(ns).e("icon"))
  36954. }, [
  36955. renderSlot(_ctx.$slots, "icon", {}, () => [
  36956. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  36957. default: withCtx(() => [
  36958. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  36959. ]),
  36960. _: 1
  36961. })) : createCommentVNode("v-if", true)
  36962. ])
  36963. ], 10, _hoisted_1$t)) : createCommentVNode("v-if", true),
  36964. createBaseVNode("div", {
  36965. class: normalizeClass(unref(ns).e("title"))
  36966. }, [
  36967. renderSlot(_ctx.$slots, "title", {}, () => [
  36968. createTextVNode(toDisplayString(_ctx.title || unref(t)("el.pageHeader.title")), 1)
  36969. ])
  36970. ], 2)
  36971. ], 2),
  36972. createVNode(unref(ElDivider), { direction: "vertical" }),
  36973. createBaseVNode("div", {
  36974. class: normalizeClass(unref(ns).e("content"))
  36975. }, [
  36976. renderSlot(_ctx.$slots, "content", {}, () => [
  36977. createTextVNode(toDisplayString(_ctx.content), 1)
  36978. ])
  36979. ], 2)
  36980. ], 2),
  36981. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  36982. key: 0,
  36983. class: normalizeClass(unref(ns).e("extra"))
  36984. }, [
  36985. renderSlot(_ctx.$slots, "extra")
  36986. ], 2)) : createCommentVNode("v-if", true)
  36987. ], 2),
  36988. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  36989. key: 1,
  36990. class: normalizeClass(unref(ns).e("main"))
  36991. }, [
  36992. renderSlot(_ctx.$slots, "default")
  36993. ], 2)) : createCommentVNode("v-if", true)
  36994. ], 2);
  36995. };
  36996. }
  36997. });
  36998. var PageHeader = /* @__PURE__ */ _export_sfc$1(_sfc_main$Y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/page-header/src/page-header.vue"]]);
  36999. const ElPageHeader = withInstall(PageHeader);
  37000. const elPaginationKey = Symbol("elPaginationKey");
  37001. const paginationPrevProps = buildProps({
  37002. disabled: Boolean,
  37003. currentPage: {
  37004. type: Number,
  37005. default: 1
  37006. },
  37007. prevText: {
  37008. type: String
  37009. },
  37010. prevIcon: {
  37011. type: iconPropType
  37012. }
  37013. });
  37014. const paginationPrevEmits = {
  37015. click: (evt) => evt instanceof MouseEvent
  37016. };
  37017. const _hoisted_1$s = ["disabled", "aria-label", "aria-disabled"];
  37018. const _hoisted_2$i = { key: 0 };
  37019. const __default__$F = /* @__PURE__ */ defineComponent({
  37020. name: "ElPaginationPrev"
  37021. });
  37022. const _sfc_main$X = /* @__PURE__ */ defineComponent({
  37023. ...__default__$F,
  37024. props: paginationPrevProps,
  37025. emits: paginationPrevEmits,
  37026. setup(__props) {
  37027. const props = __props;
  37028. const { t } = useLocale();
  37029. const internalDisabled = computed(() => props.disabled || props.currentPage <= 1);
  37030. return (_ctx, _cache) => {
  37031. return openBlock(), createElementBlock("button", {
  37032. type: "button",
  37033. class: "btn-prev",
  37034. disabled: unref(internalDisabled),
  37035. "aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
  37036. "aria-disabled": unref(internalDisabled),
  37037. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  37038. }, [
  37039. _ctx.prevText ? (openBlock(), createElementBlock("span", _hoisted_2$i, toDisplayString(_ctx.prevText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  37040. default: withCtx(() => [
  37041. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))
  37042. ]),
  37043. _: 1
  37044. }))
  37045. ], 8, _hoisted_1$s);
  37046. };
  37047. }
  37048. });
  37049. var Prev = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/prev.vue"]]);
  37050. const paginationNextProps = buildProps({
  37051. disabled: Boolean,
  37052. currentPage: {
  37053. type: Number,
  37054. default: 1
  37055. },
  37056. pageCount: {
  37057. type: Number,
  37058. default: 50
  37059. },
  37060. nextText: {
  37061. type: String
  37062. },
  37063. nextIcon: {
  37064. type: iconPropType
  37065. }
  37066. });
  37067. const _hoisted_1$r = ["disabled", "aria-label", "aria-disabled"];
  37068. const _hoisted_2$h = { key: 0 };
  37069. const __default__$E = /* @__PURE__ */ defineComponent({
  37070. name: "ElPaginationNext"
  37071. });
  37072. const _sfc_main$W = /* @__PURE__ */ defineComponent({
  37073. ...__default__$E,
  37074. props: paginationNextProps,
  37075. emits: ["click"],
  37076. setup(__props) {
  37077. const props = __props;
  37078. const { t } = useLocale();
  37079. const internalDisabled = computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  37080. return (_ctx, _cache) => {
  37081. return openBlock(), createElementBlock("button", {
  37082. type: "button",
  37083. class: "btn-next",
  37084. disabled: unref(internalDisabled),
  37085. "aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
  37086. "aria-disabled": unref(internalDisabled),
  37087. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  37088. }, [
  37089. _ctx.nextText ? (openBlock(), createElementBlock("span", _hoisted_2$h, toDisplayString(_ctx.nextText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  37090. default: withCtx(() => [
  37091. (openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))
  37092. ]),
  37093. _: 1
  37094. }))
  37095. ], 8, _hoisted_1$r);
  37096. };
  37097. }
  37098. });
  37099. var Next = /* @__PURE__ */ _export_sfc$1(_sfc_main$W, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/next.vue"]]);
  37100. const selectGroupKey = Symbol("ElSelectGroup");
  37101. const selectKey = Symbol("ElSelect");
  37102. function useOption$1(props, states) {
  37103. const select = inject(selectKey);
  37104. const selectGroup = inject(selectGroupKey, { disabled: false });
  37105. const isObject$1$1 = computed(() => isObject$1(props.value));
  37106. const itemSelected = computed(() => {
  37107. if (!select.props.multiple) {
  37108. return isEqual2(props.value, select.props.modelValue);
  37109. } else {
  37110. return contains(select.props.modelValue, props.value);
  37111. }
  37112. });
  37113. const limitReached = computed(() => {
  37114. if (select.props.multiple) {
  37115. const modelValue = select.props.modelValue || [];
  37116. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  37117. } else {
  37118. return false;
  37119. }
  37120. });
  37121. const currentLabel = computed(() => {
  37122. return props.label || (isObject$1$1.value ? "" : props.value);
  37123. });
  37124. const currentValue = computed(() => {
  37125. return props.value || props.label || "";
  37126. });
  37127. const isDisabled = computed(() => {
  37128. return props.disabled || states.groupDisabled || limitReached.value;
  37129. });
  37130. const instance = getCurrentInstance();
  37131. const contains = (arr = [], target) => {
  37132. if (!isObject$1$1.value) {
  37133. return arr && arr.includes(target);
  37134. } else {
  37135. const valueKey = select.props.valueKey;
  37136. return arr && arr.some((item) => {
  37137. return toRaw(get(item, valueKey)) === get(target, valueKey);
  37138. });
  37139. }
  37140. };
  37141. const isEqual2 = (a2, b2) => {
  37142. if (!isObject$1$1.value) {
  37143. return a2 === b2;
  37144. } else {
  37145. const { valueKey } = select.props;
  37146. return get(a2, valueKey) === get(b2, valueKey);
  37147. }
  37148. };
  37149. const hoverItem = () => {
  37150. if (!props.disabled && !selectGroup.disabled) {
  37151. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  37152. }
  37153. };
  37154. watch(() => currentLabel.value, () => {
  37155. if (!props.created && !select.props.remote)
  37156. select.setSelected();
  37157. });
  37158. watch(() => props.value, (val, oldVal) => {
  37159. const { remote, valueKey } = select.props;
  37160. if (!Object.is(val, oldVal)) {
  37161. select.onOptionDestroy(oldVal, instance.proxy);
  37162. select.onOptionCreate(instance.proxy);
  37163. }
  37164. if (!props.created && !remote) {
  37165. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  37166. return;
  37167. }
  37168. select.setSelected();
  37169. }
  37170. });
  37171. watch(() => selectGroup.disabled, () => {
  37172. states.groupDisabled = selectGroup.disabled;
  37173. }, { immediate: true });
  37174. const { queryChange } = toRaw(select);
  37175. watch(queryChange, (changes) => {
  37176. const { query } = unref(changes);
  37177. const regexp2 = new RegExp(escapeStringRegexp(query), "i");
  37178. states.visible = regexp2.test(currentLabel.value) || props.created;
  37179. if (!states.visible) {
  37180. select.filteredOptionsCount--;
  37181. }
  37182. }, { immediate: true });
  37183. return {
  37184. select,
  37185. currentLabel,
  37186. currentValue,
  37187. itemSelected,
  37188. isDisabled,
  37189. hoverItem
  37190. };
  37191. }
  37192. const _sfc_main$V = /* @__PURE__ */ defineComponent({
  37193. name: "ElOption",
  37194. componentName: "ElOption",
  37195. props: {
  37196. value: {
  37197. required: true,
  37198. type: [String, Number, Boolean, Object]
  37199. },
  37200. label: [String, Number],
  37201. created: Boolean,
  37202. disabled: Boolean
  37203. },
  37204. setup(props) {
  37205. const ns = useNamespace("select");
  37206. const id = useId();
  37207. const containerKls = computed(() => [
  37208. ns.be("dropdown", "item"),
  37209. ns.is("disabled", unref(isDisabled)),
  37210. {
  37211. selected: unref(itemSelected),
  37212. hover: unref(hover)
  37213. }
  37214. ]);
  37215. const states = reactive({
  37216. index: -1,
  37217. groupDisabled: false,
  37218. visible: true,
  37219. hitState: false,
  37220. hover: false
  37221. });
  37222. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption$1(props, states);
  37223. const { visible, hover } = toRefs(states);
  37224. const vm = getCurrentInstance().proxy;
  37225. select.onOptionCreate(vm);
  37226. onBeforeUnmount(() => {
  37227. const key = vm.value;
  37228. const { selected } = select;
  37229. const selectedOptions = select.props.multiple ? selected : [selected];
  37230. const doesSelected = selectedOptions.some((item) => {
  37231. return item.value === vm.value;
  37232. });
  37233. nextTick(() => {
  37234. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  37235. select.cachedOptions.delete(key);
  37236. }
  37237. });
  37238. select.onOptionDestroy(key, vm);
  37239. });
  37240. function selectOptionClick() {
  37241. if (props.disabled !== true && states.groupDisabled !== true) {
  37242. select.handleOptionSelect(vm);
  37243. }
  37244. }
  37245. return {
  37246. ns,
  37247. id,
  37248. containerKls,
  37249. currentLabel,
  37250. itemSelected,
  37251. isDisabled,
  37252. select,
  37253. hoverItem,
  37254. visible,
  37255. hover,
  37256. selectOptionClick,
  37257. states
  37258. };
  37259. }
  37260. });
  37261. const _hoisted_1$q = ["id", "aria-disabled", "aria-selected"];
  37262. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  37263. return withDirectives((openBlock(), createElementBlock("li", {
  37264. id: _ctx.id,
  37265. class: normalizeClass(_ctx.containerKls),
  37266. role: "option",
  37267. "aria-disabled": _ctx.isDisabled || void 0,
  37268. "aria-selected": _ctx.itemSelected,
  37269. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  37270. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  37271. }, [
  37272. renderSlot(_ctx.$slots, "default", {}, () => [
  37273. createBaseVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  37274. ])
  37275. ], 42, _hoisted_1$q)), [
  37276. [vShow, _ctx.visible]
  37277. ]);
  37278. }
  37279. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["render", _sfc_render$b], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  37280. const _sfc_main$U = /* @__PURE__ */ defineComponent({
  37281. name: "ElSelectDropdown",
  37282. componentName: "ElSelectDropdown",
  37283. setup() {
  37284. const select = inject(selectKey);
  37285. const ns = useNamespace("select");
  37286. const popperClass = computed(() => select.props.popperClass);
  37287. const isMultiple = computed(() => select.props.multiple);
  37288. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  37289. const minWidth = ref("");
  37290. function updateMinWidth() {
  37291. var _a2;
  37292. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.offsetWidth}px`;
  37293. }
  37294. onMounted(() => {
  37295. updateMinWidth();
  37296. useResizeObserver(select.selectWrapper, updateMinWidth);
  37297. });
  37298. return {
  37299. ns,
  37300. minWidth,
  37301. popperClass,
  37302. isMultiple,
  37303. isFitInputWidth
  37304. };
  37305. }
  37306. });
  37307. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  37308. return openBlock(), createElementBlock("div", {
  37309. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  37310. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  37311. }, [
  37312. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  37313. key: 0,
  37314. class: normalizeClass(_ctx.ns.be("dropdown", "header"))
  37315. }, [
  37316. renderSlot(_ctx.$slots, "header")
  37317. ], 2)) : createCommentVNode("v-if", true),
  37318. renderSlot(_ctx.$slots, "default"),
  37319. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  37320. key: 1,
  37321. class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
  37322. }, [
  37323. renderSlot(_ctx.$slots, "footer")
  37324. ], 2)) : createCommentVNode("v-if", true)
  37325. ], 6);
  37326. }
  37327. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["render", _sfc_render$a], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  37328. function useSelectStates(props) {
  37329. const { t } = useLocale();
  37330. return reactive({
  37331. options: /* @__PURE__ */ new Map(),
  37332. cachedOptions: /* @__PURE__ */ new Map(),
  37333. disabledOptions: /* @__PURE__ */ new Map(),
  37334. createdLabel: null,
  37335. createdSelected: false,
  37336. selected: props.multiple ? [] : {},
  37337. inputLength: 20,
  37338. inputWidth: 0,
  37339. optionsCount: 0,
  37340. filteredOptionsCount: 0,
  37341. visible: false,
  37342. selectedLabel: "",
  37343. hoverIndex: -1,
  37344. query: "",
  37345. previousQuery: null,
  37346. inputHovering: false,
  37347. cachedPlaceHolder: "",
  37348. currentPlaceholder: t("el.select.placeholder"),
  37349. menuVisibleOnFocus: false,
  37350. isOnComposition: false,
  37351. prefixWidth: 11,
  37352. mouseEnter: false,
  37353. focused: false
  37354. });
  37355. }
  37356. const useSelect$2 = (props, states, ctx) => {
  37357. const { t } = useLocale();
  37358. const ns = useNamespace("select");
  37359. useDeprecated({
  37360. from: "suffixTransition",
  37361. replacement: "override style scheme",
  37362. version: "2.3.0",
  37363. scope: "props",
  37364. ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
  37365. }, computed(() => props.suffixTransition === false));
  37366. const reference = ref(null);
  37367. const input = ref(null);
  37368. const iOSInput = ref(null);
  37369. const tooltipRef = ref(null);
  37370. const tagTooltipRef = ref(null);
  37371. const tags = ref(null);
  37372. const selectWrapper = ref(null);
  37373. const scrollbar = ref(null);
  37374. const hoverOption = ref();
  37375. const queryChange = shallowRef({ query: "" });
  37376. const groupQueryChange = shallowRef("");
  37377. const optionList = ref([]);
  37378. let originClientHeight = 0;
  37379. const { form, formItem } = useFormItem();
  37380. const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
  37381. const selectDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  37382. const showClose = computed(() => {
  37383. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  37384. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  37385. return criteria;
  37386. });
  37387. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  37388. const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
  37389. const showStatusIconAndState = computed(() => (form == null ? void 0 : form.statusIcon) && (formItem == null ? void 0 : formItem.validateState) && ValidateComponentsMap[formItem == null ? void 0 : formItem.validateState]);
  37390. const debounce$1 = computed(() => props.remote ? 300 : 0);
  37391. const emptyText = computed(() => {
  37392. if (props.loading) {
  37393. return props.loadingText || t("el.select.loading");
  37394. } else {
  37395. if (props.remote && states.query === "" && states.options.size === 0)
  37396. return false;
  37397. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  37398. return props.noMatchText || t("el.select.noMatch");
  37399. }
  37400. if (states.options.size === 0) {
  37401. return props.noDataText || t("el.select.noData");
  37402. }
  37403. }
  37404. return null;
  37405. });
  37406. const optionsArray = computed(() => {
  37407. const list = Array.from(states.options.values());
  37408. const newList = [];
  37409. optionList.value.forEach((item) => {
  37410. const index2 = list.findIndex((i) => i.currentLabel === item);
  37411. if (index2 > -1) {
  37412. newList.push(list[index2]);
  37413. }
  37414. });
  37415. return newList.length >= list.length ? newList : list;
  37416. });
  37417. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  37418. const showNewOption = computed(() => {
  37419. const hasExistingOption = optionsArray.value.filter((option) => {
  37420. return !option.created;
  37421. }).some((option) => {
  37422. return option.currentLabel === states.query;
  37423. });
  37424. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  37425. });
  37426. const selectSize = useFormSize();
  37427. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  37428. const dropMenuVisible = computed({
  37429. get() {
  37430. return states.visible && emptyText.value !== false;
  37431. },
  37432. set(val) {
  37433. states.visible = val;
  37434. }
  37435. });
  37436. watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
  37437. nextTick(() => {
  37438. resetInputHeight();
  37439. });
  37440. });
  37441. watch(() => props.placeholder, (val) => {
  37442. states.cachedPlaceHolder = states.currentPlaceholder = val;
  37443. const hasValue = props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0;
  37444. if (hasValue) {
  37445. states.currentPlaceholder = "";
  37446. }
  37447. });
  37448. watch(() => props.modelValue, (val, oldVal) => {
  37449. if (props.multiple) {
  37450. resetInputHeight();
  37451. if (val && val.length > 0 || input.value && states.query !== "") {
  37452. states.currentPlaceholder = "";
  37453. } else {
  37454. states.currentPlaceholder = states.cachedPlaceHolder;
  37455. }
  37456. if (props.filterable && !props.reserveKeyword) {
  37457. states.query = "";
  37458. handleQueryChange(states.query);
  37459. }
  37460. }
  37461. setSelected();
  37462. if (props.filterable && !props.multiple) {
  37463. states.inputLength = 20;
  37464. }
  37465. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  37466. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  37467. }
  37468. }, {
  37469. flush: "post",
  37470. deep: true
  37471. });
  37472. watch(() => states.visible, (val) => {
  37473. var _a2, _b, _c, _d, _e;
  37474. if (!val) {
  37475. if (props.filterable) {
  37476. if (isFunction$2(props.filterMethod)) {
  37477. props.filterMethod("");
  37478. }
  37479. if (isFunction$2(props.remoteMethod)) {
  37480. props.remoteMethod("");
  37481. }
  37482. }
  37483. states.query = "";
  37484. states.previousQuery = null;
  37485. states.selectedLabel = "";
  37486. states.inputLength = 20;
  37487. states.menuVisibleOnFocus = false;
  37488. resetHoverIndex();
  37489. nextTick(() => {
  37490. if (input.value && input.value.value === "" && states.selected.length === 0) {
  37491. states.currentPlaceholder = states.cachedPlaceHolder;
  37492. }
  37493. });
  37494. if (!props.multiple) {
  37495. if (states.selected) {
  37496. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  37497. states.selectedLabel = states.createdLabel;
  37498. } else {
  37499. states.selectedLabel = states.selected.currentLabel;
  37500. }
  37501. if (props.filterable)
  37502. states.query = states.selectedLabel;
  37503. }
  37504. if (props.filterable) {
  37505. states.currentPlaceholder = states.cachedPlaceHolder;
  37506. }
  37507. }
  37508. } else {
  37509. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  37510. if (props.filterable) {
  37511. states.filteredOptionsCount = states.optionsCount;
  37512. states.query = props.remote ? "" : states.selectedLabel;
  37513. (_d = (_c = iOSInput.value) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c);
  37514. if (props.multiple) {
  37515. (_e = input.value) == null ? void 0 : _e.focus();
  37516. } else {
  37517. if (states.selectedLabel) {
  37518. states.currentPlaceholder = `${states.selectedLabel}`;
  37519. states.selectedLabel = "";
  37520. }
  37521. }
  37522. handleQueryChange(states.query);
  37523. if (!props.multiple && !props.remote) {
  37524. queryChange.value.query = "";
  37525. triggerRef(queryChange);
  37526. triggerRef(groupQueryChange);
  37527. }
  37528. }
  37529. }
  37530. ctx.emit("visible-change", val);
  37531. });
  37532. watch(() => states.options.entries(), () => {
  37533. var _a2, _b, _c;
  37534. if (!isClient)
  37535. return;
  37536. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  37537. if (props.multiple) {
  37538. resetInputHeight();
  37539. }
  37540. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  37541. if (!props.filterable && !props.defaultFirstOption && !isUndefined(props.modelValue) || !Array.from(inputs).includes(document.activeElement)) {
  37542. setSelected();
  37543. }
  37544. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  37545. checkDefaultFirstOption();
  37546. }
  37547. }, {
  37548. flush: "post"
  37549. });
  37550. watch(() => states.hoverIndex, (val) => {
  37551. if (isNumber(val) && val > -1) {
  37552. hoverOption.value = optionsArray.value[val] || {};
  37553. } else {
  37554. hoverOption.value = {};
  37555. }
  37556. optionsArray.value.forEach((option) => {
  37557. option.hover = hoverOption.value === option;
  37558. });
  37559. });
  37560. const resetInputHeight = () => {
  37561. nextTick(() => {
  37562. var _a2, _b;
  37563. if (!reference.value)
  37564. return;
  37565. const input2 = reference.value.$el.querySelector("input");
  37566. originClientHeight = originClientHeight || (input2.clientHeight > 0 ? input2.clientHeight + 2 : 0);
  37567. const _tags = tags.value;
  37568. const cssVarOfSelectSize = getComputedStyle(input2).getPropertyValue(ns.cssVarName("input-height"));
  37569. const gotSize = Number.parseFloat(cssVarOfSelectSize) || getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
  37570. const sizeInMap = selectSize.value || gotSize === originClientHeight || originClientHeight <= 0 ? gotSize : originClientHeight;
  37571. const isElHidden = input2.offsetParent === null;
  37572. !isElHidden && (input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`);
  37573. if (states.visible && emptyText.value !== false) {
  37574. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  37575. }
  37576. });
  37577. };
  37578. const handleQueryChange = async (val) => {
  37579. if (states.previousQuery === val || states.isOnComposition)
  37580. return;
  37581. if (states.previousQuery === null && (isFunction$2(props.filterMethod) || isFunction$2(props.remoteMethod))) {
  37582. states.previousQuery = val;
  37583. return;
  37584. }
  37585. states.previousQuery = val;
  37586. nextTick(() => {
  37587. var _a2, _b;
  37588. if (states.visible)
  37589. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  37590. });
  37591. states.hoverIndex = -1;
  37592. if (props.multiple && props.filterable) {
  37593. nextTick(() => {
  37594. if (!selectDisabled.value) {
  37595. const length = input.value.value.length * 15 + 20;
  37596. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  37597. managePlaceholder();
  37598. }
  37599. resetInputHeight();
  37600. });
  37601. }
  37602. if (props.remote && isFunction$2(props.remoteMethod)) {
  37603. states.hoverIndex = -1;
  37604. props.remoteMethod(val);
  37605. } else if (isFunction$2(props.filterMethod)) {
  37606. props.filterMethod(val);
  37607. triggerRef(groupQueryChange);
  37608. } else {
  37609. states.filteredOptionsCount = states.optionsCount;
  37610. queryChange.value.query = val;
  37611. triggerRef(queryChange);
  37612. triggerRef(groupQueryChange);
  37613. }
  37614. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  37615. await nextTick();
  37616. checkDefaultFirstOption();
  37617. }
  37618. };
  37619. const managePlaceholder = () => {
  37620. if (states.currentPlaceholder !== "") {
  37621. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  37622. }
  37623. };
  37624. const checkDefaultFirstOption = () => {
  37625. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  37626. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  37627. const firstOriginOption = optionsInDropdown[0];
  37628. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  37629. };
  37630. const setSelected = () => {
  37631. var _a2;
  37632. if (!props.multiple) {
  37633. const option = getOption(props.modelValue);
  37634. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  37635. states.createdLabel = option.props.value;
  37636. states.createdSelected = true;
  37637. } else {
  37638. states.createdSelected = false;
  37639. }
  37640. states.selectedLabel = option.currentLabel;
  37641. states.selected = option;
  37642. if (props.filterable)
  37643. states.query = states.selectedLabel;
  37644. return;
  37645. } else {
  37646. states.selectedLabel = "";
  37647. }
  37648. const result = [];
  37649. if (Array.isArray(props.modelValue)) {
  37650. props.modelValue.forEach((value) => {
  37651. result.push(getOption(value));
  37652. });
  37653. }
  37654. states.selected = result;
  37655. nextTick(() => {
  37656. resetInputHeight();
  37657. });
  37658. };
  37659. const getOption = (value) => {
  37660. let option;
  37661. const isObjectValue = toRawType(value).toLowerCase() === "object";
  37662. const isNull = toRawType(value).toLowerCase() === "null";
  37663. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  37664. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  37665. const cachedOption = cachedOptionsArray.value[i];
  37666. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  37667. if (isEqualValue) {
  37668. option = {
  37669. value,
  37670. currentLabel: cachedOption.currentLabel,
  37671. isDisabled: cachedOption.isDisabled
  37672. };
  37673. break;
  37674. }
  37675. }
  37676. if (option)
  37677. return option;
  37678. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  37679. const newOption = {
  37680. value,
  37681. currentLabel: label
  37682. };
  37683. if (props.multiple) {
  37684. newOption.hitState = false;
  37685. }
  37686. return newOption;
  37687. };
  37688. const resetHoverIndex = () => {
  37689. setTimeout(() => {
  37690. const valueKey = props.valueKey;
  37691. if (!props.multiple) {
  37692. states.hoverIndex = optionsArray.value.findIndex((item) => {
  37693. return getValueKey(item) === getValueKey(states.selected);
  37694. });
  37695. } else {
  37696. if (states.selected.length > 0) {
  37697. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  37698. return optionsArray.value.findIndex((item) => {
  37699. return get(item, valueKey) === get(selected, valueKey);
  37700. });
  37701. }));
  37702. } else {
  37703. states.hoverIndex = -1;
  37704. }
  37705. }
  37706. }, 300);
  37707. };
  37708. const handleResize = () => {
  37709. var _a2, _b;
  37710. resetInputWidth();
  37711. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  37712. props.multiple && resetInputHeight();
  37713. };
  37714. const resetInputWidth = () => {
  37715. var _a2;
  37716. states.inputWidth = (_a2 = reference.value) == null ? void 0 : _a2.$el.offsetWidth;
  37717. };
  37718. const onInputChange = () => {
  37719. if (props.filterable && states.query !== states.selectedLabel) {
  37720. states.query = states.selectedLabel;
  37721. handleQueryChange(states.query);
  37722. }
  37723. };
  37724. const debouncedOnInputChange = debounce(() => {
  37725. onInputChange();
  37726. }, debounce$1.value);
  37727. const debouncedQueryChange = debounce((e) => {
  37728. handleQueryChange(e.target.value);
  37729. }, debounce$1.value);
  37730. const emitChange = (val) => {
  37731. if (!isEqual$1(props.modelValue, val)) {
  37732. ctx.emit(CHANGE_EVENT, val);
  37733. }
  37734. };
  37735. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it2) => !states.disabledOptions.has(it2));
  37736. const deletePrevTag = (e) => {
  37737. if (e.code === EVENT_CODE.delete)
  37738. return;
  37739. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  37740. const value = props.modelValue.slice();
  37741. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  37742. if (lastNotDisabledIndex < 0)
  37743. return;
  37744. value.splice(lastNotDisabledIndex, 1);
  37745. ctx.emit(UPDATE_MODEL_EVENT, value);
  37746. emitChange(value);
  37747. }
  37748. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  37749. states.currentPlaceholder = states.cachedPlaceHolder;
  37750. }
  37751. };
  37752. const deleteTag = (event, tag) => {
  37753. const index2 = states.selected.indexOf(tag);
  37754. if (index2 > -1 && !selectDisabled.value) {
  37755. const value = props.modelValue.slice();
  37756. value.splice(index2, 1);
  37757. ctx.emit(UPDATE_MODEL_EVENT, value);
  37758. emitChange(value);
  37759. ctx.emit("remove-tag", tag.value);
  37760. }
  37761. event.stopPropagation();
  37762. focus();
  37763. };
  37764. const deleteSelected = (event) => {
  37765. event.stopPropagation();
  37766. const value = props.multiple ? [] : "";
  37767. if (!isString$1(value)) {
  37768. for (const item of states.selected) {
  37769. if (item.isDisabled)
  37770. value.push(item.value);
  37771. }
  37772. }
  37773. ctx.emit(UPDATE_MODEL_EVENT, value);
  37774. emitChange(value);
  37775. states.hoverIndex = -1;
  37776. states.visible = false;
  37777. ctx.emit("clear");
  37778. focus();
  37779. };
  37780. const handleOptionSelect = (option) => {
  37781. var _a2;
  37782. if (props.multiple) {
  37783. const value = (props.modelValue || []).slice();
  37784. const optionIndex = getValueIndex(value, option.value);
  37785. if (optionIndex > -1) {
  37786. value.splice(optionIndex, 1);
  37787. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  37788. value.push(option.value);
  37789. }
  37790. ctx.emit(UPDATE_MODEL_EVENT, value);
  37791. emitChange(value);
  37792. if (option.created) {
  37793. states.query = "";
  37794. handleQueryChange("");
  37795. states.inputLength = 20;
  37796. }
  37797. if (props.filterable)
  37798. (_a2 = input.value) == null ? void 0 : _a2.focus();
  37799. } else {
  37800. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  37801. emitChange(option.value);
  37802. states.visible = false;
  37803. }
  37804. setSoftFocus();
  37805. if (states.visible)
  37806. return;
  37807. nextTick(() => {
  37808. scrollToOption(option);
  37809. });
  37810. };
  37811. const getValueIndex = (arr = [], value) => {
  37812. if (!isObject$1(value))
  37813. return arr.indexOf(value);
  37814. const valueKey = props.valueKey;
  37815. let index2 = -1;
  37816. arr.some((item, i) => {
  37817. if (toRaw(get(item, valueKey)) === get(value, valueKey)) {
  37818. index2 = i;
  37819. return true;
  37820. }
  37821. return false;
  37822. });
  37823. return index2;
  37824. };
  37825. const setSoftFocus = () => {
  37826. const _input = input.value || reference.value;
  37827. if (_input) {
  37828. _input == null ? void 0 : _input.focus();
  37829. }
  37830. };
  37831. const scrollToOption = (option) => {
  37832. var _a2, _b, _c, _d, _e;
  37833. const targetOption = Array.isArray(option) ? option[0] : option;
  37834. let target = null;
  37835. if (targetOption == null ? void 0 : targetOption.value) {
  37836. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  37837. if (options.length > 0) {
  37838. target = options[0].$el;
  37839. }
  37840. }
  37841. if (tooltipRef.value && target) {
  37842. const menu = (_d = (_c = (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
  37843. if (menu) {
  37844. scrollIntoView(menu, target);
  37845. }
  37846. }
  37847. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  37848. };
  37849. const onOptionCreate = (vm) => {
  37850. states.optionsCount++;
  37851. states.filteredOptionsCount++;
  37852. states.options.set(vm.value, vm);
  37853. states.cachedOptions.set(vm.value, vm);
  37854. vm.disabled && states.disabledOptions.set(vm.value, vm);
  37855. };
  37856. const onOptionDestroy = (key, vm) => {
  37857. if (states.options.get(key) === vm) {
  37858. states.optionsCount--;
  37859. states.filteredOptionsCount--;
  37860. states.options.delete(key);
  37861. }
  37862. };
  37863. const resetInputState = (e) => {
  37864. if (e.code !== EVENT_CODE.backspace)
  37865. toggleLastOptionHitState(false);
  37866. states.inputLength = input.value.value.length * 15 + 20;
  37867. resetInputHeight();
  37868. };
  37869. const toggleLastOptionHitState = (hit) => {
  37870. if (!Array.isArray(states.selected))
  37871. return;
  37872. const lastNotDisabledIndex = getLastNotDisabledIndex(states.selected.map((it2) => it2.value));
  37873. const option = states.selected[lastNotDisabledIndex];
  37874. if (!option)
  37875. return;
  37876. if (hit === true || hit === false) {
  37877. option.hitState = hit;
  37878. return hit;
  37879. }
  37880. option.hitState = !option.hitState;
  37881. return option.hitState;
  37882. };
  37883. const handleComposition = (event) => {
  37884. const text = event.target.value;
  37885. if (event.type === "compositionend") {
  37886. states.isOnComposition = false;
  37887. nextTick(() => handleQueryChange(text));
  37888. } else {
  37889. const lastCharacter = text[text.length - 1] || "";
  37890. states.isOnComposition = !isKorean(lastCharacter);
  37891. }
  37892. };
  37893. const handleMenuEnter = () => {
  37894. nextTick(() => scrollToOption(states.selected));
  37895. };
  37896. const handleFocus = (event) => {
  37897. if (!states.focused) {
  37898. if (props.automaticDropdown || props.filterable) {
  37899. if (props.filterable && !states.visible) {
  37900. states.menuVisibleOnFocus = true;
  37901. }
  37902. states.visible = true;
  37903. }
  37904. states.focused = true;
  37905. ctx.emit("focus", event);
  37906. }
  37907. };
  37908. const focus = () => {
  37909. var _a2, _b;
  37910. if (states.visible) {
  37911. (_a2 = input.value || reference.value) == null ? void 0 : _a2.focus();
  37912. } else {
  37913. (_b = reference.value) == null ? void 0 : _b.focus();
  37914. }
  37915. };
  37916. const blur = () => {
  37917. var _a2, _b, _c;
  37918. states.visible = false;
  37919. (_a2 = reference.value) == null ? void 0 : _a2.blur();
  37920. (_c = (_b = iOSInput.value) == null ? void 0 : _b.blur) == null ? void 0 : _c.call(_b);
  37921. };
  37922. const handleBlur = (event) => {
  37923. var _a2, _b, _c;
  37924. if (((_a2 = tooltipRef.value) == null ? void 0 : _a2.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event)) || ((_c = selectWrapper.value) == null ? void 0 : _c.contains(event.relatedTarget))) {
  37925. return;
  37926. }
  37927. states.visible && handleClose();
  37928. states.focused = false;
  37929. ctx.emit("blur", event);
  37930. };
  37931. const handleClearClick = (event) => {
  37932. deleteSelected(event);
  37933. };
  37934. const handleClose = () => {
  37935. states.visible = false;
  37936. };
  37937. const handleKeydownEscape = (event) => {
  37938. if (states.visible) {
  37939. event.preventDefault();
  37940. event.stopPropagation();
  37941. states.visible = false;
  37942. }
  37943. };
  37944. const toggleMenu = (e) => {
  37945. if (e && !states.mouseEnter) {
  37946. return;
  37947. }
  37948. if (!selectDisabled.value) {
  37949. if (states.menuVisibleOnFocus) {
  37950. states.menuVisibleOnFocus = false;
  37951. } else {
  37952. if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
  37953. states.visible = !states.visible;
  37954. }
  37955. }
  37956. focus();
  37957. }
  37958. };
  37959. const selectOption = () => {
  37960. if (!states.visible) {
  37961. toggleMenu();
  37962. } else {
  37963. if (optionsArray.value[states.hoverIndex]) {
  37964. handleOptionSelect(optionsArray.value[states.hoverIndex]);
  37965. }
  37966. }
  37967. };
  37968. const getValueKey = (item) => {
  37969. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  37970. };
  37971. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  37972. const showTagList = computed(() => props.multiple ? states.selected.slice(0, props.maxCollapseTags) : []);
  37973. const collapseTagList = computed(() => props.multiple ? states.selected.slice(props.maxCollapseTags) : []);
  37974. const navigateOptions = (direction2) => {
  37975. if (!states.visible) {
  37976. states.visible = true;
  37977. return;
  37978. }
  37979. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  37980. return;
  37981. if (states.isOnComposition)
  37982. return;
  37983. if (!optionsAllDisabled.value) {
  37984. if (direction2 === "next") {
  37985. states.hoverIndex++;
  37986. if (states.hoverIndex === states.options.size) {
  37987. states.hoverIndex = 0;
  37988. }
  37989. } else if (direction2 === "prev") {
  37990. states.hoverIndex--;
  37991. if (states.hoverIndex < 0) {
  37992. states.hoverIndex = states.options.size - 1;
  37993. }
  37994. }
  37995. const option = optionsArray.value[states.hoverIndex];
  37996. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  37997. navigateOptions(direction2);
  37998. }
  37999. nextTick(() => scrollToOption(hoverOption.value));
  38000. }
  38001. };
  38002. const handleMouseEnter = () => {
  38003. states.mouseEnter = true;
  38004. };
  38005. const handleMouseLeave = () => {
  38006. states.mouseEnter = false;
  38007. };
  38008. const handleDeleteTooltipTag = (event, tag) => {
  38009. var _a2, _b;
  38010. deleteTag(event, tag);
  38011. (_b = (_a2 = tagTooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  38012. };
  38013. const selectTagsStyle = computed(() => ({
  38014. maxWidth: `${unref(states.inputWidth) - 32 - (showStatusIconAndState.value ? 22 : 0)}px`,
  38015. width: "100%"
  38016. }));
  38017. return {
  38018. optionList,
  38019. optionsArray,
  38020. hoverOption,
  38021. selectSize,
  38022. handleResize,
  38023. debouncedOnInputChange,
  38024. debouncedQueryChange,
  38025. deletePrevTag,
  38026. deleteTag,
  38027. deleteSelected,
  38028. handleOptionSelect,
  38029. scrollToOption,
  38030. readonly: readonly2,
  38031. resetInputHeight,
  38032. showClose,
  38033. iconComponent,
  38034. iconReverse,
  38035. showNewOption,
  38036. collapseTagSize,
  38037. setSelected,
  38038. managePlaceholder,
  38039. selectDisabled,
  38040. emptyText,
  38041. toggleLastOptionHitState,
  38042. resetInputState,
  38043. handleComposition,
  38044. onOptionCreate,
  38045. onOptionDestroy,
  38046. handleMenuEnter,
  38047. handleFocus,
  38048. focus,
  38049. blur,
  38050. handleBlur,
  38051. handleClearClick,
  38052. handleClose,
  38053. handleKeydownEscape,
  38054. toggleMenu,
  38055. selectOption,
  38056. getValueKey,
  38057. navigateOptions,
  38058. handleDeleteTooltipTag,
  38059. dropMenuVisible,
  38060. queryChange,
  38061. groupQueryChange,
  38062. showTagList,
  38063. collapseTagList,
  38064. selectTagsStyle,
  38065. reference,
  38066. input,
  38067. iOSInput,
  38068. tooltipRef,
  38069. tagTooltipRef,
  38070. tags,
  38071. selectWrapper,
  38072. scrollbar,
  38073. handleMouseEnter,
  38074. handleMouseLeave
  38075. };
  38076. };
  38077. var ElOptions = /* @__PURE__ */ defineComponent({
  38078. name: "ElOptions",
  38079. emits: ["update-options"],
  38080. setup(_2, { slots, emit: emit2 }) {
  38081. let cachedOptions = [];
  38082. function isSameOptions(a2, b2) {
  38083. if (a2.length !== b2.length)
  38084. return false;
  38085. for (const [index2] of a2.entries()) {
  38086. if (a2[index2] != b2[index2]) {
  38087. return false;
  38088. }
  38089. }
  38090. return true;
  38091. }
  38092. return () => {
  38093. var _a2, _b;
  38094. const children = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  38095. const filteredOptions = [];
  38096. function filterOptions(children2) {
  38097. if (!Array.isArray(children2))
  38098. return;
  38099. children2.forEach((item) => {
  38100. var _a22, _b2, _c, _d;
  38101. const name = (_a22 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a22.name;
  38102. if (name === "ElOptionGroup") {
  38103. filterOptions(!isString$1(item.children) && !Array.isArray(item.children) && isFunction$2((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  38104. } else if (name === "ElOption") {
  38105. filteredOptions.push((_d = item.props) == null ? void 0 : _d.label);
  38106. } else if (Array.isArray(item.children)) {
  38107. filterOptions(item.children);
  38108. }
  38109. });
  38110. }
  38111. if (children.length) {
  38112. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  38113. }
  38114. if (!isSameOptions(filteredOptions, cachedOptions)) {
  38115. cachedOptions = filteredOptions;
  38116. emit2("update-options", filteredOptions);
  38117. }
  38118. return children;
  38119. };
  38120. }
  38121. });
  38122. const COMPONENT_NAME$9 = "ElSelect";
  38123. const _sfc_main$T = /* @__PURE__ */ defineComponent({
  38124. name: COMPONENT_NAME$9,
  38125. componentName: COMPONENT_NAME$9,
  38126. components: {
  38127. ElInput,
  38128. ElSelectMenu: ElSelectMenu$1,
  38129. ElOption: Option,
  38130. ElOptions,
  38131. ElTag,
  38132. ElScrollbar,
  38133. ElTooltip,
  38134. ElIcon
  38135. },
  38136. directives: { ClickOutside },
  38137. props: {
  38138. name: String,
  38139. id: String,
  38140. modelValue: {
  38141. type: [Array, String, Number, Boolean, Object],
  38142. default: void 0
  38143. },
  38144. autocomplete: {
  38145. type: String,
  38146. default: "off"
  38147. },
  38148. automaticDropdown: Boolean,
  38149. size: {
  38150. type: String,
  38151. validator: isValidComponentSize
  38152. },
  38153. effect: {
  38154. type: String,
  38155. default: "light"
  38156. },
  38157. disabled: Boolean,
  38158. clearable: Boolean,
  38159. filterable: Boolean,
  38160. allowCreate: Boolean,
  38161. loading: Boolean,
  38162. popperClass: {
  38163. type: String,
  38164. default: ""
  38165. },
  38166. popperOptions: {
  38167. type: Object,
  38168. default: () => ({})
  38169. },
  38170. remote: Boolean,
  38171. loadingText: String,
  38172. noMatchText: String,
  38173. noDataText: String,
  38174. remoteMethod: Function,
  38175. filterMethod: Function,
  38176. multiple: Boolean,
  38177. multipleLimit: {
  38178. type: Number,
  38179. default: 0
  38180. },
  38181. placeholder: {
  38182. type: String
  38183. },
  38184. defaultFirstOption: Boolean,
  38185. reserveKeyword: {
  38186. type: Boolean,
  38187. default: true
  38188. },
  38189. valueKey: {
  38190. type: String,
  38191. default: "value"
  38192. },
  38193. collapseTags: Boolean,
  38194. collapseTagsTooltip: Boolean,
  38195. maxCollapseTags: {
  38196. type: Number,
  38197. default: 1
  38198. },
  38199. teleported: useTooltipContentProps.teleported,
  38200. persistent: {
  38201. type: Boolean,
  38202. default: true
  38203. },
  38204. clearIcon: {
  38205. type: iconPropType,
  38206. default: circle_close_default
  38207. },
  38208. fitInputWidth: Boolean,
  38209. suffixIcon: {
  38210. type: iconPropType,
  38211. default: arrow_down_default
  38212. },
  38213. tagType: { ...tagProps.type, default: "info" },
  38214. validateEvent: {
  38215. type: Boolean,
  38216. default: true
  38217. },
  38218. remoteShowSuffix: Boolean,
  38219. suffixTransition: {
  38220. type: Boolean,
  38221. default: true
  38222. },
  38223. placement: {
  38224. type: String,
  38225. values: Ee,
  38226. default: "bottom-start"
  38227. },
  38228. ariaLabel: {
  38229. type: String,
  38230. default: void 0
  38231. }
  38232. },
  38233. emits: [
  38234. UPDATE_MODEL_EVENT,
  38235. CHANGE_EVENT,
  38236. "remove-tag",
  38237. "clear",
  38238. "visible-change",
  38239. "focus",
  38240. "blur"
  38241. ],
  38242. setup(props, ctx) {
  38243. const nsSelect = useNamespace("select");
  38244. const nsInput = useNamespace("input");
  38245. const { t } = useLocale();
  38246. const contentId = useId();
  38247. const states = useSelectStates(props);
  38248. const {
  38249. optionList,
  38250. optionsArray,
  38251. hoverOption,
  38252. selectSize,
  38253. readonly: readonly2,
  38254. handleResize,
  38255. collapseTagSize,
  38256. debouncedOnInputChange,
  38257. debouncedQueryChange,
  38258. deletePrevTag,
  38259. deleteTag,
  38260. deleteSelected,
  38261. handleOptionSelect,
  38262. scrollToOption,
  38263. setSelected,
  38264. resetInputHeight,
  38265. managePlaceholder,
  38266. showClose,
  38267. selectDisabled,
  38268. iconComponent,
  38269. iconReverse,
  38270. showNewOption,
  38271. emptyText,
  38272. toggleLastOptionHitState,
  38273. resetInputState,
  38274. handleComposition,
  38275. onOptionCreate,
  38276. onOptionDestroy,
  38277. handleMenuEnter,
  38278. handleFocus,
  38279. focus,
  38280. blur,
  38281. handleBlur,
  38282. handleClearClick,
  38283. handleClose,
  38284. handleKeydownEscape,
  38285. toggleMenu,
  38286. selectOption,
  38287. getValueKey,
  38288. navigateOptions,
  38289. handleDeleteTooltipTag,
  38290. dropMenuVisible,
  38291. reference,
  38292. input,
  38293. iOSInput,
  38294. tooltipRef,
  38295. tagTooltipRef,
  38296. tags,
  38297. selectWrapper,
  38298. scrollbar,
  38299. queryChange,
  38300. groupQueryChange,
  38301. handleMouseEnter,
  38302. handleMouseLeave,
  38303. showTagList,
  38304. collapseTagList,
  38305. selectTagsStyle
  38306. } = useSelect$2(props, states, ctx);
  38307. const {
  38308. inputWidth,
  38309. selected,
  38310. inputLength,
  38311. filteredOptionsCount,
  38312. visible,
  38313. selectedLabel,
  38314. hoverIndex,
  38315. query,
  38316. inputHovering,
  38317. currentPlaceholder,
  38318. menuVisibleOnFocus,
  38319. isOnComposition,
  38320. options,
  38321. cachedOptions,
  38322. optionsCount,
  38323. prefixWidth
  38324. } = toRefs(states);
  38325. const wrapperKls = computed(() => {
  38326. const classList = [nsSelect.b()];
  38327. const _selectSize = unref(selectSize);
  38328. if (_selectSize) {
  38329. classList.push(nsSelect.m(_selectSize));
  38330. }
  38331. if (props.disabled) {
  38332. classList.push(nsSelect.m("disabled"));
  38333. }
  38334. return classList;
  38335. });
  38336. const tagsKls = computed(() => [
  38337. nsSelect.e("tags"),
  38338. nsSelect.is("disabled", unref(selectDisabled))
  38339. ]);
  38340. const tagWrapperKls = computed(() => [
  38341. nsSelect.b("tags-wrapper"),
  38342. { "has-prefix": unref(prefixWidth) && unref(selected).length }
  38343. ]);
  38344. const inputKls = computed(() => [
  38345. nsSelect.e("input"),
  38346. nsSelect.is(unref(selectSize)),
  38347. nsSelect.is("disabled", unref(selectDisabled))
  38348. ]);
  38349. const iOSInputKls = computed(() => [
  38350. nsSelect.e("input"),
  38351. nsSelect.is(unref(selectSize)),
  38352. nsSelect.em("input", "iOS")
  38353. ]);
  38354. const scrollbarKls = computed(() => [
  38355. nsSelect.is("empty", !props.allowCreate && Boolean(unref(query)) && unref(filteredOptionsCount) === 0)
  38356. ]);
  38357. const tagTextStyle = computed(() => {
  38358. const maxWidth = unref(inputWidth) > 123 && unref(selected).length > props.maxCollapseTags ? unref(inputWidth) - 123 : unref(inputWidth) - 75;
  38359. return { maxWidth: `${maxWidth}px` };
  38360. });
  38361. const inputStyle = computed(() => ({
  38362. marginLeft: `${unref(prefixWidth)}px`,
  38363. flexGrow: 1,
  38364. width: `${unref(inputLength) / (unref(inputWidth) - 32)}%`,
  38365. maxWidth: `${unref(inputWidth) - 42}px`
  38366. }));
  38367. provide(selectKey, reactive({
  38368. props,
  38369. options,
  38370. optionsArray,
  38371. cachedOptions,
  38372. optionsCount,
  38373. filteredOptionsCount,
  38374. hoverIndex,
  38375. handleOptionSelect,
  38376. onOptionCreate,
  38377. onOptionDestroy,
  38378. selectWrapper,
  38379. selected,
  38380. setSelected,
  38381. queryChange,
  38382. groupQueryChange
  38383. }));
  38384. onMounted(() => {
  38385. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || (() => t("el.select.placeholder"));
  38386. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  38387. currentPlaceholder.value = "";
  38388. }
  38389. useResizeObserver(selectWrapper, handleResize);
  38390. if (props.remote && props.multiple) {
  38391. resetInputHeight();
  38392. }
  38393. nextTick(() => {
  38394. const refEl = reference.value && reference.value.$el;
  38395. if (!refEl)
  38396. return;
  38397. inputWidth.value = refEl.getBoundingClientRect().width;
  38398. if (ctx.slots.prefix) {
  38399. const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
  38400. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 11, 30);
  38401. }
  38402. });
  38403. setSelected();
  38404. });
  38405. if (props.multiple && !Array.isArray(props.modelValue)) {
  38406. ctx.emit(UPDATE_MODEL_EVENT, []);
  38407. }
  38408. if (!props.multiple && Array.isArray(props.modelValue)) {
  38409. ctx.emit(UPDATE_MODEL_EVENT, "");
  38410. }
  38411. const popperPaneRef = computed(() => {
  38412. var _a2, _b;
  38413. return (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  38414. });
  38415. const onOptionsRendered = (v2) => {
  38416. optionList.value = v2;
  38417. };
  38418. return {
  38419. isIOS,
  38420. onOptionsRendered,
  38421. prefixWidth,
  38422. selectSize,
  38423. readonly: readonly2,
  38424. handleResize,
  38425. collapseTagSize,
  38426. debouncedOnInputChange,
  38427. debouncedQueryChange,
  38428. deletePrevTag,
  38429. deleteTag,
  38430. handleDeleteTooltipTag,
  38431. deleteSelected,
  38432. handleOptionSelect,
  38433. scrollToOption,
  38434. inputWidth,
  38435. selected,
  38436. inputLength,
  38437. filteredOptionsCount,
  38438. visible,
  38439. selectedLabel,
  38440. hoverIndex,
  38441. query,
  38442. inputHovering,
  38443. currentPlaceholder,
  38444. menuVisibleOnFocus,
  38445. isOnComposition,
  38446. options,
  38447. resetInputHeight,
  38448. managePlaceholder,
  38449. showClose,
  38450. selectDisabled,
  38451. iconComponent,
  38452. iconReverse,
  38453. showNewOption,
  38454. emptyText,
  38455. toggleLastOptionHitState,
  38456. resetInputState,
  38457. handleComposition,
  38458. handleMenuEnter,
  38459. handleFocus,
  38460. focus,
  38461. blur,
  38462. handleBlur,
  38463. handleClearClick,
  38464. handleClose,
  38465. handleKeydownEscape,
  38466. toggleMenu,
  38467. selectOption,
  38468. getValueKey,
  38469. navigateOptions,
  38470. dropMenuVisible,
  38471. reference,
  38472. input,
  38473. iOSInput,
  38474. tooltipRef,
  38475. popperPaneRef,
  38476. tags,
  38477. selectWrapper,
  38478. scrollbar,
  38479. wrapperKls,
  38480. tagsKls,
  38481. tagWrapperKls,
  38482. inputKls,
  38483. iOSInputKls,
  38484. scrollbarKls,
  38485. selectTagsStyle,
  38486. nsSelect,
  38487. tagTextStyle,
  38488. inputStyle,
  38489. handleMouseEnter,
  38490. handleMouseLeave,
  38491. showTagList,
  38492. collapseTagList,
  38493. tagTooltipRef,
  38494. contentId,
  38495. hoverOption
  38496. };
  38497. }
  38498. });
  38499. const _hoisted_1$p = ["disabled", "autocomplete", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label"];
  38500. const _hoisted_2$g = ["disabled"];
  38501. const _hoisted_3$8 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  38502. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  38503. const _component_el_tag = resolveComponent("el-tag");
  38504. const _component_el_tooltip = resolveComponent("el-tooltip");
  38505. const _component_el_icon = resolveComponent("el-icon");
  38506. const _component_el_input = resolveComponent("el-input");
  38507. const _component_el_option = resolveComponent("el-option");
  38508. const _component_el_options = resolveComponent("el-options");
  38509. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  38510. const _component_el_select_menu = resolveComponent("el-select-menu");
  38511. const _directive_click_outside = resolveDirective("click-outside");
  38512. return withDirectives((openBlock(), createElementBlock("div", {
  38513. ref: "selectWrapper",
  38514. class: normalizeClass(_ctx.wrapperKls),
  38515. onMouseenter: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  38516. onMouseleave: _cache[23] || (_cache[23] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  38517. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  38518. }, [
  38519. createVNode(_component_el_tooltip, {
  38520. ref: "tooltipRef",
  38521. visible: _ctx.dropMenuVisible,
  38522. placement: _ctx.placement,
  38523. teleported: _ctx.teleported,
  38524. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  38525. "popper-options": _ctx.popperOptions,
  38526. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  38527. effect: _ctx.effect,
  38528. pure: "",
  38529. trigger: "click",
  38530. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  38531. "stop-popper-mouse-event": false,
  38532. "gpu-acceleration": false,
  38533. persistent: _ctx.persistent,
  38534. onShow: _ctx.handleMenuEnter
  38535. }, {
  38536. default: withCtx(() => {
  38537. var _a2, _b;
  38538. return [
  38539. createBaseVNode("div", {
  38540. class: "select-trigger",
  38541. onMouseenter: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = true),
  38542. onMouseleave: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = false)
  38543. }, [
  38544. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  38545. key: 0,
  38546. ref: "tags",
  38547. tabindex: "-1",
  38548. class: normalizeClass(_ctx.tagsKls),
  38549. style: normalizeStyle(_ctx.selectTagsStyle),
  38550. onClick: _cache[15] || (_cache[15] = (...args) => _ctx.focus && _ctx.focus(...args))
  38551. }, [
  38552. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createBlock(Transition, {
  38553. key: 0,
  38554. onAfterLeave: _ctx.resetInputHeight
  38555. }, {
  38556. default: withCtx(() => [
  38557. createBaseVNode("span", {
  38558. class: normalizeClass(_ctx.tagWrapperKls)
  38559. }, [
  38560. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  38561. return openBlock(), createBlock(_component_el_tag, {
  38562. key: _ctx.getValueKey(item),
  38563. closable: !_ctx.selectDisabled && !item.isDisabled,
  38564. size: _ctx.collapseTagSize,
  38565. hit: item.hitState,
  38566. type: _ctx.tagType,
  38567. "disable-transitions": "",
  38568. onClose: ($event) => _ctx.deleteTag($event, item)
  38569. }, {
  38570. default: withCtx(() => [
  38571. createBaseVNode("span", {
  38572. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  38573. style: normalizeStyle(_ctx.tagTextStyle)
  38574. }, toDisplayString(item.currentLabel), 7)
  38575. ]),
  38576. _: 2
  38577. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  38578. }), 128)),
  38579. _ctx.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tag, {
  38580. key: 0,
  38581. closable: false,
  38582. size: _ctx.collapseTagSize,
  38583. type: _ctx.tagType,
  38584. "disable-transitions": ""
  38585. }, {
  38586. default: withCtx(() => [
  38587. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  38588. key: 0,
  38589. ref: "tagTooltipRef",
  38590. disabled: _ctx.dropMenuVisible,
  38591. "fallback-placements": ["bottom", "top", "right", "left"],
  38592. effect: _ctx.effect,
  38593. placement: "bottom",
  38594. teleported: _ctx.teleported
  38595. }, {
  38596. default: withCtx(() => [
  38597. createBaseVNode("span", {
  38598. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  38599. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3)
  38600. ]),
  38601. content: withCtx(() => [
  38602. createBaseVNode("div", {
  38603. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  38604. }, [
  38605. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  38606. return openBlock(), createElementBlock("div", {
  38607. key: _ctx.getValueKey(item),
  38608. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  38609. }, [
  38610. createVNode(_component_el_tag, {
  38611. class: "in-tooltip",
  38612. closable: !_ctx.selectDisabled && !item.isDisabled,
  38613. size: _ctx.collapseTagSize,
  38614. hit: item.hitState,
  38615. type: _ctx.tagType,
  38616. "disable-transitions": "",
  38617. style: { margin: "2px" },
  38618. onClose: ($event) => _ctx.handleDeleteTooltipTag($event, item)
  38619. }, {
  38620. default: withCtx(() => [
  38621. createBaseVNode("span", {
  38622. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  38623. style: normalizeStyle({
  38624. maxWidth: _ctx.inputWidth - 75 + "px"
  38625. })
  38626. }, toDisplayString(item.currentLabel), 7)
  38627. ]),
  38628. _: 2
  38629. }, 1032, ["closable", "size", "hit", "type", "onClose"])
  38630. ], 2);
  38631. }), 128))
  38632. ], 2)
  38633. ]),
  38634. _: 1
  38635. }, 8, ["disabled", "effect", "teleported"])) : (openBlock(), createElementBlock("span", {
  38636. key: 1,
  38637. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  38638. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3))
  38639. ]),
  38640. _: 1
  38641. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  38642. ], 2)
  38643. ]),
  38644. _: 1
  38645. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  38646. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  38647. key: 1,
  38648. onAfterLeave: _ctx.resetInputHeight
  38649. }, {
  38650. default: withCtx(() => [
  38651. createBaseVNode("span", {
  38652. class: normalizeClass(_ctx.tagWrapperKls),
  38653. style: normalizeStyle(_ctx.prefixWidth && _ctx.selected.length ? { marginLeft: `${_ctx.prefixWidth}px` } : "")
  38654. }, [
  38655. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  38656. return openBlock(), createBlock(_component_el_tag, {
  38657. key: _ctx.getValueKey(item),
  38658. closable: !_ctx.selectDisabled && !item.isDisabled,
  38659. size: _ctx.collapseTagSize,
  38660. hit: item.hitState,
  38661. type: _ctx.tagType,
  38662. "disable-transitions": "",
  38663. onClose: ($event) => _ctx.deleteTag($event, item)
  38664. }, {
  38665. default: withCtx(() => [
  38666. createBaseVNode("span", {
  38667. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  38668. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  38669. }, toDisplayString(item.currentLabel), 7)
  38670. ]),
  38671. _: 2
  38672. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  38673. }), 128))
  38674. ], 6)
  38675. ]),
  38676. _: 1
  38677. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  38678. _ctx.filterable && !_ctx.selectDisabled ? withDirectives((openBlock(), createElementBlock("input", {
  38679. key: 2,
  38680. ref: "input",
  38681. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.query = $event),
  38682. type: "text",
  38683. class: normalizeClass(_ctx.inputKls),
  38684. disabled: _ctx.selectDisabled,
  38685. autocomplete: _ctx.autocomplete,
  38686. style: normalizeStyle(_ctx.inputStyle),
  38687. role: "combobox",
  38688. "aria-activedescendant": ((_a2 = _ctx.hoverOption) == null ? void 0 : _a2.id) || "",
  38689. "aria-controls": _ctx.contentId,
  38690. "aria-expanded": _ctx.dropMenuVisible,
  38691. "aria-label": _ctx.ariaLabel,
  38692. "aria-autocomplete": "none",
  38693. "aria-haspopup": "listbox",
  38694. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  38695. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  38696. onKeyup: _cache[3] || (_cache[3] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  38697. onKeydown: [
  38698. _cache[4] || (_cache[4] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  38699. _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  38700. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  38701. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
  38702. _cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  38703. _cache[9] || (_cache[9] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  38704. _cache[10] || (_cache[10] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  38705. ],
  38706. onCompositionstart: _cache[11] || (_cache[11] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  38707. onCompositionupdate: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  38708. onCompositionend: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  38709. onInput: _cache[14] || (_cache[14] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  38710. }, null, 46, _hoisted_1$p)), [
  38711. [vModelText, _ctx.query]
  38712. ]) : createCommentVNode("v-if", true)
  38713. ], 6)) : createCommentVNode("v-if", true),
  38714. _ctx.isIOS && !_ctx.multiple && _ctx.filterable && _ctx.readonly ? (openBlock(), createElementBlock("input", {
  38715. key: 1,
  38716. ref: "iOSInput",
  38717. class: normalizeClass(_ctx.iOSInputKls),
  38718. disabled: _ctx.selectDisabled,
  38719. type: "text"
  38720. }, null, 10, _hoisted_2$g)) : createCommentVNode("v-if", true),
  38721. createVNode(_component_el_input, {
  38722. id: _ctx.id,
  38723. ref: "reference",
  38724. modelValue: _ctx.selectedLabel,
  38725. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  38726. type: "text",
  38727. placeholder: typeof _ctx.currentPlaceholder === "function" ? _ctx.currentPlaceholder() : _ctx.currentPlaceholder,
  38728. name: _ctx.name,
  38729. autocomplete: _ctx.autocomplete,
  38730. size: _ctx.selectSize,
  38731. disabled: _ctx.selectDisabled,
  38732. readonly: _ctx.readonly,
  38733. "validate-event": false,
  38734. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  38735. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  38736. role: "combobox",
  38737. "aria-activedescendant": ((_b = _ctx.hoverOption) == null ? void 0 : _b.id) || "",
  38738. "aria-controls": _ctx.contentId,
  38739. "aria-expanded": _ctx.dropMenuVisible,
  38740. label: _ctx.ariaLabel,
  38741. "aria-autocomplete": "none",
  38742. "aria-haspopup": "listbox",
  38743. onFocus: _ctx.handleFocus,
  38744. onBlur: _ctx.handleBlur,
  38745. onInput: _ctx.debouncedOnInputChange,
  38746. onPaste: _ctx.debouncedOnInputChange,
  38747. onCompositionstart: _ctx.handleComposition,
  38748. onCompositionupdate: _ctx.handleComposition,
  38749. onCompositionend: _ctx.handleComposition,
  38750. onKeydown: [
  38751. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  38752. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  38753. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  38754. withKeys(_ctx.handleKeydownEscape, ["esc"]),
  38755. _cache[19] || (_cache[19] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  38756. ]
  38757. }, createSlots({
  38758. suffix: withCtx(() => [
  38759. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  38760. key: 0,
  38761. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  38762. }, {
  38763. default: withCtx(() => [
  38764. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  38765. ]),
  38766. _: 1
  38767. }, 8, ["class"])) : createCommentVNode("v-if", true),
  38768. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  38769. key: 1,
  38770. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  38771. onClick: _ctx.handleClearClick
  38772. }, {
  38773. default: withCtx(() => [
  38774. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  38775. ]),
  38776. _: 1
  38777. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  38778. ]),
  38779. _: 2
  38780. }, [
  38781. _ctx.$slots.prefix ? {
  38782. name: "prefix",
  38783. fn: withCtx(() => [
  38784. createBaseVNode("div", _hoisted_3$8, [
  38785. renderSlot(_ctx.$slots, "prefix")
  38786. ])
  38787. ])
  38788. } : void 0
  38789. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "aria-activedescendant", "aria-controls", "aria-expanded", "label", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  38790. ], 32)
  38791. ];
  38792. }),
  38793. content: withCtx(() => [
  38794. createVNode(_component_el_select_menu, null, createSlots({
  38795. default: withCtx(() => [
  38796. withDirectives(createVNode(_component_el_scrollbar, {
  38797. id: _ctx.contentId,
  38798. ref: "scrollbar",
  38799. tag: "ul",
  38800. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  38801. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  38802. class: normalizeClass(_ctx.scrollbarKls),
  38803. role: "listbox",
  38804. "aria-label": _ctx.ariaLabel,
  38805. "aria-orientation": "vertical"
  38806. }, {
  38807. default: withCtx(() => [
  38808. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  38809. key: 0,
  38810. value: _ctx.query,
  38811. created: true
  38812. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  38813. createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, {
  38814. default: withCtx(() => [
  38815. renderSlot(_ctx.$slots, "default")
  38816. ]),
  38817. _: 3
  38818. }, 8, ["onUpdateOptions"])
  38819. ]),
  38820. _: 3
  38821. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
  38822. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  38823. ]),
  38824. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  38825. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  38826. key: 1,
  38827. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  38828. }, toDisplayString(_ctx.emptyText), 3))
  38829. ], 64)) : createCommentVNode("v-if", true)
  38830. ]),
  38831. _: 2
  38832. }, [
  38833. _ctx.$slots.header ? {
  38834. name: "header",
  38835. fn: withCtx(() => [
  38836. renderSlot(_ctx.$slots, "header")
  38837. ])
  38838. } : void 0,
  38839. _ctx.$slots.footer ? {
  38840. name: "footer",
  38841. fn: withCtx(() => [
  38842. renderSlot(_ctx.$slots, "footer")
  38843. ])
  38844. } : void 0
  38845. ]), 1024)
  38846. ]),
  38847. _: 3
  38848. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onShow"])
  38849. ], 34)), [
  38850. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  38851. ]);
  38852. }
  38853. var Select$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["render", _sfc_render$9], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  38854. const _sfc_main$S = /* @__PURE__ */ defineComponent({
  38855. name: "ElOptionGroup",
  38856. componentName: "ElOptionGroup",
  38857. props: {
  38858. label: String,
  38859. disabled: Boolean
  38860. },
  38861. setup(props) {
  38862. const ns = useNamespace("select");
  38863. const visible = ref(true);
  38864. const instance = getCurrentInstance();
  38865. const children = ref([]);
  38866. provide(selectGroupKey, reactive({
  38867. ...toRefs(props)
  38868. }));
  38869. const select = inject(selectKey);
  38870. onMounted(() => {
  38871. children.value = flattedChildren2(instance.subTree);
  38872. });
  38873. const flattedChildren2 = (node) => {
  38874. const children2 = [];
  38875. if (Array.isArray(node.children)) {
  38876. node.children.forEach((child) => {
  38877. var _a2;
  38878. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  38879. children2.push(child.component.proxy);
  38880. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  38881. children2.push(...flattedChildren2(child));
  38882. }
  38883. });
  38884. }
  38885. return children2;
  38886. };
  38887. const { groupQueryChange } = toRaw(select);
  38888. watch(groupQueryChange, () => {
  38889. visible.value = children.value.some((option) => option.visible === true);
  38890. }, { flush: "post" });
  38891. return {
  38892. visible,
  38893. ns
  38894. };
  38895. }
  38896. });
  38897. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  38898. return withDirectives((openBlock(), createElementBlock("ul", {
  38899. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  38900. }, [
  38901. createBaseVNode("li", {
  38902. class: normalizeClass(_ctx.ns.be("group", "title"))
  38903. }, toDisplayString(_ctx.label), 3),
  38904. createBaseVNode("li", null, [
  38905. createBaseVNode("ul", {
  38906. class: normalizeClass(_ctx.ns.b("group"))
  38907. }, [
  38908. renderSlot(_ctx.$slots, "default")
  38909. ], 2)
  38910. ])
  38911. ], 2)), [
  38912. [vShow, _ctx.visible]
  38913. ]);
  38914. }
  38915. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$S, [["render", _sfc_render$8], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  38916. const ElSelect = withInstall(Select$1, {
  38917. Option,
  38918. OptionGroup
  38919. });
  38920. const ElOption = withNoopInstall(Option);
  38921. const ElOptionGroup = withNoopInstall(OptionGroup);
  38922. const usePagination = () => inject(elPaginationKey, {});
  38923. const paginationSizesProps = buildProps({
  38924. pageSize: {
  38925. type: Number,
  38926. required: true
  38927. },
  38928. pageSizes: {
  38929. type: definePropType(Array),
  38930. default: () => mutable([10, 20, 30, 40, 50, 100])
  38931. },
  38932. popperClass: {
  38933. type: String
  38934. },
  38935. disabled: Boolean,
  38936. teleported: Boolean,
  38937. size: {
  38938. type: String,
  38939. values: componentSizes
  38940. }
  38941. });
  38942. const __default__$D = /* @__PURE__ */ defineComponent({
  38943. name: "ElPaginationSizes"
  38944. });
  38945. const _sfc_main$R = /* @__PURE__ */ defineComponent({
  38946. ...__default__$D,
  38947. props: paginationSizesProps,
  38948. emits: ["page-size-change"],
  38949. setup(__props, { emit: emit2 }) {
  38950. const props = __props;
  38951. const { t } = useLocale();
  38952. const ns = useNamespace("pagination");
  38953. const pagination = usePagination();
  38954. const innerPageSize = ref(props.pageSize);
  38955. watch(() => props.pageSizes, (newVal, oldVal) => {
  38956. if (isEqual$1(newVal, oldVal))
  38957. return;
  38958. if (Array.isArray(newVal)) {
  38959. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  38960. emit2("page-size-change", pageSize);
  38961. }
  38962. });
  38963. watch(() => props.pageSize, (newVal) => {
  38964. innerPageSize.value = newVal;
  38965. });
  38966. const innerPageSizes = computed(() => props.pageSizes);
  38967. function handleChange(val) {
  38968. var _a2;
  38969. if (val !== innerPageSize.value) {
  38970. innerPageSize.value = val;
  38971. (_a2 = pagination.handleSizeChange) == null ? void 0 : _a2.call(pagination, Number(val));
  38972. }
  38973. }
  38974. return (_ctx, _cache) => {
  38975. return openBlock(), createElementBlock("span", {
  38976. class: normalizeClass(unref(ns).e("sizes"))
  38977. }, [
  38978. createVNode(unref(ElSelect), {
  38979. "model-value": innerPageSize.value,
  38980. disabled: _ctx.disabled,
  38981. "popper-class": _ctx.popperClass,
  38982. size: _ctx.size,
  38983. teleported: _ctx.teleported,
  38984. "validate-event": false,
  38985. onChange: handleChange
  38986. }, {
  38987. default: withCtx(() => [
  38988. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(innerPageSizes), (item) => {
  38989. return openBlock(), createBlock(unref(ElOption), {
  38990. key: item,
  38991. value: item,
  38992. label: item + unref(t)("el.pagination.pagesize")
  38993. }, null, 8, ["value", "label"]);
  38994. }), 128))
  38995. ]),
  38996. _: 1
  38997. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported"])
  38998. ], 2);
  38999. };
  39000. }
  39001. });
  39002. var Sizes = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/sizes.vue"]]);
  39003. const paginationJumperProps = buildProps({
  39004. size: {
  39005. type: String,
  39006. values: componentSizes
  39007. }
  39008. });
  39009. const _hoisted_1$o = ["disabled"];
  39010. const __default__$C = /* @__PURE__ */ defineComponent({
  39011. name: "ElPaginationJumper"
  39012. });
  39013. const _sfc_main$Q = /* @__PURE__ */ defineComponent({
  39014. ...__default__$C,
  39015. props: paginationJumperProps,
  39016. setup(__props) {
  39017. const { t } = useLocale();
  39018. const ns = useNamespace("pagination");
  39019. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  39020. const userInput = ref();
  39021. const innerValue = computed(() => {
  39022. var _a2;
  39023. return (_a2 = userInput.value) != null ? _a2 : currentPage == null ? void 0 : currentPage.value;
  39024. });
  39025. function handleInput(val) {
  39026. userInput.value = val ? +val : "";
  39027. }
  39028. function handleChange(val) {
  39029. val = Math.trunc(+val);
  39030. changeEvent == null ? void 0 : changeEvent(val);
  39031. userInput.value = void 0;
  39032. }
  39033. return (_ctx, _cache) => {
  39034. return openBlock(), createElementBlock("span", {
  39035. class: normalizeClass(unref(ns).e("jump")),
  39036. disabled: unref(disabled)
  39037. }, [
  39038. createBaseVNode("span", {
  39039. class: normalizeClass([unref(ns).e("goto")])
  39040. }, toDisplayString(unref(t)("el.pagination.goto")), 3),
  39041. createVNode(unref(ElInput), {
  39042. size: _ctx.size,
  39043. class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
  39044. min: 1,
  39045. max: unref(pageCount),
  39046. disabled: unref(disabled),
  39047. "model-value": unref(innerValue),
  39048. "validate-event": false,
  39049. label: unref(t)("el.pagination.page"),
  39050. type: "number",
  39051. "onUpdate:modelValue": handleInput,
  39052. onChange: handleChange
  39053. }, null, 8, ["size", "class", "max", "disabled", "model-value", "label"]),
  39054. createBaseVNode("span", {
  39055. class: normalizeClass([unref(ns).e("classifier")])
  39056. }, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
  39057. ], 10, _hoisted_1$o);
  39058. };
  39059. }
  39060. });
  39061. var Jumper = /* @__PURE__ */ _export_sfc$1(_sfc_main$Q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/jumper.vue"]]);
  39062. const paginationTotalProps = buildProps({
  39063. total: {
  39064. type: Number,
  39065. default: 1e3
  39066. }
  39067. });
  39068. const _hoisted_1$n = ["disabled"];
  39069. const __default__$B = /* @__PURE__ */ defineComponent({
  39070. name: "ElPaginationTotal"
  39071. });
  39072. const _sfc_main$P = /* @__PURE__ */ defineComponent({
  39073. ...__default__$B,
  39074. props: paginationTotalProps,
  39075. setup(__props) {
  39076. const { t } = useLocale();
  39077. const ns = useNamespace("pagination");
  39078. const { disabled } = usePagination();
  39079. return (_ctx, _cache) => {
  39080. return openBlock(), createElementBlock("span", {
  39081. class: normalizeClass(unref(ns).e("total")),
  39082. disabled: unref(disabled)
  39083. }, toDisplayString(unref(t)("el.pagination.total", {
  39084. total: _ctx.total
  39085. })), 11, _hoisted_1$n);
  39086. };
  39087. }
  39088. });
  39089. var Total = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/total.vue"]]);
  39090. const paginationPagerProps = buildProps({
  39091. currentPage: {
  39092. type: Number,
  39093. default: 1
  39094. },
  39095. pageCount: {
  39096. type: Number,
  39097. required: true
  39098. },
  39099. pagerCount: {
  39100. type: Number,
  39101. default: 7
  39102. },
  39103. disabled: Boolean
  39104. });
  39105. const _hoisted_1$m = ["onKeyup"];
  39106. const _hoisted_2$f = ["aria-current", "aria-label", "tabindex"];
  39107. const _hoisted_3$7 = ["tabindex", "aria-label"];
  39108. const _hoisted_4$5 = ["aria-current", "aria-label", "tabindex"];
  39109. const _hoisted_5$4 = ["tabindex", "aria-label"];
  39110. const _hoisted_6$1 = ["aria-current", "aria-label", "tabindex"];
  39111. const __default__$A = /* @__PURE__ */ defineComponent({
  39112. name: "ElPaginationPager"
  39113. });
  39114. const _sfc_main$O = /* @__PURE__ */ defineComponent({
  39115. ...__default__$A,
  39116. props: paginationPagerProps,
  39117. emits: ["change"],
  39118. setup(__props, { emit: emit2 }) {
  39119. const props = __props;
  39120. const nsPager = useNamespace("pager");
  39121. const nsIcon = useNamespace("icon");
  39122. const { t } = useLocale();
  39123. const showPrevMore = ref(false);
  39124. const showNextMore = ref(false);
  39125. const quickPrevHover = ref(false);
  39126. const quickNextHover = ref(false);
  39127. const quickPrevFocus = ref(false);
  39128. const quickNextFocus = ref(false);
  39129. const pagers = computed(() => {
  39130. const pagerCount = props.pagerCount;
  39131. const halfPagerCount = (pagerCount - 1) / 2;
  39132. const currentPage = Number(props.currentPage);
  39133. const pageCount = Number(props.pageCount);
  39134. let showPrevMore2 = false;
  39135. let showNextMore2 = false;
  39136. if (pageCount > pagerCount) {
  39137. if (currentPage > pagerCount - halfPagerCount) {
  39138. showPrevMore2 = true;
  39139. }
  39140. if (currentPage < pageCount - halfPagerCount) {
  39141. showNextMore2 = true;
  39142. }
  39143. }
  39144. const array2 = [];
  39145. if (showPrevMore2 && !showNextMore2) {
  39146. const startPage = pageCount - (pagerCount - 2);
  39147. for (let i = startPage; i < pageCount; i++) {
  39148. array2.push(i);
  39149. }
  39150. } else if (!showPrevMore2 && showNextMore2) {
  39151. for (let i = 2; i < pagerCount; i++) {
  39152. array2.push(i);
  39153. }
  39154. } else if (showPrevMore2 && showNextMore2) {
  39155. const offset2 = Math.floor(pagerCount / 2) - 1;
  39156. for (let i = currentPage - offset2; i <= currentPage + offset2; i++) {
  39157. array2.push(i);
  39158. }
  39159. } else {
  39160. for (let i = 2; i < pageCount; i++) {
  39161. array2.push(i);
  39162. }
  39163. }
  39164. return array2;
  39165. });
  39166. const prevMoreKls = computed(() => [
  39167. "more",
  39168. "btn-quickprev",
  39169. nsIcon.b(),
  39170. nsPager.is("disabled", props.disabled)
  39171. ]);
  39172. const nextMoreKls = computed(() => [
  39173. "more",
  39174. "btn-quicknext",
  39175. nsIcon.b(),
  39176. nsPager.is("disabled", props.disabled)
  39177. ]);
  39178. const tabindex = computed(() => props.disabled ? -1 : 0);
  39179. watchEffect(() => {
  39180. const halfPagerCount = (props.pagerCount - 1) / 2;
  39181. showPrevMore.value = false;
  39182. showNextMore.value = false;
  39183. if (props.pageCount > props.pagerCount) {
  39184. if (props.currentPage > props.pagerCount - halfPagerCount) {
  39185. showPrevMore.value = true;
  39186. }
  39187. if (props.currentPage < props.pageCount - halfPagerCount) {
  39188. showNextMore.value = true;
  39189. }
  39190. }
  39191. });
  39192. function onMouseEnter(forward = false) {
  39193. if (props.disabled)
  39194. return;
  39195. if (forward) {
  39196. quickPrevHover.value = true;
  39197. } else {
  39198. quickNextHover.value = true;
  39199. }
  39200. }
  39201. function onFocus(forward = false) {
  39202. if (forward) {
  39203. quickPrevFocus.value = true;
  39204. } else {
  39205. quickNextFocus.value = true;
  39206. }
  39207. }
  39208. function onEnter(e) {
  39209. const target = e.target;
  39210. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  39211. const newPage = Number(target.textContent);
  39212. if (newPage !== props.currentPage) {
  39213. emit2("change", newPage);
  39214. }
  39215. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  39216. onPagerClick(e);
  39217. }
  39218. }
  39219. function onPagerClick(event) {
  39220. const target = event.target;
  39221. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  39222. return;
  39223. }
  39224. let newPage = Number(target.textContent);
  39225. const pageCount = props.pageCount;
  39226. const currentPage = props.currentPage;
  39227. const pagerCountOffset = props.pagerCount - 2;
  39228. if (target.className.includes("more")) {
  39229. if (target.className.includes("quickprev")) {
  39230. newPage = currentPage - pagerCountOffset;
  39231. } else if (target.className.includes("quicknext")) {
  39232. newPage = currentPage + pagerCountOffset;
  39233. }
  39234. }
  39235. if (!Number.isNaN(+newPage)) {
  39236. if (newPage < 1) {
  39237. newPage = 1;
  39238. }
  39239. if (newPage > pageCount) {
  39240. newPage = pageCount;
  39241. }
  39242. }
  39243. if (newPage !== currentPage) {
  39244. emit2("change", newPage);
  39245. }
  39246. }
  39247. return (_ctx, _cache) => {
  39248. return openBlock(), createElementBlock("ul", {
  39249. class: normalizeClass(unref(nsPager).b()),
  39250. onClick: onPagerClick,
  39251. onKeyup: withKeys(onEnter, ["enter"])
  39252. }, [
  39253. _ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
  39254. key: 0,
  39255. class: normalizeClass([[
  39256. unref(nsPager).is("active", _ctx.currentPage === 1),
  39257. unref(nsPager).is("disabled", _ctx.disabled)
  39258. ], "number"]),
  39259. "aria-current": _ctx.currentPage === 1,
  39260. "aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
  39261. tabindex: unref(tabindex)
  39262. }, " 1 ", 10, _hoisted_2$f)) : createCommentVNode("v-if", true),
  39263. showPrevMore.value ? (openBlock(), createElementBlock("li", {
  39264. key: 1,
  39265. class: normalizeClass(unref(prevMoreKls)),
  39266. tabindex: unref(tabindex),
  39267. "aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  39268. onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
  39269. onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
  39270. onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
  39271. onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
  39272. }, [
  39273. (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_left_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  39274. ], 42, _hoisted_3$7)) : createCommentVNode("v-if", true),
  39275. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(pagers), (pager) => {
  39276. return openBlock(), createElementBlock("li", {
  39277. key: pager,
  39278. class: normalizeClass([[
  39279. unref(nsPager).is("active", _ctx.currentPage === pager),
  39280. unref(nsPager).is("disabled", _ctx.disabled)
  39281. ], "number"]),
  39282. "aria-current": _ctx.currentPage === pager,
  39283. "aria-label": unref(t)("el.pagination.currentPage", { pager }),
  39284. tabindex: unref(tabindex)
  39285. }, toDisplayString(pager), 11, _hoisted_4$5);
  39286. }), 128)),
  39287. showNextMore.value ? (openBlock(), createElementBlock("li", {
  39288. key: 2,
  39289. class: normalizeClass(unref(nextMoreKls)),
  39290. tabindex: unref(tabindex),
  39291. "aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  39292. onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
  39293. onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
  39294. onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
  39295. onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
  39296. }, [
  39297. (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_right_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  39298. ], 42, _hoisted_5$4)) : createCommentVNode("v-if", true),
  39299. _ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
  39300. key: 3,
  39301. class: normalizeClass([[
  39302. unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  39303. unref(nsPager).is("disabled", _ctx.disabled)
  39304. ], "number"]),
  39305. "aria-current": _ctx.currentPage === _ctx.pageCount,
  39306. "aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  39307. tabindex: unref(tabindex)
  39308. }, toDisplayString(_ctx.pageCount), 11, _hoisted_6$1)) : createCommentVNode("v-if", true)
  39309. ], 42, _hoisted_1$m);
  39310. };
  39311. }
  39312. });
  39313. var Pager = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/pagination/src/components/pager.vue"]]);
  39314. const isAbsent = (v2) => typeof v2 !== "number";
  39315. const paginationProps = buildProps({
  39316. pageSize: Number,
  39317. defaultPageSize: Number,
  39318. total: Number,
  39319. pageCount: Number,
  39320. pagerCount: {
  39321. type: Number,
  39322. validator: (value) => {
  39323. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  39324. },
  39325. default: 7
  39326. },
  39327. currentPage: Number,
  39328. defaultCurrentPage: Number,
  39329. layout: {
  39330. type: String,
  39331. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  39332. },
  39333. pageSizes: {
  39334. type: definePropType(Array),
  39335. default: () => mutable([10, 20, 30, 40, 50, 100])
  39336. },
  39337. popperClass: {
  39338. type: String,
  39339. default: ""
  39340. },
  39341. prevText: {
  39342. type: String,
  39343. default: ""
  39344. },
  39345. prevIcon: {
  39346. type: iconPropType,
  39347. default: () => arrow_left_default
  39348. },
  39349. nextText: {
  39350. type: String,
  39351. default: ""
  39352. },
  39353. nextIcon: {
  39354. type: iconPropType,
  39355. default: () => arrow_right_default
  39356. },
  39357. teleported: {
  39358. type: Boolean,
  39359. default: true
  39360. },
  39361. small: Boolean,
  39362. background: Boolean,
  39363. disabled: Boolean,
  39364. hideOnSinglePage: Boolean
  39365. });
  39366. const paginationEmits = {
  39367. "update:current-page": (val) => isNumber(val),
  39368. "update:page-size": (val) => isNumber(val),
  39369. "size-change": (val) => isNumber(val),
  39370. "current-change": (val) => isNumber(val),
  39371. "prev-click": (val) => isNumber(val),
  39372. "next-click": (val) => isNumber(val)
  39373. };
  39374. const componentName = "ElPagination";
  39375. var Pagination = /* @__PURE__ */ defineComponent({
  39376. name: componentName,
  39377. props: paginationProps,
  39378. emits: paginationEmits,
  39379. setup(props, { emit: emit2, slots }) {
  39380. const { t } = useLocale();
  39381. const ns = useNamespace("pagination");
  39382. const vnodeProps = getCurrentInstance().vnode.props || {};
  39383. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  39384. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  39385. const assertValidUsage = computed(() => {
  39386. if (isAbsent(props.total) && isAbsent(props.pageCount))
  39387. return false;
  39388. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  39389. return false;
  39390. if (props.layout.includes("sizes")) {
  39391. if (!isAbsent(props.pageCount)) {
  39392. if (!hasPageSizeListener)
  39393. return false;
  39394. } else if (!isAbsent(props.total)) {
  39395. if (!isAbsent(props.pageSize)) {
  39396. if (!hasPageSizeListener) {
  39397. return false;
  39398. }
  39399. }
  39400. }
  39401. }
  39402. return true;
  39403. });
  39404. const innerPageSize = ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  39405. const innerCurrentPage = ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  39406. const pageSizeBridge = computed({
  39407. get() {
  39408. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  39409. },
  39410. set(v2) {
  39411. if (isAbsent(props.pageSize)) {
  39412. innerPageSize.value = v2;
  39413. }
  39414. if (hasPageSizeListener) {
  39415. emit2("update:page-size", v2);
  39416. emit2("size-change", v2);
  39417. }
  39418. }
  39419. });
  39420. const pageCountBridge = computed(() => {
  39421. let pageCount = 0;
  39422. if (!isAbsent(props.pageCount)) {
  39423. pageCount = props.pageCount;
  39424. } else if (!isAbsent(props.total)) {
  39425. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  39426. }
  39427. return pageCount;
  39428. });
  39429. const currentPageBridge = computed({
  39430. get() {
  39431. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  39432. },
  39433. set(v2) {
  39434. let newCurrentPage = v2;
  39435. if (v2 < 1) {
  39436. newCurrentPage = 1;
  39437. } else if (v2 > pageCountBridge.value) {
  39438. newCurrentPage = pageCountBridge.value;
  39439. }
  39440. if (isAbsent(props.currentPage)) {
  39441. innerCurrentPage.value = newCurrentPage;
  39442. }
  39443. if (hasCurrentPageListener) {
  39444. emit2("update:current-page", newCurrentPage);
  39445. emit2("current-change", newCurrentPage);
  39446. }
  39447. }
  39448. });
  39449. watch(pageCountBridge, (val) => {
  39450. if (currentPageBridge.value > val)
  39451. currentPageBridge.value = val;
  39452. });
  39453. function handleCurrentChange2(val) {
  39454. currentPageBridge.value = val;
  39455. }
  39456. function handleSizeChange(val) {
  39457. pageSizeBridge.value = val;
  39458. const newPageCount = pageCountBridge.value;
  39459. if (currentPageBridge.value > newPageCount) {
  39460. currentPageBridge.value = newPageCount;
  39461. }
  39462. }
  39463. function prev() {
  39464. if (props.disabled)
  39465. return;
  39466. currentPageBridge.value -= 1;
  39467. emit2("prev-click", currentPageBridge.value);
  39468. }
  39469. function next() {
  39470. if (props.disabled)
  39471. return;
  39472. currentPageBridge.value += 1;
  39473. emit2("next-click", currentPageBridge.value);
  39474. }
  39475. function addClass2(element, cls) {
  39476. if (element) {
  39477. if (!element.props) {
  39478. element.props = {};
  39479. }
  39480. element.props.class = [element.props.class, cls].join(" ");
  39481. }
  39482. }
  39483. provide(elPaginationKey, {
  39484. pageCount: pageCountBridge,
  39485. disabled: computed(() => props.disabled),
  39486. currentPage: currentPageBridge,
  39487. changeEvent: handleCurrentChange2,
  39488. handleSizeChange
  39489. });
  39490. return () => {
  39491. var _a2, _b;
  39492. if (!assertValidUsage.value) {
  39493. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  39494. return null;
  39495. }
  39496. if (!props.layout)
  39497. return null;
  39498. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  39499. return null;
  39500. const rootChildren = [];
  39501. const rightWrapperChildren = [];
  39502. const rightWrapperRoot = h$1("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  39503. const TEMPLATE_MAP = {
  39504. prev: h$1(Prev, {
  39505. disabled: props.disabled,
  39506. currentPage: currentPageBridge.value,
  39507. prevText: props.prevText,
  39508. prevIcon: props.prevIcon,
  39509. onClick: prev
  39510. }),
  39511. jumper: h$1(Jumper, {
  39512. size: props.small ? "small" : "default"
  39513. }),
  39514. pager: h$1(Pager, {
  39515. currentPage: currentPageBridge.value,
  39516. pageCount: pageCountBridge.value,
  39517. pagerCount: props.pagerCount,
  39518. onChange: handleCurrentChange2,
  39519. disabled: props.disabled
  39520. }),
  39521. next: h$1(Next, {
  39522. disabled: props.disabled,
  39523. currentPage: currentPageBridge.value,
  39524. pageCount: pageCountBridge.value,
  39525. nextText: props.nextText,
  39526. nextIcon: props.nextIcon,
  39527. onClick: next
  39528. }),
  39529. sizes: h$1(Sizes, {
  39530. pageSize: pageSizeBridge.value,
  39531. pageSizes: props.pageSizes,
  39532. popperClass: props.popperClass,
  39533. disabled: props.disabled,
  39534. teleported: props.teleported,
  39535. size: props.small ? "small" : "default"
  39536. }),
  39537. slot: (_b = (_a2 = slots == null ? void 0 : slots.default) == null ? void 0 : _a2.call(slots)) != null ? _b : null,
  39538. total: h$1(Total, { total: isAbsent(props.total) ? 0 : props.total })
  39539. };
  39540. const components = props.layout.split(",").map((item) => item.trim());
  39541. let haveRightWrapper = false;
  39542. components.forEach((c2) => {
  39543. if (c2 === "->") {
  39544. haveRightWrapper = true;
  39545. return;
  39546. }
  39547. if (!haveRightWrapper) {
  39548. rootChildren.push(TEMPLATE_MAP[c2]);
  39549. } else {
  39550. rightWrapperChildren.push(TEMPLATE_MAP[c2]);
  39551. }
  39552. });
  39553. addClass2(rootChildren[0], ns.is("first"));
  39554. addClass2(rootChildren[rootChildren.length - 1], ns.is("last"));
  39555. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  39556. addClass2(rightWrapperChildren[0], ns.is("first"));
  39557. addClass2(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  39558. rootChildren.push(rightWrapperRoot);
  39559. }
  39560. return h$1("div", {
  39561. class: [
  39562. ns.b(),
  39563. ns.is("background", props.background),
  39564. {
  39565. [ns.m("small")]: props.small
  39566. }
  39567. ]
  39568. }, rootChildren);
  39569. };
  39570. }
  39571. });
  39572. const ElPagination = withInstall(Pagination);
  39573. const popconfirmProps = buildProps({
  39574. title: String,
  39575. confirmButtonText: String,
  39576. cancelButtonText: String,
  39577. confirmButtonType: {
  39578. type: String,
  39579. values: buttonTypes,
  39580. default: "primary"
  39581. },
  39582. cancelButtonType: {
  39583. type: String,
  39584. values: buttonTypes,
  39585. default: "text"
  39586. },
  39587. icon: {
  39588. type: iconPropType,
  39589. default: () => question_filled_default
  39590. },
  39591. iconColor: {
  39592. type: String,
  39593. default: "#f90"
  39594. },
  39595. hideIcon: {
  39596. type: Boolean,
  39597. default: false
  39598. },
  39599. hideAfter: {
  39600. type: Number,
  39601. default: 200
  39602. },
  39603. teleported: useTooltipContentProps.teleported,
  39604. persistent: useTooltipContentProps.persistent,
  39605. width: {
  39606. type: [String, Number],
  39607. default: 150
  39608. }
  39609. });
  39610. const popconfirmEmits = {
  39611. confirm: (e) => e instanceof MouseEvent,
  39612. cancel: (e) => e instanceof MouseEvent
  39613. };
  39614. const __default__$z = /* @__PURE__ */ defineComponent({
  39615. name: "ElPopconfirm"
  39616. });
  39617. const _sfc_main$N = /* @__PURE__ */ defineComponent({
  39618. ...__default__$z,
  39619. props: popconfirmProps,
  39620. emits: popconfirmEmits,
  39621. setup(__props, { emit: emit2 }) {
  39622. const props = __props;
  39623. const { t } = useLocale();
  39624. const ns = useNamespace("popconfirm");
  39625. const tooltipRef = ref();
  39626. const hidePopper = () => {
  39627. var _a2, _b;
  39628. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.onClose) == null ? void 0 : _b.call(_a2);
  39629. };
  39630. const style = computed(() => {
  39631. return {
  39632. width: addUnit(props.width)
  39633. };
  39634. });
  39635. const confirm = (e) => {
  39636. emit2("confirm", e);
  39637. hidePopper();
  39638. };
  39639. const cancel = (e) => {
  39640. emit2("cancel", e);
  39641. hidePopper();
  39642. };
  39643. const finalConfirmButtonText = computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  39644. const finalCancelButtonText = computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  39645. return (_ctx, _cache) => {
  39646. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  39647. ref_key: "tooltipRef",
  39648. ref: tooltipRef,
  39649. trigger: "click",
  39650. effect: "light"
  39651. }, _ctx.$attrs, {
  39652. "popper-class": `${unref(ns).namespace.value}-popover`,
  39653. "popper-style": unref(style),
  39654. teleported: _ctx.teleported,
  39655. "fallback-placements": ["bottom", "top", "right", "left"],
  39656. "hide-after": _ctx.hideAfter,
  39657. persistent: _ctx.persistent
  39658. }), {
  39659. content: withCtx(() => [
  39660. createBaseVNode("div", {
  39661. class: normalizeClass(unref(ns).b())
  39662. }, [
  39663. createBaseVNode("div", {
  39664. class: normalizeClass(unref(ns).e("main"))
  39665. }, [
  39666. !_ctx.hideIcon && _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  39667. key: 0,
  39668. class: normalizeClass(unref(ns).e("icon")),
  39669. style: normalizeStyle({ color: _ctx.iconColor })
  39670. }, {
  39671. default: withCtx(() => [
  39672. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  39673. ]),
  39674. _: 1
  39675. }, 8, ["class", "style"])) : createCommentVNode("v-if", true),
  39676. createTextVNode(" " + toDisplayString(_ctx.title), 1)
  39677. ], 2),
  39678. createBaseVNode("div", {
  39679. class: normalizeClass(unref(ns).e("action"))
  39680. }, [
  39681. createVNode(unref(ElButton), {
  39682. size: "small",
  39683. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  39684. text: _ctx.cancelButtonType === "text",
  39685. onClick: cancel
  39686. }, {
  39687. default: withCtx(() => [
  39688. createTextVNode(toDisplayString(unref(finalCancelButtonText)), 1)
  39689. ]),
  39690. _: 1
  39691. }, 8, ["type", "text"]),
  39692. createVNode(unref(ElButton), {
  39693. size: "small",
  39694. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  39695. text: _ctx.confirmButtonType === "text",
  39696. onClick: confirm
  39697. }, {
  39698. default: withCtx(() => [
  39699. createTextVNode(toDisplayString(unref(finalConfirmButtonText)), 1)
  39700. ]),
  39701. _: 1
  39702. }, 8, ["type", "text"])
  39703. ], 2)
  39704. ], 2)
  39705. ]),
  39706. default: withCtx(() => [
  39707. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  39708. ]),
  39709. _: 3
  39710. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  39711. };
  39712. }
  39713. });
  39714. var Popconfirm = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popconfirm/src/popconfirm.vue"]]);
  39715. const ElPopconfirm = withInstall(Popconfirm);
  39716. const popoverProps = buildProps({
  39717. trigger: useTooltipTriggerProps.trigger,
  39718. placement: dropdownProps.placement,
  39719. disabled: useTooltipTriggerProps.disabled,
  39720. visible: useTooltipContentProps.visible,
  39721. transition: useTooltipContentProps.transition,
  39722. popperOptions: dropdownProps.popperOptions,
  39723. tabindex: dropdownProps.tabindex,
  39724. content: useTooltipContentProps.content,
  39725. popperStyle: useTooltipContentProps.popperStyle,
  39726. popperClass: useTooltipContentProps.popperClass,
  39727. enterable: {
  39728. ...useTooltipContentProps.enterable,
  39729. default: true
  39730. },
  39731. effect: {
  39732. ...useTooltipContentProps.effect,
  39733. default: "light"
  39734. },
  39735. teleported: useTooltipContentProps.teleported,
  39736. title: String,
  39737. width: {
  39738. type: [String, Number],
  39739. default: 150
  39740. },
  39741. offset: {
  39742. type: Number,
  39743. default: void 0
  39744. },
  39745. showAfter: {
  39746. type: Number,
  39747. default: 0
  39748. },
  39749. hideAfter: {
  39750. type: Number,
  39751. default: 200
  39752. },
  39753. autoClose: {
  39754. type: Number,
  39755. default: 0
  39756. },
  39757. showArrow: {
  39758. type: Boolean,
  39759. default: true
  39760. },
  39761. persistent: {
  39762. type: Boolean,
  39763. default: true
  39764. },
  39765. "onUpdate:visible": {
  39766. type: Function
  39767. }
  39768. });
  39769. const popoverEmits = {
  39770. "update:visible": (value) => isBoolean(value),
  39771. "before-enter": () => true,
  39772. "before-leave": () => true,
  39773. "after-enter": () => true,
  39774. "after-leave": () => true
  39775. };
  39776. const updateEventKeyRaw = `onUpdate:visible`;
  39777. const __default__$y = /* @__PURE__ */ defineComponent({
  39778. name: "ElPopover"
  39779. });
  39780. const _sfc_main$M = /* @__PURE__ */ defineComponent({
  39781. ...__default__$y,
  39782. props: popoverProps,
  39783. emits: popoverEmits,
  39784. setup(__props, { expose, emit: emit2 }) {
  39785. const props = __props;
  39786. const onUpdateVisible = computed(() => {
  39787. return props[updateEventKeyRaw];
  39788. });
  39789. const ns = useNamespace("popover");
  39790. const tooltipRef = ref();
  39791. const popperRef = computed(() => {
  39792. var _a2;
  39793. return (_a2 = unref(tooltipRef)) == null ? void 0 : _a2.popperRef;
  39794. });
  39795. const style = computed(() => {
  39796. return [
  39797. {
  39798. width: addUnit(props.width)
  39799. },
  39800. props.popperStyle
  39801. ];
  39802. });
  39803. const kls = computed(() => {
  39804. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  39805. });
  39806. const gpuAcceleration = computed(() => {
  39807. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  39808. });
  39809. const hide = () => {
  39810. var _a2;
  39811. (_a2 = tooltipRef.value) == null ? void 0 : _a2.hide();
  39812. };
  39813. const beforeEnter = () => {
  39814. emit2("before-enter");
  39815. };
  39816. const beforeLeave = () => {
  39817. emit2("before-leave");
  39818. };
  39819. const afterEnter = () => {
  39820. emit2("after-enter");
  39821. };
  39822. const afterLeave = () => {
  39823. emit2("update:visible", false);
  39824. emit2("after-leave");
  39825. };
  39826. expose({
  39827. popperRef,
  39828. hide
  39829. });
  39830. return (_ctx, _cache) => {
  39831. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  39832. ref_key: "tooltipRef",
  39833. ref: tooltipRef
  39834. }, _ctx.$attrs, {
  39835. trigger: _ctx.trigger,
  39836. placement: _ctx.placement,
  39837. disabled: _ctx.disabled,
  39838. visible: _ctx.visible,
  39839. transition: _ctx.transition,
  39840. "popper-options": _ctx.popperOptions,
  39841. tabindex: _ctx.tabindex,
  39842. content: _ctx.content,
  39843. offset: _ctx.offset,
  39844. "show-after": _ctx.showAfter,
  39845. "hide-after": _ctx.hideAfter,
  39846. "auto-close": _ctx.autoClose,
  39847. "show-arrow": _ctx.showArrow,
  39848. "aria-label": _ctx.title,
  39849. effect: _ctx.effect,
  39850. enterable: _ctx.enterable,
  39851. "popper-class": unref(kls),
  39852. "popper-style": unref(style),
  39853. teleported: _ctx.teleported,
  39854. persistent: _ctx.persistent,
  39855. "gpu-acceleration": unref(gpuAcceleration),
  39856. "onUpdate:visible": unref(onUpdateVisible),
  39857. onBeforeShow: beforeEnter,
  39858. onBeforeHide: beforeLeave,
  39859. onShow: afterEnter,
  39860. onHide: afterLeave
  39861. }), {
  39862. content: withCtx(() => [
  39863. _ctx.title ? (openBlock(), createElementBlock("div", {
  39864. key: 0,
  39865. class: normalizeClass(unref(ns).e("title")),
  39866. role: "title"
  39867. }, toDisplayString(_ctx.title), 3)) : createCommentVNode("v-if", true),
  39868. renderSlot(_ctx.$slots, "default", {}, () => [
  39869. createTextVNode(toDisplayString(_ctx.content), 1)
  39870. ])
  39871. ]),
  39872. default: withCtx(() => [
  39873. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  39874. ]),
  39875. _: 3
  39876. }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  39877. };
  39878. }
  39879. });
  39880. var Popover = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popover/src/popover.vue"]]);
  39881. const attachEvents = (el, binding) => {
  39882. const popperComponent = binding.arg || binding.value;
  39883. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  39884. if (popover) {
  39885. popover.triggerRef = el;
  39886. }
  39887. };
  39888. var PopoverDirective = {
  39889. mounted(el, binding) {
  39890. attachEvents(el, binding);
  39891. },
  39892. updated(el, binding) {
  39893. attachEvents(el, binding);
  39894. }
  39895. };
  39896. const VPopover = "popover";
  39897. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  39898. const ElPopover = withInstall(Popover, {
  39899. directive: ElPopoverDirective
  39900. });
  39901. const progressProps = buildProps({
  39902. type: {
  39903. type: String,
  39904. default: "line",
  39905. values: ["line", "circle", "dashboard"]
  39906. },
  39907. percentage: {
  39908. type: Number,
  39909. default: 0,
  39910. validator: (val) => val >= 0 && val <= 100
  39911. },
  39912. status: {
  39913. type: String,
  39914. default: "",
  39915. values: ["", "success", "exception", "warning"]
  39916. },
  39917. indeterminate: {
  39918. type: Boolean,
  39919. default: false
  39920. },
  39921. duration: {
  39922. type: Number,
  39923. default: 3
  39924. },
  39925. strokeWidth: {
  39926. type: Number,
  39927. default: 6
  39928. },
  39929. strokeLinecap: {
  39930. type: definePropType(String),
  39931. default: "round"
  39932. },
  39933. textInside: {
  39934. type: Boolean,
  39935. default: false
  39936. },
  39937. width: {
  39938. type: Number,
  39939. default: 126
  39940. },
  39941. showText: {
  39942. type: Boolean,
  39943. default: true
  39944. },
  39945. color: {
  39946. type: definePropType([
  39947. String,
  39948. Array,
  39949. Function
  39950. ]),
  39951. default: ""
  39952. },
  39953. striped: Boolean,
  39954. stripedFlow: Boolean,
  39955. format: {
  39956. type: definePropType(Function),
  39957. default: (percentage) => `${percentage}%`
  39958. }
  39959. });
  39960. const _hoisted_1$l = ["aria-valuenow"];
  39961. const _hoisted_2$e = { viewBox: "0 0 100 100" };
  39962. const _hoisted_3$6 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  39963. const _hoisted_4$4 = ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"];
  39964. const _hoisted_5$3 = { key: 0 };
  39965. const __default__$x = /* @__PURE__ */ defineComponent({
  39966. name: "ElProgress"
  39967. });
  39968. const _sfc_main$L = /* @__PURE__ */ defineComponent({
  39969. ...__default__$x,
  39970. props: progressProps,
  39971. setup(__props) {
  39972. const props = __props;
  39973. const STATUS_COLOR_MAP = {
  39974. success: "#13ce66",
  39975. exception: "#ff4949",
  39976. warning: "#e6a23c",
  39977. default: "#20a0ff"
  39978. };
  39979. const ns = useNamespace("progress");
  39980. const barStyle = computed(() => ({
  39981. width: `${props.percentage}%`,
  39982. animationDuration: `${props.duration}s`,
  39983. backgroundColor: getCurrentColor(props.percentage)
  39984. }));
  39985. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  39986. const radius = computed(() => {
  39987. if (["circle", "dashboard"].includes(props.type)) {
  39988. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  39989. }
  39990. return 0;
  39991. });
  39992. const trackPath = computed(() => {
  39993. const r = radius.value;
  39994. const isDashboard = props.type === "dashboard";
  39995. return `
  39996. M 50 50
  39997. m 0 ${isDashboard ? "" : "-"}${r}
  39998. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  39999. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  40000. `;
  40001. });
  40002. const perimeter = computed(() => 2 * Math.PI * radius.value);
  40003. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  40004. const strokeDashoffset = computed(() => {
  40005. const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
  40006. return `${offset2}px`;
  40007. });
  40008. const trailPathStyle = computed(() => ({
  40009. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  40010. strokeDashoffset: strokeDashoffset.value
  40011. }));
  40012. const circlePathStyle = computed(() => ({
  40013. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  40014. strokeDashoffset: strokeDashoffset.value,
  40015. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  40016. }));
  40017. const stroke = computed(() => {
  40018. let ret;
  40019. if (props.color) {
  40020. ret = getCurrentColor(props.percentage);
  40021. } else {
  40022. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  40023. }
  40024. return ret;
  40025. });
  40026. const statusIcon = computed(() => {
  40027. if (props.status === "warning") {
  40028. return warning_filled_default;
  40029. }
  40030. if (props.type === "line") {
  40031. return props.status === "success" ? circle_check_default : circle_close_default;
  40032. } else {
  40033. return props.status === "success" ? check_default : close_default;
  40034. }
  40035. });
  40036. const progressTextSize = computed(() => {
  40037. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  40038. });
  40039. const content = computed(() => props.format(props.percentage));
  40040. function getColors(color) {
  40041. const span = 100 / color.length;
  40042. const seriesColors = color.map((seriesColor, index2) => {
  40043. if (isString$1(seriesColor)) {
  40044. return {
  40045. color: seriesColor,
  40046. percentage: (index2 + 1) * span
  40047. };
  40048. }
  40049. return seriesColor;
  40050. });
  40051. return seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
  40052. }
  40053. const getCurrentColor = (percentage) => {
  40054. var _a2;
  40055. const { color } = props;
  40056. if (isFunction$2(color)) {
  40057. return color(percentage);
  40058. } else if (isString$1(color)) {
  40059. return color;
  40060. } else {
  40061. const colors = getColors(color);
  40062. for (const color2 of colors) {
  40063. if (color2.percentage > percentage)
  40064. return color2.color;
  40065. }
  40066. return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
  40067. }
  40068. };
  40069. return (_ctx, _cache) => {
  40070. return openBlock(), createElementBlock("div", {
  40071. class: normalizeClass([
  40072. unref(ns).b(),
  40073. unref(ns).m(_ctx.type),
  40074. unref(ns).is(_ctx.status),
  40075. {
  40076. [unref(ns).m("without-text")]: !_ctx.showText,
  40077. [unref(ns).m("text-inside")]: _ctx.textInside
  40078. }
  40079. ]),
  40080. role: "progressbar",
  40081. "aria-valuenow": _ctx.percentage,
  40082. "aria-valuemin": "0",
  40083. "aria-valuemax": "100"
  40084. }, [
  40085. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  40086. key: 0,
  40087. class: normalizeClass(unref(ns).b("bar"))
  40088. }, [
  40089. createBaseVNode("div", {
  40090. class: normalizeClass(unref(ns).be("bar", "outer")),
  40091. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  40092. }, [
  40093. createBaseVNode("div", {
  40094. class: normalizeClass([
  40095. unref(ns).be("bar", "inner"),
  40096. { [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  40097. { [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  40098. { [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  40099. ]),
  40100. style: normalizeStyle(unref(barStyle))
  40101. }, [
  40102. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  40103. key: 0,
  40104. class: normalizeClass(unref(ns).be("bar", "innerText"))
  40105. }, [
  40106. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  40107. createBaseVNode("span", null, toDisplayString(unref(content)), 1)
  40108. ])
  40109. ], 2)) : createCommentVNode("v-if", true)
  40110. ], 6)
  40111. ], 6)
  40112. ], 2)) : (openBlock(), createElementBlock("div", {
  40113. key: 1,
  40114. class: normalizeClass(unref(ns).b("circle")),
  40115. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  40116. }, [
  40117. (openBlock(), createElementBlock("svg", _hoisted_2$e, [
  40118. createBaseVNode("path", {
  40119. class: normalizeClass(unref(ns).be("circle", "track")),
  40120. d: unref(trackPath),
  40121. stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  40122. "stroke-linecap": _ctx.strokeLinecap,
  40123. "stroke-width": unref(relativeStrokeWidth),
  40124. fill: "none",
  40125. style: normalizeStyle(unref(trailPathStyle))
  40126. }, null, 14, _hoisted_3$6),
  40127. createBaseVNode("path", {
  40128. class: normalizeClass(unref(ns).be("circle", "path")),
  40129. d: unref(trackPath),
  40130. stroke: unref(stroke),
  40131. fill: "none",
  40132. opacity: _ctx.percentage ? 1 : 0,
  40133. "stroke-linecap": _ctx.strokeLinecap,
  40134. "stroke-width": unref(relativeStrokeWidth),
  40135. style: normalizeStyle(unref(circlePathStyle))
  40136. }, null, 14, _hoisted_4$4)
  40137. ]))
  40138. ], 6)),
  40139. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  40140. key: 2,
  40141. class: normalizeClass(unref(ns).e("text")),
  40142. style: normalizeStyle({ fontSize: `${unref(progressTextSize)}px` })
  40143. }, [
  40144. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  40145. !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$3, toDisplayString(unref(content)), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  40146. default: withCtx(() => [
  40147. (openBlock(), createBlock(resolveDynamicComponent(unref(statusIcon))))
  40148. ]),
  40149. _: 1
  40150. }))
  40151. ])
  40152. ], 6)) : createCommentVNode("v-if", true)
  40153. ], 10, _hoisted_1$l);
  40154. };
  40155. }
  40156. });
  40157. var Progress = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);
  40158. const ElProgress = withInstall(Progress);
  40159. const rateProps = buildProps({
  40160. modelValue: {
  40161. type: Number,
  40162. default: 0
  40163. },
  40164. id: {
  40165. type: String,
  40166. default: void 0
  40167. },
  40168. lowThreshold: {
  40169. type: Number,
  40170. default: 2
  40171. },
  40172. highThreshold: {
  40173. type: Number,
  40174. default: 4
  40175. },
  40176. max: {
  40177. type: Number,
  40178. default: 5
  40179. },
  40180. colors: {
  40181. type: definePropType([Array, Object]),
  40182. default: () => mutable(["", "", ""])
  40183. },
  40184. voidColor: {
  40185. type: String,
  40186. default: ""
  40187. },
  40188. disabledVoidColor: {
  40189. type: String,
  40190. default: ""
  40191. },
  40192. icons: {
  40193. type: definePropType([Array, Object]),
  40194. default: () => [star_filled_default, star_filled_default, star_filled_default]
  40195. },
  40196. voidIcon: {
  40197. type: iconPropType,
  40198. default: () => star_default
  40199. },
  40200. disabledVoidIcon: {
  40201. type: iconPropType,
  40202. default: () => star_filled_default
  40203. },
  40204. disabled: Boolean,
  40205. allowHalf: Boolean,
  40206. showText: Boolean,
  40207. showScore: Boolean,
  40208. textColor: {
  40209. type: String,
  40210. default: ""
  40211. },
  40212. texts: {
  40213. type: definePropType(Array),
  40214. default: () => mutable([
  40215. "Extremely bad",
  40216. "Disappointed",
  40217. "Fair",
  40218. "Satisfied",
  40219. "Surprise"
  40220. ])
  40221. },
  40222. scoreTemplate: {
  40223. type: String,
  40224. default: "{value}"
  40225. },
  40226. size: useSizeProp,
  40227. label: {
  40228. type: String,
  40229. default: void 0
  40230. },
  40231. clearable: {
  40232. type: Boolean,
  40233. default: false
  40234. }
  40235. });
  40236. const rateEmits = {
  40237. [CHANGE_EVENT]: (value) => isNumber(value),
  40238. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  40239. };
  40240. const _hoisted_1$k = ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"];
  40241. const _hoisted_2$d = ["onMousemove", "onClick"];
  40242. const __default__$w = /* @__PURE__ */ defineComponent({
  40243. name: "ElRate"
  40244. });
  40245. const _sfc_main$K = /* @__PURE__ */ defineComponent({
  40246. ...__default__$w,
  40247. props: rateProps,
  40248. emits: rateEmits,
  40249. setup(__props, { expose, emit: emit2 }) {
  40250. const props = __props;
  40251. function getValueFromMap(value, map2) {
  40252. const isExcludedObject = (val) => isObject$1(val);
  40253. const matchedKeys = Object.keys(map2).map((key) => +key).filter((key) => {
  40254. const val = map2[key];
  40255. const excluded = isExcludedObject(val) ? val.excluded : false;
  40256. return excluded ? value < key : value <= key;
  40257. }).sort((a2, b2) => a2 - b2);
  40258. const matchedValue = map2[matchedKeys[0]];
  40259. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  40260. }
  40261. const formContext = inject(formContextKey, void 0);
  40262. const formItemContext = inject(formItemContextKey, void 0);
  40263. const rateSize = useFormSize();
  40264. const ns = useNamespace("rate");
  40265. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  40266. formItemContext
  40267. });
  40268. const currentValue = ref(props.modelValue);
  40269. const hoverIndex = ref(-1);
  40270. const pointerAtLeftHalf = ref(true);
  40271. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  40272. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  40273. const rateStyles = computed(() => {
  40274. return ns.cssVarBlock({
  40275. "void-color": props.voidColor,
  40276. "disabled-void-color": props.disabledVoidColor,
  40277. "fill-color": activeColor.value
  40278. });
  40279. });
  40280. const text = computed(() => {
  40281. let result = "";
  40282. if (props.showScore) {
  40283. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  40284. } else if (props.showText) {
  40285. result = props.texts[Math.ceil(currentValue.value) - 1];
  40286. }
  40287. return result;
  40288. });
  40289. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  40290. const colorMap = computed(() => isArray$3(props.colors) ? {
  40291. [props.lowThreshold]: props.colors[0],
  40292. [props.highThreshold]: { value: props.colors[1], excluded: true },
  40293. [props.max]: props.colors[2]
  40294. } : props.colors);
  40295. const activeColor = computed(() => {
  40296. const color = getValueFromMap(currentValue.value, colorMap.value);
  40297. return isObject$1(color) ? "" : color;
  40298. });
  40299. const decimalStyle = computed(() => {
  40300. let width = "";
  40301. if (rateDisabled.value) {
  40302. width = `${valueDecimal.value}%`;
  40303. } else if (props.allowHalf) {
  40304. width = "50%";
  40305. }
  40306. return {
  40307. color: activeColor.value,
  40308. width
  40309. };
  40310. });
  40311. const componentMap = computed(() => {
  40312. let icons = isArray$3(props.icons) ? [...props.icons] : { ...props.icons };
  40313. icons = markRaw(icons);
  40314. return isArray$3(icons) ? {
  40315. [props.lowThreshold]: icons[0],
  40316. [props.highThreshold]: {
  40317. value: icons[1],
  40318. excluded: true
  40319. },
  40320. [props.max]: icons[2]
  40321. } : icons;
  40322. });
  40323. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  40324. const voidComponent = computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
  40325. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  40326. function showDecimalIcon(item) {
  40327. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  40328. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  40329. return showWhenDisabled || showWhenAllowHalf;
  40330. }
  40331. function emitValue(value) {
  40332. if (props.clearable && value === props.modelValue) {
  40333. value = 0;
  40334. }
  40335. emit2(UPDATE_MODEL_EVENT, value);
  40336. if (props.modelValue !== value) {
  40337. emit2("change", value);
  40338. }
  40339. }
  40340. function selectValue(value) {
  40341. if (rateDisabled.value) {
  40342. return;
  40343. }
  40344. if (props.allowHalf && pointerAtLeftHalf.value) {
  40345. emitValue(currentValue.value);
  40346. } else {
  40347. emitValue(value);
  40348. }
  40349. }
  40350. function handleKey(e) {
  40351. if (rateDisabled.value) {
  40352. return;
  40353. }
  40354. let _currentValue = currentValue.value;
  40355. const code = e.code;
  40356. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  40357. if (props.allowHalf) {
  40358. _currentValue += 0.5;
  40359. } else {
  40360. _currentValue += 1;
  40361. }
  40362. e.stopPropagation();
  40363. e.preventDefault();
  40364. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  40365. if (props.allowHalf) {
  40366. _currentValue -= 0.5;
  40367. } else {
  40368. _currentValue -= 1;
  40369. }
  40370. e.stopPropagation();
  40371. e.preventDefault();
  40372. }
  40373. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  40374. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  40375. emit2(UPDATE_MODEL_EVENT, _currentValue);
  40376. emit2("change", _currentValue);
  40377. return _currentValue;
  40378. }
  40379. function setCurrentValue(value, event) {
  40380. if (rateDisabled.value) {
  40381. return;
  40382. }
  40383. if (props.allowHalf && event) {
  40384. let target = event.target;
  40385. if (hasClass(target, ns.e("item"))) {
  40386. target = target.querySelector(`.${ns.e("icon")}`);
  40387. }
  40388. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  40389. target = target.parentNode;
  40390. }
  40391. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  40392. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  40393. } else {
  40394. currentValue.value = value;
  40395. }
  40396. hoverIndex.value = value;
  40397. }
  40398. function resetCurrentValue() {
  40399. if (rateDisabled.value) {
  40400. return;
  40401. }
  40402. if (props.allowHalf) {
  40403. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  40404. }
  40405. currentValue.value = props.modelValue;
  40406. hoverIndex.value = -1;
  40407. }
  40408. watch(() => props.modelValue, (val) => {
  40409. currentValue.value = val;
  40410. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  40411. });
  40412. if (!props.modelValue) {
  40413. emit2(UPDATE_MODEL_EVENT, 0);
  40414. }
  40415. expose({
  40416. setCurrentValue,
  40417. resetCurrentValue
  40418. });
  40419. return (_ctx, _cache) => {
  40420. var _a2;
  40421. return openBlock(), createElementBlock("div", {
  40422. id: unref(inputId),
  40423. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  40424. role: "slider",
  40425. "aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "rating" : void 0,
  40426. "aria-labelledby": unref(isLabeledByFormItem) ? (_a2 = unref(formItemContext)) == null ? void 0 : _a2.labelId : void 0,
  40427. "aria-valuenow": currentValue.value,
  40428. "aria-valuetext": unref(text) || void 0,
  40429. "aria-valuemin": "0",
  40430. "aria-valuemax": _ctx.max,
  40431. tabindex: "0",
  40432. style: normalizeStyle(unref(rateStyles)),
  40433. onKeydown: handleKey
  40434. }, [
  40435. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  40436. return openBlock(), createElementBlock("span", {
  40437. key,
  40438. class: normalizeClass(unref(ns).e("item")),
  40439. onMousemove: ($event) => setCurrentValue(item, $event),
  40440. onMouseleave: resetCurrentValue,
  40441. onClick: ($event) => selectValue(item)
  40442. }, [
  40443. createVNode(unref(ElIcon), {
  40444. class: normalizeClass([
  40445. unref(ns).e("icon"),
  40446. { hover: hoverIndex.value === item },
  40447. unref(ns).is("active", item <= currentValue.value)
  40448. ])
  40449. }, {
  40450. default: withCtx(() => [
  40451. !showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  40452. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), null, null, 512)), [
  40453. [vShow, item <= currentValue.value]
  40454. ]),
  40455. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), null, null, 512)), [
  40456. [vShow, !(item <= currentValue.value)]
  40457. ])
  40458. ], 64)) : createCommentVNode("v-if", true),
  40459. showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  40460. (openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), {
  40461. class: normalizeClass([unref(ns).em("decimal", "box")])
  40462. }, null, 8, ["class"])),
  40463. createVNode(unref(ElIcon), {
  40464. style: normalizeStyle(unref(decimalStyle)),
  40465. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  40466. }, {
  40467. default: withCtx(() => [
  40468. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  40469. ]),
  40470. _: 1
  40471. }, 8, ["style", "class"])
  40472. ], 64)) : createCommentVNode("v-if", true)
  40473. ]),
  40474. _: 2
  40475. }, 1032, ["class"])
  40476. ], 42, _hoisted_2$d);
  40477. }), 128)),
  40478. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  40479. key: 0,
  40480. class: normalizeClass(unref(ns).e("text")),
  40481. style: normalizeStyle({ color: _ctx.textColor })
  40482. }, toDisplayString(unref(text)), 7)) : createCommentVNode("v-if", true)
  40483. ], 46, _hoisted_1$k);
  40484. };
  40485. }
  40486. });
  40487. var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
  40488. const ElRate = withInstall(Rate);
  40489. const IconMap = {
  40490. success: "icon-success",
  40491. warning: "icon-warning",
  40492. error: "icon-error",
  40493. info: "icon-info"
  40494. };
  40495. const IconComponentMap = {
  40496. [IconMap.success]: circle_check_filled_default,
  40497. [IconMap.warning]: warning_filled_default,
  40498. [IconMap.error]: circle_close_filled_default,
  40499. [IconMap.info]: info_filled_default
  40500. };
  40501. const resultProps = buildProps({
  40502. title: {
  40503. type: String,
  40504. default: ""
  40505. },
  40506. subTitle: {
  40507. type: String,
  40508. default: ""
  40509. },
  40510. icon: {
  40511. type: String,
  40512. values: ["success", "warning", "info", "error"],
  40513. default: "info"
  40514. }
  40515. });
  40516. const __default__$v = /* @__PURE__ */ defineComponent({
  40517. name: "ElResult"
  40518. });
  40519. const _sfc_main$J = /* @__PURE__ */ defineComponent({
  40520. ...__default__$v,
  40521. props: resultProps,
  40522. setup(__props) {
  40523. const props = __props;
  40524. const ns = useNamespace("result");
  40525. const resultIcon = computed(() => {
  40526. const icon = props.icon;
  40527. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  40528. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  40529. return {
  40530. class: iconClass,
  40531. component: iconComponent
  40532. };
  40533. });
  40534. return (_ctx, _cache) => {
  40535. return openBlock(), createElementBlock("div", {
  40536. class: normalizeClass(unref(ns).b())
  40537. }, [
  40538. createBaseVNode("div", {
  40539. class: normalizeClass(unref(ns).e("icon"))
  40540. }, [
  40541. renderSlot(_ctx.$slots, "icon", {}, () => [
  40542. unref(resultIcon).component ? (openBlock(), createBlock(resolveDynamicComponent(unref(resultIcon).component), {
  40543. key: 0,
  40544. class: normalizeClass(unref(resultIcon).class)
  40545. }, null, 8, ["class"])) : createCommentVNode("v-if", true)
  40546. ])
  40547. ], 2),
  40548. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
  40549. key: 0,
  40550. class: normalizeClass(unref(ns).e("title"))
  40551. }, [
  40552. renderSlot(_ctx.$slots, "title", {}, () => [
  40553. createBaseVNode("p", null, toDisplayString(_ctx.title), 1)
  40554. ])
  40555. ], 2)) : createCommentVNode("v-if", true),
  40556. _ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
  40557. key: 1,
  40558. class: normalizeClass(unref(ns).e("subtitle"))
  40559. }, [
  40560. renderSlot(_ctx.$slots, "sub-title", {}, () => [
  40561. createBaseVNode("p", null, toDisplayString(_ctx.subTitle), 1)
  40562. ])
  40563. ], 2)) : createCommentVNode("v-if", true),
  40564. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  40565. key: 2,
  40566. class: normalizeClass(unref(ns).e("extra"))
  40567. }, [
  40568. renderSlot(_ctx.$slots, "extra")
  40569. ], 2)) : createCommentVNode("v-if", true)
  40570. ], 2);
  40571. };
  40572. }
  40573. });
  40574. var Result = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/result/src/result.vue"]]);
  40575. const ElResult = withInstall(Result);
  40576. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  40577. return typeof value === "number" && value !== value;
  40578. };
  40579. function isEqual(first, second) {
  40580. if (first === second) {
  40581. return true;
  40582. }
  40583. if (safeIsNaN(first) && safeIsNaN(second)) {
  40584. return true;
  40585. }
  40586. return false;
  40587. }
  40588. function areInputsEqual(newInputs, lastInputs) {
  40589. if (newInputs.length !== lastInputs.length) {
  40590. return false;
  40591. }
  40592. for (var i = 0; i < newInputs.length; i++) {
  40593. if (!isEqual(newInputs[i], lastInputs[i])) {
  40594. return false;
  40595. }
  40596. }
  40597. return true;
  40598. }
  40599. function memoizeOne(resultFn, isEqual2) {
  40600. if (isEqual2 === void 0) {
  40601. isEqual2 = areInputsEqual;
  40602. }
  40603. var cache2 = null;
  40604. function memoized() {
  40605. var newArgs = [];
  40606. for (var _i = 0; _i < arguments.length; _i++) {
  40607. newArgs[_i] = arguments[_i];
  40608. }
  40609. if (cache2 && cache2.lastThis === this && isEqual2(newArgs, cache2.lastArgs)) {
  40610. return cache2.lastResult;
  40611. }
  40612. var lastResult = resultFn.apply(this, newArgs);
  40613. cache2 = {
  40614. lastResult,
  40615. lastArgs: newArgs,
  40616. lastThis: this
  40617. };
  40618. return lastResult;
  40619. }
  40620. memoized.clear = function clear2() {
  40621. cache2 = null;
  40622. };
  40623. return memoized;
  40624. }
  40625. const useCache = () => {
  40626. const vm = getCurrentInstance();
  40627. const props = vm.proxy.$props;
  40628. return computed(() => {
  40629. const _getItemStyleCache = (_2, __, ___) => ({});
  40630. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  40631. });
  40632. };
  40633. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  40634. const ITEM_RENDER_EVT = "itemRendered";
  40635. const SCROLL_EVT = "scroll";
  40636. const FORWARD = "forward";
  40637. const BACKWARD = "backward";
  40638. const AUTO_ALIGNMENT = "auto";
  40639. const SMART_ALIGNMENT = "smart";
  40640. const START_ALIGNMENT = "start";
  40641. const CENTERED_ALIGNMENT = "center";
  40642. const END_ALIGNMENT = "end";
  40643. const HORIZONTAL = "horizontal";
  40644. const VERTICAL = "vertical";
  40645. const LTR = "ltr";
  40646. const RTL = "rtl";
  40647. const RTL_OFFSET_NAG = "negative";
  40648. const RTL_OFFSET_POS_ASC = "positive-ascending";
  40649. const RTL_OFFSET_POS_DESC = "positive-descending";
  40650. const ScrollbarDirKey = {
  40651. [HORIZONTAL]: "left",
  40652. [VERTICAL]: "top"
  40653. };
  40654. const SCROLLBAR_MIN_SIZE = 20;
  40655. const LayoutKeys = {
  40656. [HORIZONTAL]: "deltaX",
  40657. [VERTICAL]: "deltaY"
  40658. };
  40659. const useWheel = ({ atEndEdge, atStartEdge, layout: layout2 }, onWheelDelta) => {
  40660. let frameHandle;
  40661. let offset2 = 0;
  40662. const hasReachedEdge = (offset22) => {
  40663. const edgeReached = offset22 < 0 && atStartEdge.value || offset22 > 0 && atEndEdge.value;
  40664. return edgeReached;
  40665. };
  40666. const onWheel = (e) => {
  40667. cAF(frameHandle);
  40668. const newOffset = e[LayoutKeys[layout2.value]];
  40669. if (hasReachedEdge(offset2) && hasReachedEdge(offset2 + newOffset))
  40670. return;
  40671. offset2 += newOffset;
  40672. if (!isFirefox()) {
  40673. e.preventDefault();
  40674. }
  40675. frameHandle = rAF(() => {
  40676. onWheelDelta(offset2);
  40677. offset2 = 0;
  40678. });
  40679. };
  40680. return {
  40681. hasReachedEdge,
  40682. onWheel
  40683. };
  40684. };
  40685. const itemSize$1 = buildProp({
  40686. type: definePropType([Number, Function]),
  40687. required: true
  40688. });
  40689. const estimatedItemSize = buildProp({
  40690. type: Number
  40691. });
  40692. const cache = buildProp({
  40693. type: Number,
  40694. default: 2
  40695. });
  40696. const direction = buildProp({
  40697. type: String,
  40698. values: ["ltr", "rtl"],
  40699. default: "ltr"
  40700. });
  40701. const initScrollOffset = buildProp({
  40702. type: Number,
  40703. default: 0
  40704. });
  40705. const total = buildProp({
  40706. type: Number,
  40707. required: true
  40708. });
  40709. const layout = buildProp({
  40710. type: String,
  40711. values: ["horizontal", "vertical"],
  40712. default: VERTICAL
  40713. });
  40714. const virtualizedProps = buildProps({
  40715. className: {
  40716. type: String,
  40717. default: ""
  40718. },
  40719. containerElement: {
  40720. type: definePropType([String, Object]),
  40721. default: "div"
  40722. },
  40723. data: {
  40724. type: definePropType(Array),
  40725. default: () => mutable([])
  40726. },
  40727. direction,
  40728. height: {
  40729. type: [String, Number],
  40730. required: true
  40731. },
  40732. innerElement: {
  40733. type: [String, Object],
  40734. default: "div"
  40735. },
  40736. style: {
  40737. type: definePropType([Object, String, Array])
  40738. },
  40739. useIsScrolling: {
  40740. type: Boolean,
  40741. default: false
  40742. },
  40743. width: {
  40744. type: [Number, String],
  40745. required: false
  40746. },
  40747. perfMode: {
  40748. type: Boolean,
  40749. default: true
  40750. },
  40751. scrollbarAlwaysOn: {
  40752. type: Boolean,
  40753. default: false
  40754. }
  40755. });
  40756. const virtualizedListProps = buildProps({
  40757. cache,
  40758. estimatedItemSize,
  40759. layout,
  40760. initScrollOffset,
  40761. total,
  40762. itemSize: itemSize$1,
  40763. ...virtualizedProps
  40764. });
  40765. const scrollbarSize = {
  40766. type: Number,
  40767. default: 6
  40768. };
  40769. const startGap = { type: Number, default: 0 };
  40770. const endGap = { type: Number, default: 2 };
  40771. const virtualizedGridProps = buildProps({
  40772. columnCache: cache,
  40773. columnWidth: itemSize$1,
  40774. estimatedColumnWidth: estimatedItemSize,
  40775. estimatedRowHeight: estimatedItemSize,
  40776. initScrollLeft: initScrollOffset,
  40777. initScrollTop: initScrollOffset,
  40778. itemKey: {
  40779. type: definePropType(Function),
  40780. default: ({
  40781. columnIndex,
  40782. rowIndex
  40783. }) => `${rowIndex}:${columnIndex}`
  40784. },
  40785. rowCache: cache,
  40786. rowHeight: itemSize$1,
  40787. totalColumn: total,
  40788. totalRow: total,
  40789. hScrollbarSize: scrollbarSize,
  40790. vScrollbarSize: scrollbarSize,
  40791. scrollbarStartGap: startGap,
  40792. scrollbarEndGap: endGap,
  40793. role: String,
  40794. ...virtualizedProps
  40795. });
  40796. const virtualizedScrollbarProps = buildProps({
  40797. alwaysOn: Boolean,
  40798. class: String,
  40799. layout,
  40800. total,
  40801. ratio: {
  40802. type: Number,
  40803. required: true
  40804. },
  40805. clientSize: {
  40806. type: Number,
  40807. required: true
  40808. },
  40809. scrollFrom: {
  40810. type: Number,
  40811. required: true
  40812. },
  40813. scrollbarSize,
  40814. startGap,
  40815. endGap,
  40816. visible: Boolean
  40817. });
  40818. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  40819. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  40820. const isRTL = (dir) => dir === RTL;
  40821. let cachedRTLResult = null;
  40822. function getRTLOffsetType(recalculate = false) {
  40823. if (cachedRTLResult === null || recalculate) {
  40824. const outerDiv = document.createElement("div");
  40825. const outerStyle = outerDiv.style;
  40826. outerStyle.width = "50px";
  40827. outerStyle.height = "50px";
  40828. outerStyle.overflow = "scroll";
  40829. outerStyle.direction = "rtl";
  40830. const innerDiv = document.createElement("div");
  40831. const innerStyle = innerDiv.style;
  40832. innerStyle.width = "100px";
  40833. innerStyle.height = "100px";
  40834. outerDiv.appendChild(innerDiv);
  40835. document.body.appendChild(outerDiv);
  40836. if (outerDiv.scrollLeft > 0) {
  40837. cachedRTLResult = RTL_OFFSET_POS_DESC;
  40838. } else {
  40839. outerDiv.scrollLeft = 1;
  40840. if (outerDiv.scrollLeft === 0) {
  40841. cachedRTLResult = RTL_OFFSET_NAG;
  40842. } else {
  40843. cachedRTLResult = RTL_OFFSET_POS_ASC;
  40844. }
  40845. }
  40846. document.body.removeChild(outerDiv);
  40847. return cachedRTLResult;
  40848. }
  40849. return cachedRTLResult;
  40850. }
  40851. function renderThumbStyle({ move, size: size2, bar }, layout2) {
  40852. const style = {};
  40853. const translate2 = `translate${bar.axis}(${move}px)`;
  40854. style[bar.size] = size2;
  40855. style.transform = translate2;
  40856. style.msTransform = translate2;
  40857. style.webkitTransform = translate2;
  40858. if (layout2 === "horizontal") {
  40859. style.height = "100%";
  40860. } else {
  40861. style.width = "100%";
  40862. }
  40863. return style;
  40864. }
  40865. const ScrollBar = /* @__PURE__ */ defineComponent({
  40866. name: "ElVirtualScrollBar",
  40867. props: virtualizedScrollbarProps,
  40868. emits: ["scroll", "start-move", "stop-move"],
  40869. setup(props, { emit: emit2 }) {
  40870. const GAP2 = computed(() => props.startGap + props.endGap);
  40871. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  40872. const nsScrollbar = useNamespace("scrollbar");
  40873. const trackRef = ref();
  40874. const thumbRef = ref();
  40875. let frameHandle = null;
  40876. let onselectstartStore = null;
  40877. const state = reactive({
  40878. isDragging: false,
  40879. traveled: 0
  40880. });
  40881. const bar = computed(() => BAR_MAP[props.layout]);
  40882. const trackSize = computed(() => props.clientSize - unref(GAP2));
  40883. const trackStyle = computed(() => ({
  40884. position: "absolute",
  40885. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  40886. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  40887. [ScrollbarDirKey[props.layout]]: "2px",
  40888. right: "2px",
  40889. bottom: "2px",
  40890. borderRadius: "4px"
  40891. }));
  40892. const thumbSize = computed(() => {
  40893. const ratio = props.ratio;
  40894. const clientSize = props.clientSize;
  40895. if (ratio >= 100) {
  40896. return Number.POSITIVE_INFINITY;
  40897. }
  40898. if (ratio >= 50) {
  40899. return ratio * clientSize / 100;
  40900. }
  40901. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  40902. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  40903. });
  40904. const thumbStyle = computed(() => {
  40905. if (!Number.isFinite(thumbSize.value)) {
  40906. return {
  40907. display: "none"
  40908. };
  40909. }
  40910. const thumb = `${thumbSize.value}px`;
  40911. const style = renderThumbStyle({
  40912. bar: bar.value,
  40913. size: thumb,
  40914. move: state.traveled
  40915. }, props.layout);
  40916. return style;
  40917. });
  40918. const totalSteps = computed(() => Math.floor(props.clientSize - thumbSize.value - unref(GAP2)));
  40919. const attachEvents2 = () => {
  40920. window.addEventListener("mousemove", onMouseMove);
  40921. window.addEventListener("mouseup", onMouseUp);
  40922. const thumbEl = unref(thumbRef);
  40923. if (!thumbEl)
  40924. return;
  40925. onselectstartStore = document.onselectstart;
  40926. document.onselectstart = () => false;
  40927. thumbEl.addEventListener("touchmove", onMouseMove);
  40928. thumbEl.addEventListener("touchend", onMouseUp);
  40929. };
  40930. const detachEvents = () => {
  40931. window.removeEventListener("mousemove", onMouseMove);
  40932. window.removeEventListener("mouseup", onMouseUp);
  40933. document.onselectstart = onselectstartStore;
  40934. onselectstartStore = null;
  40935. const thumbEl = unref(thumbRef);
  40936. if (!thumbEl)
  40937. return;
  40938. thumbEl.removeEventListener("touchmove", onMouseMove);
  40939. thumbEl.removeEventListener("touchend", onMouseUp);
  40940. };
  40941. const onThumbMouseDown = (e) => {
  40942. e.stopImmediatePropagation();
  40943. if (e.ctrlKey || [1, 2].includes(e.button)) {
  40944. return;
  40945. }
  40946. state.isDragging = true;
  40947. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  40948. emit2("start-move");
  40949. attachEvents2();
  40950. };
  40951. const onMouseUp = () => {
  40952. state.isDragging = false;
  40953. state[bar.value.axis] = 0;
  40954. emit2("stop-move");
  40955. detachEvents();
  40956. };
  40957. const onMouseMove = (e) => {
  40958. const { isDragging: isDragging2 } = state;
  40959. if (!isDragging2)
  40960. return;
  40961. if (!thumbRef.value || !trackRef.value)
  40962. return;
  40963. const prevPage = state[bar.value.axis];
  40964. if (!prevPage)
  40965. return;
  40966. cAF(frameHandle);
  40967. const offset2 = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  40968. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  40969. const distance = offset2 - thumbClickPosition;
  40970. frameHandle = rAF(() => {
  40971. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  40972. emit2("scroll", distance, totalSteps.value);
  40973. });
  40974. };
  40975. const clickTrackHandler = (e) => {
  40976. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  40977. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  40978. const distance = offset2 - thumbHalf;
  40979. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  40980. emit2("scroll", distance, totalSteps.value);
  40981. };
  40982. watch(() => props.scrollFrom, (v2) => {
  40983. if (state.isDragging)
  40984. return;
  40985. state.traveled = Math.ceil(v2 * totalSteps.value);
  40986. });
  40987. onBeforeUnmount(() => {
  40988. detachEvents();
  40989. });
  40990. return () => {
  40991. return h$1("div", {
  40992. role: "presentation",
  40993. ref: trackRef,
  40994. class: [
  40995. nsVirtualScrollbar.b(),
  40996. props.class,
  40997. (props.alwaysOn || state.isDragging) && "always-on"
  40998. ],
  40999. style: trackStyle.value,
  41000. onMousedown: withModifiers(clickTrackHandler, ["stop", "prevent"]),
  41001. onTouchstartPrevent: onThumbMouseDown
  41002. }, h$1("div", {
  41003. ref: thumbRef,
  41004. class: nsScrollbar.e("thumb"),
  41005. style: thumbStyle.value,
  41006. onMousedown: onThumbMouseDown
  41007. }, []));
  41008. };
  41009. }
  41010. });
  41011. const createList = ({
  41012. name,
  41013. getOffset: getOffset2,
  41014. getItemSize,
  41015. getItemOffset,
  41016. getEstimatedTotalSize: getEstimatedTotalSize2,
  41017. getStartIndexForOffset,
  41018. getStopIndexForStartIndex,
  41019. initCache,
  41020. clearCache,
  41021. validateProps
  41022. }) => {
  41023. return /* @__PURE__ */ defineComponent({
  41024. name: name != null ? name : "ElVirtualList",
  41025. props: virtualizedListProps,
  41026. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  41027. setup(props, { emit: emit2, expose }) {
  41028. validateProps(props);
  41029. const instance = getCurrentInstance();
  41030. const ns = useNamespace("vl");
  41031. const dynamicSizeCache = ref(initCache(props, instance));
  41032. const getItemStyleCache = useCache();
  41033. const windowRef = ref();
  41034. const innerRef = ref();
  41035. const scrollbarRef = ref();
  41036. const states = ref({
  41037. isScrolling: false,
  41038. scrollDir: "forward",
  41039. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  41040. updateRequested: false,
  41041. isScrollbarDragging: false,
  41042. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  41043. });
  41044. const itemsToRender = computed(() => {
  41045. const { total: total2, cache: cache2 } = props;
  41046. const { isScrolling, scrollDir, scrollOffset } = unref(states);
  41047. if (total2 === 0) {
  41048. return [0, 0, 0, 0];
  41049. }
  41050. const startIndex = getStartIndexForOffset(props, scrollOffset, unref(dynamicSizeCache));
  41051. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, unref(dynamicSizeCache));
  41052. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache2) : 1;
  41053. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache2) : 1;
  41054. return [
  41055. Math.max(0, startIndex - cacheBackward),
  41056. Math.max(0, Math.min(total2 - 1, stopIndex + cacheForward)),
  41057. startIndex,
  41058. stopIndex
  41059. ];
  41060. });
  41061. const estimatedTotalSize = computed(() => getEstimatedTotalSize2(props, unref(dynamicSizeCache)));
  41062. const _isHorizontal = computed(() => isHorizontal(props.layout));
  41063. const windowStyle = computed(() => [
  41064. {
  41065. position: "relative",
  41066. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  41067. WebkitOverflowScrolling: "touch",
  41068. willChange: "transform"
  41069. },
  41070. {
  41071. direction: props.direction,
  41072. height: isNumber(props.height) ? `${props.height}px` : props.height,
  41073. width: isNumber(props.width) ? `${props.width}px` : props.width
  41074. },
  41075. props.style
  41076. ]);
  41077. const innerStyle = computed(() => {
  41078. const size2 = unref(estimatedTotalSize);
  41079. const horizontal = unref(_isHorizontal);
  41080. return {
  41081. height: horizontal ? "100%" : `${size2}px`,
  41082. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  41083. width: horizontal ? `${size2}px` : "100%"
  41084. };
  41085. });
  41086. const clientSize = computed(() => _isHorizontal.value ? props.width : props.height);
  41087. const { onWheel } = useWheel({
  41088. atStartEdge: computed(() => states.value.scrollOffset <= 0),
  41089. atEndEdge: computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  41090. layout: computed(() => props.layout)
  41091. }, (offset2) => {
  41092. var _a2, _b;
  41093. (_b = (_a2 = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a2);
  41094. scrollTo(Math.min(states.value.scrollOffset + offset2, estimatedTotalSize.value - clientSize.value));
  41095. });
  41096. const emitEvents = () => {
  41097. const { total: total2 } = props;
  41098. if (total2 > 0) {
  41099. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = unref(itemsToRender);
  41100. emit2(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  41101. }
  41102. const { scrollDir, scrollOffset, updateRequested } = unref(states);
  41103. emit2(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  41104. };
  41105. const scrollVertically = (e) => {
  41106. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  41107. const _states = unref(states);
  41108. if (_states.scrollOffset === scrollTop) {
  41109. return;
  41110. }
  41111. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  41112. states.value = {
  41113. ..._states,
  41114. isScrolling: true,
  41115. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  41116. scrollOffset,
  41117. updateRequested: false
  41118. };
  41119. nextTick(resetIsScrolling);
  41120. };
  41121. const scrollHorizontally = (e) => {
  41122. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  41123. const _states = unref(states);
  41124. if (_states.scrollOffset === scrollLeft) {
  41125. return;
  41126. }
  41127. const { direction: direction2 } = props;
  41128. let scrollOffset = scrollLeft;
  41129. if (direction2 === RTL) {
  41130. switch (getRTLOffsetType()) {
  41131. case RTL_OFFSET_NAG: {
  41132. scrollOffset = -scrollLeft;
  41133. break;
  41134. }
  41135. case RTL_OFFSET_POS_DESC: {
  41136. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  41137. break;
  41138. }
  41139. }
  41140. }
  41141. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  41142. states.value = {
  41143. ..._states,
  41144. isScrolling: true,
  41145. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  41146. scrollOffset,
  41147. updateRequested: false
  41148. };
  41149. nextTick(resetIsScrolling);
  41150. };
  41151. const onScroll = (e) => {
  41152. unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  41153. emitEvents();
  41154. };
  41155. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  41156. const offset2 = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  41157. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset2));
  41158. };
  41159. const scrollTo = (offset2) => {
  41160. offset2 = Math.max(offset2, 0);
  41161. if (offset2 === unref(states).scrollOffset) {
  41162. return;
  41163. }
  41164. states.value = {
  41165. ...unref(states),
  41166. scrollOffset: offset2,
  41167. scrollDir: getScrollDir(unref(states).scrollOffset, offset2),
  41168. updateRequested: true
  41169. };
  41170. nextTick(resetIsScrolling);
  41171. };
  41172. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  41173. const { scrollOffset } = unref(states);
  41174. idx = Math.max(0, Math.min(idx, props.total - 1));
  41175. scrollTo(getOffset2(props, idx, alignment, scrollOffset, unref(dynamicSizeCache)));
  41176. };
  41177. const getItemStyle = (idx) => {
  41178. const { direction: direction2, itemSize: itemSize2, layout: layout2 } = props;
  41179. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize2, clearCache && layout2, clearCache && direction2);
  41180. let style;
  41181. if (hasOwn(itemStyleCache, String(idx))) {
  41182. style = itemStyleCache[idx];
  41183. } else {
  41184. const offset2 = getItemOffset(props, idx, unref(dynamicSizeCache));
  41185. const size2 = getItemSize(props, idx, unref(dynamicSizeCache));
  41186. const horizontal = unref(_isHorizontal);
  41187. const isRtl = direction2 === RTL;
  41188. const offsetHorizontal = horizontal ? offset2 : 0;
  41189. itemStyleCache[idx] = style = {
  41190. position: "absolute",
  41191. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  41192. right: isRtl ? `${offsetHorizontal}px` : void 0,
  41193. top: !horizontal ? `${offset2}px` : 0,
  41194. height: !horizontal ? `${size2}px` : "100%",
  41195. width: horizontal ? `${size2}px` : "100%"
  41196. };
  41197. }
  41198. return style;
  41199. };
  41200. const resetIsScrolling = () => {
  41201. states.value.isScrolling = false;
  41202. nextTick(() => {
  41203. getItemStyleCache.value(-1, null, null);
  41204. });
  41205. };
  41206. const resetScrollTop = () => {
  41207. const window2 = windowRef.value;
  41208. if (window2) {
  41209. window2.scrollTop = 0;
  41210. }
  41211. };
  41212. onMounted(() => {
  41213. if (!isClient)
  41214. return;
  41215. const { initScrollOffset: initScrollOffset2 } = props;
  41216. const windowElement = unref(windowRef);
  41217. if (isNumber(initScrollOffset2) && windowElement) {
  41218. if (unref(_isHorizontal)) {
  41219. windowElement.scrollLeft = initScrollOffset2;
  41220. } else {
  41221. windowElement.scrollTop = initScrollOffset2;
  41222. }
  41223. }
  41224. emitEvents();
  41225. });
  41226. onUpdated(() => {
  41227. const { direction: direction2, layout: layout2 } = props;
  41228. const { scrollOffset, updateRequested } = unref(states);
  41229. const windowElement = unref(windowRef);
  41230. if (updateRequested && windowElement) {
  41231. if (layout2 === HORIZONTAL) {
  41232. if (direction2 === RTL) {
  41233. switch (getRTLOffsetType()) {
  41234. case RTL_OFFSET_NAG: {
  41235. windowElement.scrollLeft = -scrollOffset;
  41236. break;
  41237. }
  41238. case RTL_OFFSET_POS_ASC: {
  41239. windowElement.scrollLeft = scrollOffset;
  41240. break;
  41241. }
  41242. default: {
  41243. const { clientWidth, scrollWidth } = windowElement;
  41244. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  41245. break;
  41246. }
  41247. }
  41248. } else {
  41249. windowElement.scrollLeft = scrollOffset;
  41250. }
  41251. } else {
  41252. windowElement.scrollTop = scrollOffset;
  41253. }
  41254. }
  41255. });
  41256. const api = {
  41257. ns,
  41258. clientSize,
  41259. estimatedTotalSize,
  41260. windowStyle,
  41261. windowRef,
  41262. innerRef,
  41263. innerStyle,
  41264. itemsToRender,
  41265. scrollbarRef,
  41266. states,
  41267. getItemStyle,
  41268. onScroll,
  41269. onScrollbarScroll,
  41270. onWheel,
  41271. scrollTo,
  41272. scrollToItem,
  41273. resetScrollTop
  41274. };
  41275. expose({
  41276. windowRef,
  41277. innerRef,
  41278. getItemStyleCache,
  41279. scrollTo,
  41280. scrollToItem,
  41281. resetScrollTop,
  41282. states
  41283. });
  41284. return api;
  41285. },
  41286. render(ctx) {
  41287. var _a2;
  41288. const {
  41289. $slots,
  41290. className,
  41291. clientSize,
  41292. containerElement,
  41293. data,
  41294. getItemStyle,
  41295. innerElement,
  41296. itemsToRender,
  41297. innerStyle,
  41298. layout: layout2,
  41299. total: total2,
  41300. onScroll,
  41301. onScrollbarScroll,
  41302. onWheel,
  41303. states,
  41304. useIsScrolling,
  41305. windowStyle,
  41306. ns
  41307. } = ctx;
  41308. const [start, end2] = itemsToRender;
  41309. const Container2 = resolveDynamicComponent(containerElement);
  41310. const Inner = resolveDynamicComponent(innerElement);
  41311. const children = [];
  41312. if (total2 > 0) {
  41313. for (let i = start; i <= end2; i++) {
  41314. children.push((_a2 = $slots.default) == null ? void 0 : _a2.call($slots, {
  41315. data,
  41316. key: i,
  41317. index: i,
  41318. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  41319. style: getItemStyle(i)
  41320. }));
  41321. }
  41322. }
  41323. const InnerNode = [
  41324. h$1(Inner, {
  41325. style: innerStyle,
  41326. ref: "innerRef"
  41327. }, !isString$1(Inner) ? {
  41328. default: () => children
  41329. } : children)
  41330. ];
  41331. const scrollbar = h$1(ScrollBar, {
  41332. ref: "scrollbarRef",
  41333. clientSize,
  41334. layout: layout2,
  41335. onScroll: onScrollbarScroll,
  41336. ratio: clientSize * 100 / this.estimatedTotalSize,
  41337. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  41338. total: total2
  41339. });
  41340. const listContainer = h$1(Container2, {
  41341. class: [ns.e("window"), className],
  41342. style: windowStyle,
  41343. onScroll,
  41344. onWheel,
  41345. ref: "windowRef",
  41346. key: 0
  41347. }, !isString$1(Container2) ? { default: () => [InnerNode] } : [InnerNode]);
  41348. return h$1("div", {
  41349. key: 0,
  41350. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  41351. }, [listContainer, scrollbar]);
  41352. }
  41353. });
  41354. };
  41355. const FixedSizeList = createList({
  41356. name: "ElFixedSizeList",
  41357. getItemOffset: ({ itemSize: itemSize2 }, index2) => index2 * itemSize2,
  41358. getItemSize: ({ itemSize: itemSize2 }) => itemSize2,
  41359. getEstimatedTotalSize: ({ total: total2, itemSize: itemSize2 }) => itemSize2 * total2,
  41360. getOffset: ({ height, total: total2, itemSize: itemSize2, layout: layout2, width }, index2, alignment, scrollOffset) => {
  41361. const size2 = isHorizontal(layout2) ? width : height;
  41362. const lastItemOffset = Math.max(0, total2 * itemSize2 - size2);
  41363. const maxOffset = Math.min(lastItemOffset, index2 * itemSize2);
  41364. const minOffset = Math.max(0, (index2 + 1) * itemSize2 - size2);
  41365. if (alignment === SMART_ALIGNMENT) {
  41366. if (scrollOffset >= minOffset - size2 && scrollOffset <= maxOffset + size2) {
  41367. alignment = AUTO_ALIGNMENT;
  41368. } else {
  41369. alignment = CENTERED_ALIGNMENT;
  41370. }
  41371. }
  41372. switch (alignment) {
  41373. case START_ALIGNMENT: {
  41374. return maxOffset;
  41375. }
  41376. case END_ALIGNMENT: {
  41377. return minOffset;
  41378. }
  41379. case CENTERED_ALIGNMENT: {
  41380. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  41381. if (middleOffset < Math.ceil(size2 / 2)) {
  41382. return 0;
  41383. } else if (middleOffset > lastItemOffset + Math.floor(size2 / 2)) {
  41384. return lastItemOffset;
  41385. } else {
  41386. return middleOffset;
  41387. }
  41388. }
  41389. case AUTO_ALIGNMENT:
  41390. default: {
  41391. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41392. return scrollOffset;
  41393. } else if (scrollOffset < minOffset) {
  41394. return minOffset;
  41395. } else {
  41396. return maxOffset;
  41397. }
  41398. }
  41399. }
  41400. },
  41401. getStartIndexForOffset: ({ total: total2, itemSize: itemSize2 }, offset2) => Math.max(0, Math.min(total2 - 1, Math.floor(offset2 / itemSize2))),
  41402. getStopIndexForStartIndex: ({ height, total: total2, itemSize: itemSize2, layout: layout2, width }, startIndex, scrollOffset) => {
  41403. const offset2 = startIndex * itemSize2;
  41404. const size2 = isHorizontal(layout2) ? width : height;
  41405. const numVisibleItems = Math.ceil((size2 + scrollOffset - offset2) / itemSize2);
  41406. return Math.max(0, Math.min(total2 - 1, startIndex + numVisibleItems - 1));
  41407. },
  41408. initCache() {
  41409. return void 0;
  41410. },
  41411. clearCache: true,
  41412. validateProps() {
  41413. }
  41414. });
  41415. const getItemFromCache$1 = (props, index2, listCache) => {
  41416. const { itemSize: itemSize2 } = props;
  41417. const { items, lastVisitedIndex } = listCache;
  41418. if (index2 > lastVisitedIndex) {
  41419. let offset2 = 0;
  41420. if (lastVisitedIndex >= 0) {
  41421. const item = items[lastVisitedIndex];
  41422. offset2 = item.offset + item.size;
  41423. }
  41424. for (let i = lastVisitedIndex + 1; i <= index2; i++) {
  41425. const size2 = itemSize2(i);
  41426. items[i] = {
  41427. offset: offset2,
  41428. size: size2
  41429. };
  41430. offset2 += size2;
  41431. }
  41432. listCache.lastVisitedIndex = index2;
  41433. }
  41434. return items[index2];
  41435. };
  41436. const findItem$1 = (props, listCache, offset2) => {
  41437. const { items, lastVisitedIndex } = listCache;
  41438. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  41439. if (lastVisitedOffset >= offset2) {
  41440. return bs$1(props, listCache, 0, lastVisitedIndex, offset2);
  41441. }
  41442. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset2);
  41443. };
  41444. const bs$1 = (props, listCache, low, high, offset2) => {
  41445. while (low <= high) {
  41446. const mid = low + Math.floor((high - low) / 2);
  41447. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  41448. if (currentOffset === offset2) {
  41449. return mid;
  41450. } else if (currentOffset < offset2) {
  41451. low = mid + 1;
  41452. } else if (currentOffset > offset2) {
  41453. high = mid - 1;
  41454. }
  41455. }
  41456. return Math.max(0, low - 1);
  41457. };
  41458. const es$1 = (props, listCache, index2, offset2) => {
  41459. const { total: total2 } = props;
  41460. let exponent = 1;
  41461. while (index2 < total2 && getItemFromCache$1(props, index2, listCache).offset < offset2) {
  41462. index2 += exponent;
  41463. exponent *= 2;
  41464. }
  41465. return bs$1(props, listCache, Math.floor(index2 / 2), Math.min(index2, total2 - 1), offset2);
  41466. };
  41467. const getEstimatedTotalSize = ({ total: total2 }, { items, estimatedItemSize: estimatedItemSize2, lastVisitedIndex }) => {
  41468. let totalSizeOfMeasuredItems = 0;
  41469. if (lastVisitedIndex >= total2) {
  41470. lastVisitedIndex = total2 - 1;
  41471. }
  41472. if (lastVisitedIndex >= 0) {
  41473. const item = items[lastVisitedIndex];
  41474. totalSizeOfMeasuredItems = item.offset + item.size;
  41475. }
  41476. const numUnmeasuredItems = total2 - lastVisitedIndex - 1;
  41477. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize2;
  41478. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  41479. };
  41480. const DynamicSizeList = createList({
  41481. name: "ElDynamicSizeList",
  41482. getItemOffset: (props, index2, listCache) => getItemFromCache$1(props, index2, listCache).offset,
  41483. getItemSize: (_2, index2, { items }) => items[index2].size,
  41484. getEstimatedTotalSize,
  41485. getOffset: (props, index2, alignment, scrollOffset, listCache) => {
  41486. const { height, layout: layout2, width } = props;
  41487. const size2 = isHorizontal(layout2) ? width : height;
  41488. const item = getItemFromCache$1(props, index2, listCache);
  41489. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  41490. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size2, item.offset));
  41491. const minOffset = Math.max(0, item.offset - size2 + item.size);
  41492. if (alignment === SMART_ALIGNMENT) {
  41493. if (scrollOffset >= minOffset - size2 && scrollOffset <= maxOffset + size2) {
  41494. alignment = AUTO_ALIGNMENT;
  41495. } else {
  41496. alignment = CENTERED_ALIGNMENT;
  41497. }
  41498. }
  41499. switch (alignment) {
  41500. case START_ALIGNMENT: {
  41501. return maxOffset;
  41502. }
  41503. case END_ALIGNMENT: {
  41504. return minOffset;
  41505. }
  41506. case CENTERED_ALIGNMENT: {
  41507. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  41508. }
  41509. case AUTO_ALIGNMENT:
  41510. default: {
  41511. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41512. return scrollOffset;
  41513. } else if (scrollOffset < minOffset) {
  41514. return minOffset;
  41515. } else {
  41516. return maxOffset;
  41517. }
  41518. }
  41519. }
  41520. },
  41521. getStartIndexForOffset: (props, offset2, listCache) => findItem$1(props, listCache, offset2),
  41522. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  41523. const { height, total: total2, layout: layout2, width } = props;
  41524. const size2 = isHorizontal(layout2) ? width : height;
  41525. const item = getItemFromCache$1(props, startIndex, listCache);
  41526. const maxOffset = scrollOffset + size2;
  41527. let offset2 = item.offset + item.size;
  41528. let stopIndex = startIndex;
  41529. while (stopIndex < total2 - 1 && offset2 < maxOffset) {
  41530. stopIndex++;
  41531. offset2 += getItemFromCache$1(props, stopIndex, listCache).size;
  41532. }
  41533. return stopIndex;
  41534. },
  41535. initCache({ estimatedItemSize: estimatedItemSize2 = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  41536. const cache2 = {
  41537. items: {},
  41538. estimatedItemSize: estimatedItemSize2,
  41539. lastVisitedIndex: -1
  41540. };
  41541. cache2.clearCacheAfterIndex = (index2, forceUpdate = true) => {
  41542. var _a2, _b;
  41543. cache2.lastVisitedIndex = Math.min(cache2.lastVisitedIndex, index2 - 1);
  41544. (_a2 = instance.exposed) == null ? void 0 : _a2.getItemStyleCache(-1);
  41545. if (forceUpdate) {
  41546. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  41547. }
  41548. };
  41549. return cache2;
  41550. },
  41551. clearCache: false,
  41552. validateProps: ({ itemSize: itemSize2 }) => {
  41553. }
  41554. });
  41555. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  41556. let frameHandle = null;
  41557. let xOffset = 0;
  41558. let yOffset = 0;
  41559. const hasReachedEdge = (x2, y) => {
  41560. const xEdgeReached = x2 <= 0 && atXStartEdge.value || x2 >= 0 && atXEndEdge.value;
  41561. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  41562. return xEdgeReached && yEdgeReached;
  41563. };
  41564. const onWheel = (e) => {
  41565. cAF(frameHandle);
  41566. let x2 = e.deltaX;
  41567. let y = e.deltaY;
  41568. if (Math.abs(x2) > Math.abs(y)) {
  41569. y = 0;
  41570. } else {
  41571. x2 = 0;
  41572. }
  41573. if (e.shiftKey && y !== 0) {
  41574. x2 = y;
  41575. y = 0;
  41576. }
  41577. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x2, yOffset + y))
  41578. return;
  41579. xOffset += x2;
  41580. yOffset += y;
  41581. e.preventDefault();
  41582. frameHandle = rAF(() => {
  41583. onWheelDelta(xOffset, yOffset);
  41584. xOffset = 0;
  41585. yOffset = 0;
  41586. });
  41587. };
  41588. return {
  41589. hasReachedEdge,
  41590. onWheel
  41591. };
  41592. };
  41593. const createGrid = ({
  41594. name,
  41595. clearCache,
  41596. getColumnPosition,
  41597. getColumnStartIndexForOffset,
  41598. getColumnStopIndexForStartIndex,
  41599. getEstimatedTotalHeight: getEstimatedTotalHeight2,
  41600. getEstimatedTotalWidth: getEstimatedTotalWidth2,
  41601. getColumnOffset,
  41602. getRowOffset,
  41603. getRowPosition,
  41604. getRowStartIndexForOffset,
  41605. getRowStopIndexForStartIndex,
  41606. initCache,
  41607. injectToInstance,
  41608. validateProps
  41609. }) => {
  41610. return /* @__PURE__ */ defineComponent({
  41611. name: name != null ? name : "ElVirtualList",
  41612. props: virtualizedGridProps,
  41613. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  41614. setup(props, { emit: emit2, expose, slots }) {
  41615. const ns = useNamespace("vl");
  41616. validateProps(props);
  41617. const instance = getCurrentInstance();
  41618. const cache2 = ref(initCache(props, instance));
  41619. injectToInstance == null ? void 0 : injectToInstance(instance, cache2);
  41620. const windowRef = ref();
  41621. const hScrollbar = ref();
  41622. const vScrollbar = ref();
  41623. const innerRef = ref(null);
  41624. const states = ref({
  41625. isScrolling: false,
  41626. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  41627. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  41628. updateRequested: false,
  41629. xAxisScrollDir: FORWARD,
  41630. yAxisScrollDir: FORWARD
  41631. });
  41632. const getItemStyleCache = useCache();
  41633. const parsedHeight = computed(() => Number.parseInt(`${props.height}`, 10));
  41634. const parsedWidth = computed(() => Number.parseInt(`${props.width}`, 10));
  41635. const columnsToRender = computed(() => {
  41636. const { totalColumn, totalRow, columnCache } = props;
  41637. const { isScrolling, xAxisScrollDir, scrollLeft } = unref(states);
  41638. if (totalColumn === 0 || totalRow === 0) {
  41639. return [0, 0, 0, 0];
  41640. }
  41641. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, unref(cache2));
  41642. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, unref(cache2));
  41643. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  41644. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  41645. return [
  41646. Math.max(0, startIndex - cacheBackward),
  41647. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  41648. startIndex,
  41649. stopIndex
  41650. ];
  41651. });
  41652. const rowsToRender = computed(() => {
  41653. const { totalColumn, totalRow, rowCache } = props;
  41654. const { isScrolling, yAxisScrollDir, scrollTop } = unref(states);
  41655. if (totalColumn === 0 || totalRow === 0) {
  41656. return [0, 0, 0, 0];
  41657. }
  41658. const startIndex = getRowStartIndexForOffset(props, scrollTop, unref(cache2));
  41659. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, unref(cache2));
  41660. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  41661. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  41662. return [
  41663. Math.max(0, startIndex - cacheBackward),
  41664. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  41665. startIndex,
  41666. stopIndex
  41667. ];
  41668. });
  41669. const estimatedTotalHeight = computed(() => getEstimatedTotalHeight2(props, unref(cache2)));
  41670. const estimatedTotalWidth = computed(() => getEstimatedTotalWidth2(props, unref(cache2)));
  41671. const windowStyle = computed(() => {
  41672. var _a2;
  41673. return [
  41674. {
  41675. position: "relative",
  41676. overflow: "hidden",
  41677. WebkitOverflowScrolling: "touch",
  41678. willChange: "transform"
  41679. },
  41680. {
  41681. direction: props.direction,
  41682. height: isNumber(props.height) ? `${props.height}px` : props.height,
  41683. width: isNumber(props.width) ? `${props.width}px` : props.width
  41684. },
  41685. (_a2 = props.style) != null ? _a2 : {}
  41686. ];
  41687. });
  41688. const innerStyle = computed(() => {
  41689. const width = `${unref(estimatedTotalWidth)}px`;
  41690. const height = `${unref(estimatedTotalHeight)}px`;
  41691. return {
  41692. height,
  41693. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  41694. width
  41695. };
  41696. });
  41697. const emitEvents = () => {
  41698. const { totalColumn, totalRow } = props;
  41699. if (totalColumn > 0 && totalRow > 0) {
  41700. const [
  41701. columnCacheStart,
  41702. columnCacheEnd,
  41703. columnVisibleStart,
  41704. columnVisibleEnd
  41705. ] = unref(columnsToRender);
  41706. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = unref(rowsToRender);
  41707. emit2(ITEM_RENDER_EVT, {
  41708. columnCacheStart,
  41709. columnCacheEnd,
  41710. rowCacheStart,
  41711. rowCacheEnd,
  41712. columnVisibleStart,
  41713. columnVisibleEnd,
  41714. rowVisibleStart,
  41715. rowVisibleEnd
  41716. });
  41717. }
  41718. const {
  41719. scrollLeft,
  41720. scrollTop,
  41721. updateRequested,
  41722. xAxisScrollDir,
  41723. yAxisScrollDir
  41724. } = unref(states);
  41725. emit2(SCROLL_EVT, {
  41726. xAxisScrollDir,
  41727. scrollLeft,
  41728. yAxisScrollDir,
  41729. scrollTop,
  41730. updateRequested
  41731. });
  41732. };
  41733. const onScroll = (e) => {
  41734. const {
  41735. clientHeight,
  41736. clientWidth,
  41737. scrollHeight,
  41738. scrollLeft,
  41739. scrollTop,
  41740. scrollWidth
  41741. } = e.currentTarget;
  41742. const _states = unref(states);
  41743. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  41744. return;
  41745. }
  41746. let _scrollLeft = scrollLeft;
  41747. if (isRTL(props.direction)) {
  41748. switch (getRTLOffsetType()) {
  41749. case RTL_OFFSET_NAG:
  41750. _scrollLeft = -scrollLeft;
  41751. break;
  41752. case RTL_OFFSET_POS_DESC:
  41753. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  41754. break;
  41755. }
  41756. }
  41757. states.value = {
  41758. ..._states,
  41759. isScrolling: true,
  41760. scrollLeft: _scrollLeft,
  41761. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  41762. updateRequested: true,
  41763. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  41764. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  41765. };
  41766. nextTick(() => resetIsScrolling());
  41767. onUpdated2();
  41768. emitEvents();
  41769. };
  41770. const onVerticalScroll = (distance, totalSteps) => {
  41771. const height = unref(parsedHeight);
  41772. const offset2 = (estimatedTotalHeight.value - height) / totalSteps * distance;
  41773. scrollTo({
  41774. scrollTop: Math.min(estimatedTotalHeight.value - height, offset2)
  41775. });
  41776. };
  41777. const onHorizontalScroll = (distance, totalSteps) => {
  41778. const width = unref(parsedWidth);
  41779. const offset2 = (estimatedTotalWidth.value - width) / totalSteps * distance;
  41780. scrollTo({
  41781. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset2)
  41782. });
  41783. };
  41784. const { onWheel } = useGridWheel({
  41785. atXStartEdge: computed(() => states.value.scrollLeft <= 0),
  41786. atXEndEdge: computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - unref(parsedWidth)),
  41787. atYStartEdge: computed(() => states.value.scrollTop <= 0),
  41788. atYEndEdge: computed(() => states.value.scrollTop >= estimatedTotalHeight.value - unref(parsedHeight))
  41789. }, (x2, y) => {
  41790. var _a2, _b, _c, _d;
  41791. (_b = (_a2 = hScrollbar.value) == null ? void 0 : _a2.onMouseUp) == null ? void 0 : _b.call(_a2);
  41792. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  41793. const width = unref(parsedWidth);
  41794. const height = unref(parsedHeight);
  41795. scrollTo({
  41796. scrollLeft: Math.min(states.value.scrollLeft + x2, estimatedTotalWidth.value - width),
  41797. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  41798. });
  41799. });
  41800. const scrollTo = ({
  41801. scrollLeft = states.value.scrollLeft,
  41802. scrollTop = states.value.scrollTop
  41803. }) => {
  41804. scrollLeft = Math.max(scrollLeft, 0);
  41805. scrollTop = Math.max(scrollTop, 0);
  41806. const _states = unref(states);
  41807. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  41808. return;
  41809. }
  41810. states.value = {
  41811. ..._states,
  41812. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  41813. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  41814. scrollLeft,
  41815. scrollTop,
  41816. updateRequested: true
  41817. };
  41818. nextTick(() => resetIsScrolling());
  41819. onUpdated2();
  41820. emitEvents();
  41821. };
  41822. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  41823. const _states = unref(states);
  41824. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  41825. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  41826. const scrollBarWidth2 = getScrollBarWidth(ns.namespace.value);
  41827. const _cache = unref(cache2);
  41828. const estimatedHeight = getEstimatedTotalHeight2(props, _cache);
  41829. const estimatedWidth = getEstimatedTotalWidth2(props, _cache);
  41830. scrollTo({
  41831. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth2 : 0),
  41832. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth2 : 0)
  41833. });
  41834. };
  41835. const getItemStyle = (rowIndex, columnIndex) => {
  41836. const { columnWidth, direction: direction2, rowHeight } = props;
  41837. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction2);
  41838. const key = `${rowIndex},${columnIndex}`;
  41839. if (hasOwn(itemStyleCache, key)) {
  41840. return itemStyleCache[key];
  41841. } else {
  41842. const [, left2] = getColumnPosition(props, columnIndex, unref(cache2));
  41843. const _cache = unref(cache2);
  41844. const rtl = isRTL(direction2);
  41845. const [height, top] = getRowPosition(props, rowIndex, _cache);
  41846. const [width] = getColumnPosition(props, columnIndex, _cache);
  41847. itemStyleCache[key] = {
  41848. position: "absolute",
  41849. left: rtl ? void 0 : `${left2}px`,
  41850. right: rtl ? `${left2}px` : void 0,
  41851. top: `${top}px`,
  41852. height: `${height}px`,
  41853. width: `${width}px`
  41854. };
  41855. return itemStyleCache[key];
  41856. }
  41857. };
  41858. const resetIsScrolling = () => {
  41859. states.value.isScrolling = false;
  41860. nextTick(() => {
  41861. getItemStyleCache.value(-1, null, null);
  41862. });
  41863. };
  41864. onMounted(() => {
  41865. if (!isClient)
  41866. return;
  41867. const { initScrollLeft, initScrollTop } = props;
  41868. const windowElement = unref(windowRef);
  41869. if (windowElement) {
  41870. if (isNumber(initScrollLeft)) {
  41871. windowElement.scrollLeft = initScrollLeft;
  41872. }
  41873. if (isNumber(initScrollTop)) {
  41874. windowElement.scrollTop = initScrollTop;
  41875. }
  41876. }
  41877. emitEvents();
  41878. });
  41879. const onUpdated2 = () => {
  41880. const { direction: direction2 } = props;
  41881. const { scrollLeft, scrollTop, updateRequested } = unref(states);
  41882. const windowElement = unref(windowRef);
  41883. if (updateRequested && windowElement) {
  41884. if (direction2 === RTL) {
  41885. switch (getRTLOffsetType()) {
  41886. case RTL_OFFSET_NAG: {
  41887. windowElement.scrollLeft = -scrollLeft;
  41888. break;
  41889. }
  41890. case RTL_OFFSET_POS_ASC: {
  41891. windowElement.scrollLeft = scrollLeft;
  41892. break;
  41893. }
  41894. default: {
  41895. const { clientWidth, scrollWidth } = windowElement;
  41896. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  41897. break;
  41898. }
  41899. }
  41900. } else {
  41901. windowElement.scrollLeft = Math.max(0, scrollLeft);
  41902. }
  41903. windowElement.scrollTop = Math.max(0, scrollTop);
  41904. }
  41905. };
  41906. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  41907. expose({
  41908. windowRef,
  41909. innerRef,
  41910. getItemStyleCache,
  41911. scrollTo,
  41912. scrollToItem,
  41913. states,
  41914. resetAfterColumnIndex,
  41915. resetAfterRowIndex,
  41916. resetAfter
  41917. });
  41918. const renderScrollbars = () => {
  41919. const {
  41920. scrollbarAlwaysOn,
  41921. scrollbarStartGap,
  41922. scrollbarEndGap,
  41923. totalColumn,
  41924. totalRow
  41925. } = props;
  41926. const width = unref(parsedWidth);
  41927. const height = unref(parsedHeight);
  41928. const estimatedWidth = unref(estimatedTotalWidth);
  41929. const estimatedHeight = unref(estimatedTotalHeight);
  41930. const { scrollLeft, scrollTop } = unref(states);
  41931. const horizontalScrollbar = h$1(ScrollBar, {
  41932. ref: hScrollbar,
  41933. alwaysOn: scrollbarAlwaysOn,
  41934. startGap: scrollbarStartGap,
  41935. endGap: scrollbarEndGap,
  41936. class: ns.e("horizontal"),
  41937. clientSize: width,
  41938. layout: "horizontal",
  41939. onScroll: onHorizontalScroll,
  41940. ratio: width * 100 / estimatedWidth,
  41941. scrollFrom: scrollLeft / (estimatedWidth - width),
  41942. total: totalRow,
  41943. visible: true
  41944. });
  41945. const verticalScrollbar = h$1(ScrollBar, {
  41946. ref: vScrollbar,
  41947. alwaysOn: scrollbarAlwaysOn,
  41948. startGap: scrollbarStartGap,
  41949. endGap: scrollbarEndGap,
  41950. class: ns.e("vertical"),
  41951. clientSize: height,
  41952. layout: "vertical",
  41953. onScroll: onVerticalScroll,
  41954. ratio: height * 100 / estimatedHeight,
  41955. scrollFrom: scrollTop / (estimatedHeight - height),
  41956. total: totalColumn,
  41957. visible: true
  41958. });
  41959. return {
  41960. horizontalScrollbar,
  41961. verticalScrollbar
  41962. };
  41963. };
  41964. const renderItems = () => {
  41965. var _a2;
  41966. const [columnStart, columnEnd] = unref(columnsToRender);
  41967. const [rowStart, rowEnd] = unref(rowsToRender);
  41968. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  41969. const children = [];
  41970. if (totalRow > 0 && totalColumn > 0) {
  41971. for (let row = rowStart; row <= rowEnd; row++) {
  41972. for (let column = columnStart; column <= columnEnd; column++) {
  41973. children.push((_a2 = slots.default) == null ? void 0 : _a2.call(slots, {
  41974. columnIndex: column,
  41975. data,
  41976. key: itemKey({ columnIndex: column, data, rowIndex: row }),
  41977. isScrolling: useIsScrolling ? unref(states).isScrolling : void 0,
  41978. style: getItemStyle(row, column),
  41979. rowIndex: row
  41980. }));
  41981. }
  41982. }
  41983. }
  41984. return children;
  41985. };
  41986. const renderInner = () => {
  41987. const Inner = resolveDynamicComponent(props.innerElement);
  41988. const children = renderItems();
  41989. return [
  41990. h$1(Inner, {
  41991. style: unref(innerStyle),
  41992. ref: innerRef
  41993. }, !isString$1(Inner) ? {
  41994. default: () => children
  41995. } : children)
  41996. ];
  41997. };
  41998. const renderWindow = () => {
  41999. const Container2 = resolveDynamicComponent(props.containerElement);
  42000. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  42001. const Inner = renderInner();
  42002. return h$1("div", {
  42003. key: 0,
  42004. class: ns.e("wrapper"),
  42005. role: props.role
  42006. }, [
  42007. h$1(Container2, {
  42008. class: props.className,
  42009. style: unref(windowStyle),
  42010. onScroll,
  42011. onWheel,
  42012. ref: windowRef
  42013. }, !isString$1(Container2) ? { default: () => Inner } : Inner),
  42014. horizontalScrollbar,
  42015. verticalScrollbar
  42016. ]);
  42017. };
  42018. return renderWindow;
  42019. }
  42020. });
  42021. };
  42022. const FixedSizeGrid = createGrid({
  42023. name: "ElFixedSizeGrid",
  42024. getColumnPosition: ({ columnWidth }, index2) => [
  42025. columnWidth,
  42026. index2 * columnWidth
  42027. ],
  42028. getRowPosition: ({ rowHeight }, index2) => [
  42029. rowHeight,
  42030. index2 * rowHeight
  42031. ],
  42032. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  42033. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  42034. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _2, scrollBarWidth2) => {
  42035. width = Number(width);
  42036. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  42037. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  42038. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth2 + columnWidth);
  42039. if (alignment === "smart") {
  42040. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  42041. alignment = AUTO_ALIGNMENT;
  42042. } else {
  42043. alignment = CENTERED_ALIGNMENT;
  42044. }
  42045. }
  42046. switch (alignment) {
  42047. case START_ALIGNMENT:
  42048. return maxOffset;
  42049. case END_ALIGNMENT:
  42050. return minOffset;
  42051. case CENTERED_ALIGNMENT: {
  42052. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  42053. if (middleOffset < Math.ceil(width / 2)) {
  42054. return 0;
  42055. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  42056. return lastColumnOffset;
  42057. } else {
  42058. return middleOffset;
  42059. }
  42060. }
  42061. case AUTO_ALIGNMENT:
  42062. default:
  42063. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  42064. return scrollLeft;
  42065. } else if (minOffset > maxOffset) {
  42066. return minOffset;
  42067. } else if (scrollLeft < minOffset) {
  42068. return minOffset;
  42069. } else {
  42070. return maxOffset;
  42071. }
  42072. }
  42073. },
  42074. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _2, scrollBarWidth2) => {
  42075. height = Number(height);
  42076. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  42077. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  42078. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth2 + rowHeight);
  42079. if (align === SMART_ALIGNMENT) {
  42080. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  42081. align = AUTO_ALIGNMENT;
  42082. } else {
  42083. align = CENTERED_ALIGNMENT;
  42084. }
  42085. }
  42086. switch (align) {
  42087. case START_ALIGNMENT:
  42088. return maxOffset;
  42089. case END_ALIGNMENT:
  42090. return minOffset;
  42091. case CENTERED_ALIGNMENT: {
  42092. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  42093. if (middleOffset < Math.ceil(height / 2)) {
  42094. return 0;
  42095. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  42096. return lastRowOffset;
  42097. } else {
  42098. return middleOffset;
  42099. }
  42100. }
  42101. case AUTO_ALIGNMENT:
  42102. default:
  42103. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  42104. return scrollTop;
  42105. } else if (minOffset > maxOffset) {
  42106. return minOffset;
  42107. } else if (scrollTop < minOffset) {
  42108. return minOffset;
  42109. } else {
  42110. return maxOffset;
  42111. }
  42112. }
  42113. },
  42114. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  42115. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  42116. const left2 = startIndex * columnWidth;
  42117. const visibleColumnsCount = Math.ceil((width + scrollLeft - left2) / columnWidth);
  42118. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  42119. },
  42120. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  42121. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  42122. const top = startIndex * rowHeight;
  42123. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  42124. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  42125. },
  42126. initCache: () => void 0,
  42127. clearCache: true,
  42128. validateProps: ({ columnWidth, rowHeight }) => {
  42129. }
  42130. });
  42131. const { max, min, floor } = Math;
  42132. const ACCESS_SIZER_KEY_MAP = {
  42133. column: "columnWidth",
  42134. row: "rowHeight"
  42135. };
  42136. const ACCESS_LAST_VISITED_KEY_MAP = {
  42137. column: "lastVisitedColumnIndex",
  42138. row: "lastVisitedRowIndex"
  42139. };
  42140. const getItemFromCache = (props, index2, gridCache, type2) => {
  42141. const [cachedItems, sizer, lastVisited] = [
  42142. gridCache[type2],
  42143. props[ACCESS_SIZER_KEY_MAP[type2]],
  42144. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type2]]
  42145. ];
  42146. if (index2 > lastVisited) {
  42147. let offset2 = 0;
  42148. if (lastVisited >= 0) {
  42149. const item = cachedItems[lastVisited];
  42150. offset2 = item.offset + item.size;
  42151. }
  42152. for (let i = lastVisited + 1; i <= index2; i++) {
  42153. const size2 = sizer(i);
  42154. cachedItems[i] = {
  42155. offset: offset2,
  42156. size: size2
  42157. };
  42158. offset2 += size2;
  42159. }
  42160. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type2]] = index2;
  42161. }
  42162. return cachedItems[index2];
  42163. };
  42164. const bs = (props, gridCache, low, high, offset2, type2) => {
  42165. while (low <= high) {
  42166. const mid = low + floor((high - low) / 2);
  42167. const currentOffset = getItemFromCache(props, mid, gridCache, type2).offset;
  42168. if (currentOffset === offset2) {
  42169. return mid;
  42170. } else if (currentOffset < offset2) {
  42171. low = mid + 1;
  42172. } else {
  42173. high = mid - 1;
  42174. }
  42175. }
  42176. return max(0, low - 1);
  42177. };
  42178. const es = (props, gridCache, idx, offset2, type2) => {
  42179. const total2 = type2 === "column" ? props.totalColumn : props.totalRow;
  42180. let exponent = 1;
  42181. while (idx < total2 && getItemFromCache(props, idx, gridCache, type2).offset < offset2) {
  42182. idx += exponent;
  42183. exponent *= 2;
  42184. }
  42185. return bs(props, gridCache, floor(idx / 2), min(idx, total2 - 1), offset2, type2);
  42186. };
  42187. const findItem = (props, gridCache, offset2, type2) => {
  42188. const [cache2, lastVisitedIndex] = [
  42189. gridCache[type2],
  42190. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type2]]
  42191. ];
  42192. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache2[lastVisitedIndex].offset : 0;
  42193. if (lastVisitedItemOffset >= offset2) {
  42194. return bs(props, gridCache, 0, lastVisitedIndex, offset2, type2);
  42195. }
  42196. return es(props, gridCache, max(0, lastVisitedIndex), offset2, type2);
  42197. };
  42198. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  42199. let sizeOfVisitedRows = 0;
  42200. if (lastVisitedRowIndex >= totalRow) {
  42201. lastVisitedRowIndex = totalRow - 1;
  42202. }
  42203. if (lastVisitedRowIndex >= 0) {
  42204. const item = row[lastVisitedRowIndex];
  42205. sizeOfVisitedRows = item.offset + item.size;
  42206. }
  42207. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  42208. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  42209. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  42210. };
  42211. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  42212. let sizeOfVisitedColumns = 0;
  42213. if (lastVisitedColumnIndex > totalColumn) {
  42214. lastVisitedColumnIndex = totalColumn - 1;
  42215. }
  42216. if (lastVisitedColumnIndex >= 0) {
  42217. const item = column[lastVisitedColumnIndex];
  42218. sizeOfVisitedColumns = item.offset + item.size;
  42219. }
  42220. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  42221. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  42222. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  42223. };
  42224. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  42225. column: getEstimatedTotalWidth,
  42226. row: getEstimatedTotalHeight
  42227. };
  42228. const getOffset$1 = (props, index2, alignment, scrollOffset, cache2, type2, scrollBarWidth2) => {
  42229. const [size2, estimatedSizeAssociates] = [
  42230. type2 === "row" ? props.height : props.width,
  42231. ACCESS_ESTIMATED_SIZE_KEY_MAP[type2]
  42232. ];
  42233. const item = getItemFromCache(props, index2, cache2, type2);
  42234. const estimatedSize = estimatedSizeAssociates(props, cache2);
  42235. const maxOffset = max(0, min(estimatedSize - size2, item.offset));
  42236. const minOffset = max(0, item.offset - size2 + scrollBarWidth2 + item.size);
  42237. if (alignment === SMART_ALIGNMENT) {
  42238. if (scrollOffset >= minOffset - size2 && scrollOffset <= maxOffset + size2) {
  42239. alignment = AUTO_ALIGNMENT;
  42240. } else {
  42241. alignment = CENTERED_ALIGNMENT;
  42242. }
  42243. }
  42244. switch (alignment) {
  42245. case START_ALIGNMENT: {
  42246. return maxOffset;
  42247. }
  42248. case END_ALIGNMENT: {
  42249. return minOffset;
  42250. }
  42251. case CENTERED_ALIGNMENT: {
  42252. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  42253. }
  42254. case AUTO_ALIGNMENT:
  42255. default: {
  42256. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  42257. return scrollOffset;
  42258. } else if (minOffset > maxOffset) {
  42259. return minOffset;
  42260. } else if (scrollOffset < minOffset) {
  42261. return minOffset;
  42262. } else {
  42263. return maxOffset;
  42264. }
  42265. }
  42266. }
  42267. };
  42268. const DynamicSizeGrid = createGrid({
  42269. name: "ElDynamicSizeGrid",
  42270. getColumnPosition: (props, idx, cache2) => {
  42271. const item = getItemFromCache(props, idx, cache2, "column");
  42272. return [item.size, item.offset];
  42273. },
  42274. getRowPosition: (props, idx, cache2) => {
  42275. const item = getItemFromCache(props, idx, cache2, "row");
  42276. return [item.size, item.offset];
  42277. },
  42278. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache2, scrollBarWidth2) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache2, "column", scrollBarWidth2),
  42279. getRowOffset: (props, rowIndex, alignment, scrollTop, cache2, scrollBarWidth2) => getOffset$1(props, rowIndex, alignment, scrollTop, cache2, "row", scrollBarWidth2),
  42280. getColumnStartIndexForOffset: (props, scrollLeft, cache2) => findItem(props, cache2, scrollLeft, "column"),
  42281. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache2) => {
  42282. const item = getItemFromCache(props, startIndex, cache2, "column");
  42283. const maxOffset = scrollLeft + props.width;
  42284. let offset2 = item.offset + item.size;
  42285. let stopIndex = startIndex;
  42286. while (stopIndex < props.totalColumn - 1 && offset2 < maxOffset) {
  42287. stopIndex++;
  42288. offset2 += getItemFromCache(props, startIndex, cache2, "column").size;
  42289. }
  42290. return stopIndex;
  42291. },
  42292. getEstimatedTotalHeight,
  42293. getEstimatedTotalWidth,
  42294. getRowStartIndexForOffset: (props, scrollTop, cache2) => findItem(props, cache2, scrollTop, "row"),
  42295. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache2) => {
  42296. const { totalRow, height } = props;
  42297. const item = getItemFromCache(props, startIndex, cache2, "row");
  42298. const maxOffset = scrollTop + height;
  42299. let offset2 = item.size + item.offset;
  42300. let stopIndex = startIndex;
  42301. while (stopIndex < totalRow - 1 && offset2 < maxOffset) {
  42302. stopIndex++;
  42303. offset2 += getItemFromCache(props, stopIndex, cache2, "row").size;
  42304. }
  42305. return stopIndex;
  42306. },
  42307. injectToInstance: (instance, cache2) => {
  42308. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  42309. var _a2, _b;
  42310. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  42311. if (isNumber(columnIndex)) {
  42312. cache2.value.lastVisitedColumnIndex = Math.min(cache2.value.lastVisitedColumnIndex, columnIndex - 1);
  42313. }
  42314. if (isNumber(rowIndex)) {
  42315. cache2.value.lastVisitedRowIndex = Math.min(cache2.value.lastVisitedRowIndex, rowIndex - 1);
  42316. }
  42317. (_a2 = instance.exposed) == null ? void 0 : _a2.getItemStyleCache.value(-1, null, null);
  42318. if (forceUpdate)
  42319. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  42320. };
  42321. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  42322. resetAfter({
  42323. columnIndex
  42324. }, forceUpdate);
  42325. };
  42326. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  42327. resetAfter({
  42328. rowIndex
  42329. }, forceUpdate);
  42330. };
  42331. Object.assign(instance.proxy, {
  42332. resetAfterColumnIndex,
  42333. resetAfterRowIndex,
  42334. resetAfter
  42335. });
  42336. },
  42337. initCache: ({
  42338. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  42339. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  42340. }) => {
  42341. const cache2 = {
  42342. column: {},
  42343. estimatedColumnWidth,
  42344. estimatedRowHeight,
  42345. lastVisitedColumnIndex: -1,
  42346. lastVisitedRowIndex: -1,
  42347. row: {}
  42348. };
  42349. return cache2;
  42350. },
  42351. clearCache: false,
  42352. validateProps: ({ columnWidth, rowHeight }) => {
  42353. }
  42354. });
  42355. const _sfc_main$I = /* @__PURE__ */ defineComponent({
  42356. props: {
  42357. item: {
  42358. type: Object,
  42359. required: true
  42360. },
  42361. style: Object,
  42362. height: Number
  42363. },
  42364. setup() {
  42365. const ns = useNamespace("select");
  42366. return {
  42367. ns
  42368. };
  42369. }
  42370. });
  42371. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  42372. return _ctx.item.isTitle ? (openBlock(), createElementBlock("div", {
  42373. key: 0,
  42374. class: normalizeClass(_ctx.ns.be("group", "title")),
  42375. style: normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }])
  42376. }, toDisplayString(_ctx.item.label), 7)) : (openBlock(), createElementBlock("div", {
  42377. key: 1,
  42378. class: normalizeClass(_ctx.ns.be("group", "split")),
  42379. style: normalizeStyle(_ctx.style)
  42380. }, [
  42381. createBaseVNode("span", {
  42382. class: normalizeClass(_ctx.ns.be("group", "split-dash")),
  42383. style: normalizeStyle({ top: `${_ctx.height / 2}px` })
  42384. }, null, 6)
  42385. ], 6));
  42386. }
  42387. var GroupItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/group-item.vue"]]);
  42388. function useOption(props, { emit: emit2 }) {
  42389. return {
  42390. hoverItem: () => {
  42391. if (!props.disabled) {
  42392. emit2("hover", props.index);
  42393. }
  42394. },
  42395. selectOptionClick: () => {
  42396. if (!props.disabled) {
  42397. emit2("select", props.item, props.index);
  42398. }
  42399. }
  42400. };
  42401. }
  42402. const defaultProps$3 = {
  42403. label: "label",
  42404. value: "value",
  42405. disabled: "disabled",
  42406. options: "options"
  42407. };
  42408. function useProps(props) {
  42409. const aliasProps = computed(() => ({ ...defaultProps$3, ...props.props }));
  42410. const getLabel = (option) => get(option, aliasProps.value.label);
  42411. const getValue2 = (option) => get(option, aliasProps.value.value);
  42412. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  42413. const getOptions = (option) => get(option, aliasProps.value.options);
  42414. return {
  42415. aliasProps,
  42416. getLabel,
  42417. getValue: getValue2,
  42418. getDisabled,
  42419. getOptions
  42420. };
  42421. }
  42422. const SelectProps = buildProps({
  42423. allowCreate: Boolean,
  42424. autocomplete: {
  42425. type: definePropType(String),
  42426. default: "none"
  42427. },
  42428. automaticDropdown: Boolean,
  42429. clearable: Boolean,
  42430. clearIcon: {
  42431. type: iconPropType,
  42432. default: circle_close_default
  42433. },
  42434. effect: {
  42435. type: definePropType(String),
  42436. default: "light"
  42437. },
  42438. collapseTags: Boolean,
  42439. collapseTagsTooltip: {
  42440. type: Boolean,
  42441. default: false
  42442. },
  42443. maxCollapseTags: {
  42444. type: Number,
  42445. default: 1
  42446. },
  42447. defaultFirstOption: Boolean,
  42448. disabled: Boolean,
  42449. estimatedOptionHeight: {
  42450. type: Number,
  42451. default: void 0
  42452. },
  42453. filterable: Boolean,
  42454. filterMethod: Function,
  42455. height: {
  42456. type: Number,
  42457. default: 170
  42458. },
  42459. itemHeight: {
  42460. type: Number,
  42461. default: 34
  42462. },
  42463. id: String,
  42464. loading: Boolean,
  42465. loadingText: String,
  42466. label: String,
  42467. modelValue: {
  42468. type: definePropType([Array, String, Number, Boolean, Object])
  42469. },
  42470. multiple: Boolean,
  42471. multipleLimit: {
  42472. type: Number,
  42473. default: 0
  42474. },
  42475. name: String,
  42476. noDataText: String,
  42477. noMatchText: String,
  42478. remoteMethod: Function,
  42479. reserveKeyword: {
  42480. type: Boolean,
  42481. default: true
  42482. },
  42483. options: {
  42484. type: definePropType(Array),
  42485. required: true
  42486. },
  42487. placeholder: {
  42488. type: String
  42489. },
  42490. teleported: useTooltipContentProps.teleported,
  42491. persistent: {
  42492. type: Boolean,
  42493. default: true
  42494. },
  42495. popperClass: {
  42496. type: String,
  42497. default: ""
  42498. },
  42499. popperOptions: {
  42500. type: definePropType(Object),
  42501. default: () => ({})
  42502. },
  42503. remote: Boolean,
  42504. size: useSizeProp,
  42505. props: {
  42506. type: definePropType(Object),
  42507. default: () => defaultProps$3
  42508. },
  42509. valueKey: {
  42510. type: String,
  42511. default: "value"
  42512. },
  42513. scrollbarAlwaysOn: {
  42514. type: Boolean,
  42515. default: false
  42516. },
  42517. validateEvent: {
  42518. type: Boolean,
  42519. default: true
  42520. },
  42521. placement: {
  42522. type: definePropType(String),
  42523. values: Ee,
  42524. default: "bottom-start"
  42525. }
  42526. });
  42527. const OptionProps = buildProps({
  42528. data: Array,
  42529. disabled: Boolean,
  42530. hovering: Boolean,
  42531. item: {
  42532. type: definePropType(Object),
  42533. required: true
  42534. },
  42535. index: Number,
  42536. style: Object,
  42537. selected: Boolean,
  42538. created: Boolean
  42539. });
  42540. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  42541. const _sfc_main$H = /* @__PURE__ */ defineComponent({
  42542. props: OptionProps,
  42543. emits: ["select", "hover"],
  42544. setup(props, { emit: emit2 }) {
  42545. const select = inject(selectV2InjectionKey);
  42546. const ns = useNamespace("select");
  42547. const { hoverItem, selectOptionClick } = useOption(props, { emit: emit2 });
  42548. const { getLabel } = useProps(select.props);
  42549. return {
  42550. ns,
  42551. hoverItem,
  42552. selectOptionClick,
  42553. getLabel
  42554. };
  42555. }
  42556. });
  42557. const _hoisted_1$j = ["aria-selected"];
  42558. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  42559. return openBlock(), createElementBlock("li", {
  42560. "aria-selected": _ctx.selected,
  42561. style: normalizeStyle(_ctx.style),
  42562. class: normalizeClass([
  42563. _ctx.ns.be("dropdown", "option-item"),
  42564. _ctx.ns.is("selected", _ctx.selected),
  42565. _ctx.ns.is("disabled", _ctx.disabled),
  42566. _ctx.ns.is("created", _ctx.created),
  42567. { hover: _ctx.hovering }
  42568. ]),
  42569. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  42570. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  42571. }, [
  42572. renderSlot(_ctx.$slots, "default", {
  42573. item: _ctx.item,
  42574. index: _ctx.index,
  42575. disabled: _ctx.disabled
  42576. }, () => [
  42577. createBaseVNode("span", null, toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  42578. ])
  42579. ], 46, _hoisted_1$j);
  42580. }
  42581. var OptionItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/option-item.vue"]]);
  42582. var ElSelectMenu = /* @__PURE__ */ defineComponent({
  42583. name: "ElSelectDropdown",
  42584. props: {
  42585. data: {
  42586. type: Array,
  42587. required: true
  42588. },
  42589. hoveringIndex: Number,
  42590. width: Number
  42591. },
  42592. setup(props, {
  42593. slots,
  42594. expose
  42595. }) {
  42596. const select = inject(selectV2InjectionKey);
  42597. const ns = useNamespace("select");
  42598. const {
  42599. getLabel,
  42600. getValue: getValue2,
  42601. getDisabled
  42602. } = useProps(select.props);
  42603. const cachedHeights = ref([]);
  42604. const listRef = ref();
  42605. const size2 = computed(() => props.data.length);
  42606. watch(() => size2.value, () => {
  42607. var _a2, _b;
  42608. (_b = (_a2 = select.popper.value).updatePopper) == null ? void 0 : _b.call(_a2);
  42609. });
  42610. const isSized = computed(() => isUndefined(select.props.estimatedOptionHeight));
  42611. const listProps = computed(() => {
  42612. if (isSized.value) {
  42613. return {
  42614. itemSize: select.props.itemHeight
  42615. };
  42616. }
  42617. return {
  42618. estimatedSize: select.props.estimatedOptionHeight,
  42619. itemSize: (idx) => cachedHeights.value[idx]
  42620. };
  42621. });
  42622. const contains = (arr = [], target) => {
  42623. const {
  42624. props: {
  42625. valueKey
  42626. }
  42627. } = select;
  42628. if (!isObject$1(target)) {
  42629. return arr.includes(target);
  42630. }
  42631. return arr && arr.some((item) => {
  42632. return toRaw(get(item, valueKey)) === get(target, valueKey);
  42633. });
  42634. };
  42635. const isEqual2 = (selected, target) => {
  42636. if (!isObject$1(target)) {
  42637. return selected === target;
  42638. } else {
  42639. const {
  42640. valueKey
  42641. } = select.props;
  42642. return get(selected, valueKey) === get(target, valueKey);
  42643. }
  42644. };
  42645. const isItemSelected = (modelValue, target) => {
  42646. if (select.props.multiple) {
  42647. return contains(modelValue, getValue2(target));
  42648. }
  42649. return isEqual2(modelValue, getValue2(target));
  42650. };
  42651. const isItemDisabled = (modelValue, selected) => {
  42652. const {
  42653. disabled,
  42654. multiple,
  42655. multipleLimit
  42656. } = select.props;
  42657. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  42658. };
  42659. const isItemHovering = (target) => props.hoveringIndex === target;
  42660. const scrollToItem = (index2) => {
  42661. const list = listRef.value;
  42662. if (list) {
  42663. list.scrollToItem(index2);
  42664. }
  42665. };
  42666. const resetScrollTop = () => {
  42667. const list = listRef.value;
  42668. if (list) {
  42669. list.resetScrollTop();
  42670. }
  42671. };
  42672. expose({
  42673. listRef,
  42674. isSized,
  42675. isItemDisabled,
  42676. isItemHovering,
  42677. isItemSelected,
  42678. scrollToItem,
  42679. resetScrollTop
  42680. });
  42681. const Item = (itemProps) => {
  42682. const {
  42683. index: index2,
  42684. data,
  42685. style
  42686. } = itemProps;
  42687. const sized = unref(isSized);
  42688. const {
  42689. itemSize: itemSize2,
  42690. estimatedSize
  42691. } = unref(listProps);
  42692. const {
  42693. modelValue
  42694. } = select.props;
  42695. const {
  42696. onSelect,
  42697. onHover
  42698. } = select;
  42699. const item = data[index2];
  42700. if (item.type === "Group") {
  42701. return createVNode(GroupItem, {
  42702. "item": item,
  42703. "style": style,
  42704. "height": sized ? itemSize2 : estimatedSize
  42705. }, null);
  42706. }
  42707. const isSelected = isItemSelected(modelValue, item);
  42708. const isDisabled = isItemDisabled(modelValue, isSelected);
  42709. const isHovering = isItemHovering(index2);
  42710. return createVNode(OptionItem, mergeProps(itemProps, {
  42711. "selected": isSelected,
  42712. "disabled": getDisabled(item) || isDisabled,
  42713. "created": !!item.created,
  42714. "hovering": isHovering,
  42715. "item": item,
  42716. "onSelect": onSelect,
  42717. "onHover": onHover
  42718. }), {
  42719. default: (props2) => {
  42720. var _a2;
  42721. return ((_a2 = slots.default) == null ? void 0 : _a2.call(slots, props2)) || createVNode("span", null, [getLabel(item)]);
  42722. }
  42723. });
  42724. };
  42725. const {
  42726. onKeyboardNavigate,
  42727. onKeyboardSelect
  42728. } = select;
  42729. const onForward = () => {
  42730. onKeyboardNavigate("forward");
  42731. };
  42732. const onBackward = () => {
  42733. onKeyboardNavigate("backward");
  42734. };
  42735. const onEscOrTab = () => {
  42736. select.expanded = false;
  42737. };
  42738. const onKeydown = (e) => {
  42739. const {
  42740. code
  42741. } = e;
  42742. const {
  42743. tab,
  42744. esc,
  42745. down: down2,
  42746. up: up2,
  42747. enter
  42748. } = EVENT_CODE;
  42749. if (code !== tab) {
  42750. e.preventDefault();
  42751. e.stopPropagation();
  42752. }
  42753. switch (code) {
  42754. case tab:
  42755. case esc: {
  42756. onEscOrTab();
  42757. break;
  42758. }
  42759. case down2: {
  42760. onForward();
  42761. break;
  42762. }
  42763. case up2: {
  42764. onBackward();
  42765. break;
  42766. }
  42767. case enter: {
  42768. onKeyboardSelect();
  42769. break;
  42770. }
  42771. }
  42772. };
  42773. return () => {
  42774. var _a2;
  42775. const {
  42776. data,
  42777. width
  42778. } = props;
  42779. const {
  42780. height,
  42781. multiple,
  42782. scrollbarAlwaysOn
  42783. } = select.props;
  42784. if (data.length === 0) {
  42785. return createVNode("div", {
  42786. "class": ns.b("dropdown"),
  42787. "style": {
  42788. width: `${width}px`
  42789. }
  42790. }, [(_a2 = slots.empty) == null ? void 0 : _a2.call(slots)]);
  42791. }
  42792. const List = unref(isSized) ? FixedSizeList : DynamicSizeList;
  42793. return createVNode("div", {
  42794. "class": [ns.b("dropdown"), ns.is("multiple", multiple)]
  42795. }, [createVNode(List, mergeProps({
  42796. "ref": listRef
  42797. }, unref(listProps), {
  42798. "className": ns.be("dropdown", "list"),
  42799. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  42800. "data": data,
  42801. "height": height,
  42802. "width": width,
  42803. "total": data.length,
  42804. "onKeydown": onKeydown
  42805. }), {
  42806. default: (props2) => createVNode(Item, props2, null)
  42807. })]);
  42808. };
  42809. }
  42810. });
  42811. function useAllowCreate(props, states) {
  42812. const { aliasProps, getLabel, getValue: getValue2 } = useProps(props);
  42813. const createOptionCount = ref(0);
  42814. const cachedSelectedOption = ref(null);
  42815. const enableAllowCreateMode = computed(() => {
  42816. return props.allowCreate && props.filterable;
  42817. });
  42818. function hasExistingOption(query) {
  42819. const hasValue = (option) => getValue2(option) === query;
  42820. return props.options && props.options.some(hasValue) || states.createdOptions.some(hasValue);
  42821. }
  42822. function selectNewOption(option) {
  42823. if (!enableAllowCreateMode.value) {
  42824. return;
  42825. }
  42826. if (props.multiple && option.created) {
  42827. createOptionCount.value++;
  42828. } else {
  42829. cachedSelectedOption.value = option;
  42830. }
  42831. }
  42832. function createNewOption(query) {
  42833. if (enableAllowCreateMode.value) {
  42834. if (query && query.length > 0 && !hasExistingOption(query)) {
  42835. const newOption = {
  42836. [aliasProps.value.value]: query,
  42837. [aliasProps.value.label]: query,
  42838. created: true,
  42839. [aliasProps.value.disabled]: false
  42840. };
  42841. if (states.createdOptions.length >= createOptionCount.value) {
  42842. states.createdOptions[createOptionCount.value] = newOption;
  42843. } else {
  42844. states.createdOptions.push(newOption);
  42845. }
  42846. } else {
  42847. if (props.multiple) {
  42848. states.createdOptions.length = createOptionCount.value;
  42849. } else {
  42850. const selectedOption = cachedSelectedOption.value;
  42851. states.createdOptions.length = 0;
  42852. if (selectedOption && selectedOption.created) {
  42853. states.createdOptions.push(selectedOption);
  42854. }
  42855. }
  42856. }
  42857. }
  42858. }
  42859. function removeNewOption(option) {
  42860. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  42861. return;
  42862. }
  42863. const idx = states.createdOptions.findIndex((it2) => getValue2(it2) === getValue2(option));
  42864. if (~idx) {
  42865. states.createdOptions.splice(idx, 1);
  42866. createOptionCount.value--;
  42867. }
  42868. }
  42869. function clearAllNewOption() {
  42870. if (enableAllowCreateMode.value) {
  42871. states.createdOptions.length = 0;
  42872. createOptionCount.value = 0;
  42873. }
  42874. }
  42875. return {
  42876. createNewOption,
  42877. removeNewOption,
  42878. selectNewOption,
  42879. clearAllNewOption
  42880. };
  42881. }
  42882. function useInput(handleInput) {
  42883. const isComposing = ref(false);
  42884. const handleCompositionStart = () => {
  42885. isComposing.value = true;
  42886. };
  42887. const handleCompositionUpdate = (event) => {
  42888. const text = event.target.value;
  42889. const lastCharacter = text[text.length - 1] || "";
  42890. isComposing.value = !isKorean(lastCharacter);
  42891. };
  42892. const handleCompositionEnd = (event) => {
  42893. if (isComposing.value) {
  42894. isComposing.value = false;
  42895. if (isFunction$2(handleInput)) {
  42896. handleInput(event);
  42897. }
  42898. }
  42899. };
  42900. return {
  42901. handleCompositionStart,
  42902. handleCompositionUpdate,
  42903. handleCompositionEnd
  42904. };
  42905. }
  42906. const DEFAULT_INPUT_PLACEHOLDER = "";
  42907. const MINIMUM_INPUT_WIDTH = 11;
  42908. const TAG_BASE_WIDTH = {
  42909. larget: 51,
  42910. default: 42,
  42911. small: 33
  42912. };
  42913. const useSelect$1 = (props, emit2) => {
  42914. const { t } = useLocale();
  42915. const nsSelectV2 = useNamespace("select-v2");
  42916. const nsInput = useNamespace("input");
  42917. const { form: elForm, formItem: elFormItem } = useFormItem();
  42918. const { getLabel, getValue: getValue2, getDisabled, getOptions } = useProps(props);
  42919. const states = reactive({
  42920. inputValue: DEFAULT_INPUT_PLACEHOLDER,
  42921. displayInputValue: DEFAULT_INPUT_PLACEHOLDER,
  42922. calculatedWidth: 0,
  42923. cachedPlaceholder: "",
  42924. cachedOptions: [],
  42925. createdOptions: [],
  42926. createdLabel: "",
  42927. createdSelected: false,
  42928. currentPlaceholder: "",
  42929. hoveringIndex: -1,
  42930. comboBoxHovering: false,
  42931. isOnComposition: false,
  42932. isSilentBlur: false,
  42933. isComposing: false,
  42934. inputLength: 20,
  42935. selectWidth: 200,
  42936. initialInputHeight: 0,
  42937. previousQuery: null,
  42938. previousValue: void 0,
  42939. query: "",
  42940. selectedLabel: "",
  42941. softFocus: false,
  42942. tagInMultiLine: false
  42943. });
  42944. const selectedIndex = ref(-1);
  42945. const popperSize = ref(-1);
  42946. const controlRef = ref(null);
  42947. const inputRef = ref(null);
  42948. const menuRef = ref(null);
  42949. const popper = ref(null);
  42950. const selectRef = ref(null);
  42951. const selectionRef = ref(null);
  42952. const calculatorRef = ref(null);
  42953. const expanded = ref(false);
  42954. const selectDisabled = computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  42955. const popupHeight = computed(() => {
  42956. const totalHeight = filteredOptions.value.length * 34;
  42957. return totalHeight > props.height ? props.height : totalHeight;
  42958. });
  42959. const hasModelValue = computed(() => {
  42960. return !isNil(props.modelValue);
  42961. });
  42962. const showClearBtn = computed(() => {
  42963. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : hasModelValue.value;
  42964. const criteria = props.clearable && !selectDisabled.value && states.comboBoxHovering && hasValue;
  42965. return criteria;
  42966. });
  42967. const iconComponent = computed(() => props.remote && props.filterable ? "" : arrow_up_default);
  42968. const iconReverse = computed(() => iconComponent.value && nsSelectV2.is("reverse", expanded.value));
  42969. const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  42970. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  42971. const debounce$1 = computed(() => props.remote ? 300 : 0);
  42972. const emptyText = computed(() => {
  42973. const options = filteredOptions.value;
  42974. if (props.loading) {
  42975. return props.loadingText || t("el.select.loading");
  42976. } else {
  42977. if (props.remote && states.inputValue === "" && options.length === 0)
  42978. return false;
  42979. if (props.filterable && states.inputValue && options.length > 0) {
  42980. return props.noMatchText || t("el.select.noMatch");
  42981. }
  42982. if (options.length === 0) {
  42983. return props.noDataText || t("el.select.noData");
  42984. }
  42985. }
  42986. return null;
  42987. });
  42988. const filteredOptions = computed(() => {
  42989. const isValidOption = (o2) => {
  42990. const query = states.inputValue;
  42991. const regexp2 = new RegExp(escapeStringRegexp(query), "i");
  42992. const containsQueryString = query ? regexp2.test(getLabel(o2) || "") : true;
  42993. return containsQueryString;
  42994. };
  42995. if (props.loading) {
  42996. return [];
  42997. }
  42998. return [...props.options, ...states.createdOptions].reduce((all, item) => {
  42999. const options = getOptions(item);
  43000. if (isArray$3(options)) {
  43001. const filtered = options.filter(isValidOption);
  43002. if (filtered.length > 0) {
  43003. all.push({
  43004. label: getLabel(item),
  43005. isTitle: true,
  43006. type: "Group"
  43007. }, ...filtered, { type: "Group" });
  43008. }
  43009. } else if (props.remote || isValidOption(item)) {
  43010. all.push(item);
  43011. }
  43012. return all;
  43013. }, []);
  43014. });
  43015. const filteredOptionsValueMap = computed(() => {
  43016. const valueMap = /* @__PURE__ */ new Map();
  43017. filteredOptions.value.forEach((option, index2) => {
  43018. valueMap.set(getValueKey(getValue2(option)), { option, index: index2 });
  43019. });
  43020. return valueMap;
  43021. });
  43022. const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  43023. const selectSize = useFormSize();
  43024. const collapseTagSize = computed(() => selectSize.value === "small" ? "small" : "default");
  43025. const tagMaxWidth = computed(() => {
  43026. const select = selectionRef.value;
  43027. const size2 = collapseTagSize.value || "default";
  43028. const paddingLeft = select ? Number.parseInt(getComputedStyle(select).paddingLeft) : 0;
  43029. const paddingRight = select ? Number.parseInt(getComputedStyle(select).paddingRight) : 0;
  43030. return states.selectWidth - paddingRight - paddingLeft - TAG_BASE_WIDTH[size2];
  43031. });
  43032. const calculatePopperSize = () => {
  43033. var _a2;
  43034. popperSize.value = ((_a2 = selectRef.value) == null ? void 0 : _a2.offsetWidth) || 200;
  43035. };
  43036. const inputWrapperStyle = computed(() => {
  43037. return {
  43038. width: `${states.calculatedWidth === 0 ? MINIMUM_INPUT_WIDTH : Math.ceil(states.calculatedWidth) + MINIMUM_INPUT_WIDTH}px`
  43039. };
  43040. });
  43041. const shouldShowPlaceholder = computed(() => {
  43042. if (isArray$3(props.modelValue)) {
  43043. return props.modelValue.length === 0 && !states.displayInputValue;
  43044. }
  43045. return props.filterable ? states.displayInputValue.length === 0 : true;
  43046. });
  43047. const currentPlaceholder = computed(() => {
  43048. const _placeholder = props.placeholder || t("el.select.placeholder");
  43049. return props.multiple || isNil(props.modelValue) ? _placeholder : states.selectedLabel;
  43050. });
  43051. const popperRef = computed(() => {
  43052. var _a2, _b;
  43053. return (_b = (_a2 = popper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  43054. });
  43055. const indexRef = computed(() => {
  43056. if (props.multiple) {
  43057. const len = props.modelValue.length;
  43058. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  43059. const { index: index2 } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  43060. return index2;
  43061. }
  43062. } else {
  43063. if (props.modelValue && filteredOptionsValueMap.value.has(props.modelValue)) {
  43064. const { index: index2 } = filteredOptionsValueMap.value.get(props.modelValue);
  43065. return index2;
  43066. }
  43067. }
  43068. return -1;
  43069. });
  43070. const dropdownMenuVisible = computed({
  43071. get() {
  43072. return expanded.value && emptyText.value !== false;
  43073. },
  43074. set(val) {
  43075. expanded.value = val;
  43076. }
  43077. });
  43078. const showTagList = computed(() => states.cachedOptions.slice(0, props.maxCollapseTags));
  43079. const collapseTagList = computed(() => states.cachedOptions.slice(props.maxCollapseTags));
  43080. const {
  43081. createNewOption,
  43082. removeNewOption,
  43083. selectNewOption,
  43084. clearAllNewOption
  43085. } = useAllowCreate(props, states);
  43086. const {
  43087. handleCompositionStart,
  43088. handleCompositionUpdate,
  43089. handleCompositionEnd
  43090. } = useInput((e) => onInput(e));
  43091. const focusAndUpdatePopup = () => {
  43092. var _a2, _b, _c;
  43093. (_b = (_a2 = inputRef.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  43094. (_c = popper.value) == null ? void 0 : _c.updatePopper();
  43095. };
  43096. const toggleMenu = () => {
  43097. if (props.automaticDropdown)
  43098. return;
  43099. if (!selectDisabled.value) {
  43100. if (states.isComposing)
  43101. states.softFocus = true;
  43102. return nextTick(() => {
  43103. var _a2, _b;
  43104. expanded.value = !expanded.value;
  43105. (_b = (_a2 = inputRef.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  43106. });
  43107. }
  43108. };
  43109. const onInputChange = () => {
  43110. if (props.filterable && states.inputValue !== states.selectedLabel) {
  43111. states.query = states.selectedLabel;
  43112. }
  43113. handleQueryChange(states.inputValue);
  43114. return nextTick(() => {
  43115. createNewOption(states.inputValue);
  43116. });
  43117. };
  43118. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  43119. const handleQueryChange = (val) => {
  43120. if (states.previousQuery === val) {
  43121. return;
  43122. }
  43123. states.previousQuery = val;
  43124. if (props.filterable && isFunction$2(props.filterMethod)) {
  43125. props.filterMethod(val);
  43126. } else if (props.filterable && props.remote && isFunction$2(props.remoteMethod)) {
  43127. props.remoteMethod(val);
  43128. }
  43129. };
  43130. const emitChange = (val) => {
  43131. if (!isEqual$1(props.modelValue, val)) {
  43132. emit2(CHANGE_EVENT, val);
  43133. }
  43134. };
  43135. const update = (val) => {
  43136. emit2(UPDATE_MODEL_EVENT, val);
  43137. emitChange(val);
  43138. states.previousValue = String(val);
  43139. };
  43140. const getValueIndex = (arr = [], value) => {
  43141. if (!isObject$1(value)) {
  43142. return arr.indexOf(value);
  43143. }
  43144. const valueKey = props.valueKey;
  43145. let index2 = -1;
  43146. arr.some((item, i) => {
  43147. if (get(item, valueKey) === get(value, valueKey)) {
  43148. index2 = i;
  43149. return true;
  43150. }
  43151. return false;
  43152. });
  43153. return index2;
  43154. };
  43155. const getValueKey = (item) => {
  43156. return isObject$1(item) ? get(item, props.valueKey) : item;
  43157. };
  43158. const resetInputHeight = () => {
  43159. return nextTick(() => {
  43160. var _a2, _b;
  43161. if (!inputRef.value)
  43162. return;
  43163. const selection = selectionRef.value;
  43164. selectRef.value.height = selection.offsetHeight;
  43165. if (expanded.value && emptyText.value !== false) {
  43166. (_b = (_a2 = popper.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  43167. }
  43168. });
  43169. };
  43170. const handleResize = () => {
  43171. var _a2, _b;
  43172. resetInputWidth();
  43173. calculatePopperSize();
  43174. (_b = (_a2 = popper.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  43175. if (props.multiple) {
  43176. return resetInputHeight();
  43177. }
  43178. };
  43179. const resetInputWidth = () => {
  43180. const select = selectionRef.value;
  43181. if (select) {
  43182. states.selectWidth = select.getBoundingClientRect().width;
  43183. }
  43184. };
  43185. const onSelect = (option, idx, byClick = true) => {
  43186. var _a2, _b;
  43187. if (props.multiple) {
  43188. let selectedOptions = props.modelValue.slice();
  43189. const index2 = getValueIndex(selectedOptions, getValue2(option));
  43190. if (index2 > -1) {
  43191. selectedOptions = [
  43192. ...selectedOptions.slice(0, index2),
  43193. ...selectedOptions.slice(index2 + 1)
  43194. ];
  43195. states.cachedOptions.splice(index2, 1);
  43196. removeNewOption(option);
  43197. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  43198. selectedOptions = [...selectedOptions, getValue2(option)];
  43199. states.cachedOptions.push(option);
  43200. selectNewOption(option);
  43201. updateHoveringIndex(idx);
  43202. }
  43203. update(selectedOptions);
  43204. if (option.created) {
  43205. states.query = "";
  43206. handleQueryChange("");
  43207. states.inputLength = 20;
  43208. }
  43209. if (props.filterable && !props.reserveKeyword) {
  43210. (_b = (_a2 = inputRef.value).focus) == null ? void 0 : _b.call(_a2);
  43211. onUpdateInputValue("");
  43212. }
  43213. if (props.filterable) {
  43214. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  43215. }
  43216. resetInputHeight();
  43217. setSoftFocus();
  43218. } else {
  43219. selectedIndex.value = idx;
  43220. states.selectedLabel = getLabel(option);
  43221. update(getValue2(option));
  43222. expanded.value = false;
  43223. states.isComposing = false;
  43224. states.isSilentBlur = byClick;
  43225. selectNewOption(option);
  43226. if (!option.created) {
  43227. clearAllNewOption();
  43228. }
  43229. updateHoveringIndex(idx);
  43230. }
  43231. };
  43232. const deleteTag = (event, option) => {
  43233. let selectedOptions = props.modelValue.slice();
  43234. const index2 = getValueIndex(selectedOptions, getValue2(option));
  43235. if (index2 > -1 && !selectDisabled.value) {
  43236. selectedOptions = [
  43237. ...props.modelValue.slice(0, index2),
  43238. ...props.modelValue.slice(index2 + 1)
  43239. ];
  43240. states.cachedOptions.splice(index2, 1);
  43241. update(selectedOptions);
  43242. emit2("remove-tag", getValue2(option));
  43243. states.softFocus = true;
  43244. removeNewOption(option);
  43245. return nextTick(focusAndUpdatePopup);
  43246. }
  43247. event.stopPropagation();
  43248. };
  43249. const handleFocus = (event) => {
  43250. const focused = states.isComposing;
  43251. states.isComposing = true;
  43252. if (!states.softFocus) {
  43253. if (!focused)
  43254. emit2("focus", event);
  43255. } else {
  43256. states.softFocus = false;
  43257. }
  43258. };
  43259. const handleBlur = (event) => {
  43260. states.softFocus = false;
  43261. return nextTick(() => {
  43262. var _a2, _b;
  43263. (_b = (_a2 = inputRef.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
  43264. if (calculatorRef.value) {
  43265. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  43266. }
  43267. if (states.isSilentBlur) {
  43268. states.isSilentBlur = false;
  43269. } else {
  43270. if (states.isComposing) {
  43271. emit2("blur", event);
  43272. }
  43273. }
  43274. states.isComposing = false;
  43275. });
  43276. };
  43277. const handleEsc = () => {
  43278. if (states.displayInputValue.length > 0) {
  43279. onUpdateInputValue("");
  43280. } else {
  43281. expanded.value = false;
  43282. }
  43283. };
  43284. const handleDel = (e) => {
  43285. if (states.displayInputValue.length === 0) {
  43286. e.preventDefault();
  43287. const selected = props.modelValue.slice();
  43288. selected.pop();
  43289. removeNewOption(states.cachedOptions.pop());
  43290. update(selected);
  43291. }
  43292. };
  43293. const handleClear = () => {
  43294. let emptyValue;
  43295. if (isArray$3(props.modelValue)) {
  43296. emptyValue = [];
  43297. } else {
  43298. emptyValue = void 0;
  43299. }
  43300. states.softFocus = true;
  43301. if (props.multiple) {
  43302. states.cachedOptions = [];
  43303. } else {
  43304. states.selectedLabel = "";
  43305. }
  43306. expanded.value = false;
  43307. update(emptyValue);
  43308. emit2("clear");
  43309. clearAllNewOption();
  43310. return nextTick(focusAndUpdatePopup);
  43311. };
  43312. const onUpdateInputValue = (val) => {
  43313. states.displayInputValue = val;
  43314. states.inputValue = val;
  43315. };
  43316. const onKeyboardNavigate = (direction2, hoveringIndex = void 0) => {
  43317. const options = filteredOptions.value;
  43318. if (!["forward", "backward"].includes(direction2) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value) {
  43319. return;
  43320. }
  43321. if (!expanded.value) {
  43322. return toggleMenu();
  43323. }
  43324. if (hoveringIndex === void 0) {
  43325. hoveringIndex = states.hoveringIndex;
  43326. }
  43327. let newIndex = -1;
  43328. if (direction2 === "forward") {
  43329. newIndex = hoveringIndex + 1;
  43330. if (newIndex >= options.length) {
  43331. newIndex = 0;
  43332. }
  43333. } else if (direction2 === "backward") {
  43334. newIndex = hoveringIndex - 1;
  43335. if (newIndex < 0 || newIndex >= options.length) {
  43336. newIndex = options.length - 1;
  43337. }
  43338. }
  43339. const option = options[newIndex];
  43340. if (getDisabled(option) || option.type === "Group") {
  43341. return onKeyboardNavigate(direction2, newIndex);
  43342. } else {
  43343. updateHoveringIndex(newIndex);
  43344. scrollToItem(newIndex);
  43345. }
  43346. };
  43347. const onKeyboardSelect = () => {
  43348. if (!expanded.value) {
  43349. return toggleMenu();
  43350. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  43351. onSelect(filteredOptions.value[states.hoveringIndex], states.hoveringIndex, false);
  43352. }
  43353. };
  43354. const updateHoveringIndex = (idx) => {
  43355. states.hoveringIndex = idx;
  43356. };
  43357. const resetHoveringIndex = () => {
  43358. states.hoveringIndex = -1;
  43359. };
  43360. const setSoftFocus = () => {
  43361. var _a2;
  43362. const _input = inputRef.value;
  43363. if (_input) {
  43364. (_a2 = _input.focus) == null ? void 0 : _a2.call(_input);
  43365. }
  43366. };
  43367. const onInput = (event) => {
  43368. const value = event.target.value;
  43369. onUpdateInputValue(value);
  43370. if (states.displayInputValue.length > 0 && !expanded.value) {
  43371. expanded.value = true;
  43372. }
  43373. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  43374. if (props.multiple) {
  43375. resetInputHeight();
  43376. }
  43377. if (props.remote) {
  43378. debouncedOnInputChange();
  43379. } else {
  43380. return onInputChange();
  43381. }
  43382. };
  43383. const handleClickOutside = () => {
  43384. expanded.value = false;
  43385. return handleBlur();
  43386. };
  43387. const handleMenuEnter = () => {
  43388. states.inputValue = states.displayInputValue;
  43389. return nextTick(() => {
  43390. if (~indexRef.value) {
  43391. updateHoveringIndex(indexRef.value);
  43392. scrollToItem(states.hoveringIndex);
  43393. }
  43394. });
  43395. };
  43396. const scrollToItem = (index2) => {
  43397. menuRef.value.scrollToItem(index2);
  43398. };
  43399. const initStates = () => {
  43400. resetHoveringIndex();
  43401. if (props.multiple) {
  43402. if (props.modelValue.length > 0) {
  43403. let initHovering = false;
  43404. states.cachedOptions.length = 0;
  43405. states.previousValue = props.modelValue.toString();
  43406. for (const value of props.modelValue) {
  43407. const selectValue = getValueKey(value);
  43408. if (filteredOptionsValueMap.value.has(selectValue)) {
  43409. const { index: index2, option } = filteredOptionsValueMap.value.get(selectValue);
  43410. states.cachedOptions.push(option);
  43411. if (!initHovering) {
  43412. updateHoveringIndex(index2);
  43413. }
  43414. initHovering = true;
  43415. }
  43416. }
  43417. } else {
  43418. states.cachedOptions = [];
  43419. states.previousValue = void 0;
  43420. }
  43421. } else {
  43422. if (hasModelValue.value) {
  43423. states.previousValue = props.modelValue;
  43424. const options = filteredOptions.value;
  43425. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue2(option)) === getValueKey(props.modelValue));
  43426. if (~selectedItemIndex) {
  43427. states.selectedLabel = getLabel(options[selectedItemIndex]);
  43428. updateHoveringIndex(selectedItemIndex);
  43429. } else {
  43430. states.selectedLabel = getValueKey(props.modelValue);
  43431. }
  43432. } else {
  43433. states.selectedLabel = "";
  43434. states.previousValue = void 0;
  43435. }
  43436. }
  43437. clearAllNewOption();
  43438. calculatePopperSize();
  43439. };
  43440. watch(expanded, (val) => {
  43441. var _a2, _b;
  43442. emit2("visible-change", val);
  43443. if (val) {
  43444. (_b = (_a2 = popper.value).update) == null ? void 0 : _b.call(_a2);
  43445. } else {
  43446. states.displayInputValue = "";
  43447. states.previousQuery = null;
  43448. createNewOption("");
  43449. }
  43450. });
  43451. watch(() => props.modelValue, (val, oldVal) => {
  43452. var _a2;
  43453. if (!val || val.toString() !== states.previousValue) {
  43454. initStates();
  43455. }
  43456. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  43457. (_a2 = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a2.call(elFormItem, "change").catch((err) => debugWarn());
  43458. }
  43459. }, {
  43460. deep: true
  43461. });
  43462. watch(() => props.options, () => {
  43463. const input = inputRef.value;
  43464. if (!input || input && document.activeElement !== input) {
  43465. initStates();
  43466. }
  43467. }, {
  43468. deep: true
  43469. });
  43470. watch(filteredOptions, () => {
  43471. return menuRef.value && nextTick(menuRef.value.resetScrollTop);
  43472. });
  43473. watch(() => dropdownMenuVisible.value, (val) => {
  43474. if (!val) {
  43475. resetHoveringIndex();
  43476. }
  43477. });
  43478. onMounted(() => {
  43479. initStates();
  43480. });
  43481. useResizeObserver(selectRef, handleResize);
  43482. return {
  43483. collapseTagSize,
  43484. currentPlaceholder,
  43485. expanded,
  43486. emptyText,
  43487. popupHeight,
  43488. debounce: debounce$1,
  43489. filteredOptions,
  43490. iconComponent,
  43491. iconReverse,
  43492. inputWrapperStyle,
  43493. popperSize,
  43494. dropdownMenuVisible,
  43495. hasModelValue,
  43496. shouldShowPlaceholder,
  43497. selectDisabled,
  43498. selectSize,
  43499. showClearBtn,
  43500. states,
  43501. tagMaxWidth,
  43502. nsSelectV2,
  43503. nsInput,
  43504. calculatorRef,
  43505. controlRef,
  43506. inputRef,
  43507. menuRef,
  43508. popper,
  43509. selectRef,
  43510. selectionRef,
  43511. popperRef,
  43512. validateState,
  43513. validateIcon,
  43514. showTagList,
  43515. collapseTagList,
  43516. debouncedOnInputChange,
  43517. deleteTag,
  43518. getLabel,
  43519. getValue: getValue2,
  43520. getDisabled,
  43521. getValueKey,
  43522. handleBlur,
  43523. handleClear,
  43524. handleClickOutside,
  43525. handleDel,
  43526. handleEsc,
  43527. handleFocus,
  43528. handleMenuEnter,
  43529. handleResize,
  43530. toggleMenu,
  43531. scrollTo: scrollToItem,
  43532. onInput,
  43533. onKeyboardNavigate,
  43534. onKeyboardSelect,
  43535. onSelect,
  43536. onHover: updateHoveringIndex,
  43537. onUpdateInputValue,
  43538. handleCompositionStart,
  43539. handleCompositionEnd,
  43540. handleCompositionUpdate
  43541. };
  43542. };
  43543. const _sfc_main$G = /* @__PURE__ */ defineComponent({
  43544. name: "ElSelectV2",
  43545. components: {
  43546. ElSelectMenu,
  43547. ElTag,
  43548. ElTooltip,
  43549. ElIcon
  43550. },
  43551. directives: { ClickOutside, ModelText: vModelText },
  43552. props: SelectProps,
  43553. emits: [
  43554. UPDATE_MODEL_EVENT,
  43555. CHANGE_EVENT,
  43556. "remove-tag",
  43557. "clear",
  43558. "visible-change",
  43559. "focus",
  43560. "blur"
  43561. ],
  43562. setup(props, { emit: emit2 }) {
  43563. const modelValue = computed(() => {
  43564. const { modelValue: rawModelValue, multiple } = props;
  43565. const fallback = multiple ? [] : void 0;
  43566. if (isArray$3(rawModelValue)) {
  43567. return multiple ? rawModelValue : fallback;
  43568. }
  43569. return multiple ? fallback : rawModelValue;
  43570. });
  43571. const API = useSelect$1(reactive({
  43572. ...toRefs(props),
  43573. modelValue
  43574. }), emit2);
  43575. provide(selectV2InjectionKey, {
  43576. props: reactive({
  43577. ...toRefs(props),
  43578. height: API.popupHeight,
  43579. modelValue
  43580. }),
  43581. popper: API.popper,
  43582. onSelect: API.onSelect,
  43583. onHover: API.onHover,
  43584. onKeyboardNavigate: API.onKeyboardNavigate,
  43585. onKeyboardSelect: API.onKeyboardSelect
  43586. });
  43587. return {
  43588. ...API,
  43589. modelValue
  43590. };
  43591. }
  43592. });
  43593. const _hoisted_1$i = { key: 0 };
  43594. const _hoisted_2$c = ["id", "autocomplete", "aria-expanded", "aria-labelledby", "disabled", "readonly", "name", "unselectable"];
  43595. const _hoisted_3$5 = ["textContent"];
  43596. const _hoisted_4$3 = ["id", "aria-labelledby", "aria-expanded", "autocomplete", "disabled", "name", "readonly", "unselectable"];
  43597. const _hoisted_5$2 = ["textContent"];
  43598. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  43599. const _component_el_tag = resolveComponent("el-tag");
  43600. const _component_el_tooltip = resolveComponent("el-tooltip");
  43601. const _component_el_icon = resolveComponent("el-icon");
  43602. const _component_el_select_menu = resolveComponent("el-select-menu");
  43603. const _directive_model_text = resolveDirective("model-text");
  43604. const _directive_click_outside = resolveDirective("click-outside");
  43605. return withDirectives((openBlock(), createElementBlock("div", {
  43606. ref: "selectRef",
  43607. class: normalizeClass([_ctx.nsSelectV2.b(), _ctx.nsSelectV2.m(_ctx.selectSize)]),
  43608. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"])),
  43609. onMouseenter: _cache[25] || (_cache[25] = ($event) => _ctx.states.comboBoxHovering = true),
  43610. onMouseleave: _cache[26] || (_cache[26] = ($event) => _ctx.states.comboBoxHovering = false)
  43611. }, [
  43612. createVNode(_component_el_tooltip, {
  43613. ref: "popper",
  43614. visible: _ctx.dropdownMenuVisible,
  43615. teleported: _ctx.teleported,
  43616. "popper-class": [_ctx.nsSelectV2.e("popper"), _ctx.popperClass],
  43617. "gpu-acceleration": false,
  43618. "stop-popper-mouse-event": false,
  43619. "popper-options": _ctx.popperOptions,
  43620. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  43621. effect: _ctx.effect,
  43622. placement: _ctx.placement,
  43623. pure: "",
  43624. transition: `${_ctx.nsSelectV2.namespace.value}-zoom-in-top`,
  43625. trigger: "click",
  43626. persistent: _ctx.persistent,
  43627. onBeforeShow: _ctx.handleMenuEnter,
  43628. onHide: _cache[23] || (_cache[23] = ($event) => _ctx.states.inputValue = _ctx.states.displayInputValue)
  43629. }, {
  43630. default: withCtx(() => [
  43631. createBaseVNode("div", {
  43632. ref: "selectionRef",
  43633. class: normalizeClass([
  43634. _ctx.nsSelectV2.e("wrapper"),
  43635. _ctx.nsSelectV2.is("focused", _ctx.states.isComposing || _ctx.expanded),
  43636. _ctx.nsSelectV2.is("hovering", _ctx.states.comboBoxHovering),
  43637. _ctx.nsSelectV2.is("filterable", _ctx.filterable),
  43638. _ctx.nsSelectV2.is("disabled", _ctx.selectDisabled)
  43639. ])
  43640. }, [
  43641. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_1$i, [
  43642. renderSlot(_ctx.$slots, "prefix")
  43643. ])) : createCommentVNode("v-if", true),
  43644. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  43645. key: 1,
  43646. class: normalizeClass(_ctx.nsSelectV2.e("selection"))
  43647. }, [
  43648. _ctx.collapseTags && _ctx.modelValue.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  43649. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  43650. return openBlock(), createElementBlock("div", {
  43651. key: _ctx.getValueKey(_ctx.getValue(item)),
  43652. class: normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  43653. }, [
  43654. createVNode(_component_el_tag, {
  43655. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  43656. size: _ctx.collapseTagSize,
  43657. type: "info",
  43658. "disable-transitions": "",
  43659. onClose: ($event) => _ctx.deleteTag($event, item)
  43660. }, {
  43661. default: withCtx(() => [
  43662. createBaseVNode("span", {
  43663. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  43664. style: normalizeStyle({
  43665. maxWidth: `${_ctx.tagMaxWidth}px`
  43666. })
  43667. }, toDisplayString(_ctx.getLabel(item)), 7)
  43668. ]),
  43669. _: 2
  43670. }, 1032, ["closable", "size", "onClose"])
  43671. ], 2);
  43672. }), 128)),
  43673. createBaseVNode("div", {
  43674. class: normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  43675. }, [
  43676. _ctx.modelValue.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tag, {
  43677. key: 0,
  43678. closable: false,
  43679. size: _ctx.collapseTagSize,
  43680. type: "info",
  43681. "disable-transitions": ""
  43682. }, {
  43683. default: withCtx(() => [
  43684. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  43685. key: 0,
  43686. disabled: _ctx.dropdownMenuVisible,
  43687. "fallback-placements": ["bottom", "top", "right", "left"],
  43688. effect: _ctx.effect,
  43689. placement: "bottom",
  43690. teleported: false
  43691. }, {
  43692. default: withCtx(() => [
  43693. createBaseVNode("span", {
  43694. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  43695. style: normalizeStyle({
  43696. maxWidth: `${_ctx.tagMaxWidth}px`
  43697. })
  43698. }, " + " + toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 7)
  43699. ]),
  43700. content: withCtx(() => [
  43701. createBaseVNode("div", {
  43702. class: normalizeClass(_ctx.nsSelectV2.e("selection"))
  43703. }, [
  43704. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (selected) => {
  43705. return openBlock(), createElementBlock("div", {
  43706. key: _ctx.getValueKey(_ctx.getValue(selected)),
  43707. class: normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  43708. }, [
  43709. createVNode(_component_el_tag, {
  43710. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  43711. size: _ctx.collapseTagSize,
  43712. class: "in-tooltip",
  43713. type: "info",
  43714. "disable-transitions": "",
  43715. onClose: ($event) => _ctx.deleteTag($event, selected)
  43716. }, {
  43717. default: withCtx(() => [
  43718. createBaseVNode("span", {
  43719. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  43720. style: normalizeStyle({
  43721. maxWidth: `${_ctx.tagMaxWidth}px`
  43722. })
  43723. }, toDisplayString(_ctx.getLabel(selected)), 7)
  43724. ]),
  43725. _: 2
  43726. }, 1032, ["closable", "size", "onClose"])
  43727. ], 2);
  43728. }), 128))
  43729. ], 2)
  43730. ]),
  43731. _: 1
  43732. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  43733. key: 1,
  43734. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  43735. style: normalizeStyle({
  43736. maxWidth: `${_ctx.tagMaxWidth}px`
  43737. })
  43738. }, " + " + toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 7))
  43739. ]),
  43740. _: 1
  43741. }, 8, ["size"])) : createCommentVNode("v-if", true)
  43742. ], 2)
  43743. ], 64)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.states.cachedOptions, (selected) => {
  43744. return openBlock(), createElementBlock("div", {
  43745. key: _ctx.getValueKey(_ctx.getValue(selected)),
  43746. class: normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  43747. }, [
  43748. createVNode(_component_el_tag, {
  43749. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  43750. size: _ctx.collapseTagSize,
  43751. type: "info",
  43752. "disable-transitions": "",
  43753. onClose: ($event) => _ctx.deleteTag($event, selected)
  43754. }, {
  43755. default: withCtx(() => [
  43756. createBaseVNode("span", {
  43757. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  43758. style: normalizeStyle({
  43759. maxWidth: `${_ctx.tagMaxWidth}px`
  43760. })
  43761. }, toDisplayString(_ctx.getLabel(selected)), 7)
  43762. ]),
  43763. _: 2
  43764. }, 1032, ["closable", "size", "onClose"])
  43765. ], 2);
  43766. }), 128)),
  43767. createBaseVNode("div", {
  43768. class: normalizeClass([
  43769. _ctx.nsSelectV2.e("selected-item"),
  43770. _ctx.nsSelectV2.e("input-wrapper")
  43771. ]),
  43772. style: normalizeStyle(_ctx.inputWrapperStyle)
  43773. }, [
  43774. withDirectives(createBaseVNode("input", {
  43775. id: _ctx.id,
  43776. ref: "inputRef",
  43777. autocomplete: _ctx.autocomplete,
  43778. "aria-autocomplete": "list",
  43779. "aria-haspopup": "listbox",
  43780. autocapitalize: "off",
  43781. "aria-expanded": _ctx.expanded,
  43782. "aria-labelledby": _ctx.label,
  43783. class: normalizeClass([
  43784. _ctx.nsSelectV2.is(_ctx.selectSize),
  43785. _ctx.nsSelectV2.e("combobox-input")
  43786. ]),
  43787. disabled: _ctx.disabled,
  43788. role: "combobox",
  43789. readonly: !_ctx.filterable,
  43790. spellcheck: "false",
  43791. type: "text",
  43792. name: _ctx.name,
  43793. unselectable: _ctx.expanded ? "on" : void 0,
  43794. "onUpdate:modelValue": _cache[0] || (_cache[0] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args)),
  43795. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  43796. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  43797. onInput: _cache[3] || (_cache[3] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  43798. onCompositionstart: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  43799. onCompositionupdate: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  43800. onCompositionend: _cache[6] || (_cache[6] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  43801. onKeydown: [
  43802. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  43803. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  43804. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  43805. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  43806. _cache[11] || (_cache[11] = withKeys(withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  43807. ]
  43808. }, null, 42, _hoisted_2$c), [
  43809. [_directive_model_text, _ctx.states.displayInputValue]
  43810. ]),
  43811. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  43812. key: 0,
  43813. ref: "calculatorRef",
  43814. "aria-hidden": "true",
  43815. class: normalizeClass(_ctx.nsSelectV2.e("input-calculator")),
  43816. textContent: toDisplayString(_ctx.states.displayInputValue)
  43817. }, null, 10, _hoisted_3$5)) : createCommentVNode("v-if", true)
  43818. ], 6)
  43819. ], 2)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  43820. createBaseVNode("div", {
  43821. class: normalizeClass([
  43822. _ctx.nsSelectV2.e("selected-item"),
  43823. _ctx.nsSelectV2.e("input-wrapper")
  43824. ])
  43825. }, [
  43826. withDirectives(createBaseVNode("input", {
  43827. id: _ctx.id,
  43828. ref: "inputRef",
  43829. "aria-autocomplete": "list",
  43830. "aria-haspopup": "listbox",
  43831. "aria-labelledby": _ctx.label,
  43832. "aria-expanded": _ctx.expanded,
  43833. autocapitalize: "off",
  43834. autocomplete: _ctx.autocomplete,
  43835. class: normalizeClass(_ctx.nsSelectV2.e("combobox-input")),
  43836. disabled: _ctx.disabled,
  43837. name: _ctx.name,
  43838. role: "combobox",
  43839. readonly: !_ctx.filterable,
  43840. spellcheck: "false",
  43841. type: "text",
  43842. unselectable: _ctx.expanded ? "on" : void 0,
  43843. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  43844. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  43845. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  43846. onFocus: _cache[15] || (_cache[15] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  43847. onBlur: _cache[16] || (_cache[16] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  43848. onInput: _cache[17] || (_cache[17] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  43849. onKeydown: [
  43850. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  43851. _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  43852. _cache[20] || (_cache[20] = withKeys(withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  43853. _cache[21] || (_cache[21] = withKeys(withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"]))
  43854. ],
  43855. "onUpdate:modelValue": _cache[22] || (_cache[22] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args))
  43856. }, null, 42, _hoisted_4$3), [
  43857. [_directive_model_text, _ctx.states.displayInputValue]
  43858. ])
  43859. ], 2),
  43860. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  43861. key: 0,
  43862. ref: "calculatorRef",
  43863. "aria-hidden": "true",
  43864. class: normalizeClass([
  43865. _ctx.nsSelectV2.e("selected-item"),
  43866. _ctx.nsSelectV2.e("input-calculator")
  43867. ]),
  43868. textContent: toDisplayString(_ctx.states.displayInputValue)
  43869. }, null, 10, _hoisted_5$2)) : createCommentVNode("v-if", true)
  43870. ], 64)),
  43871. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("span", {
  43872. key: 3,
  43873. class: normalizeClass([
  43874. _ctx.nsSelectV2.e("placeholder"),
  43875. _ctx.nsSelectV2.is("transparent", _ctx.multiple ? _ctx.modelValue.length === 0 : !_ctx.hasModelValue)
  43876. ])
  43877. }, toDisplayString(_ctx.currentPlaceholder), 3)) : createCommentVNode("v-if", true),
  43878. createBaseVNode("span", {
  43879. class: normalizeClass(_ctx.nsSelectV2.e("suffix"))
  43880. }, [
  43881. _ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
  43882. key: 0,
  43883. class: normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  43884. }, {
  43885. default: withCtx(() => [
  43886. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  43887. ]),
  43888. _: 1
  43889. }, 8, ["class"])), [
  43890. [vShow, !_ctx.showClearBtn]
  43891. ]) : createCommentVNode("v-if", true),
  43892. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  43893. key: 1,
  43894. class: normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon")]),
  43895. onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
  43896. }, {
  43897. default: withCtx(() => [
  43898. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  43899. ]),
  43900. _: 1
  43901. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  43902. _ctx.validateState && _ctx.validateIcon ? (openBlock(), createBlock(_component_el_icon, {
  43903. key: 2,
  43904. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  43905. }, {
  43906. default: withCtx(() => [
  43907. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  43908. ]),
  43909. _: 1
  43910. }, 8, ["class"])) : createCommentVNode("v-if", true)
  43911. ], 2)
  43912. ], 2)
  43913. ]),
  43914. content: withCtx(() => [
  43915. createVNode(_component_el_select_menu, {
  43916. ref: "menuRef",
  43917. data: _ctx.filteredOptions,
  43918. width: _ctx.popperSize,
  43919. "hovering-index": _ctx.states.hoveringIndex,
  43920. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  43921. }, {
  43922. default: withCtx((scope) => [
  43923. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))
  43924. ]),
  43925. empty: withCtx(() => [
  43926. renderSlot(_ctx.$slots, "empty", {}, () => [
  43927. createBaseVNode("p", {
  43928. class: normalizeClass(_ctx.nsSelectV2.e("empty"))
  43929. }, toDisplayString(_ctx.emptyText ? _ctx.emptyText : ""), 3)
  43930. ])
  43931. ]),
  43932. _: 3
  43933. }, 8, ["data", "width", "hovering-index", "scrollbar-always-on"])
  43934. ]),
  43935. _: 3
  43936. }, 8, ["visible", "teleported", "popper-class", "popper-options", "effect", "placement", "transition", "persistent", "onBeforeShow"])
  43937. ], 34)), [
  43938. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  43939. ]);
  43940. }
  43941. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/select.vue"]]);
  43942. Select.install = (app) => {
  43943. app.component(Select.name, Select);
  43944. };
  43945. const _Select = Select;
  43946. const ElSelectV2 = _Select;
  43947. const skeletonProps = buildProps({
  43948. animated: {
  43949. type: Boolean,
  43950. default: false
  43951. },
  43952. count: {
  43953. type: Number,
  43954. default: 1
  43955. },
  43956. rows: {
  43957. type: Number,
  43958. default: 3
  43959. },
  43960. loading: {
  43961. type: Boolean,
  43962. default: true
  43963. },
  43964. throttle: {
  43965. type: Number
  43966. }
  43967. });
  43968. const skeletonItemProps = buildProps({
  43969. variant: {
  43970. type: String,
  43971. values: [
  43972. "circle",
  43973. "rect",
  43974. "h1",
  43975. "h3",
  43976. "text",
  43977. "caption",
  43978. "p",
  43979. "image",
  43980. "button"
  43981. ],
  43982. default: "text"
  43983. }
  43984. });
  43985. const __default__$u = /* @__PURE__ */ defineComponent({
  43986. name: "ElSkeletonItem"
  43987. });
  43988. const _sfc_main$F = /* @__PURE__ */ defineComponent({
  43989. ...__default__$u,
  43990. props: skeletonItemProps,
  43991. setup(__props) {
  43992. const ns = useNamespace("skeleton");
  43993. return (_ctx, _cache) => {
  43994. return openBlock(), createElementBlock("div", {
  43995. class: normalizeClass([unref(ns).e("item"), unref(ns).e(_ctx.variant)])
  43996. }, [
  43997. _ctx.variant === "image" ? (openBlock(), createBlock(unref(picture_filled_default), { key: 0 })) : createCommentVNode("v-if", true)
  43998. ], 2);
  43999. };
  44000. }
  44001. });
  44002. var SkeletonItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/skeleton/src/skeleton-item.vue"]]);
  44003. const __default__$t = /* @__PURE__ */ defineComponent({
  44004. name: "ElSkeleton"
  44005. });
  44006. const _sfc_main$E = /* @__PURE__ */ defineComponent({
  44007. ...__default__$t,
  44008. props: skeletonProps,
  44009. setup(__props, { expose }) {
  44010. const props = __props;
  44011. const ns = useNamespace("skeleton");
  44012. const uiLoading = useThrottleRender(toRef(props, "loading"), props.throttle);
  44013. expose({
  44014. uiLoading
  44015. });
  44016. return (_ctx, _cache) => {
  44017. return unref(uiLoading) ? (openBlock(), createElementBlock("div", mergeProps({
  44018. key: 0,
  44019. class: [unref(ns).b(), unref(ns).is("animated", _ctx.animated)]
  44020. }, _ctx.$attrs), [
  44021. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.count, (i) => {
  44022. return openBlock(), createElementBlock(Fragment, { key: i }, [
  44023. _ctx.loading ? renderSlot(_ctx.$slots, "template", { key: i }, () => [
  44024. createVNode(SkeletonItem, {
  44025. class: normalizeClass(unref(ns).is("first")),
  44026. variant: "p"
  44027. }, null, 8, ["class"]),
  44028. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (item) => {
  44029. return openBlock(), createBlock(SkeletonItem, {
  44030. key: item,
  44031. class: normalizeClass([
  44032. unref(ns).e("paragraph"),
  44033. unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  44034. ]),
  44035. variant: "p"
  44036. }, null, 8, ["class"]);
  44037. }), 128))
  44038. ]) : createCommentVNode("v-if", true)
  44039. ], 64);
  44040. }), 128))
  44041. ], 16)) : renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)));
  44042. };
  44043. }
  44044. });
  44045. var Skeleton = /* @__PURE__ */ _export_sfc$1(_sfc_main$E, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/skeleton/src/skeleton.vue"]]);
  44046. const ElSkeleton = withInstall(Skeleton, {
  44047. SkeletonItem
  44048. });
  44049. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  44050. const sliderContextKey = Symbol("sliderContextKey");
  44051. const sliderProps = buildProps({
  44052. modelValue: {
  44053. type: definePropType([Number, Array]),
  44054. default: 0
  44055. },
  44056. id: {
  44057. type: String,
  44058. default: void 0
  44059. },
  44060. min: {
  44061. type: Number,
  44062. default: 0
  44063. },
  44064. max: {
  44065. type: Number,
  44066. default: 100
  44067. },
  44068. step: {
  44069. type: Number,
  44070. default: 1
  44071. },
  44072. showInput: Boolean,
  44073. showInputControls: {
  44074. type: Boolean,
  44075. default: true
  44076. },
  44077. size: useSizeProp,
  44078. inputSize: useSizeProp,
  44079. showStops: Boolean,
  44080. showTooltip: {
  44081. type: Boolean,
  44082. default: true
  44083. },
  44084. formatTooltip: {
  44085. type: definePropType(Function),
  44086. default: void 0
  44087. },
  44088. disabled: Boolean,
  44089. range: Boolean,
  44090. vertical: Boolean,
  44091. height: String,
  44092. debounce: {
  44093. type: Number,
  44094. default: 300
  44095. },
  44096. label: {
  44097. type: String,
  44098. default: void 0
  44099. },
  44100. rangeStartLabel: {
  44101. type: String,
  44102. default: void 0
  44103. },
  44104. rangeEndLabel: {
  44105. type: String,
  44106. default: void 0
  44107. },
  44108. formatValueText: {
  44109. type: definePropType(Function),
  44110. default: void 0
  44111. },
  44112. tooltipClass: {
  44113. type: String,
  44114. default: void 0
  44115. },
  44116. placement: {
  44117. type: String,
  44118. values: Ee,
  44119. default: "top"
  44120. },
  44121. marks: {
  44122. type: definePropType(Object)
  44123. },
  44124. validateEvent: {
  44125. type: Boolean,
  44126. default: true
  44127. }
  44128. });
  44129. const isValidValue$1 = (value) => isNumber(value) || isArray$3(value) && value.every(isNumber);
  44130. const sliderEmits = {
  44131. [UPDATE_MODEL_EVENT]: isValidValue$1,
  44132. [INPUT_EVENT]: isValidValue$1,
  44133. [CHANGE_EVENT]: isValidValue$1
  44134. };
  44135. const useLifecycle = (props, initData, resetSize) => {
  44136. const sliderWrapper = ref();
  44137. onMounted(async () => {
  44138. if (props.range) {
  44139. if (Array.isArray(props.modelValue)) {
  44140. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  44141. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  44142. } else {
  44143. initData.firstValue = props.min;
  44144. initData.secondValue = props.max;
  44145. }
  44146. initData.oldValue = [initData.firstValue, initData.secondValue];
  44147. } else {
  44148. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  44149. initData.firstValue = props.min;
  44150. } else {
  44151. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  44152. }
  44153. initData.oldValue = initData.firstValue;
  44154. }
  44155. useEventListener(window, "resize", resetSize);
  44156. await nextTick();
  44157. resetSize();
  44158. });
  44159. return {
  44160. sliderWrapper
  44161. };
  44162. };
  44163. const useMarks = (props) => {
  44164. return computed(() => {
  44165. if (!props.marks) {
  44166. return [];
  44167. }
  44168. const marksKeys = Object.keys(props.marks);
  44169. return marksKeys.map(Number.parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  44170. point,
  44171. position: (point - props.min) * 100 / (props.max - props.min),
  44172. mark: props.marks[point]
  44173. }));
  44174. });
  44175. };
  44176. const useSlide = (props, initData, emit2) => {
  44177. const { form: elForm, formItem: elFormItem } = useFormItem();
  44178. const slider = shallowRef();
  44179. const firstButton = ref();
  44180. const secondButton = ref();
  44181. const buttonRefs = {
  44182. firstButton,
  44183. secondButton
  44184. };
  44185. const sliderDisabled = computed(() => {
  44186. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  44187. });
  44188. const minValue = computed(() => {
  44189. return Math.min(initData.firstValue, initData.secondValue);
  44190. });
  44191. const maxValue = computed(() => {
  44192. return Math.max(initData.firstValue, initData.secondValue);
  44193. });
  44194. const barSize = computed(() => {
  44195. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  44196. });
  44197. const barStart = computed(() => {
  44198. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  44199. });
  44200. const runwayStyle = computed(() => {
  44201. return props.vertical ? { height: props.height } : {};
  44202. });
  44203. const barStyle = computed(() => {
  44204. return props.vertical ? {
  44205. height: barSize.value,
  44206. bottom: barStart.value
  44207. } : {
  44208. width: barSize.value,
  44209. left: barStart.value
  44210. };
  44211. });
  44212. const resetSize = () => {
  44213. if (slider.value) {
  44214. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  44215. }
  44216. };
  44217. const getButtonRefByPercent = (percent) => {
  44218. const targetValue = props.min + percent * (props.max - props.min) / 100;
  44219. if (!props.range) {
  44220. return firstButton;
  44221. }
  44222. let buttonRefName;
  44223. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  44224. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  44225. } else {
  44226. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  44227. }
  44228. return buttonRefs[buttonRefName];
  44229. };
  44230. const setPosition = (percent) => {
  44231. const buttonRef = getButtonRefByPercent(percent);
  44232. buttonRef.value.setPosition(percent);
  44233. return buttonRef;
  44234. };
  44235. const setFirstValue = (firstValue) => {
  44236. initData.firstValue = firstValue;
  44237. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  44238. };
  44239. const setSecondValue = (secondValue) => {
  44240. initData.secondValue = secondValue;
  44241. if (props.range) {
  44242. _emit([minValue.value, maxValue.value]);
  44243. }
  44244. };
  44245. const _emit = (val) => {
  44246. emit2(UPDATE_MODEL_EVENT, val);
  44247. emit2(INPUT_EVENT, val);
  44248. };
  44249. const emitChange = async () => {
  44250. await nextTick();
  44251. emit2(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  44252. };
  44253. const handleSliderPointerEvent = (event) => {
  44254. var _a2, _b, _c, _d, _e, _f;
  44255. if (sliderDisabled.value || initData.dragging)
  44256. return;
  44257. resetSize();
  44258. let newPercent = 0;
  44259. if (props.vertical) {
  44260. const clientY = (_c = (_b = (_a2 = event.touches) == null ? void 0 : _a2.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  44261. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  44262. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  44263. } else {
  44264. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  44265. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  44266. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  44267. }
  44268. if (newPercent < 0 || newPercent > 100)
  44269. return;
  44270. return setPosition(newPercent);
  44271. };
  44272. const onSliderWrapperPrevent = (event) => {
  44273. var _a2, _b;
  44274. if (((_a2 = buttonRefs["firstButton"].value) == null ? void 0 : _a2.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  44275. event.preventDefault();
  44276. }
  44277. };
  44278. const onSliderDown = async (event) => {
  44279. const buttonRef = handleSliderPointerEvent(event);
  44280. if (buttonRef) {
  44281. await nextTick();
  44282. buttonRef.value.onButtonDown(event);
  44283. }
  44284. };
  44285. const onSliderClick = (event) => {
  44286. const buttonRef = handleSliderPointerEvent(event);
  44287. if (buttonRef) {
  44288. emitChange();
  44289. }
  44290. };
  44291. return {
  44292. elFormItem,
  44293. slider,
  44294. firstButton,
  44295. secondButton,
  44296. sliderDisabled,
  44297. minValue,
  44298. maxValue,
  44299. runwayStyle,
  44300. barStyle,
  44301. resetSize,
  44302. setPosition,
  44303. emitChange,
  44304. onSliderWrapperPrevent,
  44305. onSliderClick,
  44306. onSliderDown,
  44307. setFirstValue,
  44308. setSecondValue
  44309. };
  44310. };
  44311. const { left, down, right, up, home, end, pageUp, pageDown } = EVENT_CODE;
  44312. const useTooltip = (props, formatTooltip, showTooltip) => {
  44313. const tooltip = ref();
  44314. const tooltipVisible = ref(false);
  44315. const enableFormat = computed(() => {
  44316. return formatTooltip.value instanceof Function;
  44317. });
  44318. const formatValue = computed(() => {
  44319. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  44320. });
  44321. const displayTooltip = debounce(() => {
  44322. showTooltip.value && (tooltipVisible.value = true);
  44323. }, 50);
  44324. const hideTooltip = debounce(() => {
  44325. showTooltip.value && (tooltipVisible.value = false);
  44326. }, 50);
  44327. return {
  44328. tooltip,
  44329. tooltipVisible,
  44330. formatValue,
  44331. displayTooltip,
  44332. hideTooltip
  44333. };
  44334. };
  44335. const useSliderButton = (props, initData, emit2) => {
  44336. const {
  44337. disabled,
  44338. min: min2,
  44339. max: max2,
  44340. step,
  44341. showTooltip,
  44342. precision,
  44343. sliderSize,
  44344. formatTooltip,
  44345. emitChange,
  44346. resetSize,
  44347. updateDragging
  44348. } = inject(sliderContextKey);
  44349. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  44350. const button = ref();
  44351. const currentPosition = computed(() => {
  44352. return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
  44353. });
  44354. const wrapperStyle = computed(() => {
  44355. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  44356. });
  44357. const handleMouseEnter = () => {
  44358. initData.hovering = true;
  44359. displayTooltip();
  44360. };
  44361. const handleMouseLeave = () => {
  44362. initData.hovering = false;
  44363. if (!initData.dragging) {
  44364. hideTooltip();
  44365. }
  44366. };
  44367. const onButtonDown = (event) => {
  44368. if (disabled.value)
  44369. return;
  44370. event.preventDefault();
  44371. onDragStart(event);
  44372. window.addEventListener("mousemove", onDragging);
  44373. window.addEventListener("touchmove", onDragging);
  44374. window.addEventListener("mouseup", onDragEnd);
  44375. window.addEventListener("touchend", onDragEnd);
  44376. window.addEventListener("contextmenu", onDragEnd);
  44377. button.value.focus();
  44378. };
  44379. const incrementPosition = (amount) => {
  44380. if (disabled.value)
  44381. return;
  44382. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max2.value - min2.value) * 100;
  44383. setPosition(initData.newPosition);
  44384. emitChange();
  44385. };
  44386. const onLeftKeyDown = () => {
  44387. incrementPosition(-step.value);
  44388. };
  44389. const onRightKeyDown = () => {
  44390. incrementPosition(step.value);
  44391. };
  44392. const onPageDownKeyDown = () => {
  44393. incrementPosition(-step.value * 4);
  44394. };
  44395. const onPageUpKeyDown = () => {
  44396. incrementPosition(step.value * 4);
  44397. };
  44398. const onHomeKeyDown = () => {
  44399. if (disabled.value)
  44400. return;
  44401. setPosition(0);
  44402. emitChange();
  44403. };
  44404. const onEndKeyDown = () => {
  44405. if (disabled.value)
  44406. return;
  44407. setPosition(100);
  44408. emitChange();
  44409. };
  44410. const onKeyDown = (event) => {
  44411. let isPreventDefault = true;
  44412. if ([left, down].includes(event.key)) {
  44413. onLeftKeyDown();
  44414. } else if ([right, up].includes(event.key)) {
  44415. onRightKeyDown();
  44416. } else if (event.key === home) {
  44417. onHomeKeyDown();
  44418. } else if (event.key === end) {
  44419. onEndKeyDown();
  44420. } else if (event.key === pageDown) {
  44421. onPageDownKeyDown();
  44422. } else if (event.key === pageUp) {
  44423. onPageUpKeyDown();
  44424. } else {
  44425. isPreventDefault = false;
  44426. }
  44427. isPreventDefault && event.preventDefault();
  44428. };
  44429. const getClientXY2 = (event) => {
  44430. let clientX;
  44431. let clientY;
  44432. if (event.type.startsWith("touch")) {
  44433. clientY = event.touches[0].clientY;
  44434. clientX = event.touches[0].clientX;
  44435. } else {
  44436. clientY = event.clientY;
  44437. clientX = event.clientX;
  44438. }
  44439. return {
  44440. clientX,
  44441. clientY
  44442. };
  44443. };
  44444. const onDragStart = (event) => {
  44445. initData.dragging = true;
  44446. initData.isClick = true;
  44447. const { clientX, clientY } = getClientXY2(event);
  44448. if (props.vertical) {
  44449. initData.startY = clientY;
  44450. } else {
  44451. initData.startX = clientX;
  44452. }
  44453. initData.startPosition = Number.parseFloat(currentPosition.value);
  44454. initData.newPosition = initData.startPosition;
  44455. };
  44456. const onDragging = (event) => {
  44457. if (initData.dragging) {
  44458. initData.isClick = false;
  44459. displayTooltip();
  44460. resetSize();
  44461. let diff;
  44462. const { clientX, clientY } = getClientXY2(event);
  44463. if (props.vertical) {
  44464. initData.currentY = clientY;
  44465. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  44466. } else {
  44467. initData.currentX = clientX;
  44468. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  44469. }
  44470. initData.newPosition = initData.startPosition + diff;
  44471. setPosition(initData.newPosition);
  44472. }
  44473. };
  44474. const onDragEnd = () => {
  44475. if (initData.dragging) {
  44476. setTimeout(() => {
  44477. initData.dragging = false;
  44478. if (!initData.hovering) {
  44479. hideTooltip();
  44480. }
  44481. if (!initData.isClick) {
  44482. setPosition(initData.newPosition);
  44483. }
  44484. emitChange();
  44485. }, 0);
  44486. window.removeEventListener("mousemove", onDragging);
  44487. window.removeEventListener("touchmove", onDragging);
  44488. window.removeEventListener("mouseup", onDragEnd);
  44489. window.removeEventListener("touchend", onDragEnd);
  44490. window.removeEventListener("contextmenu", onDragEnd);
  44491. }
  44492. };
  44493. const setPosition = async (newPosition) => {
  44494. if (newPosition === null || Number.isNaN(+newPosition))
  44495. return;
  44496. if (newPosition < 0) {
  44497. newPosition = 0;
  44498. } else if (newPosition > 100) {
  44499. newPosition = 100;
  44500. }
  44501. const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
  44502. const steps = Math.round(newPosition / lengthPerStep);
  44503. let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
  44504. value = Number.parseFloat(value.toFixed(precision.value));
  44505. if (value !== props.modelValue) {
  44506. emit2(UPDATE_MODEL_EVENT, value);
  44507. }
  44508. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  44509. initData.oldValue = props.modelValue;
  44510. }
  44511. await nextTick();
  44512. initData.dragging && displayTooltip();
  44513. tooltip.value.updatePopper();
  44514. };
  44515. watch(() => initData.dragging, (val) => {
  44516. updateDragging(val);
  44517. });
  44518. return {
  44519. disabled,
  44520. button,
  44521. tooltip,
  44522. tooltipVisible,
  44523. showTooltip,
  44524. wrapperStyle,
  44525. formatValue,
  44526. handleMouseEnter,
  44527. handleMouseLeave,
  44528. onButtonDown,
  44529. onKeyDown,
  44530. setPosition
  44531. };
  44532. };
  44533. const useStops = (props, initData, minValue, maxValue) => {
  44534. const stops = computed(() => {
  44535. if (!props.showStops || props.min > props.max)
  44536. return [];
  44537. if (props.step === 0) {
  44538. return [];
  44539. }
  44540. const stopCount = (props.max - props.min) / props.step;
  44541. const stepWidth = 100 * props.step / (props.max - props.min);
  44542. const result = Array.from({ length: stopCount - 1 }).map((_2, index2) => (index2 + 1) * stepWidth);
  44543. if (props.range) {
  44544. return result.filter((step) => {
  44545. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  44546. });
  44547. } else {
  44548. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  44549. }
  44550. });
  44551. const getStopStyle = (position) => {
  44552. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  44553. };
  44554. return {
  44555. stops,
  44556. getStopStyle
  44557. };
  44558. };
  44559. const useWatch = (props, initData, minValue, maxValue, emit2, elFormItem) => {
  44560. const _emit = (val) => {
  44561. emit2(UPDATE_MODEL_EVENT, val);
  44562. emit2(INPUT_EVENT, val);
  44563. };
  44564. const valueChanged = () => {
  44565. if (props.range) {
  44566. return ![minValue.value, maxValue.value].every((item, index2) => item === initData.oldValue[index2]);
  44567. } else {
  44568. return props.modelValue !== initData.oldValue;
  44569. }
  44570. };
  44571. const setValues = () => {
  44572. var _a2, _b;
  44573. if (props.min > props.max) {
  44574. throwError("Slider", "min should not be greater than max.");
  44575. }
  44576. const val = props.modelValue;
  44577. if (props.range && Array.isArray(val)) {
  44578. if (val[1] < props.min) {
  44579. _emit([props.min, props.min]);
  44580. } else if (val[0] > props.max) {
  44581. _emit([props.max, props.max]);
  44582. } else if (val[0] < props.min) {
  44583. _emit([props.min, val[1]]);
  44584. } else if (val[1] > props.max) {
  44585. _emit([val[0], props.max]);
  44586. } else {
  44587. initData.firstValue = val[0];
  44588. initData.secondValue = val[1];
  44589. if (valueChanged()) {
  44590. if (props.validateEvent) {
  44591. (_a2 = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a2.call(elFormItem, "change").catch((err) => debugWarn());
  44592. }
  44593. initData.oldValue = val.slice();
  44594. }
  44595. }
  44596. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  44597. if (val < props.min) {
  44598. _emit(props.min);
  44599. } else if (val > props.max) {
  44600. _emit(props.max);
  44601. } else {
  44602. initData.firstValue = val;
  44603. if (valueChanged()) {
  44604. if (props.validateEvent) {
  44605. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  44606. }
  44607. initData.oldValue = val;
  44608. }
  44609. }
  44610. }
  44611. };
  44612. setValues();
  44613. watch(() => initData.dragging, (val) => {
  44614. if (!val) {
  44615. setValues();
  44616. }
  44617. });
  44618. watch(() => props.modelValue, (val, oldVal) => {
  44619. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index2) => item === oldVal[index2]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  44620. return;
  44621. }
  44622. setValues();
  44623. }, {
  44624. deep: true
  44625. });
  44626. watch(() => [props.min, props.max], () => {
  44627. setValues();
  44628. });
  44629. };
  44630. const sliderButtonProps = buildProps({
  44631. modelValue: {
  44632. type: Number,
  44633. default: 0
  44634. },
  44635. vertical: Boolean,
  44636. tooltipClass: String,
  44637. placement: {
  44638. type: String,
  44639. values: Ee,
  44640. default: "top"
  44641. }
  44642. });
  44643. const sliderButtonEmits = {
  44644. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  44645. };
  44646. const _hoisted_1$h = ["tabindex"];
  44647. const __default__$s = /* @__PURE__ */ defineComponent({
  44648. name: "ElSliderButton"
  44649. });
  44650. const _sfc_main$D = /* @__PURE__ */ defineComponent({
  44651. ...__default__$s,
  44652. props: sliderButtonProps,
  44653. emits: sliderButtonEmits,
  44654. setup(__props, { expose, emit: emit2 }) {
  44655. const props = __props;
  44656. const ns = useNamespace("slider");
  44657. const initData = reactive({
  44658. hovering: false,
  44659. dragging: false,
  44660. isClick: false,
  44661. startX: 0,
  44662. currentX: 0,
  44663. startY: 0,
  44664. currentY: 0,
  44665. startPosition: 0,
  44666. newPosition: 0,
  44667. oldValue: props.modelValue
  44668. });
  44669. const {
  44670. disabled,
  44671. button,
  44672. tooltip,
  44673. showTooltip,
  44674. tooltipVisible,
  44675. wrapperStyle,
  44676. formatValue,
  44677. handleMouseEnter,
  44678. handleMouseLeave,
  44679. onButtonDown,
  44680. onKeyDown,
  44681. setPosition
  44682. } = useSliderButton(props, initData, emit2);
  44683. const { hovering, dragging } = toRefs(initData);
  44684. expose({
  44685. onButtonDown,
  44686. onKeyDown,
  44687. setPosition,
  44688. hovering,
  44689. dragging
  44690. });
  44691. return (_ctx, _cache) => {
  44692. return openBlock(), createElementBlock("div", {
  44693. ref_key: "button",
  44694. ref: button,
  44695. class: normalizeClass([unref(ns).e("button-wrapper"), { hover: unref(hovering), dragging: unref(dragging) }]),
  44696. style: normalizeStyle(unref(wrapperStyle)),
  44697. tabindex: unref(disabled) ? -1 : 0,
  44698. onMouseenter: _cache[0] || (_cache[0] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  44699. onMouseleave: _cache[1] || (_cache[1] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args)),
  44700. onMousedown: _cache[2] || (_cache[2] = (...args) => unref(onButtonDown) && unref(onButtonDown)(...args)),
  44701. onTouchstart: _cache[3] || (_cache[3] = (...args) => unref(onButtonDown) && unref(onButtonDown)(...args)),
  44702. onFocus: _cache[4] || (_cache[4] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  44703. onBlur: _cache[5] || (_cache[5] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args)),
  44704. onKeydown: _cache[6] || (_cache[6] = (...args) => unref(onKeyDown) && unref(onKeyDown)(...args))
  44705. }, [
  44706. createVNode(unref(ElTooltip), {
  44707. ref_key: "tooltip",
  44708. ref: tooltip,
  44709. visible: unref(tooltipVisible),
  44710. placement: _ctx.placement,
  44711. "fallback-placements": ["top", "bottom", "right", "left"],
  44712. "stop-popper-mouse-event": false,
  44713. "popper-class": _ctx.tooltipClass,
  44714. disabled: !unref(showTooltip),
  44715. persistent: ""
  44716. }, {
  44717. content: withCtx(() => [
  44718. createBaseVNode("span", null, toDisplayString(unref(formatValue)), 1)
  44719. ]),
  44720. default: withCtx(() => [
  44721. createBaseVNode("div", {
  44722. class: normalizeClass([unref(ns).e("button"), { hover: unref(hovering), dragging: unref(dragging) }])
  44723. }, null, 2)
  44724. ]),
  44725. _: 1
  44726. }, 8, ["visible", "placement", "popper-class", "disabled"])
  44727. ], 46, _hoisted_1$h);
  44728. };
  44729. }
  44730. });
  44731. var SliderButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]);
  44732. const sliderMarkerProps = buildProps({
  44733. mark: {
  44734. type: definePropType([String, Object]),
  44735. default: void 0
  44736. }
  44737. });
  44738. var SliderMarker = /* @__PURE__ */ defineComponent({
  44739. name: "ElSliderMarker",
  44740. props: sliderMarkerProps,
  44741. setup(props) {
  44742. const ns = useNamespace("slider");
  44743. const label = computed(() => {
  44744. return isString$1(props.mark) ? props.mark : props.mark.label;
  44745. });
  44746. const style = computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  44747. return () => h$1("div", {
  44748. class: ns.e("marks-text"),
  44749. style: style.value
  44750. }, label.value);
  44751. }
  44752. });
  44753. const _hoisted_1$g = ["id", "role", "aria-label", "aria-labelledby"];
  44754. const _hoisted_2$b = { key: 1 };
  44755. const __default__$r = /* @__PURE__ */ defineComponent({
  44756. name: "ElSlider"
  44757. });
  44758. const _sfc_main$C = /* @__PURE__ */ defineComponent({
  44759. ...__default__$r,
  44760. props: sliderProps,
  44761. emits: sliderEmits,
  44762. setup(__props, { expose, emit: emit2 }) {
  44763. const props = __props;
  44764. const ns = useNamespace("slider");
  44765. const { t } = useLocale();
  44766. const initData = reactive({
  44767. firstValue: 0,
  44768. secondValue: 0,
  44769. oldValue: 0,
  44770. dragging: false,
  44771. sliderSize: 1
  44772. });
  44773. const {
  44774. elFormItem,
  44775. slider,
  44776. firstButton,
  44777. secondButton,
  44778. sliderDisabled,
  44779. minValue,
  44780. maxValue,
  44781. runwayStyle,
  44782. barStyle,
  44783. resetSize,
  44784. emitChange,
  44785. onSliderWrapperPrevent,
  44786. onSliderClick,
  44787. onSliderDown,
  44788. setFirstValue,
  44789. setSecondValue
  44790. } = useSlide(props, initData, emit2);
  44791. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  44792. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  44793. formItemContext: elFormItem
  44794. });
  44795. const sliderWrapperSize = useFormSize();
  44796. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  44797. const groupLabel = computed(() => {
  44798. return props.label || t("el.slider.defaultLabel", {
  44799. min: props.min,
  44800. max: props.max
  44801. });
  44802. });
  44803. const firstButtonLabel = computed(() => {
  44804. if (props.range) {
  44805. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  44806. } else {
  44807. return groupLabel.value;
  44808. }
  44809. });
  44810. const firstValueText = computed(() => {
  44811. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  44812. });
  44813. const secondButtonLabel = computed(() => {
  44814. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  44815. });
  44816. const secondValueText = computed(() => {
  44817. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  44818. });
  44819. const sliderKls = computed(() => [
  44820. ns.b(),
  44821. ns.m(sliderWrapperSize.value),
  44822. ns.is("vertical", props.vertical),
  44823. { [ns.m("with-input")]: props.showInput }
  44824. ]);
  44825. const markList = useMarks(props);
  44826. useWatch(props, initData, minValue, maxValue, emit2, elFormItem);
  44827. const precision = computed(() => {
  44828. const precisions = [props.min, props.max, props.step].map((item) => {
  44829. const decimal = `${item}`.split(".")[1];
  44830. return decimal ? decimal.length : 0;
  44831. });
  44832. return Math.max.apply(null, precisions);
  44833. });
  44834. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  44835. const { firstValue, secondValue, sliderSize } = toRefs(initData);
  44836. const updateDragging = (val) => {
  44837. initData.dragging = val;
  44838. };
  44839. provide(sliderContextKey, {
  44840. ...toRefs(props),
  44841. sliderSize,
  44842. disabled: sliderDisabled,
  44843. precision,
  44844. emitChange,
  44845. resetSize,
  44846. updateDragging
  44847. });
  44848. expose({
  44849. onSliderClick
  44850. });
  44851. return (_ctx, _cache) => {
  44852. var _a2, _b;
  44853. return openBlock(), createElementBlock("div", {
  44854. id: _ctx.range ? unref(inputId) : void 0,
  44855. ref_key: "sliderWrapper",
  44856. ref: sliderWrapper,
  44857. class: normalizeClass(unref(sliderKls)),
  44858. role: _ctx.range ? "group" : void 0,
  44859. "aria-label": _ctx.range && !unref(isLabeledByFormItem) ? unref(groupLabel) : void 0,
  44860. "aria-labelledby": _ctx.range && unref(isLabeledByFormItem) ? (_a2 = unref(elFormItem)) == null ? void 0 : _a2.labelId : void 0,
  44861. onTouchstart: _cache[2] || (_cache[2] = (...args) => unref(onSliderWrapperPrevent) && unref(onSliderWrapperPrevent)(...args)),
  44862. onTouchmove: _cache[3] || (_cache[3] = (...args) => unref(onSliderWrapperPrevent) && unref(onSliderWrapperPrevent)(...args))
  44863. }, [
  44864. createBaseVNode("div", {
  44865. ref_key: "slider",
  44866. ref: slider,
  44867. class: normalizeClass([
  44868. unref(ns).e("runway"),
  44869. { "show-input": _ctx.showInput && !_ctx.range },
  44870. unref(ns).is("disabled", unref(sliderDisabled))
  44871. ]),
  44872. style: normalizeStyle(unref(runwayStyle)),
  44873. onMousedown: _cache[0] || (_cache[0] = (...args) => unref(onSliderDown) && unref(onSliderDown)(...args)),
  44874. onTouchstart: _cache[1] || (_cache[1] = (...args) => unref(onSliderDown) && unref(onSliderDown)(...args))
  44875. }, [
  44876. createBaseVNode("div", {
  44877. class: normalizeClass(unref(ns).e("bar")),
  44878. style: normalizeStyle(unref(barStyle))
  44879. }, null, 6),
  44880. createVNode(SliderButton, {
  44881. id: !_ctx.range ? unref(inputId) : void 0,
  44882. ref_key: "firstButton",
  44883. ref: firstButton,
  44884. "model-value": unref(firstValue),
  44885. vertical: _ctx.vertical,
  44886. "tooltip-class": _ctx.tooltipClass,
  44887. placement: _ctx.placement,
  44888. role: "slider",
  44889. "aria-label": _ctx.range || !unref(isLabeledByFormItem) ? unref(firstButtonLabel) : void 0,
  44890. "aria-labelledby": !_ctx.range && unref(isLabeledByFormItem) ? (_b = unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  44891. "aria-valuemin": _ctx.min,
  44892. "aria-valuemax": _ctx.range ? unref(secondValue) : _ctx.max,
  44893. "aria-valuenow": unref(firstValue),
  44894. "aria-valuetext": unref(firstValueText),
  44895. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  44896. "aria-disabled": unref(sliderDisabled),
  44897. "onUpdate:modelValue": unref(setFirstValue)
  44898. }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]),
  44899. _ctx.range ? (openBlock(), createBlock(SliderButton, {
  44900. key: 0,
  44901. ref_key: "secondButton",
  44902. ref: secondButton,
  44903. "model-value": unref(secondValue),
  44904. vertical: _ctx.vertical,
  44905. "tooltip-class": _ctx.tooltipClass,
  44906. placement: _ctx.placement,
  44907. role: "slider",
  44908. "aria-label": unref(secondButtonLabel),
  44909. "aria-valuemin": unref(firstValue),
  44910. "aria-valuemax": _ctx.max,
  44911. "aria-valuenow": unref(secondValue),
  44912. "aria-valuetext": unref(secondValueText),
  44913. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  44914. "aria-disabled": unref(sliderDisabled),
  44915. "onUpdate:modelValue": unref(setSecondValue)
  44916. }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  44917. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
  44918. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(stops), (item, key) => {
  44919. return openBlock(), createElementBlock("div", {
  44920. key,
  44921. class: normalizeClass(unref(ns).e("stop")),
  44922. style: normalizeStyle(unref(getStopStyle)(item))
  44923. }, null, 6);
  44924. }), 128))
  44925. ])) : createCommentVNode("v-if", true),
  44926. unref(markList).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  44927. createBaseVNode("div", null, [
  44928. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  44929. return openBlock(), createElementBlock("div", {
  44930. key,
  44931. style: normalizeStyle(unref(getStopStyle)(item.position)),
  44932. class: normalizeClass([unref(ns).e("stop"), unref(ns).e("marks-stop")])
  44933. }, null, 6);
  44934. }), 128))
  44935. ]),
  44936. createBaseVNode("div", {
  44937. class: normalizeClass(unref(ns).e("marks"))
  44938. }, [
  44939. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  44940. return openBlock(), createBlock(unref(SliderMarker), {
  44941. key,
  44942. mark: item.mark,
  44943. style: normalizeStyle(unref(getStopStyle)(item.position))
  44944. }, null, 8, ["mark", "style"]);
  44945. }), 128))
  44946. ], 2)
  44947. ], 64)) : createCommentVNode("v-if", true)
  44948. ], 38),
  44949. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(unref(ElInputNumber), {
  44950. key: 0,
  44951. ref: "input",
  44952. "model-value": unref(firstValue),
  44953. class: normalizeClass(unref(ns).e("input")),
  44954. step: _ctx.step,
  44955. disabled: unref(sliderDisabled),
  44956. controls: _ctx.showInputControls,
  44957. min: _ctx.min,
  44958. max: _ctx.max,
  44959. debounce: _ctx.debounce,
  44960. size: unref(sliderInputSize),
  44961. "onUpdate:modelValue": unref(setFirstValue),
  44962. onChange: unref(emitChange)
  44963. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  44964. ], 42, _hoisted_1$g);
  44965. };
  44966. }
  44967. });
  44968. var Slider = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/slider.vue"]]);
  44969. const ElSlider = withInstall(Slider);
  44970. const spaceItemProps = buildProps({
  44971. prefixCls: {
  44972. type: String
  44973. }
  44974. });
  44975. const SpaceItem = /* @__PURE__ */ defineComponent({
  44976. name: "ElSpaceItem",
  44977. props: spaceItemProps,
  44978. setup(props, { slots }) {
  44979. const ns = useNamespace("space");
  44980. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  44981. return () => h$1("div", { class: classes.value }, renderSlot(slots, "default"));
  44982. }
  44983. });
  44984. const SIZE_MAP = {
  44985. small: 8,
  44986. default: 12,
  44987. large: 16
  44988. };
  44989. function useSpace(props) {
  44990. const ns = useNamespace("space");
  44991. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  44992. const horizontalSize = ref(0);
  44993. const verticalSize = ref(0);
  44994. const containerStyle = computed(() => {
  44995. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  44996. const alignment = {
  44997. alignItems: props.alignment
  44998. };
  44999. return [wrapKls, alignment, props.style];
  45000. });
  45001. const itemStyle = computed(() => {
  45002. const itemBaseStyle = {
  45003. paddingBottom: `${verticalSize.value}px`,
  45004. marginRight: `${horizontalSize.value}px`
  45005. };
  45006. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  45007. return [itemBaseStyle, fillStyle];
  45008. });
  45009. watchEffect(() => {
  45010. const { size: size2 = "small", wrap, direction: dir, fill } = props;
  45011. if (isArray$3(size2)) {
  45012. const [h2 = 0, v2 = 0] = size2;
  45013. horizontalSize.value = h2;
  45014. verticalSize.value = v2;
  45015. } else {
  45016. let val;
  45017. if (isNumber(size2)) {
  45018. val = size2;
  45019. } else {
  45020. val = SIZE_MAP[size2 || "small"] || SIZE_MAP.small;
  45021. }
  45022. if ((wrap || fill) && dir === "horizontal") {
  45023. horizontalSize.value = verticalSize.value = val;
  45024. } else {
  45025. if (dir === "horizontal") {
  45026. horizontalSize.value = val;
  45027. verticalSize.value = 0;
  45028. } else {
  45029. verticalSize.value = val;
  45030. horizontalSize.value = 0;
  45031. }
  45032. }
  45033. }
  45034. });
  45035. return {
  45036. classes,
  45037. containerStyle,
  45038. itemStyle
  45039. };
  45040. }
  45041. const spaceProps = buildProps({
  45042. direction: {
  45043. type: String,
  45044. values: ["horizontal", "vertical"],
  45045. default: "horizontal"
  45046. },
  45047. class: {
  45048. type: definePropType([
  45049. String,
  45050. Object,
  45051. Array
  45052. ]),
  45053. default: ""
  45054. },
  45055. style: {
  45056. type: definePropType([String, Array, Object]),
  45057. default: ""
  45058. },
  45059. alignment: {
  45060. type: definePropType(String),
  45061. default: "center"
  45062. },
  45063. prefixCls: {
  45064. type: String
  45065. },
  45066. spacer: {
  45067. type: definePropType([Object, String, Number, Array]),
  45068. default: null,
  45069. validator: (val) => isVNode(val) || isNumber(val) || isString$1(val)
  45070. },
  45071. wrap: Boolean,
  45072. fill: Boolean,
  45073. fillRatio: {
  45074. type: Number,
  45075. default: 100
  45076. },
  45077. size: {
  45078. type: [String, Array, Number],
  45079. values: componentSizes,
  45080. validator: (val) => {
  45081. return isNumber(val) || isArray$3(val) && val.length === 2 && val.every(isNumber);
  45082. }
  45083. }
  45084. });
  45085. const Space = /* @__PURE__ */ defineComponent({
  45086. name: "ElSpace",
  45087. props: spaceProps,
  45088. setup(props, { slots }) {
  45089. const { classes, containerStyle, itemStyle } = useSpace(props);
  45090. function extractChildren(children, parentKey = "", extractedChildren = []) {
  45091. const { prefixCls } = props;
  45092. children.forEach((child, loopKey) => {
  45093. if (isFragment(child)) {
  45094. if (isArray$3(child.children)) {
  45095. child.children.forEach((nested, key) => {
  45096. if (isFragment(nested) && isArray$3(nested.children)) {
  45097. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  45098. } else {
  45099. extractedChildren.push(createVNode(SpaceItem, {
  45100. style: itemStyle.value,
  45101. prefixCls,
  45102. key: `nested-${parentKey + key}`
  45103. }, {
  45104. default: () => [nested]
  45105. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  45106. }
  45107. });
  45108. }
  45109. } else if (isValidElementNode(child)) {
  45110. extractedChildren.push(createVNode(SpaceItem, {
  45111. style: itemStyle.value,
  45112. prefixCls,
  45113. key: `LoopKey${parentKey + loopKey}`
  45114. }, {
  45115. default: () => [child]
  45116. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  45117. }
  45118. });
  45119. return extractedChildren;
  45120. }
  45121. return () => {
  45122. var _a2;
  45123. const { spacer, direction: direction2 } = props;
  45124. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  45125. if (((_a2 = children.children) != null ? _a2 : []).length === 0)
  45126. return null;
  45127. if (isArray$3(children.children)) {
  45128. let extractedChildren = extractChildren(children.children);
  45129. if (spacer) {
  45130. const len = extractedChildren.length - 1;
  45131. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  45132. const children2 = [...acc, child];
  45133. if (idx !== len) {
  45134. children2.push(createVNode("span", {
  45135. style: [
  45136. itemStyle.value,
  45137. direction2 === "vertical" ? "width: 100%" : null
  45138. ],
  45139. key: idx
  45140. }, [
  45141. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  45142. ], PatchFlags.STYLE));
  45143. }
  45144. return children2;
  45145. }, []);
  45146. }
  45147. return createVNode("div", {
  45148. class: classes.value,
  45149. style: containerStyle.value
  45150. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  45151. }
  45152. return children.children;
  45153. };
  45154. }
  45155. });
  45156. const ElSpace = withInstall(Space);
  45157. const statisticProps = buildProps({
  45158. decimalSeparator: {
  45159. type: String,
  45160. default: "."
  45161. },
  45162. groupSeparator: {
  45163. type: String,
  45164. default: ","
  45165. },
  45166. precision: {
  45167. type: Number,
  45168. default: 0
  45169. },
  45170. formatter: Function,
  45171. value: {
  45172. type: definePropType([Number, Object]),
  45173. default: 0
  45174. },
  45175. prefix: String,
  45176. suffix: String,
  45177. title: String,
  45178. valueStyle: {
  45179. type: definePropType([String, Object, Array])
  45180. }
  45181. });
  45182. const __default__$q = /* @__PURE__ */ defineComponent({
  45183. name: "ElStatistic"
  45184. });
  45185. const _sfc_main$B = /* @__PURE__ */ defineComponent({
  45186. ...__default__$q,
  45187. props: statisticProps,
  45188. setup(__props, { expose }) {
  45189. const props = __props;
  45190. const ns = useNamespace("statistic");
  45191. const displayValue = computed(() => {
  45192. const { value, formatter: formatter2, precision, decimalSeparator, groupSeparator } = props;
  45193. if (isFunction$2(formatter2))
  45194. return formatter2(value);
  45195. if (!isNumber(value))
  45196. return value;
  45197. let [integer2, decimal = ""] = String(value).split(".");
  45198. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  45199. integer2 = integer2.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  45200. return [integer2, decimal].join(decimal ? decimalSeparator : "");
  45201. });
  45202. expose({
  45203. displayValue
  45204. });
  45205. return (_ctx, _cache) => {
  45206. return openBlock(), createElementBlock("div", {
  45207. class: normalizeClass(unref(ns).b())
  45208. }, [
  45209. _ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("div", {
  45210. key: 0,
  45211. class: normalizeClass(unref(ns).e("head"))
  45212. }, [
  45213. renderSlot(_ctx.$slots, "title", {}, () => [
  45214. createTextVNode(toDisplayString(_ctx.title), 1)
  45215. ])
  45216. ], 2)) : createCommentVNode("v-if", true),
  45217. createBaseVNode("div", {
  45218. class: normalizeClass(unref(ns).e("content"))
  45219. }, [
  45220. _ctx.$slots.prefix || _ctx.prefix ? (openBlock(), createElementBlock("div", {
  45221. key: 0,
  45222. class: normalizeClass(unref(ns).e("prefix"))
  45223. }, [
  45224. renderSlot(_ctx.$slots, "prefix", {}, () => [
  45225. createBaseVNode("span", null, toDisplayString(_ctx.prefix), 1)
  45226. ])
  45227. ], 2)) : createCommentVNode("v-if", true),
  45228. createBaseVNode("span", {
  45229. class: normalizeClass(unref(ns).e("number")),
  45230. style: normalizeStyle(_ctx.valueStyle)
  45231. }, toDisplayString(unref(displayValue)), 7),
  45232. _ctx.$slots.suffix || _ctx.suffix ? (openBlock(), createElementBlock("div", {
  45233. key: 1,
  45234. class: normalizeClass(unref(ns).e("suffix"))
  45235. }, [
  45236. renderSlot(_ctx.$slots, "suffix", {}, () => [
  45237. createBaseVNode("span", null, toDisplayString(_ctx.suffix), 1)
  45238. ])
  45239. ], 2)) : createCommentVNode("v-if", true)
  45240. ], 2)
  45241. ], 2);
  45242. };
  45243. }
  45244. });
  45245. var Statistic = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/statistic/src/statistic.vue"]]);
  45246. const ElStatistic = withInstall(Statistic);
  45247. const countdownProps = buildProps({
  45248. format: {
  45249. type: String,
  45250. default: "HH:mm:ss"
  45251. },
  45252. prefix: String,
  45253. suffix: String,
  45254. title: String,
  45255. value: {
  45256. type: definePropType([Number, Object]),
  45257. default: 0
  45258. },
  45259. valueStyle: {
  45260. type: definePropType([String, Object, Array])
  45261. }
  45262. });
  45263. const countdownEmits = {
  45264. finish: () => true,
  45265. [CHANGE_EVENT]: (value) => isNumber(value)
  45266. };
  45267. const timeUnits = [
  45268. ["Y", 1e3 * 60 * 60 * 24 * 365],
  45269. ["M", 1e3 * 60 * 60 * 24 * 30],
  45270. ["D", 1e3 * 60 * 60 * 24],
  45271. ["H", 1e3 * 60 * 60],
  45272. ["m", 1e3 * 60],
  45273. ["s", 1e3],
  45274. ["S", 1]
  45275. ];
  45276. const getTime = (value) => {
  45277. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  45278. };
  45279. const formatTime$1 = (timestamp, format2) => {
  45280. let timeLeft = timestamp;
  45281. const escapeRegex = /\[([^\]]*)]/g;
  45282. const replacedText = timeUnits.reduce((current, [name, unit2]) => {
  45283. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  45284. if (replaceRegex.test(current)) {
  45285. const value = Math.floor(timeLeft / unit2);
  45286. timeLeft -= value * unit2;
  45287. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  45288. }
  45289. return current;
  45290. }, format2);
  45291. return replacedText.replace(escapeRegex, "$1");
  45292. };
  45293. const __default__$p = /* @__PURE__ */ defineComponent({
  45294. name: "ElCountdown"
  45295. });
  45296. const _sfc_main$A = /* @__PURE__ */ defineComponent({
  45297. ...__default__$p,
  45298. props: countdownProps,
  45299. emits: countdownEmits,
  45300. setup(__props, { expose, emit: emit2 }) {
  45301. const props = __props;
  45302. let timer;
  45303. const rawValue = ref(getTime(props.value) - Date.now());
  45304. const displayValue = computed(() => formatTime$1(rawValue.value, props.format));
  45305. const formatter2 = (val) => formatTime$1(val, props.format);
  45306. const stopTimer = () => {
  45307. if (timer) {
  45308. cAF(timer);
  45309. timer = void 0;
  45310. }
  45311. };
  45312. const startTimer = () => {
  45313. const timestamp = getTime(props.value);
  45314. const frameFunc = () => {
  45315. let diff = timestamp - Date.now();
  45316. emit2("change", diff);
  45317. if (diff <= 0) {
  45318. diff = 0;
  45319. stopTimer();
  45320. emit2("finish");
  45321. } else {
  45322. timer = rAF(frameFunc);
  45323. }
  45324. rawValue.value = diff;
  45325. };
  45326. timer = rAF(frameFunc);
  45327. };
  45328. watch(() => [props.value, props.format], () => {
  45329. stopTimer();
  45330. startTimer();
  45331. }, {
  45332. immediate: true
  45333. });
  45334. onBeforeUnmount(() => {
  45335. stopTimer();
  45336. });
  45337. expose({
  45338. displayValue
  45339. });
  45340. return (_ctx, _cache) => {
  45341. return openBlock(), createBlock(unref(ElStatistic), {
  45342. value: rawValue.value,
  45343. title: _ctx.title,
  45344. prefix: _ctx.prefix,
  45345. suffix: _ctx.suffix,
  45346. "value-style": _ctx.valueStyle,
  45347. formatter: formatter2
  45348. }, createSlots({ _: 2 }, [
  45349. renderList(_ctx.$slots, (_2, name) => {
  45350. return {
  45351. name,
  45352. fn: withCtx(() => [
  45353. renderSlot(_ctx.$slots, name)
  45354. ])
  45355. };
  45356. })
  45357. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  45358. };
  45359. }
  45360. });
  45361. var Countdown = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/countdown/src/countdown.vue"]]);
  45362. const ElCountdown = withInstall(Countdown);
  45363. const stepsProps = buildProps({
  45364. space: {
  45365. type: [Number, String],
  45366. default: ""
  45367. },
  45368. active: {
  45369. type: Number,
  45370. default: 0
  45371. },
  45372. direction: {
  45373. type: String,
  45374. default: "horizontal",
  45375. values: ["horizontal", "vertical"]
  45376. },
  45377. alignCenter: {
  45378. type: Boolean
  45379. },
  45380. simple: {
  45381. type: Boolean
  45382. },
  45383. finishStatus: {
  45384. type: String,
  45385. values: ["wait", "process", "finish", "error", "success"],
  45386. default: "finish"
  45387. },
  45388. processStatus: {
  45389. type: String,
  45390. values: ["wait", "process", "finish", "error", "success"],
  45391. default: "process"
  45392. }
  45393. });
  45394. const stepsEmits = {
  45395. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  45396. };
  45397. const __default__$o = /* @__PURE__ */ defineComponent({
  45398. name: "ElSteps"
  45399. });
  45400. const _sfc_main$z = /* @__PURE__ */ defineComponent({
  45401. ...__default__$o,
  45402. props: stepsProps,
  45403. emits: stepsEmits,
  45404. setup(__props, { emit: emit2 }) {
  45405. const props = __props;
  45406. const ns = useNamespace("steps");
  45407. const {
  45408. children: steps,
  45409. addChild: addStep,
  45410. removeChild: removeStep
  45411. } = useOrderedChildren(getCurrentInstance(), "ElStep");
  45412. watch(steps, () => {
  45413. steps.value.forEach((instance, index2) => {
  45414. instance.setIndex(index2);
  45415. });
  45416. });
  45417. provide("ElSteps", { props, steps, addStep, removeStep });
  45418. watch(() => props.active, (newVal, oldVal) => {
  45419. emit2(CHANGE_EVENT, newVal, oldVal);
  45420. });
  45421. return (_ctx, _cache) => {
  45422. return openBlock(), createElementBlock("div", {
  45423. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  45424. }, [
  45425. renderSlot(_ctx.$slots, "default")
  45426. ], 2);
  45427. };
  45428. }
  45429. });
  45430. var Steps = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/steps/src/steps.vue"]]);
  45431. const stepProps = buildProps({
  45432. title: {
  45433. type: String,
  45434. default: ""
  45435. },
  45436. icon: {
  45437. type: iconPropType
  45438. },
  45439. description: {
  45440. type: String,
  45441. default: ""
  45442. },
  45443. status: {
  45444. type: String,
  45445. values: ["", "wait", "process", "finish", "error", "success"],
  45446. default: ""
  45447. }
  45448. });
  45449. const __default__$n = /* @__PURE__ */ defineComponent({
  45450. name: "ElStep"
  45451. });
  45452. const _sfc_main$y = /* @__PURE__ */ defineComponent({
  45453. ...__default__$n,
  45454. props: stepProps,
  45455. setup(__props) {
  45456. const props = __props;
  45457. const ns = useNamespace("step");
  45458. const index2 = ref(-1);
  45459. const lineStyle = ref({});
  45460. const internalStatus = ref("");
  45461. const parent = inject("ElSteps");
  45462. const currentInstance2 = getCurrentInstance();
  45463. onMounted(() => {
  45464. watch([
  45465. () => parent.props.active,
  45466. () => parent.props.processStatus,
  45467. () => parent.props.finishStatus
  45468. ], ([active]) => {
  45469. updateStatus(active);
  45470. }, { immediate: true });
  45471. });
  45472. onBeforeUnmount(() => {
  45473. parent.removeStep(stepItemState.uid);
  45474. });
  45475. const currentStatus = computed(() => {
  45476. return props.status || internalStatus.value;
  45477. });
  45478. const prevStatus = computed(() => {
  45479. const prevStep = parent.steps.value[index2.value - 1];
  45480. return prevStep ? prevStep.currentStatus : "wait";
  45481. });
  45482. const isCenter = computed(() => {
  45483. return parent.props.alignCenter;
  45484. });
  45485. const isVertical = computed(() => {
  45486. return parent.props.direction === "vertical";
  45487. });
  45488. const isSimple = computed(() => {
  45489. return parent.props.simple;
  45490. });
  45491. const stepsCount = computed(() => {
  45492. return parent.steps.value.length;
  45493. });
  45494. const isLast = computed(() => {
  45495. var _a2;
  45496. return ((_a2 = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a2.uid) === (currentInstance2 == null ? void 0 : currentInstance2.uid);
  45497. });
  45498. const space = computed(() => {
  45499. return isSimple.value ? "" : parent.props.space;
  45500. });
  45501. const containerKls = computed(() => {
  45502. return [
  45503. ns.b(),
  45504. ns.is(isSimple.value ? "simple" : parent.props.direction),
  45505. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  45506. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  45507. ];
  45508. });
  45509. const style = computed(() => {
  45510. const style2 = {
  45511. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  45512. };
  45513. if (isVertical.value)
  45514. return style2;
  45515. if (isLast.value) {
  45516. style2.maxWidth = `${100 / stepsCount.value}%`;
  45517. }
  45518. return style2;
  45519. });
  45520. const setIndex = (val) => {
  45521. index2.value = val;
  45522. };
  45523. const calcProgress = (status) => {
  45524. const isWait = status === "wait";
  45525. const style2 = {
  45526. transitionDelay: `${isWait ? "-" : ""}${150 * index2.value}ms`
  45527. };
  45528. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  45529. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  45530. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  45531. lineStyle.value = style2;
  45532. };
  45533. const updateStatus = (activeIndex) => {
  45534. if (activeIndex > index2.value) {
  45535. internalStatus.value = parent.props.finishStatus;
  45536. } else if (activeIndex === index2.value && prevStatus.value !== "error") {
  45537. internalStatus.value = parent.props.processStatus;
  45538. } else {
  45539. internalStatus.value = "wait";
  45540. }
  45541. const prevChild = parent.steps.value[index2.value - 1];
  45542. if (prevChild)
  45543. prevChild.calcProgress(internalStatus.value);
  45544. };
  45545. const stepItemState = reactive({
  45546. uid: currentInstance2.uid,
  45547. currentStatus,
  45548. setIndex,
  45549. calcProgress
  45550. });
  45551. parent.addStep(stepItemState);
  45552. return (_ctx, _cache) => {
  45553. return openBlock(), createElementBlock("div", {
  45554. style: normalizeStyle(unref(style)),
  45555. class: normalizeClass(unref(containerKls))
  45556. }, [
  45557. createCommentVNode(" icon & line "),
  45558. createBaseVNode("div", {
  45559. class: normalizeClass([unref(ns).e("head"), unref(ns).is(unref(currentStatus))])
  45560. }, [
  45561. !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  45562. key: 0,
  45563. class: normalizeClass(unref(ns).e("line"))
  45564. }, [
  45565. createBaseVNode("i", {
  45566. class: normalizeClass(unref(ns).e("line-inner")),
  45567. style: normalizeStyle(lineStyle.value)
  45568. }, null, 6)
  45569. ], 2)) : createCommentVNode("v-if", true),
  45570. createBaseVNode("div", {
  45571. class: normalizeClass([unref(ns).e("icon"), unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  45572. }, [
  45573. renderSlot(_ctx.$slots, "icon", {}, () => [
  45574. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  45575. key: 0,
  45576. class: normalizeClass(unref(ns).e("icon-inner"))
  45577. }, {
  45578. default: withCtx(() => [
  45579. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  45580. ]),
  45581. _: 1
  45582. }, 8, ["class"])) : unref(currentStatus) === "success" ? (openBlock(), createBlock(unref(ElIcon), {
  45583. key: 1,
  45584. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  45585. }, {
  45586. default: withCtx(() => [
  45587. createVNode(unref(check_default))
  45588. ]),
  45589. _: 1
  45590. }, 8, ["class"])) : unref(currentStatus) === "error" ? (openBlock(), createBlock(unref(ElIcon), {
  45591. key: 2,
  45592. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  45593. }, {
  45594. default: withCtx(() => [
  45595. createVNode(unref(close_default))
  45596. ]),
  45597. _: 1
  45598. }, 8, ["class"])) : !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  45599. key: 3,
  45600. class: normalizeClass(unref(ns).e("icon-inner"))
  45601. }, toDisplayString(index2.value + 1), 3)) : createCommentVNode("v-if", true)
  45602. ])
  45603. ], 2)
  45604. ], 2),
  45605. createCommentVNode(" title & description "),
  45606. createBaseVNode("div", {
  45607. class: normalizeClass(unref(ns).e("main"))
  45608. }, [
  45609. createBaseVNode("div", {
  45610. class: normalizeClass([unref(ns).e("title"), unref(ns).is(unref(currentStatus))])
  45611. }, [
  45612. renderSlot(_ctx.$slots, "title", {}, () => [
  45613. createTextVNode(toDisplayString(_ctx.title), 1)
  45614. ])
  45615. ], 2),
  45616. unref(isSimple) ? (openBlock(), createElementBlock("div", {
  45617. key: 0,
  45618. class: normalizeClass(unref(ns).e("arrow"))
  45619. }, null, 2)) : (openBlock(), createElementBlock("div", {
  45620. key: 1,
  45621. class: normalizeClass([unref(ns).e("description"), unref(ns).is(unref(currentStatus))])
  45622. }, [
  45623. renderSlot(_ctx.$slots, "description", {}, () => [
  45624. createTextVNode(toDisplayString(_ctx.description), 1)
  45625. ])
  45626. ], 2))
  45627. ], 2)
  45628. ], 6);
  45629. };
  45630. }
  45631. });
  45632. var Step = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/steps/src/item.vue"]]);
  45633. const ElSteps = withInstall(Steps, {
  45634. Step
  45635. });
  45636. const ElStep = withNoopInstall(Step);
  45637. const switchProps = buildProps({
  45638. modelValue: {
  45639. type: [Boolean, String, Number],
  45640. default: false
  45641. },
  45642. disabled: {
  45643. type: Boolean,
  45644. default: false
  45645. },
  45646. loading: {
  45647. type: Boolean,
  45648. default: false
  45649. },
  45650. size: {
  45651. type: String,
  45652. validator: isValidComponentSize
  45653. },
  45654. width: {
  45655. type: [String, Number],
  45656. default: ""
  45657. },
  45658. inlinePrompt: {
  45659. type: Boolean,
  45660. default: false
  45661. },
  45662. inactiveActionIcon: {
  45663. type: iconPropType
  45664. },
  45665. activeActionIcon: {
  45666. type: iconPropType
  45667. },
  45668. activeIcon: {
  45669. type: iconPropType
  45670. },
  45671. inactiveIcon: {
  45672. type: iconPropType
  45673. },
  45674. activeText: {
  45675. type: String,
  45676. default: ""
  45677. },
  45678. inactiveText: {
  45679. type: String,
  45680. default: ""
  45681. },
  45682. activeValue: {
  45683. type: [Boolean, String, Number],
  45684. default: true
  45685. },
  45686. inactiveValue: {
  45687. type: [Boolean, String, Number],
  45688. default: false
  45689. },
  45690. activeColor: {
  45691. type: String,
  45692. default: ""
  45693. },
  45694. inactiveColor: {
  45695. type: String,
  45696. default: ""
  45697. },
  45698. borderColor: {
  45699. type: String,
  45700. default: ""
  45701. },
  45702. name: {
  45703. type: String,
  45704. default: ""
  45705. },
  45706. validateEvent: {
  45707. type: Boolean,
  45708. default: true
  45709. },
  45710. beforeChange: {
  45711. type: definePropType(Function)
  45712. },
  45713. id: String,
  45714. tabindex: {
  45715. type: [String, Number]
  45716. },
  45717. value: {
  45718. type: [Boolean, String, Number],
  45719. default: false
  45720. },
  45721. label: {
  45722. type: String,
  45723. default: void 0
  45724. }
  45725. });
  45726. const switchEmits = {
  45727. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  45728. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  45729. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  45730. };
  45731. const _hoisted_1$f = ["onClick"];
  45732. const _hoisted_2$a = ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  45733. const _hoisted_3$4 = ["aria-hidden"];
  45734. const _hoisted_4$2 = ["aria-hidden"];
  45735. const _hoisted_5$1 = ["aria-hidden"];
  45736. const COMPONENT_NAME$8 = "ElSwitch";
  45737. const __default__$m = /* @__PURE__ */ defineComponent({
  45738. name: COMPONENT_NAME$8
  45739. });
  45740. const _sfc_main$x = /* @__PURE__ */ defineComponent({
  45741. ...__default__$m,
  45742. props: switchProps,
  45743. emits: switchEmits,
  45744. setup(__props, { expose, emit: emit2 }) {
  45745. const props = __props;
  45746. const vm = getCurrentInstance();
  45747. const { formItem } = useFormItem();
  45748. const switchSize = useFormSize();
  45749. const ns = useNamespace("switch");
  45750. const useBatchDeprecated = (list) => {
  45751. list.forEach((param) => {
  45752. useDeprecated({
  45753. from: param[0],
  45754. replacement: param[1],
  45755. scope: COMPONENT_NAME$8,
  45756. version: "2.3.0",
  45757. ref: "https://element-plus.org/en-US/component/switch.html#attributes",
  45758. type: "Attribute"
  45759. }, computed(() => {
  45760. var _a2;
  45761. return !!((_a2 = vm.vnode.props) == null ? void 0 : _a2[param[2]]);
  45762. }));
  45763. });
  45764. };
  45765. useBatchDeprecated([
  45766. ['"value"', '"model-value" or "v-model"', "value"],
  45767. ['"active-color"', "CSS var `--el-switch-on-color`", "activeColor"],
  45768. ['"inactive-color"', "CSS var `--el-switch-off-color`", "inactiveColor"],
  45769. ['"border-color"', "CSS var `--el-switch-border-color`", "borderColor"]
  45770. ]);
  45771. const { inputId } = useFormItemInputId(props, {
  45772. formItemContext: formItem
  45773. });
  45774. const switchDisabled = useFormDisabled(computed(() => props.loading));
  45775. const isControlled = ref(props.modelValue !== false);
  45776. const input = ref();
  45777. const core = ref();
  45778. const switchKls = computed(() => [
  45779. ns.b(),
  45780. ns.m(switchSize.value),
  45781. ns.is("disabled", switchDisabled.value),
  45782. ns.is("checked", checked.value)
  45783. ]);
  45784. const labelLeftKls = computed(() => [
  45785. ns.e("label"),
  45786. ns.em("label", "left"),
  45787. ns.is("active", !checked.value)
  45788. ]);
  45789. const labelRightKls = computed(() => [
  45790. ns.e("label"),
  45791. ns.em("label", "right"),
  45792. ns.is("active", checked.value)
  45793. ]);
  45794. const coreStyle = computed(() => ({
  45795. width: addUnit(props.width)
  45796. }));
  45797. watch(() => props.modelValue, () => {
  45798. isControlled.value = true;
  45799. });
  45800. watch(() => props.value, () => {
  45801. isControlled.value = false;
  45802. });
  45803. const actualValue = computed(() => {
  45804. return isControlled.value ? props.modelValue : props.value;
  45805. });
  45806. const checked = computed(() => actualValue.value === props.activeValue);
  45807. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  45808. emit2(UPDATE_MODEL_EVENT, props.inactiveValue);
  45809. emit2(CHANGE_EVENT, props.inactiveValue);
  45810. emit2(INPUT_EVENT, props.inactiveValue);
  45811. }
  45812. watch(checked, (val) => {
  45813. var _a2;
  45814. input.value.checked = val;
  45815. if (props.validateEvent) {
  45816. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  45817. }
  45818. });
  45819. const handleChange = () => {
  45820. const val = checked.value ? props.inactiveValue : props.activeValue;
  45821. emit2(UPDATE_MODEL_EVENT, val);
  45822. emit2(CHANGE_EVENT, val);
  45823. emit2(INPUT_EVENT, val);
  45824. nextTick(() => {
  45825. input.value.checked = checked.value;
  45826. });
  45827. };
  45828. const switchValue = () => {
  45829. if (switchDisabled.value)
  45830. return;
  45831. const { beforeChange } = props;
  45832. if (!beforeChange) {
  45833. handleChange();
  45834. return;
  45835. }
  45836. const shouldChange = beforeChange();
  45837. const isPromiseOrBool = [
  45838. isPromise(shouldChange),
  45839. isBoolean(shouldChange)
  45840. ].includes(true);
  45841. if (!isPromiseOrBool) {
  45842. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  45843. }
  45844. if (isPromise(shouldChange)) {
  45845. shouldChange.then((result) => {
  45846. if (result) {
  45847. handleChange();
  45848. }
  45849. }).catch((e) => {
  45850. });
  45851. } else if (shouldChange) {
  45852. handleChange();
  45853. }
  45854. };
  45855. const styles = computed(() => {
  45856. return ns.cssVarBlock({
  45857. ...props.activeColor ? { "on-color": props.activeColor } : null,
  45858. ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
  45859. ...props.borderColor ? { "border-color": props.borderColor } : null
  45860. });
  45861. });
  45862. const focus = () => {
  45863. var _a2, _b;
  45864. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  45865. };
  45866. onMounted(() => {
  45867. input.value.checked = checked.value;
  45868. });
  45869. expose({
  45870. focus,
  45871. checked
  45872. });
  45873. return (_ctx, _cache) => {
  45874. return openBlock(), createElementBlock("div", {
  45875. class: normalizeClass(unref(switchKls)),
  45876. style: normalizeStyle(unref(styles)),
  45877. onClick: withModifiers(switchValue, ["prevent"])
  45878. }, [
  45879. createBaseVNode("input", {
  45880. id: unref(inputId),
  45881. ref_key: "input",
  45882. ref: input,
  45883. class: normalizeClass(unref(ns).e("input")),
  45884. type: "checkbox",
  45885. role: "switch",
  45886. "aria-checked": unref(checked),
  45887. "aria-disabled": unref(switchDisabled),
  45888. "aria-label": _ctx.label,
  45889. name: _ctx.name,
  45890. "true-value": _ctx.activeValue,
  45891. "false-value": _ctx.inactiveValue,
  45892. disabled: unref(switchDisabled),
  45893. tabindex: _ctx.tabindex,
  45894. onChange: handleChange,
  45895. onKeydown: withKeys(switchValue, ["enter"])
  45896. }, null, 42, _hoisted_2$a),
  45897. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  45898. key: 0,
  45899. class: normalizeClass(unref(labelLeftKls))
  45900. }, [
  45901. _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  45902. default: withCtx(() => [
  45903. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  45904. ]),
  45905. _: 1
  45906. })) : createCommentVNode("v-if", true),
  45907. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  45908. key: 1,
  45909. "aria-hidden": unref(checked)
  45910. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$4)) : createCommentVNode("v-if", true)
  45911. ], 2)) : createCommentVNode("v-if", true),
  45912. createBaseVNode("span", {
  45913. ref_key: "core",
  45914. ref: core,
  45915. class: normalizeClass(unref(ns).e("core")),
  45916. style: normalizeStyle(unref(coreStyle))
  45917. }, [
  45918. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  45919. key: 0,
  45920. class: normalizeClass(unref(ns).e("inner"))
  45921. }, [
  45922. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
  45923. key: 0,
  45924. class: normalizeClass(unref(ns).is("icon"))
  45925. }, {
  45926. default: withCtx(() => [
  45927. (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  45928. ]),
  45929. _: 1
  45930. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  45931. key: 1,
  45932. class: normalizeClass(unref(ns).is("text")),
  45933. "aria-hidden": !unref(checked)
  45934. }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$2)) : createCommentVNode("v-if", true)
  45935. ], 2)) : createCommentVNode("v-if", true),
  45936. createBaseVNode("div", {
  45937. class: normalizeClass(unref(ns).e("action"))
  45938. }, [
  45939. _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
  45940. key: 0,
  45941. class: normalizeClass(unref(ns).is("loading"))
  45942. }, {
  45943. default: withCtx(() => [
  45944. createVNode(unref(loading_default))
  45945. ]),
  45946. _: 1
  45947. }, 8, ["class"])) : _ctx.activeActionIcon && unref(checked) ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  45948. default: withCtx(() => [
  45949. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeActionIcon)))
  45950. ]),
  45951. _: 1
  45952. })) : _ctx.inactiveActionIcon && !unref(checked) ? (openBlock(), createBlock(unref(ElIcon), { key: 2 }, {
  45953. default: withCtx(() => [
  45954. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveActionIcon)))
  45955. ]),
  45956. _: 1
  45957. })) : createCommentVNode("v-if", true)
  45958. ], 2)
  45959. ], 6),
  45960. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  45961. key: 1,
  45962. class: normalizeClass(unref(labelRightKls))
  45963. }, [
  45964. _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  45965. default: withCtx(() => [
  45966. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  45967. ]),
  45968. _: 1
  45969. })) : createCommentVNode("v-if", true),
  45970. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  45971. key: 1,
  45972. "aria-hidden": !unref(checked)
  45973. }, toDisplayString(_ctx.activeText), 9, _hoisted_5$1)) : createCommentVNode("v-if", true)
  45974. ], 2)) : createCommentVNode("v-if", true)
  45975. ], 14, _hoisted_1$f);
  45976. };
  45977. }
  45978. });
  45979. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  45980. const ElSwitch = withInstall(Switch);
  45981. /*!
  45982. * escape-html
  45983. * Copyright(c) 2012-2013 TJ Holowaychuk
  45984. * Copyright(c) 2015 Andreas Lubbe
  45985. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  45986. * MIT Licensed
  45987. */
  45988. var matchHtmlRegExp = /["'&<>]/;
  45989. var escapeHtml_1 = escapeHtml;
  45990. function escapeHtml(string2) {
  45991. var str = "" + string2;
  45992. var match = matchHtmlRegExp.exec(str);
  45993. if (!match) {
  45994. return str;
  45995. }
  45996. var escape;
  45997. var html = "";
  45998. var index2 = 0;
  45999. var lastIndex = 0;
  46000. for (index2 = match.index; index2 < str.length; index2++) {
  46001. switch (str.charCodeAt(index2)) {
  46002. case 34:
  46003. escape = "&quot;";
  46004. break;
  46005. case 38:
  46006. escape = "&amp;";
  46007. break;
  46008. case 39:
  46009. escape = "&#39;";
  46010. break;
  46011. case 60:
  46012. escape = "&lt;";
  46013. break;
  46014. case 62:
  46015. escape = "&gt;";
  46016. break;
  46017. default:
  46018. continue;
  46019. }
  46020. if (lastIndex !== index2) {
  46021. html += str.substring(lastIndex, index2);
  46022. }
  46023. lastIndex = index2 + 1;
  46024. html += escape;
  46025. }
  46026. return lastIndex !== index2 ? html + str.substring(lastIndex, index2) : html;
  46027. }
  46028. const escapeHtml$1 = /* @__PURE__ */ getDefaultExportFromCjs(escapeHtml_1);
  46029. const getCell = function(event) {
  46030. var _a2;
  46031. return (_a2 = event.target) == null ? void 0 : _a2.closest("td");
  46032. };
  46033. const orderBy = function(array2, sortKey, reverse, sortMethod, sortBy) {
  46034. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  46035. return array2;
  46036. }
  46037. if (typeof reverse === "string") {
  46038. reverse = reverse === "descending" ? -1 : 1;
  46039. } else {
  46040. reverse = reverse && reverse < 0 ? -1 : 1;
  46041. }
  46042. const getKey = sortMethod ? null : function(value, index2) {
  46043. if (sortBy) {
  46044. if (!Array.isArray(sortBy)) {
  46045. sortBy = [sortBy];
  46046. }
  46047. return sortBy.map((by) => {
  46048. if (typeof by === "string") {
  46049. return get(value, by);
  46050. } else {
  46051. return by(value, index2, array2);
  46052. }
  46053. });
  46054. }
  46055. if (sortKey !== "$key") {
  46056. if (isObject$1(value) && "$value" in value)
  46057. value = value.$value;
  46058. }
  46059. return [isObject$1(value) ? get(value, sortKey) : value];
  46060. };
  46061. const compare = function(a2, b2) {
  46062. if (sortMethod) {
  46063. return sortMethod(a2.value, b2.value);
  46064. }
  46065. for (let i = 0, len = a2.key.length; i < len; i++) {
  46066. if (a2.key[i] < b2.key[i]) {
  46067. return -1;
  46068. }
  46069. if (a2.key[i] > b2.key[i]) {
  46070. return 1;
  46071. }
  46072. }
  46073. return 0;
  46074. };
  46075. return array2.map((value, index2) => {
  46076. return {
  46077. value,
  46078. index: index2,
  46079. key: getKey ? getKey(value, index2) : null
  46080. };
  46081. }).sort((a2, b2) => {
  46082. let order = compare(a2, b2);
  46083. if (!order) {
  46084. order = a2.index - b2.index;
  46085. }
  46086. return order * +reverse;
  46087. }).map((item) => item.value);
  46088. };
  46089. const getColumnById = function(table, columnId) {
  46090. let column = null;
  46091. table.columns.forEach((item) => {
  46092. if (item.id === columnId) {
  46093. column = item;
  46094. }
  46095. });
  46096. return column;
  46097. };
  46098. const getColumnByKey = function(table, columnKey) {
  46099. let column = null;
  46100. for (let i = 0; i < table.columns.length; i++) {
  46101. const item = table.columns[i];
  46102. if (item.columnKey === columnKey) {
  46103. column = item;
  46104. break;
  46105. }
  46106. }
  46107. if (!column)
  46108. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  46109. return column;
  46110. };
  46111. const getColumnByCell = function(table, cell, namespace) {
  46112. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  46113. if (matches) {
  46114. return getColumnById(table, matches[0]);
  46115. }
  46116. return null;
  46117. };
  46118. const getRowIdentity = (row, rowKey2) => {
  46119. if (!row)
  46120. throw new Error("Row is required when get row identity");
  46121. if (typeof rowKey2 === "string") {
  46122. if (!rowKey2.includes(".")) {
  46123. return `${row[rowKey2]}`;
  46124. }
  46125. const key = rowKey2.split(".");
  46126. let current = row;
  46127. for (const element of key) {
  46128. current = current[element];
  46129. }
  46130. return `${current}`;
  46131. } else if (typeof rowKey2 === "function") {
  46132. return rowKey2.call(null, row);
  46133. }
  46134. };
  46135. const getKeysMap = function(array2, rowKey2) {
  46136. const arrayMap2 = {};
  46137. (array2 || []).forEach((row, index2) => {
  46138. arrayMap2[getRowIdentity(row, rowKey2)] = { row, index: index2 };
  46139. });
  46140. return arrayMap2;
  46141. };
  46142. function mergeOptions(defaults, config) {
  46143. const options = {};
  46144. let key;
  46145. for (key in defaults) {
  46146. options[key] = defaults[key];
  46147. }
  46148. for (key in config) {
  46149. if (hasOwn(config, key)) {
  46150. const value = config[key];
  46151. if (typeof value !== "undefined") {
  46152. options[key] = value;
  46153. }
  46154. }
  46155. }
  46156. return options;
  46157. }
  46158. function parseWidth(width) {
  46159. if (width === "")
  46160. return width;
  46161. if (width !== void 0) {
  46162. width = Number.parseInt(width, 10);
  46163. if (Number.isNaN(width)) {
  46164. width = "";
  46165. }
  46166. }
  46167. return width;
  46168. }
  46169. function parseMinWidth(minWidth) {
  46170. if (minWidth === "")
  46171. return minWidth;
  46172. if (minWidth !== void 0) {
  46173. minWidth = parseWidth(minWidth);
  46174. if (Number.isNaN(minWidth)) {
  46175. minWidth = 80;
  46176. }
  46177. }
  46178. return minWidth;
  46179. }
  46180. function parseHeight(height) {
  46181. if (typeof height === "number") {
  46182. return height;
  46183. }
  46184. if (typeof height === "string") {
  46185. if (/^\d+(?:px)?$/.test(height)) {
  46186. return Number.parseInt(height, 10);
  46187. } else {
  46188. return height;
  46189. }
  46190. }
  46191. return null;
  46192. }
  46193. function compose(...funcs) {
  46194. if (funcs.length === 0) {
  46195. return (arg) => arg;
  46196. }
  46197. if (funcs.length === 1) {
  46198. return funcs[0];
  46199. }
  46200. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  46201. }
  46202. function toggleRowStatus(statusArr, row, newVal) {
  46203. let changed = false;
  46204. const index2 = statusArr.indexOf(row);
  46205. const included = index2 !== -1;
  46206. const toggleStatus = (type2) => {
  46207. if (type2 === "add") {
  46208. statusArr.push(row);
  46209. } else {
  46210. statusArr.splice(index2, 1);
  46211. }
  46212. changed = true;
  46213. if (isArray$3(row.children)) {
  46214. row.children.forEach((item) => {
  46215. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included);
  46216. });
  46217. }
  46218. };
  46219. if (isBoolean(newVal)) {
  46220. if (newVal && !included) {
  46221. toggleStatus("add");
  46222. } else if (!newVal && included) {
  46223. toggleStatus("remove");
  46224. }
  46225. } else {
  46226. included ? toggleStatus("remove") : toggleStatus("add");
  46227. }
  46228. return changed;
  46229. }
  46230. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  46231. const isNil2 = (array2) => !(Array.isArray(array2) && array2.length);
  46232. function _walker(parent, children, level) {
  46233. cb(parent, children, level);
  46234. children.forEach((item) => {
  46235. if (item[lazyKey]) {
  46236. cb(item, null, level + 1);
  46237. return;
  46238. }
  46239. const children2 = item[childrenKey];
  46240. if (!isNil2(children2)) {
  46241. _walker(item, children2, level + 1);
  46242. }
  46243. });
  46244. }
  46245. root2.forEach((item) => {
  46246. if (item[lazyKey]) {
  46247. cb(item, null, 0);
  46248. return;
  46249. }
  46250. const children = item[childrenKey];
  46251. if (!isNil2(children)) {
  46252. _walker(item, children, 0);
  46253. }
  46254. });
  46255. }
  46256. let removePopper;
  46257. function createTablePopper(parentNode, trigger2, popperContent, nextZIndex, tooltipOptions) {
  46258. tooltipOptions = merge$1({
  46259. enterable: true,
  46260. showArrow: true
  46261. }, tooltipOptions);
  46262. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  46263. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  46264. function renderContent() {
  46265. const isLight = tooltipOptions.effect === "light";
  46266. const content2 = document.createElement("div");
  46267. content2.className = [
  46268. `${ns}-popper`,
  46269. isLight ? "is-light" : "is-dark",
  46270. tooltipOptions.popperClass || ""
  46271. ].join(" ");
  46272. popperContent = escapeHtml$1(popperContent);
  46273. content2.innerHTML = popperContent;
  46274. content2.style.zIndex = String(nextZIndex());
  46275. parentNode == null ? void 0 : parentNode.appendChild(content2);
  46276. return content2;
  46277. }
  46278. function renderArrow() {
  46279. const arrow2 = document.createElement("div");
  46280. arrow2.className = `${ns}-popper__arrow`;
  46281. return arrow2;
  46282. }
  46283. function showPopper() {
  46284. popperInstance && popperInstance.update();
  46285. }
  46286. removePopper == null ? void 0 : removePopper();
  46287. removePopper = () => {
  46288. try {
  46289. popperInstance && popperInstance.destroy();
  46290. content && (parentNode == null ? void 0 : parentNode.removeChild(content));
  46291. trigger2.removeEventListener("mouseenter", onOpen);
  46292. trigger2.removeEventListener("mouseleave", onClose);
  46293. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  46294. removePopper = void 0;
  46295. } catch (e) {
  46296. }
  46297. };
  46298. let popperInstance = null;
  46299. let onOpen = showPopper;
  46300. let onClose = removePopper;
  46301. if (tooltipOptions.enterable) {
  46302. ({ onOpen, onClose } = useDelayedToggle({
  46303. showAfter: tooltipOptions.showAfter,
  46304. hideAfter: tooltipOptions.hideAfter,
  46305. open: showPopper,
  46306. close: removePopper
  46307. }));
  46308. }
  46309. const content = renderContent();
  46310. content.onmouseenter = onOpen;
  46311. content.onmouseleave = onClose;
  46312. const modifiers = [];
  46313. if (tooltipOptions.offset) {
  46314. modifiers.push({
  46315. name: "offset",
  46316. options: {
  46317. offset: [0, tooltipOptions.offset]
  46318. }
  46319. });
  46320. }
  46321. if (tooltipOptions.showArrow) {
  46322. const arrow2 = content.appendChild(renderArrow());
  46323. modifiers.push({
  46324. name: "arrow",
  46325. options: {
  46326. element: arrow2,
  46327. padding: 10
  46328. }
  46329. });
  46330. }
  46331. const popperOptions = tooltipOptions.popperOptions || {};
  46332. popperInstance = yn(trigger2, content, {
  46333. placement: tooltipOptions.placement || "top",
  46334. strategy: "fixed",
  46335. ...popperOptions,
  46336. modifiers: popperOptions.modifiers ? modifiers.concat(popperOptions.modifiers) : modifiers
  46337. });
  46338. trigger2.addEventListener("mouseenter", onOpen);
  46339. trigger2.addEventListener("mouseleave", onClose);
  46340. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  46341. return popperInstance;
  46342. }
  46343. function getCurrentColumns(column) {
  46344. if (column.children) {
  46345. return flatMap(column.children, getCurrentColumns);
  46346. } else {
  46347. return [column];
  46348. }
  46349. }
  46350. function getColSpan(colSpan, column) {
  46351. return colSpan + column.colSpan;
  46352. }
  46353. const isFixedColumn = (index2, fixed, store, realColumns) => {
  46354. let start = 0;
  46355. let after = index2;
  46356. const columns2 = store.states.columns.value;
  46357. if (realColumns) {
  46358. const curColumns = getCurrentColumns(realColumns[index2]);
  46359. const preColumns = columns2.slice(0, columns2.indexOf(curColumns[0]));
  46360. start = preColumns.reduce(getColSpan, 0);
  46361. after = start + curColumns.reduce(getColSpan, 0) - 1;
  46362. } else {
  46363. start = index2;
  46364. }
  46365. let fixedLayout;
  46366. switch (fixed) {
  46367. case "left":
  46368. if (after < store.states.fixedLeafColumnsLength.value) {
  46369. fixedLayout = "left";
  46370. }
  46371. break;
  46372. case "right":
  46373. if (start >= columns2.length - store.states.rightFixedLeafColumnsLength.value) {
  46374. fixedLayout = "right";
  46375. }
  46376. break;
  46377. default:
  46378. if (after < store.states.fixedLeafColumnsLength.value) {
  46379. fixedLayout = "left";
  46380. } else if (start >= columns2.length - store.states.rightFixedLeafColumnsLength.value) {
  46381. fixedLayout = "right";
  46382. }
  46383. }
  46384. return fixedLayout ? {
  46385. direction: fixedLayout,
  46386. start,
  46387. after
  46388. } : {};
  46389. };
  46390. const getFixedColumnsClass = (namespace, index2, fixed, store, realColumns, offset2 = 0) => {
  46391. const classes = [];
  46392. const { direction: direction2, start, after } = isFixedColumn(index2, fixed, store, realColumns);
  46393. if (direction2) {
  46394. const isLeft = direction2 === "left";
  46395. classes.push(`${namespace}-fixed-column--${direction2}`);
  46396. if (isLeft && after + offset2 === store.states.fixedLeafColumnsLength.value - 1) {
  46397. classes.push("is-last-column");
  46398. } else if (!isLeft && start - offset2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  46399. classes.push("is-first-column");
  46400. }
  46401. }
  46402. return classes;
  46403. };
  46404. function getOffset(offset2, column) {
  46405. return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  46406. }
  46407. const getFixedColumnOffset = (index2, fixed, store, realColumns) => {
  46408. const {
  46409. direction: direction2,
  46410. start = 0,
  46411. after = 0
  46412. } = isFixedColumn(index2, fixed, store, realColumns);
  46413. if (!direction2) {
  46414. return;
  46415. }
  46416. const styles = {};
  46417. const isLeft = direction2 === "left";
  46418. const columns2 = store.states.columns.value;
  46419. if (isLeft) {
  46420. styles.left = columns2.slice(0, start).reduce(getOffset, 0);
  46421. } else {
  46422. styles.right = columns2.slice(after + 1).reverse().reduce(getOffset, 0);
  46423. }
  46424. return styles;
  46425. };
  46426. const ensurePosition = (style, key) => {
  46427. if (!style)
  46428. return;
  46429. if (!Number.isNaN(style[key])) {
  46430. style[key] = `${style[key]}px`;
  46431. }
  46432. };
  46433. function useExpand(watcherData) {
  46434. const instance = getCurrentInstance();
  46435. const defaultExpandAll = ref(false);
  46436. const expandRows = ref([]);
  46437. const updateExpandRows = () => {
  46438. const data = watcherData.data.value || [];
  46439. const rowKey2 = watcherData.rowKey.value;
  46440. if (defaultExpandAll.value) {
  46441. expandRows.value = data.slice();
  46442. } else if (rowKey2) {
  46443. const expandRowsMap = getKeysMap(expandRows.value, rowKey2);
  46444. expandRows.value = data.reduce((prev, row) => {
  46445. const rowId = getRowIdentity(row, rowKey2);
  46446. const rowInfo = expandRowsMap[rowId];
  46447. if (rowInfo) {
  46448. prev.push(row);
  46449. }
  46450. return prev;
  46451. }, []);
  46452. } else {
  46453. expandRows.value = [];
  46454. }
  46455. };
  46456. const toggleRowExpansion = (row, expanded) => {
  46457. const changed = toggleRowStatus(expandRows.value, row, expanded);
  46458. if (changed) {
  46459. instance.emit("expand-change", row, expandRows.value.slice());
  46460. }
  46461. };
  46462. const setExpandRowKeys = (rowKeys) => {
  46463. instance.store.assertRowKey();
  46464. const data = watcherData.data.value || [];
  46465. const rowKey2 = watcherData.rowKey.value;
  46466. const keysMap = getKeysMap(data, rowKey2);
  46467. expandRows.value = rowKeys.reduce((prev, cur) => {
  46468. const info = keysMap[cur];
  46469. if (info) {
  46470. prev.push(info.row);
  46471. }
  46472. return prev;
  46473. }, []);
  46474. };
  46475. const isRowExpanded = (row) => {
  46476. const rowKey2 = watcherData.rowKey.value;
  46477. if (rowKey2) {
  46478. const expandMap = getKeysMap(expandRows.value, rowKey2);
  46479. return !!expandMap[getRowIdentity(row, rowKey2)];
  46480. }
  46481. return expandRows.value.includes(row);
  46482. };
  46483. return {
  46484. updateExpandRows,
  46485. toggleRowExpansion,
  46486. setExpandRowKeys,
  46487. isRowExpanded,
  46488. states: {
  46489. expandRows,
  46490. defaultExpandAll
  46491. }
  46492. };
  46493. }
  46494. function useCurrent(watcherData) {
  46495. const instance = getCurrentInstance();
  46496. const _currentRowKey = ref(null);
  46497. const currentRow = ref(null);
  46498. const setCurrentRowKey = (key) => {
  46499. instance.store.assertRowKey();
  46500. _currentRowKey.value = key;
  46501. setCurrentRowByKey(key);
  46502. };
  46503. const restoreCurrentRowKey = () => {
  46504. _currentRowKey.value = null;
  46505. };
  46506. const setCurrentRowByKey = (key) => {
  46507. const { data, rowKey: rowKey2 } = watcherData;
  46508. let _currentRow = null;
  46509. if (rowKey2.value) {
  46510. _currentRow = (unref(data) || []).find((item) => getRowIdentity(item, rowKey2.value) === key);
  46511. }
  46512. currentRow.value = _currentRow;
  46513. instance.emit("current-change", currentRow.value, null);
  46514. };
  46515. const updateCurrentRow = (_currentRow) => {
  46516. const oldCurrentRow = currentRow.value;
  46517. if (_currentRow && _currentRow !== oldCurrentRow) {
  46518. currentRow.value = _currentRow;
  46519. instance.emit("current-change", currentRow.value, oldCurrentRow);
  46520. return;
  46521. }
  46522. if (!_currentRow && oldCurrentRow) {
  46523. currentRow.value = null;
  46524. instance.emit("current-change", null, oldCurrentRow);
  46525. }
  46526. };
  46527. const updateCurrentRowData = () => {
  46528. const rowKey2 = watcherData.rowKey.value;
  46529. const data = watcherData.data.value || [];
  46530. const oldCurrentRow = currentRow.value;
  46531. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  46532. if (rowKey2) {
  46533. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey2);
  46534. setCurrentRowByKey(currentRowKey);
  46535. } else {
  46536. currentRow.value = null;
  46537. }
  46538. if (currentRow.value === null) {
  46539. instance.emit("current-change", null, oldCurrentRow);
  46540. }
  46541. } else if (_currentRowKey.value) {
  46542. setCurrentRowByKey(_currentRowKey.value);
  46543. restoreCurrentRowKey();
  46544. }
  46545. };
  46546. return {
  46547. setCurrentRowKey,
  46548. restoreCurrentRowKey,
  46549. setCurrentRowByKey,
  46550. updateCurrentRow,
  46551. updateCurrentRowData,
  46552. states: {
  46553. _currentRowKey,
  46554. currentRow
  46555. }
  46556. };
  46557. }
  46558. function useTree$2(watcherData) {
  46559. const expandRowKeys = ref([]);
  46560. const treeData = ref({});
  46561. const indent = ref(16);
  46562. const lazy = ref(false);
  46563. const lazyTreeNodeMap = ref({});
  46564. const lazyColumnIdentifier = ref("hasChildren");
  46565. const childrenColumnName = ref("children");
  46566. const instance = getCurrentInstance();
  46567. const normalizedData = computed(() => {
  46568. if (!watcherData.rowKey.value)
  46569. return {};
  46570. const data = watcherData.data.value || [];
  46571. return normalize(data);
  46572. });
  46573. const normalizedLazyNode = computed(() => {
  46574. const rowKey2 = watcherData.rowKey.value;
  46575. const keys2 = Object.keys(lazyTreeNodeMap.value);
  46576. const res = {};
  46577. if (!keys2.length)
  46578. return res;
  46579. keys2.forEach((key) => {
  46580. if (lazyTreeNodeMap.value[key].length) {
  46581. const item = { children: [] };
  46582. lazyTreeNodeMap.value[key].forEach((row) => {
  46583. const currentRowKey = getRowIdentity(row, rowKey2);
  46584. item.children.push(currentRowKey);
  46585. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  46586. res[currentRowKey] = { children: [] };
  46587. }
  46588. });
  46589. res[key] = item;
  46590. }
  46591. });
  46592. return res;
  46593. });
  46594. const normalize = (data) => {
  46595. const rowKey2 = watcherData.rowKey.value;
  46596. const res = {};
  46597. walkTreeNode(data, (parent, children, level) => {
  46598. const parentId = getRowIdentity(parent, rowKey2);
  46599. if (Array.isArray(children)) {
  46600. res[parentId] = {
  46601. children: children.map((row) => getRowIdentity(row, rowKey2)),
  46602. level
  46603. };
  46604. } else if (lazy.value) {
  46605. res[parentId] = {
  46606. children: [],
  46607. lazy: true,
  46608. level
  46609. };
  46610. }
  46611. }, childrenColumnName.value, lazyColumnIdentifier.value);
  46612. return res;
  46613. };
  46614. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  46615. var _a2;
  46616. const nested = normalizedData.value;
  46617. const normalizedLazyNode_ = normalizedLazyNode.value;
  46618. const keys2 = Object.keys(nested);
  46619. const newTreeData = {};
  46620. if (keys2.length) {
  46621. const oldTreeData = unref(treeData);
  46622. const rootLazyRowKeys = [];
  46623. const getExpanded = (oldValue, key) => {
  46624. if (ifChangeExpandRowKeys) {
  46625. if (expandRowKeys.value) {
  46626. return ifExpandAll || expandRowKeys.value.includes(key);
  46627. } else {
  46628. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  46629. }
  46630. } else {
  46631. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  46632. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  46633. }
  46634. };
  46635. keys2.forEach((key) => {
  46636. const oldValue = oldTreeData[key];
  46637. const newValue = { ...nested[key] };
  46638. newValue.expanded = getExpanded(oldValue, key);
  46639. if (newValue.lazy) {
  46640. const { loaded = false, loading = false } = oldValue || {};
  46641. newValue.loaded = !!loaded;
  46642. newValue.loading = !!loading;
  46643. rootLazyRowKeys.push(key);
  46644. }
  46645. newTreeData[key] = newValue;
  46646. });
  46647. const lazyKeys = Object.keys(normalizedLazyNode_);
  46648. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  46649. lazyKeys.forEach((key) => {
  46650. const oldValue = oldTreeData[key];
  46651. const lazyNodeChildren = normalizedLazyNode_[key].children;
  46652. if (rootLazyRowKeys.includes(key)) {
  46653. if (newTreeData[key].children.length !== 0) {
  46654. throw new Error("[ElTable]children must be an empty array.");
  46655. }
  46656. newTreeData[key].children = lazyNodeChildren;
  46657. } else {
  46658. const { loaded = false, loading = false } = oldValue || {};
  46659. newTreeData[key] = {
  46660. lazy: true,
  46661. loaded: !!loaded,
  46662. loading: !!loading,
  46663. expanded: getExpanded(oldValue, key),
  46664. children: lazyNodeChildren,
  46665. level: ""
  46666. };
  46667. }
  46668. });
  46669. }
  46670. }
  46671. treeData.value = newTreeData;
  46672. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  46673. };
  46674. watch(() => expandRowKeys.value, () => {
  46675. updateTreeData(true);
  46676. });
  46677. watch(() => normalizedData.value, () => {
  46678. updateTreeData();
  46679. });
  46680. watch(() => normalizedLazyNode.value, () => {
  46681. updateTreeData();
  46682. });
  46683. const updateTreeExpandKeys = (value) => {
  46684. expandRowKeys.value = value;
  46685. updateTreeData();
  46686. };
  46687. const toggleTreeExpansion = (row, expanded) => {
  46688. instance.store.assertRowKey();
  46689. const rowKey2 = watcherData.rowKey.value;
  46690. const id = getRowIdentity(row, rowKey2);
  46691. const data = id && treeData.value[id];
  46692. if (id && data && "expanded" in data) {
  46693. const oldExpanded = data.expanded;
  46694. expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
  46695. treeData.value[id].expanded = expanded;
  46696. if (oldExpanded !== expanded) {
  46697. instance.emit("expand-change", row, expanded);
  46698. }
  46699. instance.store.updateTableScrollY();
  46700. }
  46701. };
  46702. const loadOrToggle = (row) => {
  46703. instance.store.assertRowKey();
  46704. const rowKey2 = watcherData.rowKey.value;
  46705. const id = getRowIdentity(row, rowKey2);
  46706. const data = treeData.value[id];
  46707. if (lazy.value && data && "loaded" in data && !data.loaded) {
  46708. loadData(row, id, data);
  46709. } else {
  46710. toggleTreeExpansion(row, void 0);
  46711. }
  46712. };
  46713. const loadData = (row, key, treeNode) => {
  46714. const { load } = instance.props;
  46715. if (load && !treeData.value[key].loaded) {
  46716. treeData.value[key].loading = true;
  46717. load(row, treeNode, (data) => {
  46718. if (!Array.isArray(data)) {
  46719. throw new TypeError("[ElTable] data must be an array");
  46720. }
  46721. treeData.value[key].loading = false;
  46722. treeData.value[key].loaded = true;
  46723. treeData.value[key].expanded = true;
  46724. if (data.length) {
  46725. lazyTreeNodeMap.value[key] = data;
  46726. }
  46727. instance.emit("expand-change", row, true);
  46728. });
  46729. }
  46730. };
  46731. return {
  46732. loadData,
  46733. loadOrToggle,
  46734. toggleTreeExpansion,
  46735. updateTreeExpandKeys,
  46736. updateTreeData,
  46737. normalize,
  46738. states: {
  46739. expandRowKeys,
  46740. treeData,
  46741. indent,
  46742. lazy,
  46743. lazyTreeNodeMap,
  46744. lazyColumnIdentifier,
  46745. childrenColumnName
  46746. }
  46747. };
  46748. }
  46749. const sortData = (data, states) => {
  46750. const sortingColumn = states.sortingColumn;
  46751. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  46752. return data;
  46753. }
  46754. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  46755. };
  46756. const doFlattenColumns = (columns2) => {
  46757. const result = [];
  46758. columns2.forEach((column) => {
  46759. if (column.children && column.children.length > 0) {
  46760. result.push.apply(result, doFlattenColumns(column.children));
  46761. } else {
  46762. result.push(column);
  46763. }
  46764. });
  46765. return result;
  46766. };
  46767. function useWatcher$1() {
  46768. var _a2;
  46769. const instance = getCurrentInstance();
  46770. const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  46771. const rowKey2 = ref(null);
  46772. const data = ref([]);
  46773. const _data = ref([]);
  46774. const isComplex = ref(false);
  46775. const _columns = ref([]);
  46776. const originColumns = ref([]);
  46777. const columns2 = ref([]);
  46778. const fixedColumns = ref([]);
  46779. const rightFixedColumns = ref([]);
  46780. const leafColumns = ref([]);
  46781. const fixedLeafColumns = ref([]);
  46782. const rightFixedLeafColumns = ref([]);
  46783. const updateOrderFns = [];
  46784. const leafColumnsLength = ref(0);
  46785. const fixedLeafColumnsLength = ref(0);
  46786. const rightFixedLeafColumnsLength = ref(0);
  46787. const isAllSelected = ref(false);
  46788. const selection = ref([]);
  46789. const reserveSelection = ref(false);
  46790. const selectOnIndeterminate = ref(false);
  46791. const selectable = ref(null);
  46792. const filters = ref({});
  46793. const filteredData = ref(null);
  46794. const sortingColumn = ref(null);
  46795. const sortProp = ref(null);
  46796. const sortOrder = ref(null);
  46797. const hoverRow = ref(null);
  46798. watch(data, () => instance.state && scheduleLayout(false), {
  46799. deep: true
  46800. });
  46801. const assertRowKey = () => {
  46802. if (!rowKey2.value)
  46803. throw new Error("[ElTable] prop row-key is required");
  46804. };
  46805. const updateChildFixed = (column) => {
  46806. var _a22;
  46807. (_a22 = column.children) == null ? void 0 : _a22.forEach((childColumn) => {
  46808. childColumn.fixed = column.fixed;
  46809. updateChildFixed(childColumn);
  46810. });
  46811. };
  46812. const updateColumns = () => {
  46813. _columns.value.forEach((column) => {
  46814. updateChildFixed(column);
  46815. });
  46816. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  46817. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  46818. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  46819. _columns.value[0].fixed = true;
  46820. fixedColumns.value.unshift(_columns.value[0]);
  46821. }
  46822. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  46823. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  46824. const leafColumns2 = doFlattenColumns(notFixedColumns);
  46825. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  46826. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  46827. leafColumnsLength.value = leafColumns2.length;
  46828. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  46829. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  46830. columns2.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  46831. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  46832. };
  46833. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  46834. if (needUpdateColumns) {
  46835. updateColumns();
  46836. }
  46837. if (immediate) {
  46838. instance.state.doLayout();
  46839. } else {
  46840. instance.state.debouncedUpdateLayout();
  46841. }
  46842. };
  46843. const isSelected = (row) => {
  46844. return selection.value.includes(row);
  46845. };
  46846. const clearSelection = () => {
  46847. isAllSelected.value = false;
  46848. const oldSelection = selection.value;
  46849. if (oldSelection.length) {
  46850. selection.value = [];
  46851. instance.emit("selection-change", []);
  46852. }
  46853. };
  46854. const cleanSelection = () => {
  46855. let deleted;
  46856. if (rowKey2.value) {
  46857. deleted = [];
  46858. const selectedMap = getKeysMap(selection.value, rowKey2.value);
  46859. const dataMap = getKeysMap(data.value, rowKey2.value);
  46860. for (const key in selectedMap) {
  46861. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  46862. deleted.push(selectedMap[key].row);
  46863. }
  46864. }
  46865. } else {
  46866. deleted = selection.value.filter((item) => !data.value.includes(item));
  46867. }
  46868. if (deleted.length) {
  46869. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  46870. selection.value = newSelection;
  46871. instance.emit("selection-change", newSelection.slice());
  46872. }
  46873. };
  46874. const getSelectionRows = () => {
  46875. return (selection.value || []).slice();
  46876. };
  46877. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  46878. const changed = toggleRowStatus(selection.value, row, selected);
  46879. if (changed) {
  46880. const newSelection = (selection.value || []).slice();
  46881. if (emitChange) {
  46882. instance.emit("select", newSelection, row);
  46883. }
  46884. instance.emit("selection-change", newSelection);
  46885. }
  46886. };
  46887. const _toggleAllSelection = () => {
  46888. var _a22, _b;
  46889. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  46890. isAllSelected.value = value;
  46891. let selectionChanged = false;
  46892. let childrenCount = 0;
  46893. const rowKey22 = (_b = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b.rowKey.value;
  46894. data.value.forEach((row, index2) => {
  46895. const rowIndex = index2 + childrenCount;
  46896. if (selectable.value) {
  46897. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  46898. selectionChanged = true;
  46899. }
  46900. } else {
  46901. if (toggleRowStatus(selection.value, row, value)) {
  46902. selectionChanged = true;
  46903. }
  46904. }
  46905. childrenCount += getChildrenCount(getRowIdentity(row, rowKey22));
  46906. });
  46907. if (selectionChanged) {
  46908. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  46909. }
  46910. instance.emit("select-all", selection.value);
  46911. };
  46912. const updateSelectionByRowKey = () => {
  46913. const selectedMap = getKeysMap(selection.value, rowKey2.value);
  46914. data.value.forEach((row) => {
  46915. const rowId = getRowIdentity(row, rowKey2.value);
  46916. const rowInfo = selectedMap[rowId];
  46917. if (rowInfo) {
  46918. selection.value[rowInfo.index] = row;
  46919. }
  46920. });
  46921. };
  46922. const updateAllSelected = () => {
  46923. var _a22, _b, _c;
  46924. if (((_a22 = data.value) == null ? void 0 : _a22.length) === 0) {
  46925. isAllSelected.value = false;
  46926. return;
  46927. }
  46928. let selectedMap;
  46929. if (rowKey2.value) {
  46930. selectedMap = getKeysMap(selection.value, rowKey2.value);
  46931. }
  46932. const isSelected2 = function(row) {
  46933. if (selectedMap) {
  46934. return !!selectedMap[getRowIdentity(row, rowKey2.value)];
  46935. } else {
  46936. return selection.value.includes(row);
  46937. }
  46938. };
  46939. let isAllSelected_ = true;
  46940. let selectedCount = 0;
  46941. let childrenCount = 0;
  46942. for (let i = 0, j = (data.value || []).length; i < j; i++) {
  46943. const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value;
  46944. const rowIndex = i + childrenCount;
  46945. const item = data.value[i];
  46946. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  46947. if (!isSelected2(item)) {
  46948. if (!selectable.value || isRowSelectable) {
  46949. isAllSelected_ = false;
  46950. break;
  46951. }
  46952. } else {
  46953. selectedCount++;
  46954. }
  46955. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  46956. }
  46957. if (selectedCount === 0)
  46958. isAllSelected_ = false;
  46959. isAllSelected.value = isAllSelected_;
  46960. };
  46961. const getChildrenCount = (rowKey22) => {
  46962. var _a22;
  46963. if (!instance || !instance.store)
  46964. return 0;
  46965. const { treeData } = instance.store.states;
  46966. let count = 0;
  46967. const children = (_a22 = treeData.value[rowKey22]) == null ? void 0 : _a22.children;
  46968. if (children) {
  46969. count += children.length;
  46970. children.forEach((childKey) => {
  46971. count += getChildrenCount(childKey);
  46972. });
  46973. }
  46974. return count;
  46975. };
  46976. const updateFilters = (columns22, values) => {
  46977. if (!Array.isArray(columns22)) {
  46978. columns22 = [columns22];
  46979. }
  46980. const filters_ = {};
  46981. columns22.forEach((col) => {
  46982. filters.value[col.id] = values;
  46983. filters_[col.columnKey || col.id] = values;
  46984. });
  46985. return filters_;
  46986. };
  46987. const updateSort = (column, prop, order) => {
  46988. if (sortingColumn.value && sortingColumn.value !== column) {
  46989. sortingColumn.value.order = null;
  46990. }
  46991. sortingColumn.value = column;
  46992. sortProp.value = prop;
  46993. sortOrder.value = order;
  46994. };
  46995. const execFilter = () => {
  46996. let sourceData = unref(_data);
  46997. Object.keys(filters.value).forEach((columnId) => {
  46998. const values = filters.value[columnId];
  46999. if (!values || values.length === 0)
  47000. return;
  47001. const column = getColumnById({
  47002. columns: columns2.value
  47003. }, columnId);
  47004. if (column && column.filterMethod) {
  47005. sourceData = sourceData.filter((row) => {
  47006. return values.some((value) => column.filterMethod.call(null, value, row, column));
  47007. });
  47008. }
  47009. });
  47010. filteredData.value = sourceData;
  47011. };
  47012. const execSort = () => {
  47013. data.value = sortData(filteredData.value, {
  47014. sortingColumn: sortingColumn.value,
  47015. sortProp: sortProp.value,
  47016. sortOrder: sortOrder.value
  47017. });
  47018. };
  47019. const execQuery = (ignore = void 0) => {
  47020. if (!(ignore && ignore.filter)) {
  47021. execFilter();
  47022. }
  47023. execSort();
  47024. };
  47025. const clearFilter = (columnKeys) => {
  47026. const { tableHeaderRef } = instance.refs;
  47027. if (!tableHeaderRef)
  47028. return;
  47029. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  47030. const keys2 = Object.keys(panels);
  47031. if (!keys2.length)
  47032. return;
  47033. if (typeof columnKeys === "string") {
  47034. columnKeys = [columnKeys];
  47035. }
  47036. if (Array.isArray(columnKeys)) {
  47037. const columns_ = columnKeys.map((key) => getColumnByKey({
  47038. columns: columns2.value
  47039. }, key));
  47040. keys2.forEach((key) => {
  47041. const column = columns_.find((col) => col.id === key);
  47042. if (column) {
  47043. column.filteredValue = [];
  47044. }
  47045. });
  47046. instance.store.commit("filterChange", {
  47047. column: columns_,
  47048. values: [],
  47049. silent: true,
  47050. multi: true
  47051. });
  47052. } else {
  47053. keys2.forEach((key) => {
  47054. const column = columns2.value.find((col) => col.id === key);
  47055. if (column) {
  47056. column.filteredValue = [];
  47057. }
  47058. });
  47059. filters.value = {};
  47060. instance.store.commit("filterChange", {
  47061. column: {},
  47062. values: [],
  47063. silent: true
  47064. });
  47065. }
  47066. };
  47067. const clearSort = () => {
  47068. if (!sortingColumn.value)
  47069. return;
  47070. updateSort(null, null, null);
  47071. instance.store.commit("changeSortCondition", {
  47072. silent: true
  47073. });
  47074. };
  47075. const {
  47076. setExpandRowKeys,
  47077. toggleRowExpansion,
  47078. updateExpandRows,
  47079. states: expandStates,
  47080. isRowExpanded
  47081. } = useExpand({
  47082. data,
  47083. rowKey: rowKey2
  47084. });
  47085. const {
  47086. updateTreeExpandKeys,
  47087. toggleTreeExpansion,
  47088. updateTreeData,
  47089. loadOrToggle,
  47090. states: treeStates
  47091. } = useTree$2({
  47092. data,
  47093. rowKey: rowKey2
  47094. });
  47095. const {
  47096. updateCurrentRowData,
  47097. updateCurrentRow,
  47098. setCurrentRowKey,
  47099. states: currentData
  47100. } = useCurrent({
  47101. data,
  47102. rowKey: rowKey2
  47103. });
  47104. const setExpandRowKeysAdapter = (val) => {
  47105. setExpandRowKeys(val);
  47106. updateTreeExpandKeys(val);
  47107. };
  47108. const toggleRowExpansionAdapter = (row, expanded) => {
  47109. const hasExpandColumn = columns2.value.some(({ type: type2 }) => type2 === "expand");
  47110. if (hasExpandColumn) {
  47111. toggleRowExpansion(row, expanded);
  47112. } else {
  47113. toggleTreeExpansion(row, expanded);
  47114. }
  47115. };
  47116. return {
  47117. assertRowKey,
  47118. updateColumns,
  47119. scheduleLayout,
  47120. isSelected,
  47121. clearSelection,
  47122. cleanSelection,
  47123. getSelectionRows,
  47124. toggleRowSelection,
  47125. _toggleAllSelection,
  47126. toggleAllSelection: null,
  47127. updateSelectionByRowKey,
  47128. updateAllSelected,
  47129. updateFilters,
  47130. updateCurrentRow,
  47131. updateSort,
  47132. execFilter,
  47133. execSort,
  47134. execQuery,
  47135. clearFilter,
  47136. clearSort,
  47137. toggleRowExpansion,
  47138. setExpandRowKeysAdapter,
  47139. setCurrentRowKey,
  47140. toggleRowExpansionAdapter,
  47141. isRowExpanded,
  47142. updateExpandRows,
  47143. updateCurrentRowData,
  47144. loadOrToggle,
  47145. updateTreeData,
  47146. states: {
  47147. tableSize,
  47148. rowKey: rowKey2,
  47149. data,
  47150. _data,
  47151. isComplex,
  47152. _columns,
  47153. originColumns,
  47154. columns: columns2,
  47155. fixedColumns,
  47156. rightFixedColumns,
  47157. leafColumns,
  47158. fixedLeafColumns,
  47159. rightFixedLeafColumns,
  47160. updateOrderFns,
  47161. leafColumnsLength,
  47162. fixedLeafColumnsLength,
  47163. rightFixedLeafColumnsLength,
  47164. isAllSelected,
  47165. selection,
  47166. reserveSelection,
  47167. selectOnIndeterminate,
  47168. selectable,
  47169. filters,
  47170. filteredData,
  47171. sortingColumn,
  47172. sortProp,
  47173. sortOrder,
  47174. hoverRow,
  47175. ...expandStates,
  47176. ...treeStates,
  47177. ...currentData
  47178. }
  47179. };
  47180. }
  47181. function replaceColumn(array2, column) {
  47182. return array2.map((item) => {
  47183. var _a2;
  47184. if (item.id === column.id) {
  47185. return column;
  47186. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  47187. item.children = replaceColumn(item.children, column);
  47188. }
  47189. return item;
  47190. });
  47191. }
  47192. function sortColumn(array2) {
  47193. array2.forEach((item) => {
  47194. var _a2, _b;
  47195. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  47196. if ((_b = item.children) == null ? void 0 : _b.length) {
  47197. sortColumn(item.children);
  47198. }
  47199. });
  47200. array2.sort((cur, pre) => cur.no - pre.no);
  47201. }
  47202. function useStore() {
  47203. const instance = getCurrentInstance();
  47204. const watcher = useWatcher$1();
  47205. const ns = useNamespace("table");
  47206. const mutations = {
  47207. setData(states, data) {
  47208. const dataInstanceChanged = unref(states._data) !== data;
  47209. states.data.value = data;
  47210. states._data.value = data;
  47211. instance.store.execQuery();
  47212. instance.store.updateCurrentRowData();
  47213. instance.store.updateExpandRows();
  47214. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  47215. if (unref(states.reserveSelection)) {
  47216. instance.store.assertRowKey();
  47217. instance.store.updateSelectionByRowKey();
  47218. } else {
  47219. if (dataInstanceChanged) {
  47220. instance.store.clearSelection();
  47221. } else {
  47222. instance.store.cleanSelection();
  47223. }
  47224. }
  47225. instance.store.updateAllSelected();
  47226. if (instance.$ready) {
  47227. instance.store.scheduleLayout();
  47228. }
  47229. },
  47230. insertColumn(states, column, parent, updateColumnOrder) {
  47231. const array2 = unref(states._columns);
  47232. let newColumns = [];
  47233. if (!parent) {
  47234. array2.push(column);
  47235. newColumns = array2;
  47236. } else {
  47237. if (parent && !parent.children) {
  47238. parent.children = [];
  47239. }
  47240. parent.children.push(column);
  47241. newColumns = replaceColumn(array2, parent);
  47242. }
  47243. sortColumn(newColumns);
  47244. states._columns.value = newColumns;
  47245. states.updateOrderFns.push(updateColumnOrder);
  47246. if (column.type === "selection") {
  47247. states.selectable.value = column.selectable;
  47248. states.reserveSelection.value = column.reserveSelection;
  47249. }
  47250. if (instance.$ready) {
  47251. instance.store.updateColumns();
  47252. instance.store.scheduleLayout();
  47253. }
  47254. },
  47255. updateColumnOrder(states, column) {
  47256. var _a2;
  47257. const newColumnIndex = (_a2 = column.getColumnIndex) == null ? void 0 : _a2.call(column);
  47258. if (newColumnIndex === column.no)
  47259. return;
  47260. sortColumn(states._columns.value);
  47261. if (instance.$ready) {
  47262. instance.store.updateColumns();
  47263. }
  47264. },
  47265. removeColumn(states, column, parent, updateColumnOrder) {
  47266. const array2 = unref(states._columns) || [];
  47267. if (parent) {
  47268. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  47269. nextTick(() => {
  47270. var _a2;
  47271. if (((_a2 = parent.children) == null ? void 0 : _a2.length) === 0) {
  47272. delete parent.children;
  47273. }
  47274. });
  47275. states._columns.value = replaceColumn(array2, parent);
  47276. } else {
  47277. const index2 = array2.indexOf(column);
  47278. if (index2 > -1) {
  47279. array2.splice(index2, 1);
  47280. states._columns.value = array2;
  47281. }
  47282. }
  47283. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  47284. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  47285. if (instance.$ready) {
  47286. instance.store.updateColumns();
  47287. instance.store.scheduleLayout();
  47288. }
  47289. },
  47290. sort(states, options) {
  47291. const { prop, order, init } = options;
  47292. if (prop) {
  47293. const column = unref(states.columns).find((column2) => column2.property === prop);
  47294. if (column) {
  47295. column.order = order;
  47296. instance.store.updateSort(column, prop, order);
  47297. instance.store.commit("changeSortCondition", { init });
  47298. }
  47299. }
  47300. },
  47301. changeSortCondition(states, options) {
  47302. const { sortingColumn, sortProp, sortOrder } = states;
  47303. const columnValue = unref(sortingColumn), propValue = unref(sortProp), orderValue = unref(sortOrder);
  47304. if (orderValue === null) {
  47305. states.sortingColumn.value = null;
  47306. states.sortProp.value = null;
  47307. }
  47308. const ignore = { filter: true };
  47309. instance.store.execQuery(ignore);
  47310. if (!options || !(options.silent || options.init)) {
  47311. instance.emit("sort-change", {
  47312. column: columnValue,
  47313. prop: propValue,
  47314. order: orderValue
  47315. });
  47316. }
  47317. instance.store.updateTableScrollY();
  47318. },
  47319. filterChange(_states, options) {
  47320. const { column, values, silent } = options;
  47321. const newFilters = instance.store.updateFilters(column, values);
  47322. instance.store.execQuery();
  47323. if (!silent) {
  47324. instance.emit("filter-change", newFilters);
  47325. }
  47326. instance.store.updateTableScrollY();
  47327. },
  47328. toggleAllSelection() {
  47329. instance.store.toggleAllSelection();
  47330. },
  47331. rowSelectedChanged(_states, row) {
  47332. instance.store.toggleRowSelection(row);
  47333. instance.store.updateAllSelected();
  47334. },
  47335. setHoverRow(states, row) {
  47336. states.hoverRow.value = row;
  47337. },
  47338. setCurrentRow(_states, row) {
  47339. instance.store.updateCurrentRow(row);
  47340. }
  47341. };
  47342. const commit = function(name, ...args) {
  47343. const mutations2 = instance.store.mutations;
  47344. if (mutations2[name]) {
  47345. mutations2[name].apply(instance, [instance.store.states].concat(args));
  47346. } else {
  47347. throw new Error(`Action not found: ${name}`);
  47348. }
  47349. };
  47350. const updateTableScrollY = function() {
  47351. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  47352. };
  47353. return {
  47354. ns,
  47355. ...watcher,
  47356. mutations,
  47357. commit,
  47358. updateTableScrollY
  47359. };
  47360. }
  47361. const InitialStateMap = {
  47362. rowKey: "rowKey",
  47363. defaultExpandAll: "defaultExpandAll",
  47364. selectOnIndeterminate: "selectOnIndeterminate",
  47365. indent: "indent",
  47366. lazy: "lazy",
  47367. data: "data",
  47368. ["treeProps.hasChildren"]: {
  47369. key: "lazyColumnIdentifier",
  47370. default: "hasChildren"
  47371. },
  47372. ["treeProps.children"]: {
  47373. key: "childrenColumnName",
  47374. default: "children"
  47375. }
  47376. };
  47377. function createStore(table, props) {
  47378. if (!table) {
  47379. throw new Error("Table is required.");
  47380. }
  47381. const store = useStore();
  47382. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  47383. Object.keys(InitialStateMap).forEach((key) => {
  47384. handleValue(getArrKeysValue(props, key), key, store);
  47385. });
  47386. proxyTableProps(store, props);
  47387. return store;
  47388. }
  47389. function proxyTableProps(store, props) {
  47390. Object.keys(InitialStateMap).forEach((key) => {
  47391. watch(() => getArrKeysValue(props, key), (value) => {
  47392. handleValue(value, key, store);
  47393. });
  47394. });
  47395. }
  47396. function handleValue(value, propsKey, store) {
  47397. let newVal = value;
  47398. let storeKey = InitialStateMap[propsKey];
  47399. if (typeof InitialStateMap[propsKey] === "object") {
  47400. storeKey = storeKey.key;
  47401. newVal = newVal || InitialStateMap[propsKey].default;
  47402. }
  47403. store.states[storeKey].value = newVal;
  47404. }
  47405. function getArrKeysValue(props, keys2) {
  47406. if (keys2.includes(".")) {
  47407. const keyList = keys2.split(".");
  47408. let value = props;
  47409. keyList.forEach((key) => {
  47410. value = value[key];
  47411. });
  47412. return value;
  47413. } else {
  47414. return props[keys2];
  47415. }
  47416. }
  47417. class TableLayout {
  47418. constructor(options) {
  47419. this.observers = [];
  47420. this.table = null;
  47421. this.store = null;
  47422. this.columns = [];
  47423. this.fit = true;
  47424. this.showHeader = true;
  47425. this.height = ref(null);
  47426. this.scrollX = ref(false);
  47427. this.scrollY = ref(false);
  47428. this.bodyWidth = ref(null);
  47429. this.fixedWidth = ref(null);
  47430. this.rightFixedWidth = ref(null);
  47431. this.gutterWidth = 0;
  47432. for (const name in options) {
  47433. if (hasOwn(options, name)) {
  47434. if (isRef(this[name])) {
  47435. this[name].value = options[name];
  47436. } else {
  47437. this[name] = options[name];
  47438. }
  47439. }
  47440. }
  47441. if (!this.table) {
  47442. throw new Error("Table is required for Table Layout");
  47443. }
  47444. if (!this.store) {
  47445. throw new Error("Store is required for Table Layout");
  47446. }
  47447. }
  47448. updateScrollY() {
  47449. const height = this.height.value;
  47450. if (height === null)
  47451. return false;
  47452. const scrollBarRef = this.table.refs.scrollBarRef;
  47453. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  47454. let scrollY = true;
  47455. const prevScrollY = this.scrollY.value;
  47456. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  47457. this.scrollY.value = scrollY;
  47458. return prevScrollY !== scrollY;
  47459. }
  47460. return false;
  47461. }
  47462. setHeight(value, prop = "height") {
  47463. if (!isClient)
  47464. return;
  47465. const el = this.table.vnode.el;
  47466. value = parseHeight(value);
  47467. this.height.value = Number(value);
  47468. if (!el && (value || value === 0))
  47469. return nextTick(() => this.setHeight(value, prop));
  47470. if (typeof value === "number") {
  47471. el.style[prop] = `${value}px`;
  47472. this.updateElsHeight();
  47473. } else if (typeof value === "string") {
  47474. el.style[prop] = value;
  47475. this.updateElsHeight();
  47476. }
  47477. }
  47478. setMaxHeight(value) {
  47479. this.setHeight(value, "max-height");
  47480. }
  47481. getFlattenColumns() {
  47482. const flattenColumns = [];
  47483. const columns2 = this.table.store.states.columns.value;
  47484. columns2.forEach((column) => {
  47485. if (column.isColumnGroup) {
  47486. flattenColumns.push.apply(flattenColumns, column.columns);
  47487. } else {
  47488. flattenColumns.push(column);
  47489. }
  47490. });
  47491. return flattenColumns;
  47492. }
  47493. updateElsHeight() {
  47494. this.updateScrollY();
  47495. this.notifyObservers("scrollable");
  47496. }
  47497. headerDisplayNone(elm) {
  47498. if (!elm)
  47499. return true;
  47500. let headerChild = elm;
  47501. while (headerChild.tagName !== "DIV") {
  47502. if (getComputedStyle(headerChild).display === "none") {
  47503. return true;
  47504. }
  47505. headerChild = headerChild.parentElement;
  47506. }
  47507. return false;
  47508. }
  47509. updateColumnsWidth() {
  47510. if (!isClient)
  47511. return;
  47512. const fit = this.fit;
  47513. const bodyWidth = this.table.vnode.el.clientWidth;
  47514. let bodyMinWidth = 0;
  47515. const flattenColumns = this.getFlattenColumns();
  47516. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  47517. flattenColumns.forEach((column) => {
  47518. if (typeof column.width === "number" && column.realWidth)
  47519. column.realWidth = null;
  47520. });
  47521. if (flexColumns.length > 0 && fit) {
  47522. flattenColumns.forEach((column) => {
  47523. bodyMinWidth += Number(column.width || column.minWidth || 80);
  47524. });
  47525. if (bodyMinWidth <= bodyWidth) {
  47526. this.scrollX.value = false;
  47527. const totalFlexWidth = bodyWidth - bodyMinWidth;
  47528. if (flexColumns.length === 1) {
  47529. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  47530. } else {
  47531. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  47532. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  47533. let noneFirstWidth = 0;
  47534. flexColumns.forEach((column, index2) => {
  47535. if (index2 === 0)
  47536. return;
  47537. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  47538. noneFirstWidth += flexWidth;
  47539. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  47540. });
  47541. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  47542. }
  47543. } else {
  47544. this.scrollX.value = true;
  47545. flexColumns.forEach((column) => {
  47546. column.realWidth = Number(column.minWidth);
  47547. });
  47548. }
  47549. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  47550. this.table.state.resizeState.value.width = this.bodyWidth.value;
  47551. } else {
  47552. flattenColumns.forEach((column) => {
  47553. if (!column.width && !column.minWidth) {
  47554. column.realWidth = 80;
  47555. } else {
  47556. column.realWidth = Number(column.width || column.minWidth);
  47557. }
  47558. bodyMinWidth += column.realWidth;
  47559. });
  47560. this.scrollX.value = bodyMinWidth > bodyWidth;
  47561. this.bodyWidth.value = bodyMinWidth;
  47562. }
  47563. const fixedColumns = this.store.states.fixedColumns.value;
  47564. if (fixedColumns.length > 0) {
  47565. let fixedWidth = 0;
  47566. fixedColumns.forEach((column) => {
  47567. fixedWidth += Number(column.realWidth || column.width);
  47568. });
  47569. this.fixedWidth.value = fixedWidth;
  47570. }
  47571. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  47572. if (rightFixedColumns.length > 0) {
  47573. let rightFixedWidth = 0;
  47574. rightFixedColumns.forEach((column) => {
  47575. rightFixedWidth += Number(column.realWidth || column.width);
  47576. });
  47577. this.rightFixedWidth.value = rightFixedWidth;
  47578. }
  47579. this.notifyObservers("columns");
  47580. }
  47581. addObserver(observer) {
  47582. this.observers.push(observer);
  47583. }
  47584. removeObserver(observer) {
  47585. const index2 = this.observers.indexOf(observer);
  47586. if (index2 !== -1) {
  47587. this.observers.splice(index2, 1);
  47588. }
  47589. }
  47590. notifyObservers(event) {
  47591. const observers = this.observers;
  47592. observers.forEach((observer) => {
  47593. var _a2, _b;
  47594. switch (event) {
  47595. case "columns":
  47596. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  47597. break;
  47598. case "scrollable":
  47599. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  47600. break;
  47601. default:
  47602. throw new Error(`Table Layout don't have event ${event}.`);
  47603. }
  47604. });
  47605. }
  47606. }
  47607. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  47608. const _sfc_main$w = /* @__PURE__ */ defineComponent({
  47609. name: "ElTableFilterPanel",
  47610. components: {
  47611. ElCheckbox,
  47612. ElCheckboxGroup,
  47613. ElScrollbar,
  47614. ElTooltip,
  47615. ElIcon,
  47616. ArrowDown: arrow_down_default,
  47617. ArrowUp: arrow_up_default
  47618. },
  47619. directives: { ClickOutside },
  47620. props: {
  47621. placement: {
  47622. type: String,
  47623. default: "bottom-start"
  47624. },
  47625. store: {
  47626. type: Object
  47627. },
  47628. column: {
  47629. type: Object
  47630. },
  47631. upDataColumn: {
  47632. type: Function
  47633. }
  47634. },
  47635. setup(props) {
  47636. const instance = getCurrentInstance();
  47637. const { t } = useLocale();
  47638. const ns = useNamespace("table-filter");
  47639. const parent = instance == null ? void 0 : instance.parent;
  47640. if (!parent.filterPanels.value[props.column.id]) {
  47641. parent.filterPanels.value[props.column.id] = instance;
  47642. }
  47643. const tooltipVisible = ref(false);
  47644. const tooltip = ref(null);
  47645. const filters = computed(() => {
  47646. return props.column && props.column.filters;
  47647. });
  47648. const filterValue = computed({
  47649. get: () => {
  47650. var _a2;
  47651. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  47652. },
  47653. set: (value) => {
  47654. if (filteredValue.value) {
  47655. if (typeof value !== "undefined" && value !== null) {
  47656. filteredValue.value.splice(0, 1, value);
  47657. } else {
  47658. filteredValue.value.splice(0, 1);
  47659. }
  47660. }
  47661. }
  47662. });
  47663. const filteredValue = computed({
  47664. get() {
  47665. if (props.column) {
  47666. return props.column.filteredValue || [];
  47667. }
  47668. return [];
  47669. },
  47670. set(value) {
  47671. if (props.column) {
  47672. props.upDataColumn("filteredValue", value);
  47673. }
  47674. }
  47675. });
  47676. const multiple = computed(() => {
  47677. if (props.column) {
  47678. return props.column.filterMultiple;
  47679. }
  47680. return true;
  47681. });
  47682. const isActive = (filter) => {
  47683. return filter.value === filterValue.value;
  47684. };
  47685. const hidden = () => {
  47686. tooltipVisible.value = false;
  47687. };
  47688. const showFilterPanel = (e) => {
  47689. e.stopPropagation();
  47690. tooltipVisible.value = !tooltipVisible.value;
  47691. };
  47692. const hideFilterPanel = () => {
  47693. tooltipVisible.value = false;
  47694. };
  47695. const handleConfirm = () => {
  47696. confirmFilter(filteredValue.value);
  47697. hidden();
  47698. };
  47699. const handleReset = () => {
  47700. filteredValue.value = [];
  47701. confirmFilter(filteredValue.value);
  47702. hidden();
  47703. };
  47704. const handleSelect = (_filterValue) => {
  47705. filterValue.value = _filterValue;
  47706. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  47707. confirmFilter(filteredValue.value);
  47708. } else {
  47709. confirmFilter([]);
  47710. }
  47711. hidden();
  47712. };
  47713. const confirmFilter = (filteredValue2) => {
  47714. props.store.commit("filterChange", {
  47715. column: props.column,
  47716. values: filteredValue2
  47717. });
  47718. props.store.updateAllSelected();
  47719. };
  47720. watch(tooltipVisible, (value) => {
  47721. if (props.column) {
  47722. props.upDataColumn("filterOpened", value);
  47723. }
  47724. }, {
  47725. immediate: true
  47726. });
  47727. const popperPaneRef = computed(() => {
  47728. var _a2, _b;
  47729. return (_b = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  47730. });
  47731. return {
  47732. tooltipVisible,
  47733. multiple,
  47734. filteredValue,
  47735. filterValue,
  47736. filters,
  47737. handleConfirm,
  47738. handleReset,
  47739. handleSelect,
  47740. isActive,
  47741. t,
  47742. ns,
  47743. showFilterPanel,
  47744. hideFilterPanel,
  47745. popperPaneRef,
  47746. tooltip
  47747. };
  47748. }
  47749. });
  47750. const _hoisted_1$e = { key: 0 };
  47751. const _hoisted_2$9 = ["disabled"];
  47752. const _hoisted_3$3 = ["label", "onClick"];
  47753. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  47754. const _component_el_checkbox = resolveComponent("el-checkbox");
  47755. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  47756. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  47757. const _component_arrow_up = resolveComponent("arrow-up");
  47758. const _component_arrow_down = resolveComponent("arrow-down");
  47759. const _component_el_icon = resolveComponent("el-icon");
  47760. const _component_el_tooltip = resolveComponent("el-tooltip");
  47761. const _directive_click_outside = resolveDirective("click-outside");
  47762. return openBlock(), createBlock(_component_el_tooltip, {
  47763. ref: "tooltip",
  47764. visible: _ctx.tooltipVisible,
  47765. offset: 0,
  47766. placement: _ctx.placement,
  47767. "show-arrow": false,
  47768. "stop-popper-mouse-event": false,
  47769. teleported: "",
  47770. effect: "light",
  47771. pure: "",
  47772. "popper-class": _ctx.ns.b(),
  47773. persistent: ""
  47774. }, {
  47775. content: withCtx(() => [
  47776. _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$e, [
  47777. createBaseVNode("div", {
  47778. class: normalizeClass(_ctx.ns.e("content"))
  47779. }, [
  47780. createVNode(_component_el_scrollbar, {
  47781. "wrap-class": _ctx.ns.e("wrap")
  47782. }, {
  47783. default: withCtx(() => [
  47784. createVNode(_component_el_checkbox_group, {
  47785. modelValue: _ctx.filteredValue,
  47786. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  47787. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  47788. }, {
  47789. default: withCtx(() => [
  47790. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  47791. return openBlock(), createBlock(_component_el_checkbox, {
  47792. key: filter.value,
  47793. label: filter.value
  47794. }, {
  47795. default: withCtx(() => [
  47796. createTextVNode(toDisplayString(filter.text), 1)
  47797. ]),
  47798. _: 2
  47799. }, 1032, ["label"]);
  47800. }), 128))
  47801. ]),
  47802. _: 1
  47803. }, 8, ["modelValue", "class"])
  47804. ]),
  47805. _: 1
  47806. }, 8, ["wrap-class"])
  47807. ], 2),
  47808. createBaseVNode("div", {
  47809. class: normalizeClass(_ctx.ns.e("bottom"))
  47810. }, [
  47811. createBaseVNode("button", {
  47812. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  47813. disabled: _ctx.filteredValue.length === 0,
  47814. type: "button",
  47815. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  47816. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$9),
  47817. createBaseVNode("button", {
  47818. type: "button",
  47819. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  47820. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  47821. ], 2)
  47822. ])) : (openBlock(), createElementBlock("ul", {
  47823. key: 1,
  47824. class: normalizeClass(_ctx.ns.e("list"))
  47825. }, [
  47826. createBaseVNode("li", {
  47827. class: normalizeClass([
  47828. _ctx.ns.e("list-item"),
  47829. {
  47830. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  47831. }
  47832. ]),
  47833. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  47834. }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  47835. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  47836. return openBlock(), createElementBlock("li", {
  47837. key: filter.value,
  47838. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  47839. label: filter.value,
  47840. onClick: ($event) => _ctx.handleSelect(filter.value)
  47841. }, toDisplayString(filter.text), 11, _hoisted_3$3);
  47842. }), 128))
  47843. ], 2))
  47844. ]),
  47845. default: withCtx(() => [
  47846. withDirectives((openBlock(), createElementBlock("span", {
  47847. class: normalizeClass([
  47848. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  47849. `${_ctx.ns.namespace.value}-none-outline`
  47850. ]),
  47851. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  47852. }, [
  47853. createVNode(_component_el_icon, null, {
  47854. default: withCtx(() => [
  47855. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  47856. ]),
  47857. _: 1
  47858. })
  47859. ], 2)), [
  47860. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  47861. ])
  47862. ]),
  47863. _: 1
  47864. }, 8, ["visible", "placement", "popper-class"]);
  47865. }
  47866. var FilterPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);
  47867. function useLayoutObserver(root2) {
  47868. const instance = getCurrentInstance();
  47869. onBeforeMount(() => {
  47870. tableLayout.value.addObserver(instance);
  47871. });
  47872. onMounted(() => {
  47873. onColumnsChange(tableLayout.value);
  47874. onScrollableChange(tableLayout.value);
  47875. });
  47876. onUpdated(() => {
  47877. onColumnsChange(tableLayout.value);
  47878. onScrollableChange(tableLayout.value);
  47879. });
  47880. onUnmounted(() => {
  47881. tableLayout.value.removeObserver(instance);
  47882. });
  47883. const tableLayout = computed(() => {
  47884. const layout2 = root2.layout;
  47885. if (!layout2) {
  47886. throw new Error("Can not find table layout.");
  47887. }
  47888. return layout2;
  47889. });
  47890. const onColumnsChange = (layout2) => {
  47891. var _a2;
  47892. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  47893. if (!cols.length)
  47894. return;
  47895. const flattenColumns = layout2.getFlattenColumns();
  47896. const columnsMap = {};
  47897. flattenColumns.forEach((column) => {
  47898. columnsMap[column.id] = column;
  47899. });
  47900. for (let i = 0, j = cols.length; i < j; i++) {
  47901. const col = cols[i];
  47902. const name = col.getAttribute("name");
  47903. const column = columnsMap[name];
  47904. if (column) {
  47905. col.setAttribute("width", column.realWidth || column.width);
  47906. }
  47907. }
  47908. };
  47909. const onScrollableChange = (layout2) => {
  47910. var _a2, _b;
  47911. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  47912. for (let i = 0, j = cols.length; i < j; i++) {
  47913. const col = cols[i];
  47914. col.setAttribute("width", layout2.scrollY.value ? layout2.gutterWidth : "0");
  47915. }
  47916. const ths = ((_b = root2.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  47917. for (let i = 0, j = ths.length; i < j; i++) {
  47918. const th = ths[i];
  47919. th.style.width = layout2.scrollY.value ? `${layout2.gutterWidth}px` : "0";
  47920. th.style.display = layout2.scrollY.value ? "" : "none";
  47921. }
  47922. };
  47923. return {
  47924. tableLayout: tableLayout.value,
  47925. onColumnsChange,
  47926. onScrollableChange
  47927. };
  47928. }
  47929. const TABLE_INJECTION_KEY = Symbol("ElTable");
  47930. function useEvent(props, emit2) {
  47931. const instance = getCurrentInstance();
  47932. const parent = inject(TABLE_INJECTION_KEY);
  47933. const handleFilterClick = (event) => {
  47934. event.stopPropagation();
  47935. return;
  47936. };
  47937. const handleHeaderClick = (event, column) => {
  47938. if (!column.filters && column.sortable) {
  47939. handleSortClick(event, column, false);
  47940. } else if (column.filterable && !column.sortable) {
  47941. handleFilterClick(event);
  47942. }
  47943. parent == null ? void 0 : parent.emit("header-click", column, event);
  47944. };
  47945. const handleHeaderContextMenu = (event, column) => {
  47946. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  47947. };
  47948. const draggingColumn = ref(null);
  47949. const dragging = ref(false);
  47950. const dragState = ref({});
  47951. const handleMouseDown = (event, column) => {
  47952. if (!isClient)
  47953. return;
  47954. if (column.children && column.children.length > 0)
  47955. return;
  47956. if (draggingColumn.value && props.border) {
  47957. dragging.value = true;
  47958. const table = parent;
  47959. emit2("set-drag-visible", true);
  47960. const tableEl = table == null ? void 0 : table.vnode.el;
  47961. const tableLeft = tableEl.getBoundingClientRect().left;
  47962. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  47963. const columnRect = columnEl.getBoundingClientRect();
  47964. const minLeft = columnRect.left - tableLeft + 30;
  47965. addClass(columnEl, "noclick");
  47966. dragState.value = {
  47967. startMouseLeft: event.clientX,
  47968. startLeft: columnRect.right - tableLeft,
  47969. startColumnLeft: columnRect.left - tableLeft,
  47970. tableLeft
  47971. };
  47972. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  47973. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  47974. document.onselectstart = function() {
  47975. return false;
  47976. };
  47977. document.ondragstart = function() {
  47978. return false;
  47979. };
  47980. const handleMouseMove2 = (event2) => {
  47981. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  47982. const proxyLeft = dragState.value.startLeft + deltaLeft;
  47983. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  47984. };
  47985. const handleMouseUp = () => {
  47986. if (dragging.value) {
  47987. const { startColumnLeft, startLeft } = dragState.value;
  47988. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  47989. const columnWidth = finalLeft - startColumnLeft;
  47990. column.width = column.realWidth = columnWidth;
  47991. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  47992. requestAnimationFrame(() => {
  47993. props.store.scheduleLayout(false, true);
  47994. });
  47995. document.body.style.cursor = "";
  47996. dragging.value = false;
  47997. draggingColumn.value = null;
  47998. dragState.value = {};
  47999. emit2("set-drag-visible", false);
  48000. }
  48001. document.removeEventListener("mousemove", handleMouseMove2);
  48002. document.removeEventListener("mouseup", handleMouseUp);
  48003. document.onselectstart = null;
  48004. document.ondragstart = null;
  48005. setTimeout(() => {
  48006. removeClass(columnEl, "noclick");
  48007. }, 0);
  48008. };
  48009. document.addEventListener("mousemove", handleMouseMove2);
  48010. document.addEventListener("mouseup", handleMouseUp);
  48011. }
  48012. };
  48013. const handleMouseMove = (event, column) => {
  48014. if (column.children && column.children.length > 0)
  48015. return;
  48016. const el = event.target;
  48017. if (!isElement$1(el)) {
  48018. return;
  48019. }
  48020. const target = el == null ? void 0 : el.closest("th");
  48021. if (!column || !column.resizable)
  48022. return;
  48023. if (!dragging.value && props.border) {
  48024. const rect = target.getBoundingClientRect();
  48025. const bodyStyle = document.body.style;
  48026. if (rect.width > 12 && rect.right - event.pageX < 8) {
  48027. bodyStyle.cursor = "col-resize";
  48028. if (hasClass(target, "is-sortable")) {
  48029. target.style.cursor = "col-resize";
  48030. }
  48031. draggingColumn.value = column;
  48032. } else if (!dragging.value) {
  48033. bodyStyle.cursor = "";
  48034. if (hasClass(target, "is-sortable")) {
  48035. target.style.cursor = "pointer";
  48036. }
  48037. draggingColumn.value = null;
  48038. }
  48039. }
  48040. };
  48041. const handleMouseOut = () => {
  48042. if (!isClient)
  48043. return;
  48044. document.body.style.cursor = "";
  48045. };
  48046. const toggleOrder = ({ order, sortOrders }) => {
  48047. if (order === "")
  48048. return sortOrders[0];
  48049. const index2 = sortOrders.indexOf(order || null);
  48050. return sortOrders[index2 > sortOrders.length - 2 ? 0 : index2 + 1];
  48051. };
  48052. const handleSortClick = (event, column, givenOrder) => {
  48053. var _a2;
  48054. event.stopPropagation();
  48055. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  48056. const target = (_a2 = event.target) == null ? void 0 : _a2.closest("th");
  48057. if (target) {
  48058. if (hasClass(target, "noclick")) {
  48059. removeClass(target, "noclick");
  48060. return;
  48061. }
  48062. }
  48063. if (!column.sortable)
  48064. return;
  48065. const states = props.store.states;
  48066. let sortProp = states.sortProp.value;
  48067. let sortOrder;
  48068. const sortingColumn = states.sortingColumn.value;
  48069. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  48070. if (sortingColumn) {
  48071. sortingColumn.order = null;
  48072. }
  48073. states.sortingColumn.value = column;
  48074. sortProp = column.property;
  48075. }
  48076. if (!order) {
  48077. sortOrder = column.order = null;
  48078. } else {
  48079. sortOrder = column.order = order;
  48080. }
  48081. states.sortProp.value = sortProp;
  48082. states.sortOrder.value = sortOrder;
  48083. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  48084. };
  48085. return {
  48086. handleHeaderClick,
  48087. handleHeaderContextMenu,
  48088. handleMouseDown,
  48089. handleMouseMove,
  48090. handleMouseOut,
  48091. handleSortClick,
  48092. handleFilterClick
  48093. };
  48094. }
  48095. function useStyle$2(props) {
  48096. const parent = inject(TABLE_INJECTION_KEY);
  48097. const ns = useNamespace("table");
  48098. const getHeaderRowStyle = (rowIndex) => {
  48099. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  48100. if (typeof headerRowStyle === "function") {
  48101. return headerRowStyle.call(null, { rowIndex });
  48102. }
  48103. return headerRowStyle;
  48104. };
  48105. const getHeaderRowClass = (rowIndex) => {
  48106. const classes = [];
  48107. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  48108. if (typeof headerRowClassName === "string") {
  48109. classes.push(headerRowClassName);
  48110. } else if (typeof headerRowClassName === "function") {
  48111. classes.push(headerRowClassName.call(null, { rowIndex }));
  48112. }
  48113. return classes.join(" ");
  48114. };
  48115. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  48116. var _a2;
  48117. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  48118. if (typeof headerCellStyles === "function") {
  48119. headerCellStyles = headerCellStyles.call(null, {
  48120. rowIndex,
  48121. columnIndex,
  48122. row,
  48123. column
  48124. });
  48125. }
  48126. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  48127. ensurePosition(fixedStyle, "left");
  48128. ensurePosition(fixedStyle, "right");
  48129. return Object.assign({}, headerCellStyles, fixedStyle);
  48130. };
  48131. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  48132. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  48133. const classes = [
  48134. column.id,
  48135. column.order,
  48136. column.headerAlign,
  48137. column.className,
  48138. column.labelClassName,
  48139. ...fixedClasses
  48140. ];
  48141. if (!column.children) {
  48142. classes.push("is-leaf");
  48143. }
  48144. if (column.sortable) {
  48145. classes.push("is-sortable");
  48146. }
  48147. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  48148. if (typeof headerCellClassName === "string") {
  48149. classes.push(headerCellClassName);
  48150. } else if (typeof headerCellClassName === "function") {
  48151. classes.push(headerCellClassName.call(null, {
  48152. rowIndex,
  48153. columnIndex,
  48154. row,
  48155. column
  48156. }));
  48157. }
  48158. classes.push(ns.e("cell"));
  48159. return classes.filter((className) => Boolean(className)).join(" ");
  48160. };
  48161. return {
  48162. getHeaderRowStyle,
  48163. getHeaderRowClass,
  48164. getHeaderCellStyle,
  48165. getHeaderCellClass
  48166. };
  48167. }
  48168. const getAllColumns = (columns2) => {
  48169. const result = [];
  48170. columns2.forEach((column) => {
  48171. if (column.children) {
  48172. result.push(column);
  48173. result.push.apply(result, getAllColumns(column.children));
  48174. } else {
  48175. result.push(column);
  48176. }
  48177. });
  48178. return result;
  48179. };
  48180. const convertToRows = (originColumns) => {
  48181. let maxLevel = 1;
  48182. const traverse2 = (column, parent) => {
  48183. if (parent) {
  48184. column.level = parent.level + 1;
  48185. if (maxLevel < column.level) {
  48186. maxLevel = column.level;
  48187. }
  48188. }
  48189. if (column.children) {
  48190. let colSpan = 0;
  48191. column.children.forEach((subColumn) => {
  48192. traverse2(subColumn, column);
  48193. colSpan += subColumn.colSpan;
  48194. });
  48195. column.colSpan = colSpan;
  48196. } else {
  48197. column.colSpan = 1;
  48198. }
  48199. };
  48200. originColumns.forEach((column) => {
  48201. column.level = 1;
  48202. traverse2(column, void 0);
  48203. });
  48204. const rows = [];
  48205. for (let i = 0; i < maxLevel; i++) {
  48206. rows.push([]);
  48207. }
  48208. const allColumns = getAllColumns(originColumns);
  48209. allColumns.forEach((column) => {
  48210. if (!column.children) {
  48211. column.rowSpan = maxLevel - column.level + 1;
  48212. } else {
  48213. column.rowSpan = 1;
  48214. column.children.forEach((col) => col.isSubColumn = true);
  48215. }
  48216. rows[column.level - 1].push(column);
  48217. });
  48218. return rows;
  48219. };
  48220. function useUtils$1(props) {
  48221. const parent = inject(TABLE_INJECTION_KEY);
  48222. const columnRows = computed(() => {
  48223. return convertToRows(props.store.states.originColumns.value);
  48224. });
  48225. const isGroup = computed(() => {
  48226. const result = columnRows.value.length > 1;
  48227. if (result && parent) {
  48228. parent.state.isGroup.value = true;
  48229. }
  48230. return result;
  48231. });
  48232. const toggleAllSelection = (event) => {
  48233. event.stopPropagation();
  48234. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  48235. };
  48236. return {
  48237. isGroup,
  48238. toggleAllSelection,
  48239. columnRows
  48240. };
  48241. }
  48242. var TableHeader = /* @__PURE__ */ defineComponent({
  48243. name: "ElTableHeader",
  48244. components: {
  48245. ElCheckbox
  48246. },
  48247. props: {
  48248. fixed: {
  48249. type: String,
  48250. default: ""
  48251. },
  48252. store: {
  48253. required: true,
  48254. type: Object
  48255. },
  48256. border: Boolean,
  48257. defaultSort: {
  48258. type: Object,
  48259. default: () => {
  48260. return {
  48261. prop: "",
  48262. order: ""
  48263. };
  48264. }
  48265. }
  48266. },
  48267. setup(props, { emit: emit2 }) {
  48268. const instance = getCurrentInstance();
  48269. const parent = inject(TABLE_INJECTION_KEY);
  48270. const ns = useNamespace("table");
  48271. const filterPanels = ref({});
  48272. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  48273. onMounted(async () => {
  48274. await nextTick();
  48275. await nextTick();
  48276. const { prop, order } = props.defaultSort;
  48277. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  48278. });
  48279. const {
  48280. handleHeaderClick,
  48281. handleHeaderContextMenu,
  48282. handleMouseDown,
  48283. handleMouseMove,
  48284. handleMouseOut,
  48285. handleSortClick,
  48286. handleFilterClick
  48287. } = useEvent(props, emit2);
  48288. const {
  48289. getHeaderRowStyle,
  48290. getHeaderRowClass,
  48291. getHeaderCellStyle,
  48292. getHeaderCellClass
  48293. } = useStyle$2(props);
  48294. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  48295. instance.state = {
  48296. onColumnsChange,
  48297. onScrollableChange
  48298. };
  48299. instance.filterPanels = filterPanels;
  48300. return {
  48301. ns,
  48302. filterPanels,
  48303. onColumnsChange,
  48304. onScrollableChange,
  48305. columnRows,
  48306. getHeaderRowClass,
  48307. getHeaderRowStyle,
  48308. getHeaderCellClass,
  48309. getHeaderCellStyle,
  48310. handleHeaderClick,
  48311. handleHeaderContextMenu,
  48312. handleMouseDown,
  48313. handleMouseMove,
  48314. handleMouseOut,
  48315. handleSortClick,
  48316. handleFilterClick,
  48317. isGroup,
  48318. toggleAllSelection
  48319. };
  48320. },
  48321. render() {
  48322. const {
  48323. ns,
  48324. isGroup,
  48325. columnRows,
  48326. getHeaderCellStyle,
  48327. getHeaderCellClass,
  48328. getHeaderRowClass,
  48329. getHeaderRowStyle,
  48330. handleHeaderClick,
  48331. handleHeaderContextMenu,
  48332. handleMouseDown,
  48333. handleMouseMove,
  48334. handleSortClick,
  48335. handleMouseOut,
  48336. store,
  48337. $parent
  48338. } = this;
  48339. let rowSpan = 1;
  48340. return h$1("thead", {
  48341. class: { [ns.is("group")]: isGroup }
  48342. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  48343. class: getHeaderRowClass(rowIndex),
  48344. key: rowIndex,
  48345. style: getHeaderRowStyle(rowIndex)
  48346. }, subColumns.map((column, cellIndex) => {
  48347. if (column.rowSpan > rowSpan) {
  48348. rowSpan = column.rowSpan;
  48349. }
  48350. return h$1("th", {
  48351. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  48352. colspan: column.colSpan,
  48353. key: `${column.id}-thead`,
  48354. rowspan: column.rowSpan,
  48355. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  48356. onClick: ($event) => handleHeaderClick($event, column),
  48357. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  48358. onMousedown: ($event) => handleMouseDown($event, column),
  48359. onMousemove: ($event) => handleMouseMove($event, column),
  48360. onMouseout: handleMouseOut
  48361. }, [
  48362. h$1("div", {
  48363. class: [
  48364. "cell",
  48365. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  48366. ]
  48367. }, [
  48368. column.renderHeader ? column.renderHeader({
  48369. column,
  48370. $index: cellIndex,
  48371. store,
  48372. _self: $parent
  48373. }) : column.label,
  48374. column.sortable && h$1("span", {
  48375. onClick: ($event) => handleSortClick($event, column),
  48376. class: "caret-wrapper"
  48377. }, [
  48378. h$1("i", {
  48379. onClick: ($event) => handleSortClick($event, column, "ascending"),
  48380. class: "sort-caret ascending"
  48381. }),
  48382. h$1("i", {
  48383. onClick: ($event) => handleSortClick($event, column, "descending"),
  48384. class: "sort-caret descending"
  48385. })
  48386. ]),
  48387. column.filterable && h$1(FilterPanel, {
  48388. store,
  48389. placement: column.filterPlacement || "bottom-start",
  48390. column,
  48391. upDataColumn: (key, value) => {
  48392. column[key] = value;
  48393. }
  48394. })
  48395. ])
  48396. ]);
  48397. }))));
  48398. }
  48399. });
  48400. function useEvents(props) {
  48401. const parent = inject(TABLE_INJECTION_KEY);
  48402. const tooltipContent = ref("");
  48403. const tooltipTrigger = ref(h$1("div"));
  48404. const { nextZIndex } = useZIndex();
  48405. const handleEvent = (event, row, name) => {
  48406. var _a2;
  48407. const table = parent;
  48408. const cell = getCell(event);
  48409. let column;
  48410. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  48411. if (cell) {
  48412. column = getColumnByCell({
  48413. columns: props.store.states.columns.value
  48414. }, cell, namespace);
  48415. if (column) {
  48416. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  48417. }
  48418. }
  48419. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  48420. };
  48421. const handleDoubleClick = (event, row) => {
  48422. handleEvent(event, row, "dblclick");
  48423. };
  48424. const handleClick = (event, row) => {
  48425. props.store.commit("setCurrentRow", row);
  48426. handleEvent(event, row, "click");
  48427. };
  48428. const handleContextMenu = (event, row) => {
  48429. handleEvent(event, row, "contextmenu");
  48430. };
  48431. const handleMouseEnter = debounce((index2) => {
  48432. props.store.commit("setHoverRow", index2);
  48433. }, 30);
  48434. const handleMouseLeave = debounce(() => {
  48435. props.store.commit("setHoverRow", null);
  48436. }, 30);
  48437. const getPadding = (el) => {
  48438. const style = window.getComputedStyle(el, null);
  48439. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  48440. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  48441. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  48442. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  48443. return {
  48444. left: paddingLeft,
  48445. right: paddingRight,
  48446. top: paddingTop,
  48447. bottom: paddingBottom
  48448. };
  48449. };
  48450. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  48451. var _a2;
  48452. const table = parent;
  48453. const cell = getCell(event);
  48454. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  48455. if (cell) {
  48456. const column = getColumnByCell({
  48457. columns: props.store.states.columns.value
  48458. }, cell, namespace);
  48459. const hoverState = table.hoverState = { cell, column, row };
  48460. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  48461. }
  48462. if (!tooltipOptions) {
  48463. return;
  48464. }
  48465. const cellChild = event.target.querySelector(".cell");
  48466. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  48467. return;
  48468. }
  48469. const range2 = document.createRange();
  48470. range2.setStart(cellChild, 0);
  48471. range2.setEnd(cellChild, cellChild.childNodes.length);
  48472. let rangeWidth = range2.getBoundingClientRect().width;
  48473. let rangeHeight = range2.getBoundingClientRect().height;
  48474. const offsetWidth = rangeWidth - Math.floor(rangeWidth);
  48475. if (offsetWidth < 1e-3) {
  48476. rangeWidth = Math.floor(rangeWidth);
  48477. }
  48478. const offsetHeight = rangeHeight - Math.floor(rangeHeight);
  48479. if (offsetHeight < 1e-3) {
  48480. rangeHeight = Math.floor(rangeHeight);
  48481. }
  48482. const { top, left: left2, right: right2, bottom } = getPadding(cellChild);
  48483. const horizontalPadding = left2 + right2;
  48484. const verticalPadding = top + bottom;
  48485. if (rangeWidth + horizontalPadding > cellChild.offsetWidth || rangeHeight + verticalPadding > cellChild.offsetHeight || cellChild.scrollWidth > cellChild.offsetWidth) {
  48486. createTablePopper(parent == null ? void 0 : parent.refs.tableWrapper, cell, cell.innerText || cell.textContent, nextZIndex, tooltipOptions);
  48487. }
  48488. };
  48489. const handleCellMouseLeave = (event) => {
  48490. const cell = getCell(event);
  48491. if (!cell)
  48492. return;
  48493. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  48494. parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
  48495. };
  48496. return {
  48497. handleDoubleClick,
  48498. handleClick,
  48499. handleContextMenu,
  48500. handleMouseEnter,
  48501. handleMouseLeave,
  48502. handleCellMouseEnter,
  48503. handleCellMouseLeave,
  48504. tooltipContent,
  48505. tooltipTrigger
  48506. };
  48507. }
  48508. function useStyles$1(props) {
  48509. const parent = inject(TABLE_INJECTION_KEY);
  48510. const ns = useNamespace("table");
  48511. const getRowStyle = (row, rowIndex) => {
  48512. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  48513. if (typeof rowStyle === "function") {
  48514. return rowStyle.call(null, {
  48515. row,
  48516. rowIndex
  48517. });
  48518. }
  48519. return rowStyle || null;
  48520. };
  48521. const getRowClass = (row, rowIndex) => {
  48522. const classes = [ns.e("row")];
  48523. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  48524. classes.push("current-row");
  48525. }
  48526. if (props.stripe && rowIndex % 2 === 1) {
  48527. classes.push(ns.em("row", "striped"));
  48528. }
  48529. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  48530. if (typeof rowClassName === "string") {
  48531. classes.push(rowClassName);
  48532. } else if (typeof rowClassName === "function") {
  48533. classes.push(rowClassName.call(null, {
  48534. row,
  48535. rowIndex
  48536. }));
  48537. }
  48538. return classes;
  48539. };
  48540. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  48541. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  48542. let cellStyles = cellStyle != null ? cellStyle : {};
  48543. if (typeof cellStyle === "function") {
  48544. cellStyles = cellStyle.call(null, {
  48545. rowIndex,
  48546. columnIndex,
  48547. row,
  48548. column
  48549. });
  48550. }
  48551. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  48552. ensurePosition(fixedStyle, "left");
  48553. ensurePosition(fixedStyle, "right");
  48554. return Object.assign({}, cellStyles, fixedStyle);
  48555. };
  48556. const getCellClass = (rowIndex, columnIndex, row, column, offset2) => {
  48557. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset2);
  48558. const classes = [column.id, column.align, column.className, ...fixedClasses];
  48559. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  48560. if (typeof cellClassName === "string") {
  48561. classes.push(cellClassName);
  48562. } else if (typeof cellClassName === "function") {
  48563. classes.push(cellClassName.call(null, {
  48564. rowIndex,
  48565. columnIndex,
  48566. row,
  48567. column
  48568. }));
  48569. }
  48570. classes.push(ns.e("cell"));
  48571. return classes.filter((className) => Boolean(className)).join(" ");
  48572. };
  48573. const getSpan = (row, column, rowIndex, columnIndex) => {
  48574. let rowspan = 1;
  48575. let colspan = 1;
  48576. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  48577. if (typeof fn2 === "function") {
  48578. const result = fn2({
  48579. row,
  48580. column,
  48581. rowIndex,
  48582. columnIndex
  48583. });
  48584. if (Array.isArray(result)) {
  48585. rowspan = result[0];
  48586. colspan = result[1];
  48587. } else if (typeof result === "object") {
  48588. rowspan = result.rowspan;
  48589. colspan = result.colspan;
  48590. }
  48591. }
  48592. return { rowspan, colspan };
  48593. };
  48594. const getColspanRealWidth = (columns2, colspan, index2) => {
  48595. if (colspan < 1) {
  48596. return columns2[index2].realWidth;
  48597. }
  48598. const widthArr = columns2.map(({ realWidth, width }) => realWidth || width).slice(index2, index2 + colspan);
  48599. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  48600. };
  48601. return {
  48602. getRowStyle,
  48603. getRowClass,
  48604. getCellStyle,
  48605. getCellClass,
  48606. getSpan,
  48607. getColspanRealWidth
  48608. };
  48609. }
  48610. function useRender$1(props) {
  48611. const parent = inject(TABLE_INJECTION_KEY);
  48612. const ns = useNamespace("table");
  48613. const {
  48614. handleDoubleClick,
  48615. handleClick,
  48616. handleContextMenu,
  48617. handleMouseEnter,
  48618. handleMouseLeave,
  48619. handleCellMouseEnter,
  48620. handleCellMouseLeave,
  48621. tooltipContent,
  48622. tooltipTrigger
  48623. } = useEvents(props);
  48624. const {
  48625. getRowStyle,
  48626. getRowClass,
  48627. getCellStyle,
  48628. getCellClass,
  48629. getSpan,
  48630. getColspanRealWidth
  48631. } = useStyles$1(props);
  48632. const firstDefaultColumnIndex = computed(() => {
  48633. return props.store.states.columns.value.findIndex(({ type: type2 }) => type2 === "default");
  48634. });
  48635. const getKeyOfRow = (row, index2) => {
  48636. const rowKey2 = parent.props.rowKey;
  48637. if (rowKey2) {
  48638. return getRowIdentity(row, rowKey2);
  48639. }
  48640. return index2;
  48641. };
  48642. const rowRender = (row, $index, treeRowData, expanded = false) => {
  48643. const { tooltipEffect, tooltipOptions, store } = props;
  48644. const { indent, columns: columns2 } = store.states;
  48645. const rowClasses = getRowClass(row, $index);
  48646. let display = true;
  48647. if (treeRowData) {
  48648. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  48649. display = treeRowData.display;
  48650. }
  48651. const displayStyle = display ? null : {
  48652. display: "none"
  48653. };
  48654. return h$1("tr", {
  48655. style: [displayStyle, getRowStyle(row, $index)],
  48656. class: rowClasses,
  48657. key: getKeyOfRow(row, $index),
  48658. onDblclick: ($event) => handleDoubleClick($event, row),
  48659. onClick: ($event) => handleClick($event, row),
  48660. onContextmenu: ($event) => handleContextMenu($event, row),
  48661. onMouseenter: () => handleMouseEnter($index),
  48662. onMouseleave: handleMouseLeave
  48663. }, columns2.value.map((column, cellIndex) => {
  48664. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  48665. if (!rowspan || !colspan) {
  48666. return null;
  48667. }
  48668. const columnData = Object.assign({}, column);
  48669. columnData.realWidth = getColspanRealWidth(columns2.value, colspan, cellIndex);
  48670. const data = {
  48671. store: props.store,
  48672. _self: props.context || parent,
  48673. column: columnData,
  48674. row,
  48675. $index,
  48676. cellIndex,
  48677. expanded
  48678. };
  48679. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  48680. data.treeNode = {
  48681. indent: treeRowData.level * indent.value,
  48682. level: treeRowData.level
  48683. };
  48684. if (typeof treeRowData.expanded === "boolean") {
  48685. data.treeNode.expanded = treeRowData.expanded;
  48686. if ("loading" in treeRowData) {
  48687. data.treeNode.loading = treeRowData.loading;
  48688. }
  48689. if ("noLazyChildren" in treeRowData) {
  48690. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  48691. }
  48692. }
  48693. }
  48694. const baseKey = `${$index},${cellIndex}`;
  48695. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  48696. const tdChildren = cellChildren(cellIndex, column, data);
  48697. const mergedTooltipOptions = column.showOverflowTooltip && merge$1({
  48698. effect: tooltipEffect
  48699. }, tooltipOptions, column.showOverflowTooltip);
  48700. return h$1("td", {
  48701. style: getCellStyle($index, cellIndex, row, column),
  48702. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  48703. key: `${patchKey}${baseKey}`,
  48704. rowspan,
  48705. colspan,
  48706. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  48707. onMouseleave: handleCellMouseLeave
  48708. }, [tdChildren]);
  48709. }));
  48710. };
  48711. const cellChildren = (cellIndex, column, data) => {
  48712. return column.renderCell(data);
  48713. };
  48714. const wrappedRowRender = (row, $index) => {
  48715. const store = props.store;
  48716. const { isRowExpanded, assertRowKey } = store;
  48717. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey: rowKey2 } = store.states;
  48718. const columns2 = store.states.columns.value;
  48719. const hasExpandColumn = columns2.some(({ type: type2 }) => type2 === "expand");
  48720. if (hasExpandColumn) {
  48721. const expanded = isRowExpanded(row);
  48722. const tr = rowRender(row, $index, void 0, expanded);
  48723. const renderExpanded = parent.renderExpanded;
  48724. if (expanded) {
  48725. if (!renderExpanded) {
  48726. console.error("[Element Error]renderExpanded is required.");
  48727. return tr;
  48728. }
  48729. return [
  48730. [
  48731. tr,
  48732. h$1("tr", {
  48733. key: `expanded-row__${tr.key}`
  48734. }, [
  48735. h$1("td", {
  48736. colspan: columns2.length,
  48737. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  48738. }, [renderExpanded({ row, $index, store, expanded })])
  48739. ])
  48740. ]
  48741. ];
  48742. } else {
  48743. return [[tr]];
  48744. }
  48745. } else if (Object.keys(treeData.value).length) {
  48746. assertRowKey();
  48747. const key = getRowIdentity(row, rowKey2.value);
  48748. let cur = treeData.value[key];
  48749. let treeRowData = null;
  48750. if (cur) {
  48751. treeRowData = {
  48752. expanded: cur.expanded,
  48753. level: cur.level,
  48754. display: true
  48755. };
  48756. if (typeof cur.lazy === "boolean") {
  48757. if (typeof cur.loaded === "boolean" && cur.loaded) {
  48758. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  48759. }
  48760. treeRowData.loading = cur.loading;
  48761. }
  48762. }
  48763. const tmp = [rowRender(row, $index, treeRowData)];
  48764. if (cur) {
  48765. let i = 0;
  48766. const traverse2 = (children, parent2) => {
  48767. if (!(children && children.length && parent2))
  48768. return;
  48769. children.forEach((node) => {
  48770. const innerTreeRowData = {
  48771. display: parent2.display && parent2.expanded,
  48772. level: parent2.level + 1,
  48773. expanded: false,
  48774. noLazyChildren: false,
  48775. loading: false
  48776. };
  48777. const childKey = getRowIdentity(node, rowKey2.value);
  48778. if (childKey === void 0 || childKey === null) {
  48779. throw new Error("For nested data item, row-key is required.");
  48780. }
  48781. cur = { ...treeData.value[childKey] };
  48782. if (cur) {
  48783. innerTreeRowData.expanded = cur.expanded;
  48784. cur.level = cur.level || innerTreeRowData.level;
  48785. cur.display = !!(cur.expanded && innerTreeRowData.display);
  48786. if (typeof cur.lazy === "boolean") {
  48787. if (typeof cur.loaded === "boolean" && cur.loaded) {
  48788. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  48789. }
  48790. innerTreeRowData.loading = cur.loading;
  48791. }
  48792. }
  48793. i++;
  48794. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  48795. if (cur) {
  48796. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  48797. traverse2(nodes2, cur);
  48798. }
  48799. });
  48800. };
  48801. cur.display = true;
  48802. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  48803. traverse2(nodes, cur);
  48804. }
  48805. return tmp;
  48806. } else {
  48807. return rowRender(row, $index, void 0);
  48808. }
  48809. };
  48810. return {
  48811. wrappedRowRender,
  48812. tooltipContent,
  48813. tooltipTrigger
  48814. };
  48815. }
  48816. const defaultProps$2 = {
  48817. store: {
  48818. required: true,
  48819. type: Object
  48820. },
  48821. stripe: Boolean,
  48822. tooltipEffect: String,
  48823. tooltipOptions: {
  48824. type: Object
  48825. },
  48826. context: {
  48827. default: () => ({}),
  48828. type: Object
  48829. },
  48830. rowClassName: [String, Function],
  48831. rowStyle: [Object, Function],
  48832. fixed: {
  48833. type: String,
  48834. default: ""
  48835. },
  48836. highlight: Boolean
  48837. };
  48838. var TableBody = /* @__PURE__ */ defineComponent({
  48839. name: "ElTableBody",
  48840. props: defaultProps$2,
  48841. setup(props) {
  48842. const instance = getCurrentInstance();
  48843. const parent = inject(TABLE_INJECTION_KEY);
  48844. const ns = useNamespace("table");
  48845. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  48846. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  48847. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  48848. if (!props.store.states.isComplex.value || !isClient)
  48849. return;
  48850. rAF(() => {
  48851. const el = instance == null ? void 0 : instance.vnode.el;
  48852. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  48853. const oldRow = rows[oldVal];
  48854. const newRow = rows[newVal];
  48855. if (oldRow) {
  48856. removeClass(oldRow, "hover-row");
  48857. }
  48858. if (newRow) {
  48859. addClass(newRow, "hover-row");
  48860. }
  48861. });
  48862. });
  48863. onUnmounted(() => {
  48864. var _a2;
  48865. (_a2 = removePopper) == null ? void 0 : _a2();
  48866. });
  48867. return {
  48868. ns,
  48869. onColumnsChange,
  48870. onScrollableChange,
  48871. wrappedRowRender,
  48872. tooltipContent,
  48873. tooltipTrigger
  48874. };
  48875. },
  48876. render() {
  48877. const { wrappedRowRender, store } = this;
  48878. const data = store.states.data.value || [];
  48879. return h$1("tbody", { tabIndex: -1 }, [
  48880. data.reduce((acc, row) => {
  48881. return acc.concat(wrappedRowRender(row, acc.length));
  48882. }, [])
  48883. ]);
  48884. }
  48885. });
  48886. function useMapState() {
  48887. const table = inject(TABLE_INJECTION_KEY);
  48888. const store = table == null ? void 0 : table.store;
  48889. const leftFixedLeafCount = computed(() => {
  48890. return store.states.fixedLeafColumnsLength.value;
  48891. });
  48892. const rightFixedLeafCount = computed(() => {
  48893. return store.states.rightFixedColumns.value.length;
  48894. });
  48895. const columnsCount = computed(() => {
  48896. return store.states.columns.value.length;
  48897. });
  48898. const leftFixedCount = computed(() => {
  48899. return store.states.fixedColumns.value.length;
  48900. });
  48901. const rightFixedCount = computed(() => {
  48902. return store.states.rightFixedColumns.value.length;
  48903. });
  48904. return {
  48905. leftFixedLeafCount,
  48906. rightFixedLeafCount,
  48907. columnsCount,
  48908. leftFixedCount,
  48909. rightFixedCount,
  48910. columns: store.states.columns
  48911. };
  48912. }
  48913. function useStyle$1(props) {
  48914. const { columns: columns2 } = useMapState();
  48915. const ns = useNamespace("table");
  48916. const getCellClasses = (columns22, cellIndex) => {
  48917. const column = columns22[cellIndex];
  48918. const classes = [
  48919. ns.e("cell"),
  48920. column.id,
  48921. column.align,
  48922. column.labelClassName,
  48923. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  48924. ];
  48925. if (column.className) {
  48926. classes.push(column.className);
  48927. }
  48928. if (!column.children) {
  48929. classes.push(ns.is("leaf"));
  48930. }
  48931. return classes;
  48932. };
  48933. const getCellStyles = (column, cellIndex) => {
  48934. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  48935. ensurePosition(fixedStyle, "left");
  48936. ensurePosition(fixedStyle, "right");
  48937. return fixedStyle;
  48938. };
  48939. return {
  48940. getCellClasses,
  48941. getCellStyles,
  48942. columns: columns2
  48943. };
  48944. }
  48945. var TableFooter = /* @__PURE__ */ defineComponent({
  48946. name: "ElTableFooter",
  48947. props: {
  48948. fixed: {
  48949. type: String,
  48950. default: ""
  48951. },
  48952. store: {
  48953. required: true,
  48954. type: Object
  48955. },
  48956. summaryMethod: Function,
  48957. sumText: String,
  48958. border: Boolean,
  48959. defaultSort: {
  48960. type: Object,
  48961. default: () => {
  48962. return {
  48963. prop: "",
  48964. order: ""
  48965. };
  48966. }
  48967. }
  48968. },
  48969. setup(props) {
  48970. const { getCellClasses, getCellStyles, columns: columns2 } = useStyle$1(props);
  48971. const ns = useNamespace("table");
  48972. return {
  48973. ns,
  48974. getCellClasses,
  48975. getCellStyles,
  48976. columns: columns2
  48977. };
  48978. },
  48979. render() {
  48980. const { columns: columns2, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  48981. const data = this.store.states.data.value;
  48982. let sums = [];
  48983. if (summaryMethod) {
  48984. sums = summaryMethod({
  48985. columns: columns2,
  48986. data
  48987. });
  48988. } else {
  48989. columns2.forEach((column, index2) => {
  48990. if (index2 === 0) {
  48991. sums[index2] = sumText;
  48992. return;
  48993. }
  48994. const values = data.map((item) => Number(item[column.property]));
  48995. const precisions = [];
  48996. let notNumber = true;
  48997. values.forEach((value) => {
  48998. if (!Number.isNaN(+value)) {
  48999. notNumber = false;
  49000. const decimal = `${value}`.split(".")[1];
  49001. precisions.push(decimal ? decimal.length : 0);
  49002. }
  49003. });
  49004. const precision = Math.max.apply(null, precisions);
  49005. if (!notNumber) {
  49006. sums[index2] = values.reduce((prev, curr) => {
  49007. const value = Number(curr);
  49008. if (!Number.isNaN(+value)) {
  49009. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  49010. } else {
  49011. return prev;
  49012. }
  49013. }, 0);
  49014. } else {
  49015. sums[index2] = "";
  49016. }
  49017. });
  49018. }
  49019. return h$1(h$1("tfoot", [
  49020. h$1("tr", {}, [
  49021. ...columns2.map((column, cellIndex) => h$1("td", {
  49022. key: cellIndex,
  49023. colspan: column.colSpan,
  49024. rowspan: column.rowSpan,
  49025. class: getCellClasses(columns2, cellIndex),
  49026. style: getCellStyles(column, cellIndex)
  49027. }, [
  49028. h$1("div", {
  49029. class: ["cell", column.labelClassName]
  49030. }, [sums[cellIndex]])
  49031. ]))
  49032. ])
  49033. ]));
  49034. }
  49035. });
  49036. function useUtils(store) {
  49037. const setCurrentRow = (row) => {
  49038. store.commit("setCurrentRow", row);
  49039. };
  49040. const getSelectionRows = () => {
  49041. return store.getSelectionRows();
  49042. };
  49043. const toggleRowSelection = (row, selected) => {
  49044. store.toggleRowSelection(row, selected, false);
  49045. store.updateAllSelected();
  49046. };
  49047. const clearSelection = () => {
  49048. store.clearSelection();
  49049. };
  49050. const clearFilter = (columnKeys) => {
  49051. store.clearFilter(columnKeys);
  49052. };
  49053. const toggleAllSelection = () => {
  49054. store.commit("toggleAllSelection");
  49055. };
  49056. const toggleRowExpansion = (row, expanded) => {
  49057. store.toggleRowExpansionAdapter(row, expanded);
  49058. };
  49059. const clearSort = () => {
  49060. store.clearSort();
  49061. };
  49062. const sort = (prop, order) => {
  49063. store.commit("sort", { prop, order });
  49064. };
  49065. return {
  49066. setCurrentRow,
  49067. getSelectionRows,
  49068. toggleRowSelection,
  49069. clearSelection,
  49070. clearFilter,
  49071. toggleAllSelection,
  49072. toggleRowExpansion,
  49073. clearSort,
  49074. sort
  49075. };
  49076. }
  49077. function useStyle(props, layout2, store, table) {
  49078. const isHidden2 = ref(false);
  49079. const renderExpanded = ref(null);
  49080. const resizeProxyVisible = ref(false);
  49081. const setDragVisible = (visible) => {
  49082. resizeProxyVisible.value = visible;
  49083. };
  49084. const resizeState = ref({
  49085. width: null,
  49086. height: null,
  49087. headerHeight: null
  49088. });
  49089. const isGroup = ref(false);
  49090. const scrollbarViewStyle = {
  49091. display: "inline-block",
  49092. verticalAlign: "middle"
  49093. };
  49094. const tableWidth = ref();
  49095. const tableScrollHeight = ref(0);
  49096. const bodyScrollHeight = ref(0);
  49097. const headerScrollHeight = ref(0);
  49098. const footerScrollHeight = ref(0);
  49099. const appendScrollHeight = ref(0);
  49100. watchEffect(() => {
  49101. layout2.setHeight(props.height);
  49102. });
  49103. watchEffect(() => {
  49104. layout2.setMaxHeight(props.maxHeight);
  49105. });
  49106. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey2]) => {
  49107. if (!unref(rowKey2) || !unref(currentRowKey))
  49108. return;
  49109. store.setCurrentRowKey(`${currentRowKey}`);
  49110. }, {
  49111. immediate: true
  49112. });
  49113. watch(() => props.data, (data) => {
  49114. table.store.commit("setData", data);
  49115. }, {
  49116. immediate: true,
  49117. deep: true
  49118. });
  49119. watchEffect(() => {
  49120. if (props.expandRowKeys) {
  49121. store.setExpandRowKeysAdapter(props.expandRowKeys);
  49122. }
  49123. });
  49124. const handleMouseLeave = () => {
  49125. table.store.commit("setHoverRow", null);
  49126. if (table.hoverState)
  49127. table.hoverState = null;
  49128. };
  49129. const handleHeaderFooterMousewheel = (event, data) => {
  49130. const { pixelX, pixelY } = data;
  49131. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  49132. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  49133. }
  49134. };
  49135. const shouldUpdateHeight = computed(() => {
  49136. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  49137. });
  49138. const tableBodyStyles = computed(() => {
  49139. return {
  49140. width: layout2.bodyWidth.value ? `${layout2.bodyWidth.value}px` : ""
  49141. };
  49142. });
  49143. const doLayout = () => {
  49144. if (shouldUpdateHeight.value) {
  49145. layout2.updateElsHeight();
  49146. }
  49147. layout2.updateColumnsWidth();
  49148. requestAnimationFrame(syncPosition);
  49149. };
  49150. onMounted(async () => {
  49151. await nextTick();
  49152. store.updateColumns();
  49153. bindEvents();
  49154. requestAnimationFrame(doLayout);
  49155. const el = table.vnode.el;
  49156. const tableHeader = table.refs.headerWrapper;
  49157. if (props.flexible && el && el.parentElement) {
  49158. el.parentElement.style.minWidth = "0";
  49159. }
  49160. resizeState.value = {
  49161. width: tableWidth.value = el.offsetWidth,
  49162. height: el.offsetHeight,
  49163. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  49164. };
  49165. store.states.columns.value.forEach((column) => {
  49166. if (column.filteredValue && column.filteredValue.length) {
  49167. table.store.commit("filterChange", {
  49168. column,
  49169. values: column.filteredValue,
  49170. silent: true
  49171. });
  49172. }
  49173. });
  49174. table.$ready = true;
  49175. });
  49176. const setScrollClassByEl = (el, className) => {
  49177. if (!el)
  49178. return;
  49179. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  49180. classList.push(layout2.scrollX.value ? className : "is-scrolling-none");
  49181. el.className = classList.join(" ");
  49182. };
  49183. const setScrollClass = (className) => {
  49184. const { tableWrapper } = table.refs;
  49185. setScrollClassByEl(tableWrapper, className);
  49186. };
  49187. const hasScrollClass = (className) => {
  49188. const { tableWrapper } = table.refs;
  49189. return !!(tableWrapper && tableWrapper.classList.contains(className));
  49190. };
  49191. const syncPosition = function() {
  49192. if (!table.refs.scrollBarRef)
  49193. return;
  49194. if (!layout2.scrollX.value) {
  49195. const scrollingNoneClass = "is-scrolling-none";
  49196. if (!hasScrollClass(scrollingNoneClass)) {
  49197. setScrollClass(scrollingNoneClass);
  49198. }
  49199. return;
  49200. }
  49201. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  49202. if (!scrollContainer)
  49203. return;
  49204. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  49205. const { headerWrapper, footerWrapper } = table.refs;
  49206. if (headerWrapper)
  49207. headerWrapper.scrollLeft = scrollLeft;
  49208. if (footerWrapper)
  49209. footerWrapper.scrollLeft = scrollLeft;
  49210. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  49211. if (scrollLeft >= maxScrollLeftPosition) {
  49212. setScrollClass("is-scrolling-right");
  49213. } else if (scrollLeft === 0) {
  49214. setScrollClass("is-scrolling-left");
  49215. } else {
  49216. setScrollClass("is-scrolling-middle");
  49217. }
  49218. };
  49219. const bindEvents = () => {
  49220. if (!table.refs.scrollBarRef)
  49221. return;
  49222. if (table.refs.scrollBarRef.wrapRef) {
  49223. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  49224. passive: true
  49225. });
  49226. }
  49227. if (props.fit) {
  49228. useResizeObserver(table.vnode.el, resizeListener);
  49229. } else {
  49230. useEventListener(window, "resize", resizeListener);
  49231. }
  49232. useResizeObserver(table.refs.bodyWrapper, () => {
  49233. var _a2, _b;
  49234. resizeListener();
  49235. (_b = (_a2 = table.refs) == null ? void 0 : _a2.scrollBarRef) == null ? void 0 : _b.update();
  49236. });
  49237. };
  49238. const resizeListener = () => {
  49239. var _a2, _b, _c, _d;
  49240. const el = table.vnode.el;
  49241. if (!table.$ready || !el)
  49242. return;
  49243. let shouldUpdateLayout = false;
  49244. const {
  49245. width: oldWidth,
  49246. height: oldHeight,
  49247. headerHeight: oldHeaderHeight
  49248. } = resizeState.value;
  49249. const width = tableWidth.value = el.offsetWidth;
  49250. if (oldWidth !== width) {
  49251. shouldUpdateLayout = true;
  49252. }
  49253. const height = el.offsetHeight;
  49254. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  49255. shouldUpdateLayout = true;
  49256. }
  49257. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a2 = table.refs.tableHeaderRef) == null ? void 0 : _a2.$el;
  49258. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  49259. shouldUpdateLayout = true;
  49260. }
  49261. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  49262. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  49263. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  49264. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  49265. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  49266. if (shouldUpdateLayout) {
  49267. resizeState.value = {
  49268. width,
  49269. height,
  49270. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  49271. };
  49272. doLayout();
  49273. }
  49274. };
  49275. const tableSize = useFormSize();
  49276. const bodyWidth = computed(() => {
  49277. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout2;
  49278. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  49279. });
  49280. const tableLayout = computed(() => {
  49281. if (props.maxHeight)
  49282. return "fixed";
  49283. return props.tableLayout;
  49284. });
  49285. const emptyBlockStyle = computed(() => {
  49286. if (props.data && props.data.length)
  49287. return null;
  49288. let height = "100%";
  49289. if (props.height && bodyScrollHeight.value) {
  49290. height = `${bodyScrollHeight.value}px`;
  49291. }
  49292. const width = tableWidth.value;
  49293. return {
  49294. width: width ? `${width}px` : "",
  49295. height
  49296. };
  49297. });
  49298. const tableInnerStyle = computed(() => {
  49299. if (props.height) {
  49300. return {
  49301. height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height
  49302. };
  49303. }
  49304. if (props.maxHeight) {
  49305. return {
  49306. maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight
  49307. };
  49308. }
  49309. return {};
  49310. });
  49311. const scrollbarStyle = computed(() => {
  49312. if (props.height) {
  49313. return {
  49314. height: "100%"
  49315. };
  49316. }
  49317. if (props.maxHeight) {
  49318. if (!Number.isNaN(Number(props.maxHeight))) {
  49319. return {
  49320. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  49321. };
  49322. } else {
  49323. return {
  49324. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  49325. };
  49326. }
  49327. }
  49328. return {};
  49329. });
  49330. const handleFixedMousewheel = (event, data) => {
  49331. const bodyWrapper = table.refs.bodyWrapper;
  49332. if (Math.abs(data.spinY) > 0) {
  49333. const currentScrollTop = bodyWrapper.scrollTop;
  49334. if (data.pixelY < 0 && currentScrollTop !== 0) {
  49335. event.preventDefault();
  49336. }
  49337. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  49338. event.preventDefault();
  49339. }
  49340. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  49341. } else {
  49342. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  49343. }
  49344. };
  49345. return {
  49346. isHidden: isHidden2,
  49347. renderExpanded,
  49348. setDragVisible,
  49349. isGroup,
  49350. handleMouseLeave,
  49351. handleHeaderFooterMousewheel,
  49352. tableSize,
  49353. emptyBlockStyle,
  49354. handleFixedMousewheel,
  49355. resizeProxyVisible,
  49356. bodyWidth,
  49357. resizeState,
  49358. doLayout,
  49359. tableBodyStyles,
  49360. tableLayout,
  49361. scrollbarViewStyle,
  49362. tableInnerStyle,
  49363. scrollbarStyle
  49364. };
  49365. }
  49366. function useKeyRender(table) {
  49367. const observer = ref();
  49368. const initWatchDom = () => {
  49369. const el = table.vnode.el;
  49370. const columnsWrapper = el.querySelector(".hidden-columns");
  49371. const config = { childList: true, subtree: true };
  49372. const updateOrderFns = table.store.states.updateOrderFns;
  49373. observer.value = new MutationObserver(() => {
  49374. updateOrderFns.forEach((fn2) => fn2());
  49375. });
  49376. observer.value.observe(columnsWrapper, config);
  49377. };
  49378. onMounted(() => {
  49379. initWatchDom();
  49380. });
  49381. onUnmounted(() => {
  49382. var _a2;
  49383. (_a2 = observer.value) == null ? void 0 : _a2.disconnect();
  49384. });
  49385. }
  49386. var defaultProps$1 = {
  49387. data: {
  49388. type: Array,
  49389. default: () => []
  49390. },
  49391. size: useSizeProp,
  49392. width: [String, Number],
  49393. height: [String, Number],
  49394. maxHeight: [String, Number],
  49395. fit: {
  49396. type: Boolean,
  49397. default: true
  49398. },
  49399. stripe: Boolean,
  49400. border: Boolean,
  49401. rowKey: [String, Function],
  49402. showHeader: {
  49403. type: Boolean,
  49404. default: true
  49405. },
  49406. showSummary: Boolean,
  49407. sumText: String,
  49408. summaryMethod: Function,
  49409. rowClassName: [String, Function],
  49410. rowStyle: [Object, Function],
  49411. cellClassName: [String, Function],
  49412. cellStyle: [Object, Function],
  49413. headerRowClassName: [String, Function],
  49414. headerRowStyle: [Object, Function],
  49415. headerCellClassName: [String, Function],
  49416. headerCellStyle: [Object, Function],
  49417. highlightCurrentRow: Boolean,
  49418. currentRowKey: [String, Number],
  49419. emptyText: String,
  49420. expandRowKeys: Array,
  49421. defaultExpandAll: Boolean,
  49422. defaultSort: Object,
  49423. tooltipEffect: String,
  49424. tooltipOptions: Object,
  49425. spanMethod: Function,
  49426. selectOnIndeterminate: {
  49427. type: Boolean,
  49428. default: true
  49429. },
  49430. indent: {
  49431. type: Number,
  49432. default: 16
  49433. },
  49434. treeProps: {
  49435. type: Object,
  49436. default: () => {
  49437. return {
  49438. hasChildren: "hasChildren",
  49439. children: "children"
  49440. };
  49441. }
  49442. },
  49443. lazy: Boolean,
  49444. load: Function,
  49445. style: {
  49446. type: Object,
  49447. default: () => ({})
  49448. },
  49449. className: {
  49450. type: String,
  49451. default: ""
  49452. },
  49453. tableLayout: {
  49454. type: String,
  49455. default: "fixed"
  49456. },
  49457. scrollbarAlwaysOn: {
  49458. type: Boolean,
  49459. default: false
  49460. },
  49461. flexible: Boolean,
  49462. showOverflowTooltip: [Boolean, Object]
  49463. };
  49464. function hColgroup(props) {
  49465. const isAuto = props.tableLayout === "auto";
  49466. let columns2 = props.columns || [];
  49467. if (isAuto) {
  49468. if (columns2.every((column) => column.width === void 0)) {
  49469. columns2 = [];
  49470. }
  49471. }
  49472. const getPropsData = (column) => {
  49473. const propsData = {
  49474. key: `${props.tableLayout}_${column.id}`,
  49475. style: {},
  49476. name: void 0
  49477. };
  49478. if (isAuto) {
  49479. propsData.style = {
  49480. width: `${column.width}px`
  49481. };
  49482. } else {
  49483. propsData.name = column.id;
  49484. }
  49485. return propsData;
  49486. };
  49487. return h$1("colgroup", {}, columns2.map((column) => h$1("col", getPropsData(column))));
  49488. }
  49489. hColgroup.props = ["columns", "tableLayout"];
  49490. const useScrollbar$1 = () => {
  49491. const scrollBarRef = ref();
  49492. const scrollTo = (options, yCoord) => {
  49493. const scrollbar = scrollBarRef.value;
  49494. if (scrollbar) {
  49495. scrollbar.scrollTo(options, yCoord);
  49496. }
  49497. };
  49498. const setScrollPosition = (position, offset2) => {
  49499. const scrollbar = scrollBarRef.value;
  49500. if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
  49501. scrollbar[`setScroll${position}`](offset2);
  49502. }
  49503. };
  49504. const setScrollTop = (top) => setScrollPosition("Top", top);
  49505. const setScrollLeft = (left2) => setScrollPosition("Left", left2);
  49506. return {
  49507. scrollBarRef,
  49508. scrollTo,
  49509. setScrollTop,
  49510. setScrollLeft
  49511. };
  49512. };
  49513. let tableIdSeed = 1;
  49514. const _sfc_main$v = /* @__PURE__ */ defineComponent({
  49515. name: "ElTable",
  49516. directives: {
  49517. Mousewheel
  49518. },
  49519. components: {
  49520. TableHeader,
  49521. TableBody,
  49522. TableFooter,
  49523. ElScrollbar,
  49524. hColgroup
  49525. },
  49526. props: defaultProps$1,
  49527. emits: [
  49528. "select",
  49529. "select-all",
  49530. "selection-change",
  49531. "cell-mouse-enter",
  49532. "cell-mouse-leave",
  49533. "cell-contextmenu",
  49534. "cell-click",
  49535. "cell-dblclick",
  49536. "row-click",
  49537. "row-contextmenu",
  49538. "row-dblclick",
  49539. "header-click",
  49540. "header-contextmenu",
  49541. "sort-change",
  49542. "filter-change",
  49543. "current-change",
  49544. "header-dragend",
  49545. "expand-change"
  49546. ],
  49547. setup(props) {
  49548. const { t } = useLocale();
  49549. const ns = useNamespace("table");
  49550. const table = getCurrentInstance();
  49551. provide(TABLE_INJECTION_KEY, table);
  49552. const store = createStore(table, props);
  49553. table.store = store;
  49554. const layout2 = new TableLayout({
  49555. store: table.store,
  49556. table,
  49557. fit: props.fit,
  49558. showHeader: props.showHeader
  49559. });
  49560. table.layout = layout2;
  49561. const isEmpty2 = computed(() => (store.states.data.value || []).length === 0);
  49562. const {
  49563. setCurrentRow,
  49564. getSelectionRows,
  49565. toggleRowSelection,
  49566. clearSelection,
  49567. clearFilter,
  49568. toggleAllSelection,
  49569. toggleRowExpansion,
  49570. clearSort,
  49571. sort
  49572. } = useUtils(store);
  49573. const {
  49574. isHidden: isHidden2,
  49575. renderExpanded,
  49576. setDragVisible,
  49577. isGroup,
  49578. handleMouseLeave,
  49579. handleHeaderFooterMousewheel,
  49580. tableSize,
  49581. emptyBlockStyle,
  49582. handleFixedMousewheel,
  49583. resizeProxyVisible,
  49584. bodyWidth,
  49585. resizeState,
  49586. doLayout,
  49587. tableBodyStyles,
  49588. tableLayout,
  49589. scrollbarViewStyle,
  49590. tableInnerStyle,
  49591. scrollbarStyle
  49592. } = useStyle(props, layout2, store, table);
  49593. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  49594. const debouncedUpdateLayout = debounce(doLayout, 50);
  49595. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  49596. table.tableId = tableId;
  49597. table.state = {
  49598. isGroup,
  49599. resizeState,
  49600. doLayout,
  49601. debouncedUpdateLayout
  49602. };
  49603. const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
  49604. const computedEmptyText = computed(() => {
  49605. return props.emptyText || t("el.table.emptyText");
  49606. });
  49607. useKeyRender(table);
  49608. return {
  49609. ns,
  49610. layout: layout2,
  49611. store,
  49612. handleHeaderFooterMousewheel,
  49613. handleMouseLeave,
  49614. tableId,
  49615. tableSize,
  49616. isHidden: isHidden2,
  49617. isEmpty: isEmpty2,
  49618. renderExpanded,
  49619. resizeProxyVisible,
  49620. resizeState,
  49621. isGroup,
  49622. bodyWidth,
  49623. tableBodyStyles,
  49624. emptyBlockStyle,
  49625. debouncedUpdateLayout,
  49626. handleFixedMousewheel,
  49627. setCurrentRow,
  49628. getSelectionRows,
  49629. toggleRowSelection,
  49630. clearSelection,
  49631. clearFilter,
  49632. toggleAllSelection,
  49633. toggleRowExpansion,
  49634. clearSort,
  49635. doLayout,
  49636. sort,
  49637. t,
  49638. setDragVisible,
  49639. context: table,
  49640. computedSumText,
  49641. computedEmptyText,
  49642. tableLayout,
  49643. scrollbarViewStyle,
  49644. tableInnerStyle,
  49645. scrollbarStyle,
  49646. scrollBarRef,
  49647. scrollTo,
  49648. setScrollLeft,
  49649. setScrollTop
  49650. };
  49651. }
  49652. });
  49653. const _hoisted_1$d = ["data-prefix"];
  49654. const _hoisted_2$8 = {
  49655. ref: "hiddenColumns",
  49656. class: "hidden-columns"
  49657. };
  49658. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  49659. const _component_hColgroup = resolveComponent("hColgroup");
  49660. const _component_table_header = resolveComponent("table-header");
  49661. const _component_table_body = resolveComponent("table-body");
  49662. const _component_table_footer = resolveComponent("table-footer");
  49663. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  49664. const _directive_mousewheel = resolveDirective("mousewheel");
  49665. return openBlock(), createElementBlock("div", {
  49666. ref: "tableWrapper",
  49667. class: normalizeClass([
  49668. {
  49669. [_ctx.ns.m("fit")]: _ctx.fit,
  49670. [_ctx.ns.m("striped")]: _ctx.stripe,
  49671. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  49672. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  49673. [_ctx.ns.m("group")]: _ctx.isGroup,
  49674. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  49675. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  49676. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  49677. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  49678. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  49679. "has-footer": _ctx.showSummary
  49680. },
  49681. _ctx.ns.m(_ctx.tableSize),
  49682. _ctx.className,
  49683. _ctx.ns.b(),
  49684. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  49685. ]),
  49686. style: normalizeStyle(_ctx.style),
  49687. "data-prefix": _ctx.ns.namespace.value,
  49688. onMouseleave: _cache[0] || (_cache[0] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args))
  49689. }, [
  49690. createBaseVNode("div", {
  49691. class: normalizeClass(_ctx.ns.e("inner-wrapper")),
  49692. style: normalizeStyle(_ctx.tableInnerStyle)
  49693. }, [
  49694. createBaseVNode("div", _hoisted_2$8, [
  49695. renderSlot(_ctx.$slots, "default")
  49696. ], 512),
  49697. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  49698. key: 0,
  49699. ref: "headerWrapper",
  49700. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  49701. }, [
  49702. createBaseVNode("table", {
  49703. ref: "tableHeader",
  49704. class: normalizeClass(_ctx.ns.e("header")),
  49705. style: normalizeStyle(_ctx.tableBodyStyles),
  49706. border: "0",
  49707. cellpadding: "0",
  49708. cellspacing: "0"
  49709. }, [
  49710. createVNode(_component_hColgroup, {
  49711. columns: _ctx.store.states.columns.value,
  49712. "table-layout": _ctx.tableLayout
  49713. }, null, 8, ["columns", "table-layout"]),
  49714. createVNode(_component_table_header, {
  49715. ref: "tableHeaderRef",
  49716. border: _ctx.border,
  49717. "default-sort": _ctx.defaultSort,
  49718. store: _ctx.store,
  49719. onSetDragVisible: _ctx.setDragVisible
  49720. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  49721. ], 6)
  49722. ], 2)), [
  49723. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  49724. ]) : createCommentVNode("v-if", true),
  49725. createBaseVNode("div", {
  49726. ref: "bodyWrapper",
  49727. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  49728. }, [
  49729. createVNode(_component_el_scrollbar, {
  49730. ref: "scrollBarRef",
  49731. "view-style": _ctx.scrollbarViewStyle,
  49732. "wrap-style": _ctx.scrollbarStyle,
  49733. always: _ctx.scrollbarAlwaysOn
  49734. }, {
  49735. default: withCtx(() => [
  49736. createBaseVNode("table", {
  49737. ref: "tableBody",
  49738. class: normalizeClass(_ctx.ns.e("body")),
  49739. cellspacing: "0",
  49740. cellpadding: "0",
  49741. border: "0",
  49742. style: normalizeStyle({
  49743. width: _ctx.bodyWidth,
  49744. tableLayout: _ctx.tableLayout
  49745. })
  49746. }, [
  49747. createVNode(_component_hColgroup, {
  49748. columns: _ctx.store.states.columns.value,
  49749. "table-layout": _ctx.tableLayout
  49750. }, null, 8, ["columns", "table-layout"]),
  49751. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  49752. key: 0,
  49753. ref: "tableHeaderRef",
  49754. class: normalizeClass(_ctx.ns.e("body-header")),
  49755. border: _ctx.border,
  49756. "default-sort": _ctx.defaultSort,
  49757. store: _ctx.store,
  49758. onSetDragVisible: _ctx.setDragVisible
  49759. }, null, 8, ["class", "border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  49760. createVNode(_component_table_body, {
  49761. context: _ctx.context,
  49762. highlight: _ctx.highlightCurrentRow,
  49763. "row-class-name": _ctx.rowClassName,
  49764. "tooltip-effect": _ctx.tooltipEffect,
  49765. "tooltip-options": _ctx.tooltipOptions,
  49766. "row-style": _ctx.rowStyle,
  49767. store: _ctx.store,
  49768. stripe: _ctx.stripe
  49769. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  49770. _ctx.showSummary && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_footer, {
  49771. key: 1,
  49772. class: normalizeClass(_ctx.ns.e("body-footer")),
  49773. border: _ctx.border,
  49774. "default-sort": _ctx.defaultSort,
  49775. store: _ctx.store,
  49776. "sum-text": _ctx.computedSumText,
  49777. "summary-method": _ctx.summaryMethod
  49778. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : createCommentVNode("v-if", true)
  49779. ], 6),
  49780. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  49781. key: 0,
  49782. ref: "emptyBlock",
  49783. style: normalizeStyle(_ctx.emptyBlockStyle),
  49784. class: normalizeClass(_ctx.ns.e("empty-block"))
  49785. }, [
  49786. createBaseVNode("span", {
  49787. class: normalizeClass(_ctx.ns.e("empty-text"))
  49788. }, [
  49789. renderSlot(_ctx.$slots, "empty", {}, () => [
  49790. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  49791. ])
  49792. ], 2)
  49793. ], 6)) : createCommentVNode("v-if", true),
  49794. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  49795. key: 1,
  49796. ref: "appendWrapper",
  49797. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  49798. }, [
  49799. renderSlot(_ctx.$slots, "append")
  49800. ], 2)) : createCommentVNode("v-if", true)
  49801. ]),
  49802. _: 3
  49803. }, 8, ["view-style", "wrap-style", "always"])
  49804. ], 2),
  49805. _ctx.showSummary && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  49806. key: 1,
  49807. ref: "footerWrapper",
  49808. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  49809. }, [
  49810. createBaseVNode("table", {
  49811. class: normalizeClass(_ctx.ns.e("footer")),
  49812. cellspacing: "0",
  49813. cellpadding: "0",
  49814. border: "0",
  49815. style: normalizeStyle(_ctx.tableBodyStyles)
  49816. }, [
  49817. createVNode(_component_hColgroup, {
  49818. columns: _ctx.store.states.columns.value,
  49819. "table-layout": _ctx.tableLayout
  49820. }, null, 8, ["columns", "table-layout"]),
  49821. createVNode(_component_table_footer, {
  49822. border: _ctx.border,
  49823. "default-sort": _ctx.defaultSort,
  49824. store: _ctx.store,
  49825. "sum-text": _ctx.computedSumText,
  49826. "summary-method": _ctx.summaryMethod
  49827. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  49828. ], 6)
  49829. ], 2)), [
  49830. [vShow, !_ctx.isEmpty],
  49831. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  49832. ]) : createCommentVNode("v-if", true),
  49833. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  49834. key: 2,
  49835. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  49836. }, null, 2)) : createCommentVNode("v-if", true)
  49837. ], 6),
  49838. withDirectives(createBaseVNode("div", {
  49839. ref: "resizeProxy",
  49840. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  49841. }, null, 2), [
  49842. [vShow, _ctx.resizeProxyVisible]
  49843. ])
  49844. ], 46, _hoisted_1$d);
  49845. }
  49846. var Table = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);
  49847. const defaultClassNames = {
  49848. selection: "table-column--selection",
  49849. expand: "table__expand-column"
  49850. };
  49851. const cellStarts = {
  49852. default: {
  49853. order: ""
  49854. },
  49855. selection: {
  49856. width: 48,
  49857. minWidth: 48,
  49858. realWidth: 48,
  49859. order: ""
  49860. },
  49861. expand: {
  49862. width: 48,
  49863. minWidth: 48,
  49864. realWidth: 48,
  49865. order: ""
  49866. },
  49867. index: {
  49868. width: 48,
  49869. minWidth: 48,
  49870. realWidth: 48,
  49871. order: ""
  49872. }
  49873. };
  49874. const getDefaultClassName = (type2) => {
  49875. return defaultClassNames[type2] || "";
  49876. };
  49877. const cellForced = {
  49878. selection: {
  49879. renderHeader({ store, column }) {
  49880. function isDisabled() {
  49881. return store.states.data.value && store.states.data.value.length === 0;
  49882. }
  49883. return h$1(ElCheckbox, {
  49884. disabled: isDisabled(),
  49885. size: store.states.tableSize.value,
  49886. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  49887. "onUpdate:modelValue": store.toggleAllSelection,
  49888. modelValue: store.states.isAllSelected.value,
  49889. ariaLabel: column.label
  49890. });
  49891. },
  49892. renderCell({
  49893. row,
  49894. column,
  49895. store,
  49896. $index
  49897. }) {
  49898. return h$1(ElCheckbox, {
  49899. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  49900. size: store.states.tableSize.value,
  49901. onChange: () => {
  49902. store.commit("rowSelectedChanged", row);
  49903. },
  49904. onClick: (event) => event.stopPropagation(),
  49905. modelValue: store.isSelected(row),
  49906. ariaLabel: column.label
  49907. });
  49908. },
  49909. sortable: false,
  49910. resizable: false
  49911. },
  49912. index: {
  49913. renderHeader({ column }) {
  49914. return column.label || "#";
  49915. },
  49916. renderCell({
  49917. column,
  49918. $index
  49919. }) {
  49920. let i = $index + 1;
  49921. const index2 = column.index;
  49922. if (typeof index2 === "number") {
  49923. i = $index + index2;
  49924. } else if (typeof index2 === "function") {
  49925. i = index2($index);
  49926. }
  49927. return h$1("div", {}, [i]);
  49928. },
  49929. sortable: false
  49930. },
  49931. expand: {
  49932. renderHeader({ column }) {
  49933. return column.label || "";
  49934. },
  49935. renderCell({
  49936. row,
  49937. store,
  49938. expanded
  49939. }) {
  49940. const { ns } = store;
  49941. const classes = [ns.e("expand-icon")];
  49942. if (expanded) {
  49943. classes.push(ns.em("expand-icon", "expanded"));
  49944. }
  49945. const callback = function(e) {
  49946. e.stopPropagation();
  49947. store.toggleRowExpansion(row);
  49948. };
  49949. return h$1("div", {
  49950. class: classes,
  49951. onClick: callback
  49952. }, {
  49953. default: () => {
  49954. return [
  49955. h$1(ElIcon, null, {
  49956. default: () => {
  49957. return [h$1(arrow_right_default)];
  49958. }
  49959. })
  49960. ];
  49961. }
  49962. });
  49963. },
  49964. sortable: false,
  49965. resizable: false
  49966. }
  49967. };
  49968. function defaultRenderCell({
  49969. row,
  49970. column,
  49971. $index
  49972. }) {
  49973. var _a2;
  49974. const property2 = column.property;
  49975. const value = property2 && getProp(row, property2).value;
  49976. if (column && column.formatter) {
  49977. return column.formatter(row, column, value, $index);
  49978. }
  49979. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  49980. }
  49981. function treeCellPrefix({
  49982. row,
  49983. treeNode,
  49984. store
  49985. }, createPlaceholder = false) {
  49986. const { ns } = store;
  49987. if (!treeNode) {
  49988. if (createPlaceholder) {
  49989. return [
  49990. h$1("span", {
  49991. class: ns.e("placeholder")
  49992. })
  49993. ];
  49994. }
  49995. return null;
  49996. }
  49997. const ele = [];
  49998. const callback = function(e) {
  49999. e.stopPropagation();
  50000. if (treeNode.loading) {
  50001. return;
  50002. }
  50003. store.loadOrToggle(row);
  50004. };
  50005. if (treeNode.indent) {
  50006. ele.push(h$1("span", {
  50007. class: ns.e("indent"),
  50008. style: { "padding-left": `${treeNode.indent}px` }
  50009. }));
  50010. }
  50011. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  50012. const expandClasses = [
  50013. ns.e("expand-icon"),
  50014. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  50015. ];
  50016. let icon = arrow_right_default;
  50017. if (treeNode.loading) {
  50018. icon = loading_default;
  50019. }
  50020. ele.push(h$1("div", {
  50021. class: expandClasses,
  50022. onClick: callback
  50023. }, {
  50024. default: () => {
  50025. return [
  50026. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  50027. default: () => [h$1(icon)]
  50028. })
  50029. ];
  50030. }
  50031. }));
  50032. } else {
  50033. ele.push(h$1("span", {
  50034. class: ns.e("placeholder")
  50035. }));
  50036. }
  50037. return ele;
  50038. }
  50039. function getAllAliases(props, aliases) {
  50040. return props.reduce((prev, cur) => {
  50041. prev[cur] = cur;
  50042. return prev;
  50043. }, aliases);
  50044. }
  50045. function useWatcher(owner, props_) {
  50046. const instance = getCurrentInstance();
  50047. const registerComplexWatchers = () => {
  50048. const props = ["fixed"];
  50049. const aliases = {
  50050. realWidth: "width",
  50051. realMinWidth: "minWidth"
  50052. };
  50053. const allAliases = getAllAliases(props, aliases);
  50054. Object.keys(allAliases).forEach((key) => {
  50055. const columnKey = aliases[key];
  50056. if (hasOwn(props_, columnKey)) {
  50057. watch(() => props_[columnKey], (newVal) => {
  50058. let value = newVal;
  50059. if (columnKey === "width" && key === "realWidth") {
  50060. value = parseWidth(newVal);
  50061. }
  50062. if (columnKey === "minWidth" && key === "realMinWidth") {
  50063. value = parseMinWidth(newVal);
  50064. }
  50065. instance.columnConfig.value[columnKey] = value;
  50066. instance.columnConfig.value[key] = value;
  50067. const updateColumns = columnKey === "fixed";
  50068. owner.value.store.scheduleLayout(updateColumns);
  50069. });
  50070. }
  50071. });
  50072. };
  50073. const registerNormalWatchers = () => {
  50074. const props = [
  50075. "label",
  50076. "filters",
  50077. "filterMultiple",
  50078. "filteredValue",
  50079. "sortable",
  50080. "index",
  50081. "formatter",
  50082. "className",
  50083. "labelClassName",
  50084. "showOverflowTooltip"
  50085. ];
  50086. const aliases = {
  50087. property: "prop",
  50088. align: "realAlign",
  50089. headerAlign: "realHeaderAlign"
  50090. };
  50091. const allAliases = getAllAliases(props, aliases);
  50092. Object.keys(allAliases).forEach((key) => {
  50093. const columnKey = aliases[key];
  50094. if (hasOwn(props_, columnKey)) {
  50095. watch(() => props_[columnKey], (newVal) => {
  50096. instance.columnConfig.value[key] = newVal;
  50097. });
  50098. }
  50099. });
  50100. };
  50101. return {
  50102. registerComplexWatchers,
  50103. registerNormalWatchers
  50104. };
  50105. }
  50106. function useRender(props, slots, owner) {
  50107. const instance = getCurrentInstance();
  50108. const columnId = ref("");
  50109. const isSubColumn = ref(false);
  50110. const realAlign = ref();
  50111. const realHeaderAlign = ref();
  50112. const ns = useNamespace("table");
  50113. watchEffect(() => {
  50114. realAlign.value = props.align ? `is-${props.align}` : null;
  50115. realAlign.value;
  50116. });
  50117. watchEffect(() => {
  50118. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  50119. realHeaderAlign.value;
  50120. });
  50121. const columnOrTableParent = computed(() => {
  50122. let parent = instance.vnode.vParent || instance.parent;
  50123. while (parent && !parent.tableId && !parent.columnId) {
  50124. parent = parent.vnode.vParent || parent.parent;
  50125. }
  50126. return parent;
  50127. });
  50128. const hasTreeColumn = computed(() => {
  50129. const { store } = instance.parent;
  50130. if (!store)
  50131. return false;
  50132. const { treeData } = store.states;
  50133. const treeDataValue = treeData.value;
  50134. return treeDataValue && Object.keys(treeDataValue).length > 0;
  50135. });
  50136. const realWidth = ref(parseWidth(props.width));
  50137. const realMinWidth = ref(parseMinWidth(props.minWidth));
  50138. const setColumnWidth = (column) => {
  50139. if (realWidth.value)
  50140. column.width = realWidth.value;
  50141. if (realMinWidth.value) {
  50142. column.minWidth = realMinWidth.value;
  50143. }
  50144. if (!realWidth.value && realMinWidth.value) {
  50145. column.width = void 0;
  50146. }
  50147. if (!column.minWidth) {
  50148. column.minWidth = 80;
  50149. }
  50150. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  50151. return column;
  50152. };
  50153. const setColumnForcedProps = (column) => {
  50154. const type2 = column.type;
  50155. const source = cellForced[type2] || {};
  50156. Object.keys(source).forEach((prop) => {
  50157. const value = source[prop];
  50158. if (prop !== "className" && value !== void 0) {
  50159. column[prop] = value;
  50160. }
  50161. });
  50162. const className = getDefaultClassName(type2);
  50163. if (className) {
  50164. const forceClass = `${unref(ns.namespace)}-${className}`;
  50165. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  50166. }
  50167. return column;
  50168. };
  50169. const checkSubColumn = (children) => {
  50170. if (Array.isArray(children)) {
  50171. children.forEach((child) => check(child));
  50172. } else {
  50173. check(children);
  50174. }
  50175. function check(item) {
  50176. var _a2;
  50177. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  50178. item.vParent = instance;
  50179. }
  50180. }
  50181. };
  50182. const setColumnRenders = (column) => {
  50183. if (props.renderHeader)
  50184. ;
  50185. else if (column.type !== "selection") {
  50186. column.renderHeader = (scope) => {
  50187. instance.columnConfig.value["label"];
  50188. const renderHeader = slots.header;
  50189. return renderHeader ? renderHeader(scope) : column.label;
  50190. };
  50191. }
  50192. let originRenderCell = column.renderCell;
  50193. if (column.type === "expand") {
  50194. column.renderCell = (data) => h$1("div", {
  50195. class: "cell"
  50196. }, [originRenderCell(data)]);
  50197. owner.value.renderExpanded = (data) => {
  50198. return slots.default ? slots.default(data) : slots.default;
  50199. };
  50200. } else {
  50201. originRenderCell = originRenderCell || defaultRenderCell;
  50202. column.renderCell = (data) => {
  50203. let children = null;
  50204. if (slots.default) {
  50205. const vnodes = slots.default(data);
  50206. children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data);
  50207. } else {
  50208. children = originRenderCell(data);
  50209. }
  50210. const { columns: columns2 } = owner.value.store.states;
  50211. const firstUserColumnIndex = columns2.value.findIndex((item) => item.type === "default");
  50212. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  50213. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  50214. const props2 = {
  50215. class: "cell",
  50216. style: {}
  50217. };
  50218. if (column.showOverflowTooltip) {
  50219. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  50220. props2.style = {
  50221. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  50222. };
  50223. }
  50224. checkSubColumn(children);
  50225. return h$1("div", props2, [prefix, children]);
  50226. };
  50227. }
  50228. return column;
  50229. };
  50230. const getPropsData = (...propsKey) => {
  50231. return propsKey.reduce((prev, cur) => {
  50232. if (Array.isArray(cur)) {
  50233. cur.forEach((key) => {
  50234. prev[key] = props[key];
  50235. });
  50236. }
  50237. return prev;
  50238. }, {});
  50239. };
  50240. const getColumnElIndex = (children, child) => {
  50241. return Array.prototype.indexOf.call(children, child);
  50242. };
  50243. const updateColumnOrder = () => {
  50244. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  50245. };
  50246. return {
  50247. columnId,
  50248. realAlign,
  50249. isSubColumn,
  50250. realHeaderAlign,
  50251. columnOrTableParent,
  50252. setColumnWidth,
  50253. setColumnForcedProps,
  50254. setColumnRenders,
  50255. getPropsData,
  50256. getColumnElIndex,
  50257. updateColumnOrder
  50258. };
  50259. }
  50260. var defaultProps = {
  50261. type: {
  50262. type: String,
  50263. default: "default"
  50264. },
  50265. label: String,
  50266. className: String,
  50267. labelClassName: String,
  50268. property: String,
  50269. prop: String,
  50270. width: {
  50271. type: [String, Number],
  50272. default: ""
  50273. },
  50274. minWidth: {
  50275. type: [String, Number],
  50276. default: ""
  50277. },
  50278. renderHeader: Function,
  50279. sortable: {
  50280. type: [Boolean, String],
  50281. default: false
  50282. },
  50283. sortMethod: Function,
  50284. sortBy: [String, Function, Array],
  50285. resizable: {
  50286. type: Boolean,
  50287. default: true
  50288. },
  50289. columnKey: String,
  50290. align: String,
  50291. headerAlign: String,
  50292. showOverflowTooltip: {
  50293. type: [Boolean, Object],
  50294. default: void 0
  50295. },
  50296. fixed: [Boolean, String],
  50297. formatter: Function,
  50298. selectable: Function,
  50299. reserveSelection: Boolean,
  50300. filterMethod: Function,
  50301. filteredValue: Array,
  50302. filters: Array,
  50303. filterPlacement: String,
  50304. filterMultiple: {
  50305. type: Boolean,
  50306. default: true
  50307. },
  50308. index: [Number, Function],
  50309. sortOrders: {
  50310. type: Array,
  50311. default: () => {
  50312. return ["ascending", "descending", null];
  50313. },
  50314. validator: (val) => {
  50315. return val.every((order) => ["ascending", "descending", null].includes(order));
  50316. }
  50317. }
  50318. };
  50319. let columnIdSeed = 1;
  50320. var ElTableColumn$1 = /* @__PURE__ */ defineComponent({
  50321. name: "ElTableColumn",
  50322. components: {
  50323. ElCheckbox
  50324. },
  50325. props: defaultProps,
  50326. setup(props, { slots }) {
  50327. const instance = getCurrentInstance();
  50328. const columnConfig = ref({});
  50329. const owner = computed(() => {
  50330. let parent2 = instance.parent;
  50331. while (parent2 && !parent2.tableId) {
  50332. parent2 = parent2.parent;
  50333. }
  50334. return parent2;
  50335. });
  50336. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  50337. const {
  50338. columnId,
  50339. isSubColumn,
  50340. realHeaderAlign,
  50341. columnOrTableParent,
  50342. setColumnWidth,
  50343. setColumnForcedProps,
  50344. setColumnRenders,
  50345. getPropsData,
  50346. getColumnElIndex,
  50347. realAlign,
  50348. updateColumnOrder
  50349. } = useRender(props, slots, owner);
  50350. const parent = columnOrTableParent.value;
  50351. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  50352. onBeforeMount(() => {
  50353. isSubColumn.value = owner.value !== parent;
  50354. const type2 = props.type || "default";
  50355. const sortable = props.sortable === "" ? true : props.sortable;
  50356. const showOverflowTooltip = isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  50357. const defaults = {
  50358. ...cellStarts[type2],
  50359. id: columnId.value,
  50360. type: type2,
  50361. property: props.prop || props.property,
  50362. align: realAlign,
  50363. headerAlign: realHeaderAlign,
  50364. showOverflowTooltip,
  50365. filterable: props.filters || props.filterMethod,
  50366. filteredValue: [],
  50367. filterPlacement: "",
  50368. isColumnGroup: false,
  50369. isSubColumn: false,
  50370. filterOpened: false,
  50371. sortable,
  50372. index: props.index,
  50373. rawColumnKey: instance.vnode.key
  50374. };
  50375. const basicProps = [
  50376. "columnKey",
  50377. "label",
  50378. "className",
  50379. "labelClassName",
  50380. "type",
  50381. "renderHeader",
  50382. "formatter",
  50383. "fixed",
  50384. "resizable"
  50385. ];
  50386. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  50387. const selectProps = ["selectable", "reserveSelection"];
  50388. const filterProps = [
  50389. "filterMethod",
  50390. "filters",
  50391. "filterMultiple",
  50392. "filterOpened",
  50393. "filteredValue",
  50394. "filterPlacement"
  50395. ];
  50396. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  50397. column = mergeOptions(defaults, column);
  50398. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  50399. column = chains(column);
  50400. columnConfig.value = column;
  50401. registerNormalWatchers();
  50402. registerComplexWatchers();
  50403. });
  50404. onMounted(() => {
  50405. var _a2;
  50406. const parent2 = columnOrTableParent.value;
  50407. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  50408. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  50409. columnConfig.value.getColumnIndex = getColumnIndex;
  50410. const columnIndex = getColumnIndex();
  50411. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  50412. });
  50413. onBeforeUnmount(() => {
  50414. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  50415. });
  50416. instance.columnId = columnId.value;
  50417. instance.columnConfig = columnConfig;
  50418. return;
  50419. },
  50420. render() {
  50421. var _a2, _b, _c;
  50422. try {
  50423. const renderDefault = (_b = (_a2 = this.$slots).default) == null ? void 0 : _b.call(_a2, {
  50424. row: {},
  50425. column: {},
  50426. $index: -1
  50427. });
  50428. const children = [];
  50429. if (Array.isArray(renderDefault)) {
  50430. for (const childNode of renderDefault) {
  50431. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  50432. children.push(childNode);
  50433. } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
  50434. childNode.children.forEach((vnode2) => {
  50435. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  50436. children.push(vnode2);
  50437. }
  50438. });
  50439. }
  50440. }
  50441. }
  50442. const vnode = h$1("div", children);
  50443. return vnode;
  50444. } catch (e) {
  50445. return h$1("div", []);
  50446. }
  50447. }
  50448. });
  50449. const ElTable = withInstall(Table, {
  50450. TableColumn: ElTableColumn$1
  50451. });
  50452. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  50453. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  50454. SortOrder2["ASC"] = "asc";
  50455. SortOrder2["DESC"] = "desc";
  50456. return SortOrder2;
  50457. })(SortOrder || {});
  50458. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  50459. Alignment2["CENTER"] = "center";
  50460. Alignment2["RIGHT"] = "right";
  50461. return Alignment2;
  50462. })(Alignment || {});
  50463. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  50464. FixedDir2["LEFT"] = "left";
  50465. FixedDir2["RIGHT"] = "right";
  50466. return FixedDir2;
  50467. })(FixedDir || {});
  50468. const oppositeOrderMap = {
  50469. [
  50470. "asc"
  50471. /* ASC */
  50472. ]: "desc",
  50473. [
  50474. "desc"
  50475. /* DESC */
  50476. ]: "asc"
  50477. /* ASC */
  50478. };
  50479. const placeholderSign = Symbol("placeholder");
  50480. const calcColumnStyle = (column, fixedColumn, fixed) => {
  50481. var _a2;
  50482. const flex = {
  50483. flexGrow: 0,
  50484. flexShrink: 0,
  50485. ...fixed ? {} : {
  50486. flexGrow: column.flexGrow || 0,
  50487. flexShrink: column.flexShrink || 1
  50488. }
  50489. };
  50490. if (!fixed) {
  50491. flex.flexShrink = 1;
  50492. }
  50493. const style = {
  50494. ...(_a2 = column.style) != null ? _a2 : {},
  50495. ...flex,
  50496. flexBasis: "auto",
  50497. width: column.width
  50498. };
  50499. if (!fixedColumn) {
  50500. if (column.maxWidth)
  50501. style.maxWidth = column.maxWidth;
  50502. if (column.minWidth)
  50503. style.minWidth = column.minWidth;
  50504. }
  50505. return style;
  50506. };
  50507. function useColumns(props, columns2, fixed) {
  50508. const visibleColumns = computed(() => {
  50509. return unref(columns2).filter((column) => !column.hidden);
  50510. });
  50511. const fixedColumnsOnLeft = computed(() => unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  50512. const fixedColumnsOnRight = computed(() => unref(visibleColumns).filter((column) => column.fixed === "right"));
  50513. const normalColumns = computed(() => unref(visibleColumns).filter((column) => !column.fixed));
  50514. const mainColumns = computed(() => {
  50515. const ret = [];
  50516. unref(fixedColumnsOnLeft).forEach((column) => {
  50517. ret.push({
  50518. ...column,
  50519. placeholderSign
  50520. });
  50521. });
  50522. unref(normalColumns).forEach((column) => {
  50523. ret.push(column);
  50524. });
  50525. unref(fixedColumnsOnRight).forEach((column) => {
  50526. ret.push({
  50527. ...column,
  50528. placeholderSign
  50529. });
  50530. });
  50531. return ret;
  50532. });
  50533. const hasFixedColumns = computed(() => {
  50534. return unref(fixedColumnsOnLeft).length || unref(fixedColumnsOnRight).length;
  50535. });
  50536. const columnsStyles = computed(() => {
  50537. const _columns = unref(columns2);
  50538. return _columns.reduce((style, column) => {
  50539. style[column.key] = calcColumnStyle(column, unref(fixed), props.fixed);
  50540. return style;
  50541. }, {});
  50542. });
  50543. const columnsTotalWidth = computed(() => {
  50544. return unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  50545. });
  50546. const getColumn = (key) => {
  50547. return unref(columns2).find((column) => column.key === key);
  50548. };
  50549. const getColumnStyle = (key) => {
  50550. return unref(columnsStyles)[key];
  50551. };
  50552. const updateColumnWidth = (column, width) => {
  50553. column.width = width;
  50554. };
  50555. function onColumnSorted(e) {
  50556. var _a2;
  50557. const { key } = e.currentTarget.dataset;
  50558. if (!key)
  50559. return;
  50560. const { sortState, sortBy } = props;
  50561. let order = SortOrder.ASC;
  50562. if (isObject$1(sortState)) {
  50563. order = oppositeOrderMap[sortState[key]];
  50564. } else {
  50565. order = oppositeOrderMap[sortBy.order];
  50566. }
  50567. (_a2 = props.onColumnSort) == null ? void 0 : _a2.call(props, { column: getColumn(key), key, order });
  50568. }
  50569. return {
  50570. columns: columns2,
  50571. columnsStyles,
  50572. columnsTotalWidth,
  50573. fixedColumnsOnLeft,
  50574. fixedColumnsOnRight,
  50575. hasFixedColumns,
  50576. mainColumns,
  50577. normalColumns,
  50578. visibleColumns,
  50579. getColumn,
  50580. getColumnStyle,
  50581. updateColumnWidth,
  50582. onColumnSorted
  50583. };
  50584. }
  50585. const useScrollbar = (props, {
  50586. mainTableRef,
  50587. leftTableRef,
  50588. rightTableRef,
  50589. onMaybeEndReached
  50590. }) => {
  50591. const scrollPos = ref({ scrollLeft: 0, scrollTop: 0 });
  50592. function doScroll(params) {
  50593. var _a2, _b, _c;
  50594. const { scrollTop } = params;
  50595. (_a2 = mainTableRef.value) == null ? void 0 : _a2.scrollTo(params);
  50596. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  50597. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  50598. }
  50599. function scrollTo(params) {
  50600. scrollPos.value = params;
  50601. doScroll(params);
  50602. }
  50603. function scrollToTop(scrollTop) {
  50604. scrollPos.value.scrollTop = scrollTop;
  50605. doScroll(unref(scrollPos));
  50606. }
  50607. function scrollToLeft(scrollLeft) {
  50608. var _a2, _b;
  50609. scrollPos.value.scrollLeft = scrollLeft;
  50610. (_b = (_a2 = mainTableRef.value) == null ? void 0 : _a2.scrollTo) == null ? void 0 : _b.call(_a2, unref(scrollPos));
  50611. }
  50612. function onScroll(params) {
  50613. var _a2;
  50614. scrollTo(params);
  50615. (_a2 = props.onScroll) == null ? void 0 : _a2.call(props, params);
  50616. }
  50617. function onVerticalScroll({ scrollTop }) {
  50618. const { scrollTop: currentScrollTop } = unref(scrollPos);
  50619. if (scrollTop !== currentScrollTop)
  50620. scrollToTop(scrollTop);
  50621. }
  50622. function scrollToRow(row, strategy = "auto") {
  50623. var _a2;
  50624. (_a2 = mainTableRef.value) == null ? void 0 : _a2.scrollToRow(row, strategy);
  50625. }
  50626. watch(() => unref(scrollPos).scrollTop, (cur, prev) => {
  50627. if (cur > prev)
  50628. onMaybeEndReached();
  50629. });
  50630. return {
  50631. scrollPos,
  50632. scrollTo,
  50633. scrollToLeft,
  50634. scrollToTop,
  50635. scrollToRow,
  50636. onScroll,
  50637. onVerticalScroll
  50638. };
  50639. };
  50640. const useRow = (props, { mainTableRef, leftTableRef, rightTableRef }) => {
  50641. const vm = getCurrentInstance();
  50642. const { emit: emit2 } = vm;
  50643. const isResetting = shallowRef(false);
  50644. const hoveringRowKey = shallowRef(null);
  50645. const expandedRowKeys = ref(props.defaultExpandedRowKeys || []);
  50646. const lastRenderedRowIndex = ref(-1);
  50647. const resetIndex = shallowRef(null);
  50648. const rowHeights = ref({});
  50649. const pendingRowHeights = ref({});
  50650. const leftTableHeights = shallowRef({});
  50651. const mainTableHeights = shallowRef({});
  50652. const rightTableHeights = shallowRef({});
  50653. const isDynamic = computed(() => isNumber(props.estimatedRowHeight));
  50654. function onRowsRendered(params) {
  50655. var _a2;
  50656. (_a2 = props.onRowsRendered) == null ? void 0 : _a2.call(props, params);
  50657. if (params.rowCacheEnd > unref(lastRenderedRowIndex)) {
  50658. lastRenderedRowIndex.value = params.rowCacheEnd;
  50659. }
  50660. }
  50661. function onRowHovered({ hovered, rowKey: rowKey2 }) {
  50662. hoveringRowKey.value = hovered ? rowKey2 : null;
  50663. }
  50664. function onRowExpanded({
  50665. expanded,
  50666. rowData,
  50667. rowIndex,
  50668. rowKey: rowKey2
  50669. }) {
  50670. var _a2, _b;
  50671. const _expandedRowKeys = [...unref(expandedRowKeys)];
  50672. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey2);
  50673. if (expanded) {
  50674. if (currentKeyIndex === -1)
  50675. _expandedRowKeys.push(rowKey2);
  50676. } else {
  50677. if (currentKeyIndex > -1)
  50678. _expandedRowKeys.splice(currentKeyIndex, 1);
  50679. }
  50680. expandedRowKeys.value = _expandedRowKeys;
  50681. emit2("update:expandedRowKeys", _expandedRowKeys);
  50682. (_a2 = props.onRowExpand) == null ? void 0 : _a2.call(props, {
  50683. expanded,
  50684. rowData,
  50685. rowIndex,
  50686. rowKey: rowKey2
  50687. });
  50688. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  50689. }
  50690. const flushingRowHeights = debounce(() => {
  50691. var _a2, _b, _c, _d;
  50692. isResetting.value = true;
  50693. rowHeights.value = { ...unref(rowHeights), ...unref(pendingRowHeights) };
  50694. resetAfterIndex(unref(resetIndex), false);
  50695. pendingRowHeights.value = {};
  50696. resetIndex.value = null;
  50697. (_a2 = mainTableRef.value) == null ? void 0 : _a2.forceUpdate();
  50698. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  50699. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  50700. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  50701. isResetting.value = false;
  50702. }, 0);
  50703. function resetAfterIndex(index2, forceUpdate = false) {
  50704. if (!unref(isDynamic))
  50705. return;
  50706. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  50707. const table = unref(tableRef);
  50708. if (table)
  50709. table.resetAfterRowIndex(index2, forceUpdate);
  50710. });
  50711. }
  50712. function resetHeights(rowKey2, height, rowIdx) {
  50713. const resetIdx = unref(resetIndex);
  50714. if (resetIdx === null) {
  50715. resetIndex.value = rowIdx;
  50716. } else {
  50717. if (resetIdx > rowIdx) {
  50718. resetIndex.value = rowIdx;
  50719. }
  50720. }
  50721. pendingRowHeights.value[rowKey2] = height;
  50722. }
  50723. function onRowHeightChange({ rowKey: rowKey2, height, rowIndex }, fixedDir) {
  50724. if (!fixedDir) {
  50725. mainTableHeights.value[rowKey2] = height;
  50726. } else {
  50727. if (fixedDir === FixedDir.RIGHT) {
  50728. rightTableHeights.value[rowKey2] = height;
  50729. } else {
  50730. leftTableHeights.value[rowKey2] = height;
  50731. }
  50732. }
  50733. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey2] || 0));
  50734. if (unref(rowHeights)[rowKey2] !== maximumHeight) {
  50735. resetHeights(rowKey2, maximumHeight, rowIndex);
  50736. flushingRowHeights();
  50737. }
  50738. }
  50739. return {
  50740. hoveringRowKey,
  50741. expandedRowKeys,
  50742. lastRenderedRowIndex,
  50743. isDynamic,
  50744. isResetting,
  50745. rowHeights,
  50746. resetAfterIndex,
  50747. onRowExpanded,
  50748. onRowHovered,
  50749. onRowsRendered,
  50750. onRowHeightChange
  50751. };
  50752. };
  50753. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  50754. const depthMap = ref({});
  50755. const flattenedData = computed(() => {
  50756. const depths = {};
  50757. const { data: data2, rowKey: rowKey2 } = props;
  50758. const _expandedRowKeys = unref(expandedRowKeys);
  50759. if (!_expandedRowKeys || !_expandedRowKeys.length)
  50760. return data2;
  50761. const array2 = [];
  50762. const keysSet = /* @__PURE__ */ new Set();
  50763. _expandedRowKeys.forEach((x2) => keysSet.add(x2));
  50764. let copy = data2.slice();
  50765. copy.forEach((x2) => depths[x2[rowKey2]] = 0);
  50766. while (copy.length > 0) {
  50767. const item = copy.shift();
  50768. array2.push(item);
  50769. if (keysSet.has(item[rowKey2]) && Array.isArray(item.children) && item.children.length > 0) {
  50770. copy = [...item.children, ...copy];
  50771. item.children.forEach((child) => depths[child[rowKey2]] = depths[item[rowKey2]] + 1);
  50772. }
  50773. }
  50774. depthMap.value = depths;
  50775. return array2;
  50776. });
  50777. const data = computed(() => {
  50778. const { data: data2, expandColumnKey: expandColumnKey2 } = props;
  50779. return expandColumnKey2 ? unref(flattenedData) : data2;
  50780. });
  50781. watch(data, (val, prev) => {
  50782. if (val !== prev) {
  50783. lastRenderedRowIndex.value = -1;
  50784. resetAfterIndex(0, true);
  50785. }
  50786. });
  50787. return {
  50788. data,
  50789. depthMap
  50790. };
  50791. };
  50792. const sumReducer = (sum2, num) => sum2 + num;
  50793. const sum = (listLike) => {
  50794. return isArray$3(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  50795. };
  50796. const tryCall = (fLike, params, defaultRet = {}) => {
  50797. return isFunction$2(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  50798. };
  50799. const enforceUnit = (style) => {
  50800. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  50801. style[key] = addUnit(style[key]);
  50802. });
  50803. return style;
  50804. };
  50805. const componentToSlot = (ComponentLike) => isVNode(ComponentLike) ? (props) => h$1(ComponentLike, props) : ComponentLike;
  50806. const useStyles = (props, {
  50807. columnsTotalWidth,
  50808. data,
  50809. fixedColumnsOnLeft,
  50810. fixedColumnsOnRight
  50811. }) => {
  50812. const bodyWidth = computed(() => {
  50813. const { fixed, width, vScrollbarSize } = props;
  50814. const ret = width - vScrollbarSize;
  50815. return fixed ? Math.max(Math.round(unref(columnsTotalWidth)), ret) : ret;
  50816. });
  50817. const headerWidth = computed(() => unref(bodyWidth) + (props.fixed ? props.vScrollbarSize : 0));
  50818. const mainTableHeight = computed(() => {
  50819. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  50820. if (maxHeight > 0) {
  50821. const _fixedRowsHeight = unref(fixedRowsHeight);
  50822. const _rowsHeight = unref(rowsHeight);
  50823. const _headerHeight = unref(headerHeight);
  50824. const total2 = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  50825. return Math.min(total2, maxHeight - footerHeight2);
  50826. }
  50827. return height - footerHeight2;
  50828. });
  50829. const rowsHeight = computed(() => {
  50830. const { rowHeight, estimatedRowHeight } = props;
  50831. const _data = unref(data);
  50832. if (isNumber(estimatedRowHeight)) {
  50833. return _data.length * estimatedRowHeight;
  50834. }
  50835. return _data.length * rowHeight;
  50836. });
  50837. const fixedTableHeight = computed(() => {
  50838. const { maxHeight } = props;
  50839. const tableHeight = unref(mainTableHeight);
  50840. if (isNumber(maxHeight) && maxHeight > 0)
  50841. return tableHeight;
  50842. const totalHeight = unref(rowsHeight) + unref(headerHeight) + unref(fixedRowsHeight);
  50843. return Math.min(tableHeight, totalHeight);
  50844. });
  50845. const mapColumn = (column) => column.width;
  50846. const leftTableWidth = computed(() => sum(unref(fixedColumnsOnLeft).map(mapColumn)));
  50847. const rightTableWidth = computed(() => sum(unref(fixedColumnsOnRight).map(mapColumn)));
  50848. const headerHeight = computed(() => sum(props.headerHeight));
  50849. const fixedRowsHeight = computed(() => {
  50850. var _a2;
  50851. return (((_a2 = props.fixedData) == null ? void 0 : _a2.length) || 0) * props.rowHeight;
  50852. });
  50853. const windowHeight = computed(() => {
  50854. return unref(mainTableHeight) - unref(headerHeight) - unref(fixedRowsHeight);
  50855. });
  50856. const rootStyle = computed(() => {
  50857. const { style = {}, height, width } = props;
  50858. return enforceUnit({
  50859. ...style,
  50860. height,
  50861. width
  50862. });
  50863. });
  50864. const footerHeight = computed(() => enforceUnit({ height: props.footerHeight }));
  50865. const emptyStyle = computed(() => ({
  50866. top: addUnit(unref(headerHeight)),
  50867. bottom: addUnit(props.footerHeight),
  50868. width: addUnit(props.width)
  50869. }));
  50870. return {
  50871. bodyWidth,
  50872. fixedTableHeight,
  50873. mainTableHeight,
  50874. leftTableWidth,
  50875. rightTableWidth,
  50876. headerWidth,
  50877. rowsHeight,
  50878. windowHeight,
  50879. footerHeight,
  50880. emptyStyle,
  50881. rootStyle,
  50882. headerHeight
  50883. };
  50884. };
  50885. const useAutoResize = (props) => {
  50886. const sizer = ref();
  50887. const width$ = ref(0);
  50888. const height$ = ref(0);
  50889. let resizerStopper;
  50890. onMounted(() => {
  50891. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  50892. const { width, height } = entry.contentRect;
  50893. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  50894. const left2 = Number.parseInt(paddingLeft) || 0;
  50895. const right2 = Number.parseInt(paddingRight) || 0;
  50896. const top = Number.parseInt(paddingTop) || 0;
  50897. const bottom = Number.parseInt(paddingBottom) || 0;
  50898. width$.value = width - left2 - right2;
  50899. height$.value = height - top - bottom;
  50900. }).stop;
  50901. });
  50902. onBeforeUnmount(() => {
  50903. resizerStopper == null ? void 0 : resizerStopper();
  50904. });
  50905. watch([width$, height$], ([width, height]) => {
  50906. var _a2;
  50907. (_a2 = props.onResize) == null ? void 0 : _a2.call(props, {
  50908. width,
  50909. height
  50910. });
  50911. });
  50912. return {
  50913. sizer,
  50914. width: width$,
  50915. height: height$
  50916. };
  50917. };
  50918. function useTable(props) {
  50919. const mainTableRef = ref();
  50920. const leftTableRef = ref();
  50921. const rightTableRef = ref();
  50922. const {
  50923. columns: columns2,
  50924. columnsStyles,
  50925. columnsTotalWidth,
  50926. fixedColumnsOnLeft,
  50927. fixedColumnsOnRight,
  50928. hasFixedColumns,
  50929. mainColumns,
  50930. onColumnSorted
  50931. } = useColumns(props, toRef(props, "columns"), toRef(props, "fixed"));
  50932. const {
  50933. scrollTo,
  50934. scrollToLeft,
  50935. scrollToTop,
  50936. scrollToRow,
  50937. onScroll,
  50938. onVerticalScroll,
  50939. scrollPos
  50940. } = useScrollbar(props, {
  50941. mainTableRef,
  50942. leftTableRef,
  50943. rightTableRef,
  50944. onMaybeEndReached
  50945. });
  50946. const {
  50947. expandedRowKeys,
  50948. hoveringRowKey,
  50949. lastRenderedRowIndex,
  50950. isDynamic,
  50951. isResetting,
  50952. rowHeights,
  50953. resetAfterIndex,
  50954. onRowExpanded,
  50955. onRowHeightChange,
  50956. onRowHovered,
  50957. onRowsRendered
  50958. } = useRow(props, {
  50959. mainTableRef,
  50960. leftTableRef,
  50961. rightTableRef
  50962. });
  50963. const { data, depthMap } = useData(props, {
  50964. expandedRowKeys,
  50965. lastRenderedRowIndex,
  50966. resetAfterIndex
  50967. });
  50968. const {
  50969. bodyWidth,
  50970. fixedTableHeight,
  50971. mainTableHeight,
  50972. leftTableWidth,
  50973. rightTableWidth,
  50974. headerWidth,
  50975. rowsHeight,
  50976. windowHeight,
  50977. footerHeight,
  50978. emptyStyle,
  50979. rootStyle,
  50980. headerHeight
  50981. } = useStyles(props, {
  50982. columnsTotalWidth,
  50983. data,
  50984. fixedColumnsOnLeft,
  50985. fixedColumnsOnRight
  50986. });
  50987. const isScrolling = shallowRef(false);
  50988. const containerRef = ref();
  50989. const showEmpty = computed(() => {
  50990. const noData = unref(data).length === 0;
  50991. return isArray$3(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  50992. });
  50993. function getRowHeight(rowIndex) {
  50994. const { estimatedRowHeight, rowHeight, rowKey: rowKey2 } = props;
  50995. if (!estimatedRowHeight)
  50996. return rowHeight;
  50997. return unref(rowHeights)[unref(data)[rowIndex][rowKey2]] || estimatedRowHeight;
  50998. }
  50999. function onMaybeEndReached() {
  51000. const { onEndReached } = props;
  51001. if (!onEndReached)
  51002. return;
  51003. const { scrollTop } = unref(scrollPos);
  51004. const _totalHeight = unref(rowsHeight);
  51005. const clientHeight = unref(windowHeight);
  51006. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  51007. if (unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + unref(mainTableHeight) - unref(headerHeight)) {
  51008. onEndReached(heightUntilEnd);
  51009. }
  51010. }
  51011. watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  51012. deep: true
  51013. });
  51014. return {
  51015. columns: columns2,
  51016. containerRef,
  51017. mainTableRef,
  51018. leftTableRef,
  51019. rightTableRef,
  51020. isDynamic,
  51021. isResetting,
  51022. isScrolling,
  51023. hoveringRowKey,
  51024. hasFixedColumns,
  51025. columnsStyles,
  51026. columnsTotalWidth,
  51027. data,
  51028. expandedRowKeys,
  51029. depthMap,
  51030. fixedColumnsOnLeft,
  51031. fixedColumnsOnRight,
  51032. mainColumns,
  51033. bodyWidth,
  51034. emptyStyle,
  51035. rootStyle,
  51036. headerWidth,
  51037. footerHeight,
  51038. mainTableHeight,
  51039. fixedTableHeight,
  51040. leftTableWidth,
  51041. rightTableWidth,
  51042. showEmpty,
  51043. getRowHeight,
  51044. onColumnSorted,
  51045. onRowHovered,
  51046. onRowExpanded,
  51047. onRowsRendered,
  51048. onRowHeightChange,
  51049. scrollTo,
  51050. scrollToLeft,
  51051. scrollToTop,
  51052. scrollToRow,
  51053. onScroll,
  51054. onVerticalScroll
  51055. };
  51056. }
  51057. const TableV2InjectionKey = Symbol("tableV2");
  51058. const classType = String;
  51059. const columns = {
  51060. type: definePropType(Array),
  51061. required: true
  51062. };
  51063. const fixedDataType = {
  51064. type: definePropType(Array)
  51065. };
  51066. const dataType = {
  51067. ...fixedDataType,
  51068. required: true
  51069. };
  51070. const expandColumnKey = String;
  51071. const expandKeys = {
  51072. type: definePropType(Array),
  51073. default: () => mutable([])
  51074. };
  51075. const requiredNumber = {
  51076. type: Number,
  51077. required: true
  51078. };
  51079. const rowKey = {
  51080. type: definePropType([String, Number, Symbol]),
  51081. default: "id"
  51082. };
  51083. const styleType = {
  51084. type: definePropType(Object)
  51085. };
  51086. const tableV2RowProps = buildProps({
  51087. class: String,
  51088. columns,
  51089. columnsStyles: {
  51090. type: definePropType(Object),
  51091. required: true
  51092. },
  51093. depth: Number,
  51094. expandColumnKey,
  51095. estimatedRowHeight: {
  51096. ...virtualizedGridProps.estimatedRowHeight,
  51097. default: void 0
  51098. },
  51099. isScrolling: Boolean,
  51100. onRowExpand: {
  51101. type: definePropType(Function)
  51102. },
  51103. onRowHover: {
  51104. type: definePropType(Function)
  51105. },
  51106. onRowHeightChange: {
  51107. type: definePropType(Function)
  51108. },
  51109. rowData: {
  51110. type: definePropType(Object),
  51111. required: true
  51112. },
  51113. rowEventHandlers: {
  51114. type: definePropType(Object)
  51115. },
  51116. rowIndex: {
  51117. type: Number,
  51118. required: true
  51119. },
  51120. rowKey,
  51121. style: {
  51122. type: definePropType(Object)
  51123. }
  51124. });
  51125. const requiredNumberType = {
  51126. type: Number,
  51127. required: true
  51128. };
  51129. const tableV2HeaderProps = buildProps({
  51130. class: String,
  51131. columns,
  51132. fixedHeaderData: {
  51133. type: definePropType(Array)
  51134. },
  51135. headerData: {
  51136. type: definePropType(Array),
  51137. required: true
  51138. },
  51139. headerHeight: {
  51140. type: definePropType([Number, Array]),
  51141. default: 50
  51142. },
  51143. rowWidth: requiredNumberType,
  51144. rowHeight: {
  51145. type: Number,
  51146. default: 50
  51147. },
  51148. height: requiredNumberType,
  51149. width: requiredNumberType
  51150. });
  51151. const tableV2GridProps = buildProps({
  51152. columns,
  51153. data: dataType,
  51154. fixedData: fixedDataType,
  51155. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  51156. width: requiredNumber,
  51157. height: requiredNumber,
  51158. headerWidth: requiredNumber,
  51159. headerHeight: tableV2HeaderProps.headerHeight,
  51160. bodyWidth: requiredNumber,
  51161. rowHeight: requiredNumber,
  51162. cache: virtualizedListProps.cache,
  51163. useIsScrolling: Boolean,
  51164. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  51165. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  51166. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  51167. class: classType,
  51168. style: styleType,
  51169. containerStyle: styleType,
  51170. getRowHeight: {
  51171. type: definePropType(Function),
  51172. required: true
  51173. },
  51174. rowKey: tableV2RowProps.rowKey,
  51175. onRowsRendered: {
  51176. type: definePropType(Function)
  51177. },
  51178. onScroll: {
  51179. type: definePropType(Function)
  51180. }
  51181. });
  51182. const tableV2Props = buildProps({
  51183. cache: tableV2GridProps.cache,
  51184. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  51185. rowKey,
  51186. headerClass: {
  51187. type: definePropType([
  51188. String,
  51189. Function
  51190. ])
  51191. },
  51192. headerProps: {
  51193. type: definePropType([
  51194. Object,
  51195. Function
  51196. ])
  51197. },
  51198. headerCellProps: {
  51199. type: definePropType([
  51200. Object,
  51201. Function
  51202. ])
  51203. },
  51204. headerHeight: tableV2HeaderProps.headerHeight,
  51205. footerHeight: {
  51206. type: Number,
  51207. default: 0
  51208. },
  51209. rowClass: {
  51210. type: definePropType([String, Function])
  51211. },
  51212. rowProps: {
  51213. type: definePropType([Object, Function])
  51214. },
  51215. rowHeight: {
  51216. type: Number,
  51217. default: 50
  51218. },
  51219. cellProps: {
  51220. type: definePropType([
  51221. Object,
  51222. Function
  51223. ])
  51224. },
  51225. columns,
  51226. data: dataType,
  51227. dataGetter: {
  51228. type: definePropType(Function)
  51229. },
  51230. fixedData: fixedDataType,
  51231. expandColumnKey: tableV2RowProps.expandColumnKey,
  51232. expandedRowKeys: expandKeys,
  51233. defaultExpandedRowKeys: expandKeys,
  51234. class: classType,
  51235. fixed: Boolean,
  51236. style: {
  51237. type: definePropType(Object)
  51238. },
  51239. width: requiredNumber,
  51240. height: requiredNumber,
  51241. maxHeight: Number,
  51242. useIsScrolling: Boolean,
  51243. indentSize: {
  51244. type: Number,
  51245. default: 12
  51246. },
  51247. iconSize: {
  51248. type: Number,
  51249. default: 12
  51250. },
  51251. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  51252. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  51253. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  51254. sortBy: {
  51255. type: definePropType(Object),
  51256. default: () => ({})
  51257. },
  51258. sortState: {
  51259. type: definePropType(Object),
  51260. default: void 0
  51261. },
  51262. onColumnSort: {
  51263. type: definePropType(Function)
  51264. },
  51265. onExpandedRowsChange: {
  51266. type: definePropType(Function)
  51267. },
  51268. onEndReached: {
  51269. type: definePropType(Function)
  51270. },
  51271. onRowExpand: tableV2RowProps.onRowExpand,
  51272. onScroll: tableV2GridProps.onScroll,
  51273. onRowsRendered: tableV2GridProps.onRowsRendered,
  51274. rowEventHandlers: tableV2RowProps.rowEventHandlers
  51275. });
  51276. const TableV2Cell = (props, {
  51277. slots
  51278. }) => {
  51279. var _a2;
  51280. const {
  51281. cellData,
  51282. style
  51283. } = props;
  51284. const displayText = ((_a2 = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a2.call(cellData)) || "";
  51285. return createVNode("div", {
  51286. "class": props.class,
  51287. "title": displayText,
  51288. "style": style
  51289. }, [slots.default ? slots.default(props) : displayText]);
  51290. };
  51291. TableV2Cell.displayName = "ElTableV2Cell";
  51292. TableV2Cell.inheritAttrs = false;
  51293. const HeaderCell = (props, {
  51294. slots
  51295. }) => {
  51296. var _a2, _b;
  51297. return slots.default ? slots.default(props) : createVNode("div", {
  51298. "class": props.class,
  51299. "title": (_a2 = props.column) == null ? void 0 : _a2.title
  51300. }, [(_b = props.column) == null ? void 0 : _b.title]);
  51301. };
  51302. HeaderCell.displayName = "ElTableV2HeaderCell";
  51303. HeaderCell.inheritAttrs = false;
  51304. const tableV2HeaderRowProps = buildProps({
  51305. class: String,
  51306. columns,
  51307. columnsStyles: {
  51308. type: definePropType(Object),
  51309. required: true
  51310. },
  51311. headerIndex: Number,
  51312. style: { type: definePropType(Object) }
  51313. });
  51314. const TableV2HeaderRow = /* @__PURE__ */ defineComponent({
  51315. name: "ElTableV2HeaderRow",
  51316. props: tableV2HeaderRowProps,
  51317. setup(props, {
  51318. slots
  51319. }) {
  51320. return () => {
  51321. const {
  51322. columns: columns2,
  51323. columnsStyles,
  51324. headerIndex,
  51325. style
  51326. } = props;
  51327. let Cells = columns2.map((column, columnIndex) => {
  51328. return slots.cell({
  51329. columns: columns2,
  51330. column,
  51331. columnIndex,
  51332. headerIndex,
  51333. style: columnsStyles[column.key]
  51334. });
  51335. });
  51336. if (slots.header) {
  51337. Cells = slots.header({
  51338. cells: Cells.map((node) => {
  51339. if (isArray$3(node) && node.length === 1) {
  51340. return node[0];
  51341. }
  51342. return node;
  51343. }),
  51344. columns: columns2,
  51345. headerIndex
  51346. });
  51347. }
  51348. return createVNode("div", {
  51349. "class": props.class,
  51350. "style": style,
  51351. "role": "row"
  51352. }, [Cells]);
  51353. };
  51354. }
  51355. });
  51356. const COMPONENT_NAME$7 = "ElTableV2Header";
  51357. const TableV2Header = /* @__PURE__ */ defineComponent({
  51358. name: COMPONENT_NAME$7,
  51359. props: tableV2HeaderProps,
  51360. setup(props, {
  51361. slots,
  51362. expose
  51363. }) {
  51364. const ns = useNamespace("table-v2");
  51365. const headerRef = ref();
  51366. const headerStyle = computed(() => enforceUnit({
  51367. width: props.width,
  51368. height: props.height
  51369. }));
  51370. const rowStyle = computed(() => enforceUnit({
  51371. width: props.rowWidth,
  51372. height: props.height
  51373. }));
  51374. const headerHeights = computed(() => castArray$1(unref(props.headerHeight)));
  51375. const scrollToLeft = (left2) => {
  51376. const headerEl = unref(headerRef);
  51377. nextTick(() => {
  51378. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  51379. left: left2
  51380. });
  51381. });
  51382. };
  51383. const renderFixedRows = () => {
  51384. const fixedRowClassName = ns.e("fixed-header-row");
  51385. const {
  51386. columns: columns2,
  51387. fixedHeaderData,
  51388. rowHeight
  51389. } = props;
  51390. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  51391. var _a2;
  51392. const style = enforceUnit({
  51393. height: rowHeight,
  51394. width: "100%"
  51395. });
  51396. return (_a2 = slots.fixed) == null ? void 0 : _a2.call(slots, {
  51397. class: fixedRowClassName,
  51398. columns: columns2,
  51399. rowData: fixedRowData,
  51400. rowIndex: -(fixedRowIndex + 1),
  51401. style
  51402. });
  51403. });
  51404. };
  51405. const renderDynamicRows = () => {
  51406. const dynamicRowClassName = ns.e("dynamic-header-row");
  51407. const {
  51408. columns: columns2
  51409. } = props;
  51410. return unref(headerHeights).map((rowHeight, rowIndex) => {
  51411. var _a2;
  51412. const style = enforceUnit({
  51413. width: "100%",
  51414. height: rowHeight
  51415. });
  51416. return (_a2 = slots.dynamic) == null ? void 0 : _a2.call(slots, {
  51417. class: dynamicRowClassName,
  51418. columns: columns2,
  51419. headerIndex: rowIndex,
  51420. style
  51421. });
  51422. });
  51423. };
  51424. expose({
  51425. scrollToLeft
  51426. });
  51427. return () => {
  51428. if (props.height <= 0)
  51429. return;
  51430. return createVNode("div", {
  51431. "ref": headerRef,
  51432. "class": props.class,
  51433. "style": unref(headerStyle),
  51434. "role": "rowgroup"
  51435. }, [createVNode("div", {
  51436. "style": unref(rowStyle),
  51437. "class": ns.e("header")
  51438. }, [renderDynamicRows(), renderFixedRows()])]);
  51439. };
  51440. }
  51441. });
  51442. const useTableRow = (props) => {
  51443. const {
  51444. isScrolling
  51445. } = inject(TableV2InjectionKey);
  51446. const measured = ref(false);
  51447. const rowRef = ref();
  51448. const measurable = computed(() => {
  51449. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  51450. });
  51451. const doMeasure = (isInit = false) => {
  51452. const $rowRef = unref(rowRef);
  51453. if (!$rowRef)
  51454. return;
  51455. const {
  51456. columns: columns2,
  51457. onRowHeightChange,
  51458. rowKey: rowKey2,
  51459. rowIndex,
  51460. style
  51461. } = props;
  51462. const {
  51463. height
  51464. } = $rowRef.getBoundingClientRect();
  51465. measured.value = true;
  51466. nextTick(() => {
  51467. if (isInit || height !== Number.parseInt(style.height)) {
  51468. const firstColumn = columns2[0];
  51469. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  51470. onRowHeightChange == null ? void 0 : onRowHeightChange({
  51471. rowKey: rowKey2,
  51472. height,
  51473. rowIndex
  51474. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  51475. }
  51476. });
  51477. };
  51478. const eventHandlers = computed(() => {
  51479. const {
  51480. rowData,
  51481. rowIndex,
  51482. rowKey: rowKey2,
  51483. onRowHover
  51484. } = props;
  51485. const handlers = props.rowEventHandlers || {};
  51486. const eventHandlers2 = {};
  51487. Object.entries(handlers).forEach(([eventName, handler]) => {
  51488. if (isFunction$2(handler)) {
  51489. eventHandlers2[eventName] = (event) => {
  51490. handler({
  51491. event,
  51492. rowData,
  51493. rowIndex,
  51494. rowKey: rowKey2
  51495. });
  51496. };
  51497. }
  51498. });
  51499. if (onRowHover) {
  51500. [{
  51501. name: "onMouseleave",
  51502. hovered: false
  51503. }, {
  51504. name: "onMouseenter",
  51505. hovered: true
  51506. }].forEach(({
  51507. name,
  51508. hovered
  51509. }) => {
  51510. const existedHandler = eventHandlers2[name];
  51511. eventHandlers2[name] = (event) => {
  51512. onRowHover({
  51513. event,
  51514. hovered,
  51515. rowData,
  51516. rowIndex,
  51517. rowKey: rowKey2
  51518. });
  51519. existedHandler == null ? void 0 : existedHandler(event);
  51520. };
  51521. });
  51522. }
  51523. return eventHandlers2;
  51524. });
  51525. const onExpand = (expanded) => {
  51526. const {
  51527. onRowExpand,
  51528. rowData,
  51529. rowIndex,
  51530. rowKey: rowKey2
  51531. } = props;
  51532. onRowExpand == null ? void 0 : onRowExpand({
  51533. expanded,
  51534. rowData,
  51535. rowIndex,
  51536. rowKey: rowKey2
  51537. });
  51538. };
  51539. onMounted(() => {
  51540. if (unref(measurable)) {
  51541. doMeasure(true);
  51542. }
  51543. });
  51544. return {
  51545. isScrolling,
  51546. measurable,
  51547. measured,
  51548. rowRef,
  51549. eventHandlers,
  51550. onExpand
  51551. };
  51552. };
  51553. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  51554. const TableV2Row = /* @__PURE__ */ defineComponent({
  51555. name: COMPONENT_NAME$6,
  51556. props: tableV2RowProps,
  51557. setup(props, {
  51558. expose,
  51559. slots,
  51560. attrs
  51561. }) {
  51562. const {
  51563. eventHandlers,
  51564. isScrolling,
  51565. measurable,
  51566. measured,
  51567. rowRef,
  51568. onExpand
  51569. } = useTableRow(props);
  51570. expose({
  51571. onExpand
  51572. });
  51573. return () => {
  51574. const {
  51575. columns: columns2,
  51576. columnsStyles,
  51577. expandColumnKey: expandColumnKey2,
  51578. depth,
  51579. rowData,
  51580. rowIndex,
  51581. style
  51582. } = props;
  51583. let ColumnCells = columns2.map((column, columnIndex) => {
  51584. const expandable = isArray$3(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey2;
  51585. return slots.cell({
  51586. column,
  51587. columns: columns2,
  51588. columnIndex,
  51589. depth,
  51590. style: columnsStyles[column.key],
  51591. rowData,
  51592. rowIndex,
  51593. isScrolling: unref(isScrolling),
  51594. expandIconProps: expandable ? {
  51595. rowData,
  51596. rowIndex,
  51597. onExpand
  51598. } : void 0
  51599. });
  51600. });
  51601. if (slots.row) {
  51602. ColumnCells = slots.row({
  51603. cells: ColumnCells.map((node) => {
  51604. if (isArray$3(node) && node.length === 1) {
  51605. return node[0];
  51606. }
  51607. return node;
  51608. }),
  51609. style,
  51610. columns: columns2,
  51611. depth,
  51612. rowData,
  51613. rowIndex,
  51614. isScrolling: unref(isScrolling)
  51615. });
  51616. }
  51617. if (unref(measurable)) {
  51618. const {
  51619. height,
  51620. ...exceptHeightStyle
  51621. } = style || {};
  51622. const _measured = unref(measured);
  51623. return createVNode("div", mergeProps({
  51624. "ref": rowRef,
  51625. "class": props.class,
  51626. "style": _measured ? style : exceptHeightStyle,
  51627. "role": "row"
  51628. }, attrs, unref(eventHandlers)), [ColumnCells]);
  51629. }
  51630. return createVNode("div", mergeProps(attrs, {
  51631. "ref": rowRef,
  51632. "class": props.class,
  51633. "style": style,
  51634. "role": "row"
  51635. }, unref(eventHandlers)), [ColumnCells]);
  51636. };
  51637. }
  51638. });
  51639. const SortIcon = (props) => {
  51640. const {
  51641. sortOrder
  51642. } = props;
  51643. return createVNode(ElIcon, {
  51644. "size": 14,
  51645. "class": props.class
  51646. }, {
  51647. default: () => [sortOrder === SortOrder.ASC ? createVNode(sort_up_default, null, null) : createVNode(sort_down_default, null, null)]
  51648. });
  51649. };
  51650. const ExpandIcon = (props) => {
  51651. const {
  51652. expanded,
  51653. expandable,
  51654. onExpand,
  51655. style,
  51656. size: size2
  51657. } = props;
  51658. const expandIconProps = {
  51659. onClick: expandable ? () => onExpand(!expanded) : void 0,
  51660. class: props.class
  51661. };
  51662. return createVNode(ElIcon, mergeProps(expandIconProps, {
  51663. "size": size2,
  51664. "style": style
  51665. }), {
  51666. default: () => [createVNode(arrow_right_default, null, null)]
  51667. });
  51668. };
  51669. const COMPONENT_NAME$5 = "ElTableV2Grid";
  51670. const useTableGrid = (props) => {
  51671. const headerRef = ref();
  51672. const bodyRef = ref();
  51673. const totalHeight = computed(() => {
  51674. const {
  51675. data,
  51676. rowHeight,
  51677. estimatedRowHeight
  51678. } = props;
  51679. if (estimatedRowHeight) {
  51680. return;
  51681. }
  51682. return data.length * rowHeight;
  51683. });
  51684. const fixedRowHeight = computed(() => {
  51685. const {
  51686. fixedData,
  51687. rowHeight
  51688. } = props;
  51689. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  51690. });
  51691. const headerHeight = computed(() => sum(props.headerHeight));
  51692. const gridHeight = computed(() => {
  51693. const {
  51694. height
  51695. } = props;
  51696. return Math.max(0, height - unref(headerHeight) - unref(fixedRowHeight));
  51697. });
  51698. const hasHeader = computed(() => {
  51699. return unref(headerHeight) + unref(fixedRowHeight) > 0;
  51700. });
  51701. const itemKey = ({
  51702. data,
  51703. rowIndex
  51704. }) => data[rowIndex][props.rowKey];
  51705. function onItemRendered({
  51706. rowCacheStart,
  51707. rowCacheEnd,
  51708. rowVisibleStart,
  51709. rowVisibleEnd
  51710. }) {
  51711. var _a2;
  51712. (_a2 = props.onRowsRendered) == null ? void 0 : _a2.call(props, {
  51713. rowCacheStart,
  51714. rowCacheEnd,
  51715. rowVisibleStart,
  51716. rowVisibleEnd
  51717. });
  51718. }
  51719. function resetAfterRowIndex(index2, forceUpdate2) {
  51720. var _a2;
  51721. (_a2 = bodyRef.value) == null ? void 0 : _a2.resetAfterRowIndex(index2, forceUpdate2);
  51722. }
  51723. function scrollTo(leftOrOptions, top) {
  51724. const header$ = unref(headerRef);
  51725. const body$ = unref(bodyRef);
  51726. if (!header$ || !body$)
  51727. return;
  51728. if (isObject$1(leftOrOptions)) {
  51729. header$.scrollToLeft(leftOrOptions.scrollLeft);
  51730. body$.scrollTo(leftOrOptions);
  51731. } else {
  51732. header$.scrollToLeft(leftOrOptions);
  51733. body$.scrollTo({
  51734. scrollLeft: leftOrOptions,
  51735. scrollTop: top
  51736. });
  51737. }
  51738. }
  51739. function scrollToTop(scrollTop) {
  51740. var _a2;
  51741. (_a2 = unref(bodyRef)) == null ? void 0 : _a2.scrollTo({
  51742. scrollTop
  51743. });
  51744. }
  51745. function scrollToRow(row, strategy) {
  51746. var _a2;
  51747. (_a2 = unref(bodyRef)) == null ? void 0 : _a2.scrollToItem(row, 1, strategy);
  51748. }
  51749. function forceUpdate() {
  51750. var _a2, _b;
  51751. (_a2 = unref(bodyRef)) == null ? void 0 : _a2.$forceUpdate();
  51752. (_b = unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  51753. }
  51754. return {
  51755. bodyRef,
  51756. forceUpdate,
  51757. fixedRowHeight,
  51758. gridHeight,
  51759. hasHeader,
  51760. headerHeight,
  51761. headerRef,
  51762. totalHeight,
  51763. itemKey,
  51764. onItemRendered,
  51765. resetAfterRowIndex,
  51766. scrollTo,
  51767. scrollToTop,
  51768. scrollToRow
  51769. };
  51770. };
  51771. const TableGrid = /* @__PURE__ */ defineComponent({
  51772. name: COMPONENT_NAME$5,
  51773. props: tableV2GridProps,
  51774. setup(props, {
  51775. slots,
  51776. expose
  51777. }) {
  51778. const {
  51779. ns
  51780. } = inject(TableV2InjectionKey);
  51781. const {
  51782. bodyRef,
  51783. fixedRowHeight,
  51784. gridHeight,
  51785. hasHeader,
  51786. headerRef,
  51787. headerHeight,
  51788. totalHeight,
  51789. forceUpdate,
  51790. itemKey,
  51791. onItemRendered,
  51792. resetAfterRowIndex,
  51793. scrollTo,
  51794. scrollToTop,
  51795. scrollToRow
  51796. } = useTableGrid(props);
  51797. expose({
  51798. forceUpdate,
  51799. totalHeight,
  51800. scrollTo,
  51801. scrollToTop,
  51802. scrollToRow,
  51803. resetAfterRowIndex
  51804. });
  51805. const getColumnWidth = () => props.bodyWidth;
  51806. return () => {
  51807. const {
  51808. cache: cache2,
  51809. columns: columns2,
  51810. data,
  51811. fixedData,
  51812. useIsScrolling,
  51813. scrollbarAlwaysOn,
  51814. scrollbarEndGap,
  51815. scrollbarStartGap,
  51816. style,
  51817. rowHeight,
  51818. bodyWidth,
  51819. estimatedRowHeight,
  51820. headerWidth,
  51821. height,
  51822. width,
  51823. getRowHeight,
  51824. onScroll
  51825. } = props;
  51826. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  51827. const Grid = isDynamicRowEnabled ? DynamicSizeGrid : FixedSizeGrid;
  51828. const _headerHeight = unref(headerHeight);
  51829. return createVNode("div", {
  51830. "role": "table",
  51831. "class": [ns.e("table"), props.class],
  51832. "style": style
  51833. }, [createVNode(Grid, {
  51834. "ref": bodyRef,
  51835. "data": data,
  51836. "useIsScrolling": useIsScrolling,
  51837. "itemKey": itemKey,
  51838. "columnCache": 0,
  51839. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  51840. "totalColumn": 1,
  51841. "totalRow": data.length,
  51842. "rowCache": cache2,
  51843. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  51844. "width": width,
  51845. "height": unref(gridHeight),
  51846. "class": ns.e("body"),
  51847. "role": "rowgroup",
  51848. "scrollbarStartGap": scrollbarStartGap,
  51849. "scrollbarEndGap": scrollbarEndGap,
  51850. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  51851. "onScroll": onScroll,
  51852. "onItemRendered": onItemRendered,
  51853. "perfMode": false
  51854. }, {
  51855. default: (params) => {
  51856. var _a2;
  51857. const rowData = data[params.rowIndex];
  51858. return (_a2 = slots.row) == null ? void 0 : _a2.call(slots, {
  51859. ...params,
  51860. columns: columns2,
  51861. rowData
  51862. });
  51863. }
  51864. }), unref(hasHeader) && createVNode(TableV2Header, {
  51865. "ref": headerRef,
  51866. "class": ns.e("header-wrapper"),
  51867. "columns": columns2,
  51868. "headerData": data,
  51869. "headerHeight": props.headerHeight,
  51870. "fixedHeaderData": fixedData,
  51871. "rowWidth": headerWidth,
  51872. "rowHeight": rowHeight,
  51873. "width": width,
  51874. "height": Math.min(_headerHeight + unref(fixedRowHeight), height)
  51875. }, {
  51876. dynamic: slots.header,
  51877. fixed: slots.row
  51878. })]);
  51879. };
  51880. }
  51881. });
  51882. function _isSlot$5(s2) {
  51883. return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
  51884. }
  51885. const MainTable = (props, {
  51886. slots
  51887. }) => {
  51888. const {
  51889. mainTableRef,
  51890. ...rest
  51891. } = props;
  51892. return createVNode(TableGrid, mergeProps({
  51893. "ref": mainTableRef
  51894. }, rest), _isSlot$5(slots) ? slots : {
  51895. default: () => [slots]
  51896. });
  51897. };
  51898. function _isSlot$4(s2) {
  51899. return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
  51900. }
  51901. const LeftTable$1 = (props, {
  51902. slots
  51903. }) => {
  51904. if (!props.columns.length)
  51905. return;
  51906. const {
  51907. leftTableRef,
  51908. ...rest
  51909. } = props;
  51910. return createVNode(TableGrid, mergeProps({
  51911. "ref": leftTableRef
  51912. }, rest), _isSlot$4(slots) ? slots : {
  51913. default: () => [slots]
  51914. });
  51915. };
  51916. function _isSlot$3(s2) {
  51917. return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
  51918. }
  51919. const LeftTable = (props, {
  51920. slots
  51921. }) => {
  51922. if (!props.columns.length)
  51923. return;
  51924. const {
  51925. rightTableRef,
  51926. ...rest
  51927. } = props;
  51928. return createVNode(TableGrid, mergeProps({
  51929. "ref": rightTableRef
  51930. }, rest), _isSlot$3(slots) ? slots : {
  51931. default: () => [slots]
  51932. });
  51933. };
  51934. function _isSlot$2(s2) {
  51935. return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
  51936. }
  51937. const RowRenderer = (props, {
  51938. slots
  51939. }) => {
  51940. const {
  51941. columns: columns2,
  51942. columnsStyles,
  51943. depthMap,
  51944. expandColumnKey: expandColumnKey2,
  51945. expandedRowKeys,
  51946. estimatedRowHeight,
  51947. hasFixedColumns,
  51948. hoveringRowKey,
  51949. rowData,
  51950. rowIndex,
  51951. style,
  51952. isScrolling,
  51953. rowProps: rowProps2,
  51954. rowClass,
  51955. rowKey: rowKey2,
  51956. rowEventHandlers,
  51957. ns,
  51958. onRowHovered,
  51959. onRowExpanded
  51960. } = props;
  51961. const rowKls = tryCall(rowClass, {
  51962. columns: columns2,
  51963. rowData,
  51964. rowIndex
  51965. }, "");
  51966. const additionalProps = tryCall(rowProps2, {
  51967. columns: columns2,
  51968. rowData,
  51969. rowIndex
  51970. });
  51971. const _rowKey = rowData[rowKey2];
  51972. const depth = depthMap[_rowKey] || 0;
  51973. const canExpand = Boolean(expandColumnKey2);
  51974. const isFixedRow = rowIndex < 0;
  51975. const kls = [ns.e("row"), rowKls, {
  51976. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  51977. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  51978. [ns.is("hovered")]: !isScrolling && _rowKey === hoveringRowKey,
  51979. [ns.is("fixed")]: !depth && isFixedRow,
  51980. [ns.is("customized")]: Boolean(slots.row)
  51981. }];
  51982. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  51983. const _rowProps = {
  51984. ...additionalProps,
  51985. columns: columns2,
  51986. columnsStyles,
  51987. class: kls,
  51988. depth,
  51989. expandColumnKey: expandColumnKey2,
  51990. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  51991. isScrolling,
  51992. rowIndex,
  51993. rowData,
  51994. rowKey: _rowKey,
  51995. rowEventHandlers,
  51996. style
  51997. };
  51998. return createVNode(TableV2Row, mergeProps(_rowProps, {
  51999. "onRowHover": onRowHover,
  52000. "onRowExpand": onRowExpanded
  52001. }), _isSlot$2(slots) ? slots : {
  52002. default: () => [slots]
  52003. });
  52004. };
  52005. const CellRenderer = ({
  52006. columns: columns2,
  52007. column,
  52008. columnIndex,
  52009. depth,
  52010. expandIconProps,
  52011. isScrolling,
  52012. rowData,
  52013. rowIndex,
  52014. style,
  52015. expandedRowKeys,
  52016. ns,
  52017. cellProps: _cellProps,
  52018. expandColumnKey: expandColumnKey2,
  52019. indentSize,
  52020. iconSize,
  52021. rowKey: rowKey2
  52022. }, {
  52023. slots
  52024. }) => {
  52025. const cellStyle = enforceUnit(style);
  52026. if (column.placeholderSign === placeholderSign) {
  52027. return createVNode("div", {
  52028. "class": ns.em("row-cell", "placeholder"),
  52029. "style": cellStyle
  52030. }, null);
  52031. }
  52032. const {
  52033. cellRenderer,
  52034. dataKey,
  52035. dataGetter
  52036. } = column;
  52037. const columnCellRenderer = componentToSlot(cellRenderer);
  52038. const CellComponent = columnCellRenderer || slots.default || ((props) => createVNode(TableV2Cell, props, null));
  52039. const cellData = isFunction$2(dataGetter) ? dataGetter({
  52040. columns: columns2,
  52041. column,
  52042. columnIndex,
  52043. rowData,
  52044. rowIndex
  52045. }) : get(rowData, dataKey != null ? dataKey : "");
  52046. const extraCellProps = tryCall(_cellProps, {
  52047. cellData,
  52048. columns: columns2,
  52049. column,
  52050. columnIndex,
  52051. rowIndex,
  52052. rowData
  52053. });
  52054. const cellProps = {
  52055. class: ns.e("cell-text"),
  52056. columns: columns2,
  52057. column,
  52058. columnIndex,
  52059. cellData,
  52060. isScrolling,
  52061. rowData,
  52062. rowIndex
  52063. };
  52064. const Cell = CellComponent(cellProps);
  52065. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  52066. const expandable = rowIndex >= 0 && expandColumnKey2 && column.key === expandColumnKey2;
  52067. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey2]);
  52068. let IconOrPlaceholder;
  52069. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  52070. if (expandable) {
  52071. if (isObject$1(expandIconProps)) {
  52072. IconOrPlaceholder = createVNode(ExpandIcon, mergeProps(expandIconProps, {
  52073. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  52074. "size": iconSize,
  52075. "expanded": expanded,
  52076. "style": iconStyle,
  52077. "expandable": true
  52078. }), null);
  52079. } else {
  52080. IconOrPlaceholder = createVNode("div", {
  52081. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  52082. }, null);
  52083. }
  52084. }
  52085. return createVNode("div", mergeProps({
  52086. "class": kls,
  52087. "style": cellStyle
  52088. }, extraCellProps, {
  52089. "role": "cell"
  52090. }), [IconOrPlaceholder, Cell]);
  52091. };
  52092. CellRenderer.inheritAttrs = false;
  52093. function _isSlot$1(s2) {
  52094. return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
  52095. }
  52096. const HeaderRenderer = ({
  52097. columns: columns2,
  52098. columnsStyles,
  52099. headerIndex,
  52100. style,
  52101. headerClass,
  52102. headerProps,
  52103. ns
  52104. }, {
  52105. slots
  52106. }) => {
  52107. const param = {
  52108. columns: columns2,
  52109. headerIndex
  52110. };
  52111. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  52112. [ns.is("customized")]: Boolean(slots.header)
  52113. }];
  52114. const extraProps = {
  52115. ...tryCall(headerProps, param),
  52116. columnsStyles,
  52117. class: kls,
  52118. columns: columns2,
  52119. headerIndex,
  52120. style
  52121. };
  52122. return createVNode(TableV2HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  52123. default: () => [slots]
  52124. });
  52125. };
  52126. const HeaderCellRenderer = (props, {
  52127. slots
  52128. }) => {
  52129. const {
  52130. column,
  52131. ns,
  52132. style,
  52133. onColumnSorted
  52134. } = props;
  52135. const cellStyle = enforceUnit(style);
  52136. if (column.placeholderSign === placeholderSign) {
  52137. return createVNode("div", {
  52138. "class": ns.em("header-row-cell", "placeholder"),
  52139. "style": cellStyle
  52140. }, null);
  52141. }
  52142. const {
  52143. headerCellRenderer,
  52144. headerClass,
  52145. sortable
  52146. } = column;
  52147. const cellProps = {
  52148. ...props,
  52149. class: ns.e("header-cell-text")
  52150. };
  52151. const cellRenderer = componentToSlot(headerCellRenderer) || slots.default || ((props2) => createVNode(HeaderCell, props2, null));
  52152. const Cell = cellRenderer(cellProps);
  52153. const {
  52154. sortBy,
  52155. sortState,
  52156. headerCellProps
  52157. } = props;
  52158. let sorting, sortOrder;
  52159. if (sortState) {
  52160. const order = sortState[column.key];
  52161. sorting = Boolean(oppositeOrderMap[order]);
  52162. sortOrder = sorting ? order : SortOrder.ASC;
  52163. } else {
  52164. sorting = column.key === sortBy.key;
  52165. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  52166. }
  52167. const cellKls = [ns.e("header-cell"), tryCall(headerClass, props, ""), column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right"), sortable && ns.is("sortable")];
  52168. const cellWrapperProps = {
  52169. ...tryCall(headerCellProps, props),
  52170. onClick: column.sortable ? onColumnSorted : void 0,
  52171. class: cellKls,
  52172. style: cellStyle,
  52173. ["data-key"]: column.key
  52174. };
  52175. return createVNode("div", mergeProps(cellWrapperProps, {
  52176. "role": "columnheader"
  52177. }), [Cell, sortable && createVNode(SortIcon, {
  52178. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  52179. "sortOrder": sortOrder
  52180. }, null)]);
  52181. };
  52182. const Footer$1 = (props, {
  52183. slots
  52184. }) => {
  52185. var _a2;
  52186. return createVNode("div", {
  52187. "class": props.class,
  52188. "style": props.style
  52189. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  52190. };
  52191. Footer$1.displayName = "ElTableV2Footer";
  52192. const Footer = (props, {
  52193. slots
  52194. }) => {
  52195. return createVNode("div", {
  52196. "class": props.class,
  52197. "style": props.style
  52198. }, [slots.default ? slots.default() : createVNode(ElEmpty, null, null)]);
  52199. };
  52200. Footer.displayName = "ElTableV2Empty";
  52201. const Overlay = (props, {
  52202. slots
  52203. }) => {
  52204. var _a2;
  52205. return createVNode("div", {
  52206. "class": props.class,
  52207. "style": props.style
  52208. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  52209. };
  52210. Overlay.displayName = "ElTableV2Overlay";
  52211. function _isSlot(s2) {
  52212. return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
  52213. }
  52214. const COMPONENT_NAME$4 = "ElTableV2";
  52215. const TableV2 = /* @__PURE__ */ defineComponent({
  52216. name: COMPONENT_NAME$4,
  52217. props: tableV2Props,
  52218. setup(props, {
  52219. slots,
  52220. expose
  52221. }) {
  52222. const ns = useNamespace("table-v2");
  52223. const {
  52224. columnsStyles,
  52225. fixedColumnsOnLeft,
  52226. fixedColumnsOnRight,
  52227. mainColumns,
  52228. mainTableHeight,
  52229. fixedTableHeight,
  52230. leftTableWidth,
  52231. rightTableWidth,
  52232. data,
  52233. depthMap,
  52234. expandedRowKeys,
  52235. hasFixedColumns,
  52236. hoveringRowKey,
  52237. mainTableRef,
  52238. leftTableRef,
  52239. rightTableRef,
  52240. isDynamic,
  52241. isResetting,
  52242. isScrolling,
  52243. bodyWidth,
  52244. emptyStyle,
  52245. rootStyle,
  52246. headerWidth,
  52247. footerHeight,
  52248. showEmpty,
  52249. scrollTo,
  52250. scrollToLeft,
  52251. scrollToTop,
  52252. scrollToRow,
  52253. getRowHeight,
  52254. onColumnSorted,
  52255. onRowHeightChange,
  52256. onRowHovered,
  52257. onRowExpanded,
  52258. onRowsRendered,
  52259. onScroll,
  52260. onVerticalScroll
  52261. } = useTable(props);
  52262. expose({
  52263. scrollTo,
  52264. scrollToLeft,
  52265. scrollToTop,
  52266. scrollToRow
  52267. });
  52268. provide(TableV2InjectionKey, {
  52269. ns,
  52270. isResetting,
  52271. hoveringRowKey,
  52272. isScrolling
  52273. });
  52274. return () => {
  52275. const {
  52276. cache: cache2,
  52277. cellProps,
  52278. estimatedRowHeight,
  52279. expandColumnKey: expandColumnKey2,
  52280. fixedData,
  52281. headerHeight,
  52282. headerClass,
  52283. headerProps,
  52284. headerCellProps,
  52285. sortBy,
  52286. sortState,
  52287. rowHeight,
  52288. rowClass,
  52289. rowEventHandlers,
  52290. rowKey: rowKey2,
  52291. rowProps: rowProps2,
  52292. scrollbarAlwaysOn,
  52293. indentSize,
  52294. iconSize,
  52295. useIsScrolling,
  52296. vScrollbarSize,
  52297. width
  52298. } = props;
  52299. const _data = unref(data);
  52300. const mainTableProps = {
  52301. cache: cache2,
  52302. class: ns.e("main"),
  52303. columns: unref(mainColumns),
  52304. data: _data,
  52305. fixedData,
  52306. estimatedRowHeight,
  52307. bodyWidth: unref(bodyWidth) + vScrollbarSize,
  52308. headerHeight,
  52309. headerWidth: unref(headerWidth),
  52310. height: unref(mainTableHeight),
  52311. mainTableRef,
  52312. rowKey: rowKey2,
  52313. rowHeight,
  52314. scrollbarAlwaysOn,
  52315. scrollbarStartGap: 2,
  52316. scrollbarEndGap: vScrollbarSize,
  52317. useIsScrolling,
  52318. width,
  52319. getRowHeight,
  52320. onRowsRendered,
  52321. onScroll
  52322. };
  52323. const leftColumnsWidth = unref(leftTableWidth);
  52324. const _fixedTableHeight = unref(fixedTableHeight);
  52325. const leftTableProps = {
  52326. cache: cache2,
  52327. class: ns.e("left"),
  52328. columns: unref(fixedColumnsOnLeft),
  52329. data: _data,
  52330. estimatedRowHeight,
  52331. leftTableRef,
  52332. rowHeight,
  52333. bodyWidth: leftColumnsWidth,
  52334. headerWidth: leftColumnsWidth,
  52335. headerHeight,
  52336. height: _fixedTableHeight,
  52337. rowKey: rowKey2,
  52338. scrollbarAlwaysOn,
  52339. scrollbarStartGap: 2,
  52340. scrollbarEndGap: vScrollbarSize,
  52341. useIsScrolling,
  52342. width: leftColumnsWidth,
  52343. getRowHeight,
  52344. onScroll: onVerticalScroll
  52345. };
  52346. const rightColumnsWidth = unref(rightTableWidth);
  52347. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  52348. const rightTableProps = {
  52349. cache: cache2,
  52350. class: ns.e("right"),
  52351. columns: unref(fixedColumnsOnRight),
  52352. data: _data,
  52353. estimatedRowHeight,
  52354. rightTableRef,
  52355. rowHeight,
  52356. bodyWidth: rightColumnsWidthWithScrollbar,
  52357. headerWidth: rightColumnsWidthWithScrollbar,
  52358. headerHeight,
  52359. height: _fixedTableHeight,
  52360. rowKey: rowKey2,
  52361. scrollbarAlwaysOn,
  52362. scrollbarStartGap: 2,
  52363. scrollbarEndGap: vScrollbarSize,
  52364. width: rightColumnsWidthWithScrollbar,
  52365. style: `--${unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  52366. useIsScrolling,
  52367. getRowHeight,
  52368. onScroll: onVerticalScroll
  52369. };
  52370. const _columnsStyles = unref(columnsStyles);
  52371. const tableRowProps = {
  52372. ns,
  52373. depthMap: unref(depthMap),
  52374. columnsStyles: _columnsStyles,
  52375. expandColumnKey: expandColumnKey2,
  52376. expandedRowKeys: unref(expandedRowKeys),
  52377. estimatedRowHeight,
  52378. hasFixedColumns: unref(hasFixedColumns),
  52379. hoveringRowKey: unref(hoveringRowKey),
  52380. rowProps: rowProps2,
  52381. rowClass,
  52382. rowKey: rowKey2,
  52383. rowEventHandlers,
  52384. onRowHovered,
  52385. onRowExpanded,
  52386. onRowHeightChange
  52387. };
  52388. const tableCellProps = {
  52389. cellProps,
  52390. expandColumnKey: expandColumnKey2,
  52391. indentSize,
  52392. iconSize,
  52393. rowKey: rowKey2,
  52394. expandedRowKeys: unref(expandedRowKeys),
  52395. ns
  52396. };
  52397. const tableHeaderProps = {
  52398. ns,
  52399. headerClass,
  52400. headerProps,
  52401. columnsStyles: _columnsStyles
  52402. };
  52403. const tableHeaderCellProps = {
  52404. ns,
  52405. sortBy,
  52406. sortState,
  52407. headerCellProps,
  52408. onColumnSorted
  52409. };
  52410. const tableSlots = {
  52411. row: (props2) => createVNode(RowRenderer, mergeProps(props2, tableRowProps), {
  52412. row: slots.row,
  52413. cell: (props3) => {
  52414. let _slot;
  52415. return slots.cell ? createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  52416. "style": _columnsStyles[props3.column.key]
  52417. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  52418. default: () => [_slot]
  52419. }) : createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  52420. "style": _columnsStyles[props3.column.key]
  52421. }), null);
  52422. }
  52423. }),
  52424. header: (props2) => createVNode(HeaderRenderer, mergeProps(props2, tableHeaderProps), {
  52425. header: slots.header,
  52426. cell: (props3) => {
  52427. let _slot2;
  52428. return slots["header-cell"] ? createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  52429. "style": _columnsStyles[props3.column.key]
  52430. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  52431. default: () => [_slot2]
  52432. }) : createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  52433. "style": _columnsStyles[props3.column.key]
  52434. }), null);
  52435. }
  52436. })
  52437. };
  52438. const rootKls = [props.class, ns.b(), ns.e("root"), {
  52439. [ns.is("dynamic")]: unref(isDynamic)
  52440. }];
  52441. const footerProps = {
  52442. class: ns.e("footer"),
  52443. style: unref(footerHeight)
  52444. };
  52445. return createVNode("div", {
  52446. "class": rootKls,
  52447. "style": unref(rootStyle)
  52448. }, [createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  52449. default: () => [tableSlots]
  52450. }), createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  52451. default: () => [tableSlots]
  52452. }), createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  52453. default: () => [tableSlots]
  52454. }), slots.footer && createVNode(Footer$1, footerProps, {
  52455. default: slots.footer
  52456. }), unref(showEmpty) && createVNode(Footer, {
  52457. "class": ns.e("empty"),
  52458. "style": unref(emptyStyle)
  52459. }, {
  52460. default: slots.empty
  52461. }), slots.overlay && createVNode(Overlay, {
  52462. "class": ns.e("overlay")
  52463. }, {
  52464. default: slots.overlay
  52465. })]);
  52466. };
  52467. }
  52468. });
  52469. const autoResizerProps = buildProps({
  52470. disableWidth: Boolean,
  52471. disableHeight: Boolean,
  52472. onResize: {
  52473. type: definePropType(Function)
  52474. }
  52475. });
  52476. const AutoResizer = /* @__PURE__ */ defineComponent({
  52477. name: "ElAutoResizer",
  52478. props: autoResizerProps,
  52479. setup(props, {
  52480. slots
  52481. }) {
  52482. const ns = useNamespace("auto-resizer");
  52483. const {
  52484. height,
  52485. width,
  52486. sizer
  52487. } = useAutoResize(props);
  52488. const style = {
  52489. width: "100%",
  52490. height: "100%"
  52491. };
  52492. return () => {
  52493. var _a2;
  52494. return createVNode("div", {
  52495. "ref": sizer,
  52496. "class": ns.b(),
  52497. "style": style
  52498. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots, {
  52499. height: height.value,
  52500. width: width.value
  52501. })]);
  52502. };
  52503. }
  52504. });
  52505. const ElTableV2 = withInstall(TableV2);
  52506. const ElAutoResizer = withInstall(AutoResizer);
  52507. const tabsRootContextKey = Symbol("tabsRootContextKey");
  52508. const tabBarProps = buildProps({
  52509. tabs: {
  52510. type: definePropType(Array),
  52511. default: () => mutable([])
  52512. }
  52513. });
  52514. const COMPONENT_NAME$3 = "ElTabBar";
  52515. const __default__$l = /* @__PURE__ */ defineComponent({
  52516. name: COMPONENT_NAME$3
  52517. });
  52518. const _sfc_main$u = /* @__PURE__ */ defineComponent({
  52519. ...__default__$l,
  52520. props: tabBarProps,
  52521. setup(__props, { expose }) {
  52522. const props = __props;
  52523. const instance = getCurrentInstance();
  52524. const rootTabs = inject(tabsRootContextKey);
  52525. if (!rootTabs)
  52526. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  52527. const ns = useNamespace("tabs");
  52528. const barRef = ref();
  52529. const barStyle = ref();
  52530. const getBarStyle = () => {
  52531. let offset2 = 0;
  52532. let tabSize = 0;
  52533. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  52534. const sizeDir = sizeName === "width" ? "x" : "y";
  52535. const position = sizeDir === "x" ? "left" : "top";
  52536. props.tabs.every((tab) => {
  52537. var _a2, _b;
  52538. const $el = (_b = (_a2 = instance.parent) == null ? void 0 : _a2.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  52539. if (!$el)
  52540. return false;
  52541. if (!tab.active) {
  52542. return true;
  52543. }
  52544. offset2 = $el[`offset${capitalize(position)}`];
  52545. tabSize = $el[`client${capitalize(sizeName)}`];
  52546. const tabStyles = window.getComputedStyle($el);
  52547. if (sizeName === "width") {
  52548. if (props.tabs.length > 1) {
  52549. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  52550. }
  52551. offset2 += Number.parseFloat(tabStyles.paddingLeft);
  52552. }
  52553. return false;
  52554. });
  52555. return {
  52556. [sizeName]: `${tabSize}px`,
  52557. transform: `translate${capitalize(sizeDir)}(${offset2}px)`
  52558. };
  52559. };
  52560. const update = () => barStyle.value = getBarStyle();
  52561. watch(() => props.tabs, async () => {
  52562. await nextTick();
  52563. update();
  52564. }, { immediate: true });
  52565. useResizeObserver(barRef, () => update());
  52566. expose({
  52567. ref: barRef,
  52568. update
  52569. });
  52570. return (_ctx, _cache) => {
  52571. return openBlock(), createElementBlock("div", {
  52572. ref_key: "barRef",
  52573. ref: barRef,
  52574. class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
  52575. style: normalizeStyle(barStyle.value)
  52576. }, null, 6);
  52577. };
  52578. }
  52579. });
  52580. var TabBar = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-bar.vue"]]);
  52581. const tabNavProps = buildProps({
  52582. panes: {
  52583. type: definePropType(Array),
  52584. default: () => mutable([])
  52585. },
  52586. currentName: {
  52587. type: [String, Number],
  52588. default: ""
  52589. },
  52590. editable: Boolean,
  52591. type: {
  52592. type: String,
  52593. values: ["card", "border-card", ""],
  52594. default: ""
  52595. },
  52596. stretch: Boolean
  52597. });
  52598. const tabNavEmits = {
  52599. tabClick: (tab, tabName, ev) => ev instanceof Event,
  52600. tabRemove: (tab, ev) => ev instanceof Event
  52601. };
  52602. const COMPONENT_NAME$2 = "ElTabNav";
  52603. const TabNav = /* @__PURE__ */ defineComponent({
  52604. name: COMPONENT_NAME$2,
  52605. props: tabNavProps,
  52606. emits: tabNavEmits,
  52607. setup(props, {
  52608. expose,
  52609. emit: emit2
  52610. }) {
  52611. const vm = getCurrentInstance();
  52612. const rootTabs = inject(tabsRootContextKey);
  52613. if (!rootTabs)
  52614. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  52615. const ns = useNamespace("tabs");
  52616. const visibility = useDocumentVisibility();
  52617. const focused = useWindowFocus();
  52618. const navScroll$ = ref();
  52619. const nav$ = ref();
  52620. const el$ = ref();
  52621. const tabBarRef = ref();
  52622. const scrollable = ref(false);
  52623. const navOffset = ref(0);
  52624. const isFocus = ref(false);
  52625. const focusable = ref(true);
  52626. const sizeName = computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  52627. const navStyle = computed(() => {
  52628. const dir = sizeName.value === "width" ? "X" : "Y";
  52629. return {
  52630. transform: `translate${dir}(-${navOffset.value}px)`
  52631. };
  52632. });
  52633. const scrollPrev = () => {
  52634. if (!navScroll$.value)
  52635. return;
  52636. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52637. const currentOffset = navOffset.value;
  52638. if (!currentOffset)
  52639. return;
  52640. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  52641. navOffset.value = newOffset;
  52642. };
  52643. const scrollNext = () => {
  52644. if (!navScroll$.value || !nav$.value)
  52645. return;
  52646. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  52647. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52648. const currentOffset = navOffset.value;
  52649. if (navSize - currentOffset <= containerSize)
  52650. return;
  52651. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  52652. navOffset.value = newOffset;
  52653. };
  52654. const scrollToActiveTab = async () => {
  52655. const nav = nav$.value;
  52656. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  52657. return;
  52658. await nextTick();
  52659. const activeTab = el$.value.querySelector(".is-active");
  52660. if (!activeTab)
  52661. return;
  52662. const navScroll = navScroll$.value;
  52663. const isHorizontal2 = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  52664. const activeTabBounding = activeTab.getBoundingClientRect();
  52665. const navScrollBounding = navScroll.getBoundingClientRect();
  52666. const maxOffset = isHorizontal2 ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  52667. const currentOffset = navOffset.value;
  52668. let newOffset = currentOffset;
  52669. if (isHorizontal2) {
  52670. if (activeTabBounding.left < navScrollBounding.left) {
  52671. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  52672. }
  52673. if (activeTabBounding.right > navScrollBounding.right) {
  52674. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  52675. }
  52676. } else {
  52677. if (activeTabBounding.top < navScrollBounding.top) {
  52678. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  52679. }
  52680. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  52681. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  52682. }
  52683. }
  52684. newOffset = Math.max(newOffset, 0);
  52685. navOffset.value = Math.min(newOffset, maxOffset);
  52686. };
  52687. const update = () => {
  52688. var _a2;
  52689. if (!nav$.value || !navScroll$.value)
  52690. return;
  52691. props.stretch && ((_a2 = tabBarRef.value) == null ? void 0 : _a2.update());
  52692. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  52693. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52694. const currentOffset = navOffset.value;
  52695. if (containerSize < navSize) {
  52696. scrollable.value = scrollable.value || {};
  52697. scrollable.value.prev = currentOffset;
  52698. scrollable.value.next = currentOffset + containerSize < navSize;
  52699. if (navSize - currentOffset < containerSize) {
  52700. navOffset.value = navSize - containerSize;
  52701. }
  52702. } else {
  52703. scrollable.value = false;
  52704. if (currentOffset > 0) {
  52705. navOffset.value = 0;
  52706. }
  52707. }
  52708. };
  52709. const changeTab = (e) => {
  52710. const code = e.code;
  52711. const {
  52712. up: up2,
  52713. down: down2,
  52714. left: left2,
  52715. right: right2
  52716. } = EVENT_CODE;
  52717. if (![up2, down2, left2, right2].includes(code))
  52718. return;
  52719. const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  52720. const currentIndex = tabList.indexOf(e.target);
  52721. let nextIndex;
  52722. if (code === left2 || code === up2) {
  52723. if (currentIndex === 0) {
  52724. nextIndex = tabList.length - 1;
  52725. } else {
  52726. nextIndex = currentIndex - 1;
  52727. }
  52728. } else {
  52729. if (currentIndex < tabList.length - 1) {
  52730. nextIndex = currentIndex + 1;
  52731. } else {
  52732. nextIndex = 0;
  52733. }
  52734. }
  52735. tabList[nextIndex].focus({
  52736. preventScroll: true
  52737. });
  52738. tabList[nextIndex].click();
  52739. setFocus();
  52740. };
  52741. const setFocus = () => {
  52742. if (focusable.value)
  52743. isFocus.value = true;
  52744. };
  52745. const removeFocus = () => isFocus.value = false;
  52746. watch(visibility, (visibility2) => {
  52747. if (visibility2 === "hidden") {
  52748. focusable.value = false;
  52749. } else if (visibility2 === "visible") {
  52750. setTimeout(() => focusable.value = true, 50);
  52751. }
  52752. });
  52753. watch(focused, (focused2) => {
  52754. if (focused2) {
  52755. setTimeout(() => focusable.value = true, 50);
  52756. } else {
  52757. focusable.value = false;
  52758. }
  52759. });
  52760. useResizeObserver(el$, update);
  52761. onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  52762. onUpdated(() => update());
  52763. expose({
  52764. scrollToActiveTab,
  52765. removeFocus
  52766. });
  52767. watch(() => props.panes, () => vm.update(), {
  52768. flush: "post",
  52769. deep: true
  52770. });
  52771. return () => {
  52772. const scrollBtn = scrollable.value ? [createVNode("span", {
  52773. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  52774. "onClick": scrollPrev
  52775. }, [createVNode(ElIcon, null, {
  52776. default: () => [createVNode(arrow_left_default, null, null)]
  52777. })]), createVNode("span", {
  52778. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  52779. "onClick": scrollNext
  52780. }, [createVNode(ElIcon, null, {
  52781. default: () => [createVNode(arrow_right_default, null, null)]
  52782. })])] : null;
  52783. const tabs = props.panes.map((pane, index2) => {
  52784. var _a2, _b, _c, _d;
  52785. const uid2 = pane.uid;
  52786. const disabled = pane.props.disabled;
  52787. const tabName = (_b = (_a2 = pane.props.name) != null ? _a2 : pane.index) != null ? _b : `${index2}`;
  52788. const closable = !disabled && (pane.isClosable || props.editable);
  52789. pane.index = `${index2}`;
  52790. const btnClose = closable ? createVNode(ElIcon, {
  52791. "class": "is-icon-close",
  52792. "onClick": (ev) => emit2("tabRemove", pane, ev)
  52793. }, {
  52794. default: () => [createVNode(close_default, null, null)]
  52795. }) : null;
  52796. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  52797. const tabindex = !disabled && pane.active ? 0 : -1;
  52798. return createVNode("div", {
  52799. "ref": `tab-${uid2}`,
  52800. "class": [ns.e("item"), ns.is(rootTabs.props.tabPosition), ns.is("active", pane.active), ns.is("disabled", disabled), ns.is("closable", closable), ns.is("focus", isFocus.value)],
  52801. "id": `tab-${tabName}`,
  52802. "key": `tab-${uid2}`,
  52803. "aria-controls": `pane-${tabName}`,
  52804. "role": "tab",
  52805. "aria-selected": pane.active,
  52806. "tabindex": tabindex,
  52807. "onFocus": () => setFocus(),
  52808. "onBlur": () => removeFocus(),
  52809. "onClick": (ev) => {
  52810. removeFocus();
  52811. emit2("tabClick", pane, tabName, ev);
  52812. },
  52813. "onKeydown": (ev) => {
  52814. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  52815. emit2("tabRemove", pane, ev);
  52816. }
  52817. }
  52818. }, [...[tabLabelContent, btnClose]]);
  52819. });
  52820. return createVNode("div", {
  52821. "ref": el$,
  52822. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  52823. }, [scrollBtn, createVNode("div", {
  52824. "class": ns.e("nav-scroll"),
  52825. "ref": navScroll$
  52826. }, [createVNode("div", {
  52827. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  52828. "ref": nav$,
  52829. "style": navStyle.value,
  52830. "role": "tablist",
  52831. "onKeydown": changeTab
  52832. }, [...[!props.type ? createVNode(TabBar, {
  52833. "ref": tabBarRef,
  52834. "tabs": [...props.panes]
  52835. }, null) : null, tabs]])])]);
  52836. };
  52837. }
  52838. });
  52839. const tabsProps = buildProps({
  52840. type: {
  52841. type: String,
  52842. values: ["card", "border-card", ""],
  52843. default: ""
  52844. },
  52845. activeName: {
  52846. type: [String, Number]
  52847. },
  52848. closable: Boolean,
  52849. addable: Boolean,
  52850. modelValue: {
  52851. type: [String, Number]
  52852. },
  52853. editable: Boolean,
  52854. tabPosition: {
  52855. type: String,
  52856. values: ["top", "right", "bottom", "left"],
  52857. default: "top"
  52858. },
  52859. beforeLeave: {
  52860. type: definePropType(Function),
  52861. default: () => true
  52862. },
  52863. stretch: Boolean
  52864. });
  52865. const isPaneName = (value) => isString$1(value) || isNumber(value);
  52866. const tabsEmits = {
  52867. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  52868. tabClick: (pane, ev) => ev instanceof Event,
  52869. tabChange: (name) => isPaneName(name),
  52870. edit: (paneName, action) => ["remove", "add"].includes(action),
  52871. tabRemove: (name) => isPaneName(name),
  52872. tabAdd: () => true
  52873. };
  52874. const Tabs = /* @__PURE__ */ defineComponent({
  52875. name: "ElTabs",
  52876. props: tabsProps,
  52877. emits: tabsEmits,
  52878. setup(props, {
  52879. emit: emit2,
  52880. slots,
  52881. expose
  52882. }) {
  52883. var _a2, _b;
  52884. const ns = useNamespace("tabs");
  52885. const {
  52886. children: panes,
  52887. addChild: registerPane,
  52888. removeChild: unregisterPane
  52889. } = useOrderedChildren(getCurrentInstance(), "ElTabPane");
  52890. const nav$ = ref();
  52891. const currentName = ref((_b = (_a2 = props.modelValue) != null ? _a2 : props.activeName) != null ? _b : "0");
  52892. const setCurrentName = async (value, trigger2 = false) => {
  52893. var _a22, _b2, _c;
  52894. if (currentName.value === value || isUndefined(value))
  52895. return;
  52896. try {
  52897. const canLeave = await ((_a22 = props.beforeLeave) == null ? void 0 : _a22.call(props, value, currentName.value));
  52898. if (canLeave !== false) {
  52899. currentName.value = value;
  52900. if (trigger2) {
  52901. emit2(UPDATE_MODEL_EVENT, value);
  52902. emit2("tabChange", value);
  52903. }
  52904. (_c = (_b2 = nav$.value) == null ? void 0 : _b2.removeFocus) == null ? void 0 : _c.call(_b2);
  52905. }
  52906. } catch (e) {
  52907. }
  52908. };
  52909. const handleTabClick = (tab, tabName, event) => {
  52910. if (tab.props.disabled)
  52911. return;
  52912. setCurrentName(tabName, true);
  52913. emit2("tabClick", tab, event);
  52914. };
  52915. const handleTabRemove = (pane, ev) => {
  52916. if (pane.props.disabled || isUndefined(pane.props.name))
  52917. return;
  52918. ev.stopPropagation();
  52919. emit2("edit", pane.props.name, "remove");
  52920. emit2("tabRemove", pane.props.name);
  52921. };
  52922. const handleTabAdd = () => {
  52923. emit2("edit", void 0, "add");
  52924. emit2("tabAdd");
  52925. };
  52926. useDeprecated({
  52927. from: '"activeName"',
  52928. replacement: '"model-value" or "v-model"',
  52929. scope: "ElTabs",
  52930. version: "2.3.0",
  52931. ref: "https://element-plus.org/en-US/component/tabs.html#attributes",
  52932. type: "Attribute"
  52933. }, computed(() => !!props.activeName));
  52934. watch(() => props.activeName, (modelValue) => setCurrentName(modelValue));
  52935. watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  52936. watch(currentName, async () => {
  52937. var _a22;
  52938. await nextTick();
  52939. (_a22 = nav$.value) == null ? void 0 : _a22.scrollToActiveTab();
  52940. });
  52941. provide(tabsRootContextKey, {
  52942. props,
  52943. currentName,
  52944. registerPane,
  52945. unregisterPane
  52946. });
  52947. expose({
  52948. currentName
  52949. });
  52950. return () => {
  52951. const addSlot = slots.addIcon;
  52952. const newButton = props.editable || props.addable ? createVNode("span", {
  52953. "class": ns.e("new-tab"),
  52954. "tabindex": "0",
  52955. "onClick": handleTabAdd,
  52956. "onKeydown": (ev) => {
  52957. if (ev.code === EVENT_CODE.enter)
  52958. handleTabAdd();
  52959. }
  52960. }, [addSlot ? renderSlot(slots, "addIcon") : createVNode(ElIcon, {
  52961. "class": ns.is("icon-plus")
  52962. }, {
  52963. default: () => [createVNode(plus_default, null, null)]
  52964. })]) : null;
  52965. const header = createVNode("div", {
  52966. "class": [ns.e("header"), ns.is(props.tabPosition)]
  52967. }, [newButton, createVNode(TabNav, {
  52968. "ref": nav$,
  52969. "currentName": currentName.value,
  52970. "editable": props.editable,
  52971. "type": props.type,
  52972. "panes": panes.value,
  52973. "stretch": props.stretch,
  52974. "onTabClick": handleTabClick,
  52975. "onTabRemove": handleTabRemove
  52976. }, null)]);
  52977. const panels = createVNode("div", {
  52978. "class": ns.e("content")
  52979. }, [renderSlot(slots, "default")]);
  52980. return createVNode("div", {
  52981. "class": [ns.b(), ns.m(props.tabPosition), {
  52982. [ns.m("card")]: props.type === "card",
  52983. [ns.m("border-card")]: props.type === "border-card"
  52984. }]
  52985. }, [...props.tabPosition !== "bottom" ? [header, panels] : [panels, header]]);
  52986. };
  52987. }
  52988. });
  52989. const tabPaneProps = buildProps({
  52990. label: {
  52991. type: String,
  52992. default: ""
  52993. },
  52994. name: {
  52995. type: [String, Number]
  52996. },
  52997. closable: Boolean,
  52998. disabled: Boolean,
  52999. lazy: Boolean
  53000. });
  53001. const _hoisted_1$c = ["id", "aria-hidden", "aria-labelledby"];
  53002. const COMPONENT_NAME$1 = "ElTabPane";
  53003. const __default__$k = /* @__PURE__ */ defineComponent({
  53004. name: COMPONENT_NAME$1
  53005. });
  53006. const _sfc_main$t = /* @__PURE__ */ defineComponent({
  53007. ...__default__$k,
  53008. props: tabPaneProps,
  53009. setup(__props) {
  53010. const props = __props;
  53011. const instance = getCurrentInstance();
  53012. const slots = useSlots();
  53013. const tabsRoot = inject(tabsRootContextKey);
  53014. if (!tabsRoot)
  53015. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  53016. const ns = useNamespace("tab-pane");
  53017. const index2 = ref();
  53018. const isClosable = computed(() => props.closable || tabsRoot.props.closable);
  53019. const active = computedEager(() => {
  53020. var _a2;
  53021. return tabsRoot.currentName.value === ((_a2 = props.name) != null ? _a2 : index2.value);
  53022. });
  53023. const loaded = ref(active.value);
  53024. const paneName = computed(() => {
  53025. var _a2;
  53026. return (_a2 = props.name) != null ? _a2 : index2.value;
  53027. });
  53028. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  53029. watch(active, (val) => {
  53030. if (val)
  53031. loaded.value = true;
  53032. });
  53033. const pane = reactive({
  53034. uid: instance.uid,
  53035. slots,
  53036. props,
  53037. paneName,
  53038. active,
  53039. index: index2,
  53040. isClosable
  53041. });
  53042. onMounted(() => {
  53043. tabsRoot.registerPane(pane);
  53044. });
  53045. onUnmounted(() => {
  53046. tabsRoot.unregisterPane(pane.uid);
  53047. });
  53048. return (_ctx, _cache) => {
  53049. return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
  53050. key: 0,
  53051. id: `pane-${unref(paneName)}`,
  53052. class: normalizeClass(unref(ns).b()),
  53053. role: "tabpanel",
  53054. "aria-hidden": !unref(active),
  53055. "aria-labelledby": `tab-${unref(paneName)}`
  53056. }, [
  53057. renderSlot(_ctx.$slots, "default")
  53058. ], 10, _hoisted_1$c)), [
  53059. [vShow, unref(active)]
  53060. ]) : createCommentVNode("v-if", true);
  53061. };
  53062. }
  53063. });
  53064. var TabPane = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-pane.vue"]]);
  53065. const ElTabs = withInstall(Tabs, {
  53066. TabPane
  53067. });
  53068. const ElTabPane = withNoopInstall(TabPane);
  53069. const textProps = buildProps({
  53070. type: {
  53071. type: String,
  53072. values: ["primary", "success", "info", "warning", "danger", ""],
  53073. default: ""
  53074. },
  53075. size: {
  53076. type: String,
  53077. values: componentSizes,
  53078. default: ""
  53079. },
  53080. truncated: {
  53081. type: Boolean
  53082. },
  53083. lineClamp: {
  53084. type: [String, Number]
  53085. },
  53086. tag: {
  53087. type: String,
  53088. default: "span"
  53089. }
  53090. });
  53091. const __default__$j = /* @__PURE__ */ defineComponent({
  53092. name: "ElText"
  53093. });
  53094. const _sfc_main$s = /* @__PURE__ */ defineComponent({
  53095. ...__default__$j,
  53096. props: textProps,
  53097. setup(__props) {
  53098. const props = __props;
  53099. const textSize = useFormSize();
  53100. const ns = useNamespace("text");
  53101. const textKls = computed(() => [
  53102. ns.b(),
  53103. ns.m(props.type),
  53104. ns.m(textSize.value),
  53105. ns.is("truncated", props.truncated),
  53106. ns.is("line-clamp", !isUndefined(props.lineClamp))
  53107. ]);
  53108. return (_ctx, _cache) => {
  53109. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  53110. class: normalizeClass(unref(textKls)),
  53111. style: normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  53112. }, {
  53113. default: withCtx(() => [
  53114. renderSlot(_ctx.$slots, "default")
  53115. ]),
  53116. _: 3
  53117. }, 8, ["class", "style"]);
  53118. };
  53119. }
  53120. });
  53121. var Text = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/text/src/text.vue"]]);
  53122. const ElText = withInstall(Text);
  53123. const timeSelectProps = buildProps({
  53124. format: {
  53125. type: String,
  53126. default: "HH:mm"
  53127. },
  53128. modelValue: String,
  53129. disabled: Boolean,
  53130. editable: {
  53131. type: Boolean,
  53132. default: true
  53133. },
  53134. effect: {
  53135. type: String,
  53136. default: "light"
  53137. },
  53138. clearable: {
  53139. type: Boolean,
  53140. default: true
  53141. },
  53142. size: useSizeProp,
  53143. placeholder: String,
  53144. start: {
  53145. type: String,
  53146. default: "09:00"
  53147. },
  53148. end: {
  53149. type: String,
  53150. default: "18:00"
  53151. },
  53152. step: {
  53153. type: String,
  53154. default: "00:30"
  53155. },
  53156. minTime: String,
  53157. maxTime: String,
  53158. name: String,
  53159. prefixIcon: {
  53160. type: definePropType([String, Object]),
  53161. default: () => clock_default
  53162. },
  53163. clearIcon: {
  53164. type: definePropType([String, Object]),
  53165. default: () => circle_close_default
  53166. }
  53167. });
  53168. const parseTime = (time) => {
  53169. const values = (time || "").split(":");
  53170. if (values.length >= 2) {
  53171. let hours = Number.parseInt(values[0], 10);
  53172. const minutes = Number.parseInt(values[1], 10);
  53173. const timeUpper = time.toUpperCase();
  53174. if (timeUpper.includes("AM") && hours === 12) {
  53175. hours = 0;
  53176. } else if (timeUpper.includes("PM") && hours !== 12) {
  53177. hours += 12;
  53178. }
  53179. return {
  53180. hours,
  53181. minutes
  53182. };
  53183. }
  53184. return null;
  53185. };
  53186. const compareTime = (time1, time2) => {
  53187. const value1 = parseTime(time1);
  53188. if (!value1)
  53189. return -1;
  53190. const value2 = parseTime(time2);
  53191. if (!value2)
  53192. return -1;
  53193. const minutes1 = value1.minutes + value1.hours * 60;
  53194. const minutes2 = value2.minutes + value2.hours * 60;
  53195. if (minutes1 === minutes2) {
  53196. return 0;
  53197. }
  53198. return minutes1 > minutes2 ? 1 : -1;
  53199. };
  53200. const padTime = (time) => {
  53201. return `${time}`.padStart(2, "0");
  53202. };
  53203. const formatTime = (time) => {
  53204. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  53205. };
  53206. const nextTime = (time, step) => {
  53207. const timeValue = parseTime(time);
  53208. if (!timeValue)
  53209. return "";
  53210. const stepValue = parseTime(step);
  53211. if (!stepValue)
  53212. return "";
  53213. const next = {
  53214. hours: timeValue.hours,
  53215. minutes: timeValue.minutes
  53216. };
  53217. next.minutes += stepValue.minutes;
  53218. next.hours += stepValue.hours;
  53219. next.hours += Math.floor(next.minutes / 60);
  53220. next.minutes = next.minutes % 60;
  53221. return formatTime(next);
  53222. };
  53223. const __default__$i = /* @__PURE__ */ defineComponent({
  53224. name: "ElTimeSelect"
  53225. });
  53226. const _sfc_main$r = /* @__PURE__ */ defineComponent({
  53227. ...__default__$i,
  53228. props: timeSelectProps,
  53229. emits: ["change", "blur", "focus", "update:modelValue"],
  53230. setup(__props, { expose }) {
  53231. const props = __props;
  53232. dayjs.extend(customParseFormat);
  53233. const { Option: ElOption2 } = ElSelect;
  53234. const nsInput = useNamespace("input");
  53235. const select = ref();
  53236. const _disabled = useFormDisabled();
  53237. const { lang } = useLocale();
  53238. const value = computed(() => props.modelValue);
  53239. const start = computed(() => {
  53240. const time = parseTime(props.start);
  53241. return time ? formatTime(time) : null;
  53242. });
  53243. const end2 = computed(() => {
  53244. const time = parseTime(props.end);
  53245. return time ? formatTime(time) : null;
  53246. });
  53247. const step = computed(() => {
  53248. const time = parseTime(props.step);
  53249. return time ? formatTime(time) : null;
  53250. });
  53251. const minTime = computed(() => {
  53252. const time = parseTime(props.minTime || "");
  53253. return time ? formatTime(time) : null;
  53254. });
  53255. const maxTime = computed(() => {
  53256. const time = parseTime(props.maxTime || "");
  53257. return time ? formatTime(time) : null;
  53258. });
  53259. const items = computed(() => {
  53260. const result = [];
  53261. if (props.start && props.end && props.step) {
  53262. let current = start.value;
  53263. let currentTime;
  53264. while (current && end2.value && compareTime(current, end2.value) <= 0) {
  53265. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  53266. result.push({
  53267. value: currentTime,
  53268. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  53269. });
  53270. current = nextTime(current, step.value);
  53271. }
  53272. }
  53273. return result;
  53274. });
  53275. const blur = () => {
  53276. var _a2, _b;
  53277. (_b = (_a2 = select.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
  53278. };
  53279. const focus = () => {
  53280. var _a2, _b;
  53281. (_b = (_a2 = select.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  53282. };
  53283. expose({
  53284. blur,
  53285. focus
  53286. });
  53287. return (_ctx, _cache) => {
  53288. return openBlock(), createBlock(unref(ElSelect), {
  53289. ref_key: "select",
  53290. ref: select,
  53291. "model-value": unref(value),
  53292. disabled: unref(_disabled),
  53293. clearable: _ctx.clearable,
  53294. "clear-icon": _ctx.clearIcon,
  53295. size: _ctx.size,
  53296. effect: _ctx.effect,
  53297. placeholder: _ctx.placeholder,
  53298. "default-first-option": "",
  53299. filterable: _ctx.editable,
  53300. "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)),
  53301. onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)),
  53302. onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
  53303. onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event))
  53304. }, {
  53305. prefix: withCtx(() => [
  53306. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  53307. key: 0,
  53308. class: normalizeClass(unref(nsInput).e("prefix-icon"))
  53309. }, {
  53310. default: withCtx(() => [
  53311. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  53312. ]),
  53313. _: 1
  53314. }, 8, ["class"])) : createCommentVNode("v-if", true)
  53315. ]),
  53316. default: withCtx(() => [
  53317. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
  53318. return openBlock(), createBlock(unref(ElOption2), {
  53319. key: item.value,
  53320. label: item.value,
  53321. value: item.value,
  53322. disabled: item.disabled
  53323. }, null, 8, ["label", "value", "disabled"]);
  53324. }), 128))
  53325. ]),
  53326. _: 1
  53327. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable"]);
  53328. };
  53329. }
  53330. });
  53331. var TimeSelect = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-select/src/time-select.vue"]]);
  53332. TimeSelect.install = (app) => {
  53333. app.component(TimeSelect.name, TimeSelect);
  53334. };
  53335. const _TimeSelect = TimeSelect;
  53336. const ElTimeSelect = _TimeSelect;
  53337. const Timeline = /* @__PURE__ */ defineComponent({
  53338. name: "ElTimeline",
  53339. setup(_2, { slots }) {
  53340. const ns = useNamespace("timeline");
  53341. provide("timeline", slots);
  53342. return () => {
  53343. return h$1("ul", { class: [ns.b()] }, [renderSlot(slots, "default")]);
  53344. };
  53345. }
  53346. });
  53347. const timelineItemProps = buildProps({
  53348. timestamp: {
  53349. type: String,
  53350. default: ""
  53351. },
  53352. hideTimestamp: {
  53353. type: Boolean,
  53354. default: false
  53355. },
  53356. center: {
  53357. type: Boolean,
  53358. default: false
  53359. },
  53360. placement: {
  53361. type: String,
  53362. values: ["top", "bottom"],
  53363. default: "bottom"
  53364. },
  53365. type: {
  53366. type: String,
  53367. values: ["primary", "success", "warning", "danger", "info"],
  53368. default: ""
  53369. },
  53370. color: {
  53371. type: String,
  53372. default: ""
  53373. },
  53374. size: {
  53375. type: String,
  53376. values: ["normal", "large"],
  53377. default: "normal"
  53378. },
  53379. icon: {
  53380. type: iconPropType
  53381. },
  53382. hollow: {
  53383. type: Boolean,
  53384. default: false
  53385. }
  53386. });
  53387. const __default__$h = /* @__PURE__ */ defineComponent({
  53388. name: "ElTimelineItem"
  53389. });
  53390. const _sfc_main$q = /* @__PURE__ */ defineComponent({
  53391. ...__default__$h,
  53392. props: timelineItemProps,
  53393. setup(__props) {
  53394. const props = __props;
  53395. const ns = useNamespace("timeline-item");
  53396. const defaultNodeKls = computed(() => [
  53397. ns.e("node"),
  53398. ns.em("node", props.size || ""),
  53399. ns.em("node", props.type || ""),
  53400. ns.is("hollow", props.hollow)
  53401. ]);
  53402. return (_ctx, _cache) => {
  53403. return openBlock(), createElementBlock("li", {
  53404. class: normalizeClass([unref(ns).b(), { [unref(ns).e("center")]: _ctx.center }])
  53405. }, [
  53406. createBaseVNode("div", {
  53407. class: normalizeClass(unref(ns).e("tail"))
  53408. }, null, 2),
  53409. !_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  53410. key: 0,
  53411. class: normalizeClass(unref(defaultNodeKls)),
  53412. style: normalizeStyle({
  53413. backgroundColor: _ctx.color
  53414. })
  53415. }, [
  53416. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  53417. key: 0,
  53418. class: normalizeClass(unref(ns).e("icon"))
  53419. }, {
  53420. default: withCtx(() => [
  53421. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  53422. ]),
  53423. _: 1
  53424. }, 8, ["class"])) : createCommentVNode("v-if", true)
  53425. ], 6)) : createCommentVNode("v-if", true),
  53426. _ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  53427. key: 1,
  53428. class: normalizeClass(unref(ns).e("dot"))
  53429. }, [
  53430. renderSlot(_ctx.$slots, "dot")
  53431. ], 2)) : createCommentVNode("v-if", true),
  53432. createBaseVNode("div", {
  53433. class: normalizeClass(unref(ns).e("wrapper"))
  53434. }, [
  53435. !_ctx.hideTimestamp && _ctx.placement === "top" ? (openBlock(), createElementBlock("div", {
  53436. key: 0,
  53437. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
  53438. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true),
  53439. createBaseVNode("div", {
  53440. class: normalizeClass(unref(ns).e("content"))
  53441. }, [
  53442. renderSlot(_ctx.$slots, "default")
  53443. ], 2),
  53444. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (openBlock(), createElementBlock("div", {
  53445. key: 1,
  53446. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
  53447. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true)
  53448. ], 2)
  53449. ], 2);
  53450. };
  53451. }
  53452. });
  53453. var TimelineItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/timeline/src/timeline-item.vue"]]);
  53454. const ElTimeline = withInstall(Timeline, {
  53455. TimelineItem
  53456. });
  53457. const ElTimelineItem = withNoopInstall(TimelineItem);
  53458. const tooltipV2CommonProps = buildProps({
  53459. nowrap: Boolean
  53460. });
  53461. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  53462. TooltipV2Sides2["top"] = "top";
  53463. TooltipV2Sides2["bottom"] = "bottom";
  53464. TooltipV2Sides2["left"] = "left";
  53465. TooltipV2Sides2["right"] = "right";
  53466. return TooltipV2Sides2;
  53467. })(TooltipV2Sides || {});
  53468. const tooltipV2Sides = Object.values(TooltipV2Sides);
  53469. const tooltipV2ArrowProps = buildProps({
  53470. width: {
  53471. type: Number,
  53472. default: 10
  53473. },
  53474. height: {
  53475. type: Number,
  53476. default: 10
  53477. },
  53478. style: {
  53479. type: definePropType(Object),
  53480. default: null
  53481. }
  53482. });
  53483. const tooltipV2ArrowSpecialProps = buildProps({
  53484. side: {
  53485. type: definePropType(String),
  53486. values: tooltipV2Sides,
  53487. required: true
  53488. }
  53489. });
  53490. const tooltipV2Strategies = ["absolute", "fixed"];
  53491. const tooltipV2Placements = [
  53492. "top-start",
  53493. "top-end",
  53494. "top",
  53495. "bottom-start",
  53496. "bottom-end",
  53497. "bottom",
  53498. "left-start",
  53499. "left-end",
  53500. "left",
  53501. "right-start",
  53502. "right-end",
  53503. "right"
  53504. ];
  53505. const tooltipV2ContentProps = buildProps({
  53506. ariaLabel: String,
  53507. arrowPadding: {
  53508. type: definePropType(Number),
  53509. default: 5
  53510. },
  53511. effect: {
  53512. type: String,
  53513. default: ""
  53514. },
  53515. contentClass: String,
  53516. placement: {
  53517. type: definePropType(String),
  53518. values: tooltipV2Placements,
  53519. default: "bottom"
  53520. },
  53521. reference: {
  53522. type: definePropType(Object),
  53523. default: null
  53524. },
  53525. offset: {
  53526. type: Number,
  53527. default: 8
  53528. },
  53529. strategy: {
  53530. type: definePropType(String),
  53531. values: tooltipV2Strategies,
  53532. default: "absolute"
  53533. },
  53534. showArrow: {
  53535. type: Boolean,
  53536. default: false
  53537. }
  53538. });
  53539. const tooltipV2RootProps = buildProps({
  53540. delayDuration: {
  53541. type: Number,
  53542. default: 300
  53543. },
  53544. defaultOpen: Boolean,
  53545. open: {
  53546. type: Boolean,
  53547. default: void 0
  53548. },
  53549. onOpenChange: {
  53550. type: definePropType(Function)
  53551. },
  53552. "onUpdate:open": {
  53553. type: definePropType(Function)
  53554. }
  53555. });
  53556. const EventHandler = {
  53557. type: definePropType(Function)
  53558. };
  53559. const tooltipV2TriggerProps = buildProps({
  53560. onBlur: EventHandler,
  53561. onClick: EventHandler,
  53562. onFocus: EventHandler,
  53563. onMouseDown: EventHandler,
  53564. onMouseEnter: EventHandler,
  53565. onMouseLeave: EventHandler
  53566. });
  53567. const tooltipV2Props = buildProps({
  53568. ...tooltipV2RootProps,
  53569. ...tooltipV2ArrowProps,
  53570. ...tooltipV2TriggerProps,
  53571. ...tooltipV2ContentProps,
  53572. alwaysOn: Boolean,
  53573. fullTransition: Boolean,
  53574. transitionProps: {
  53575. type: definePropType(Object),
  53576. default: null
  53577. },
  53578. teleported: Boolean,
  53579. to: {
  53580. type: definePropType(String),
  53581. default: "body"
  53582. }
  53583. });
  53584. const tooltipV2RootKey = Symbol("tooltipV2");
  53585. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  53586. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  53587. const __default__$g = /* @__PURE__ */ defineComponent({
  53588. name: "ElTooltipV2Root"
  53589. });
  53590. const _sfc_main$p = /* @__PURE__ */ defineComponent({
  53591. ...__default__$g,
  53592. props: tooltipV2RootProps,
  53593. setup(__props, { expose }) {
  53594. const props = __props;
  53595. const _open = ref(props.defaultOpen);
  53596. const triggerRef2 = ref(null);
  53597. const open = computed({
  53598. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  53599. set: (open2) => {
  53600. var _a2;
  53601. _open.value = open2;
  53602. (_a2 = props["onUpdate:open"]) == null ? void 0 : _a2.call(props, open2);
  53603. }
  53604. });
  53605. const isOpenDelayed = computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  53606. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  53607. open.value = true;
  53608. }, computed(() => props.delayDuration), {
  53609. immediate: false
  53610. });
  53611. const ns = useNamespace("tooltip-v2");
  53612. const contentId = useId();
  53613. const onNormalOpen = () => {
  53614. clearTimer();
  53615. open.value = true;
  53616. };
  53617. const onDelayOpen = () => {
  53618. unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  53619. };
  53620. const onOpen = onNormalOpen;
  53621. const onClose = () => {
  53622. clearTimer();
  53623. open.value = false;
  53624. };
  53625. const onChange = (open2) => {
  53626. var _a2;
  53627. if (open2) {
  53628. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  53629. onOpen();
  53630. }
  53631. (_a2 = props.onOpenChange) == null ? void 0 : _a2.call(props, open2);
  53632. };
  53633. watch(open, onChange);
  53634. onMounted(() => {
  53635. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  53636. });
  53637. onBeforeUnmount(() => {
  53638. clearTimer();
  53639. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  53640. });
  53641. provide(tooltipV2RootKey, {
  53642. contentId,
  53643. triggerRef: triggerRef2,
  53644. ns,
  53645. onClose,
  53646. onDelayOpen,
  53647. onOpen
  53648. });
  53649. expose({
  53650. onOpen,
  53651. onClose
  53652. });
  53653. return (_ctx, _cache) => {
  53654. return renderSlot(_ctx.$slots, "default", { open: unref(open) });
  53655. };
  53656. }
  53657. });
  53658. var TooltipV2Root = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip-v2/src/root.vue"]]);
  53659. const __default__$f = /* @__PURE__ */ defineComponent({
  53660. name: "ElTooltipV2Arrow"
  53661. });
  53662. const _sfc_main$o = /* @__PURE__ */ defineComponent({
  53663. ...__default__$f,
  53664. props: {
  53665. ...tooltipV2ArrowProps,
  53666. ...tooltipV2ArrowSpecialProps
  53667. },
  53668. setup(__props) {
  53669. const props = __props;
  53670. const { ns } = inject(tooltipV2RootKey);
  53671. const { arrowRef } = inject(tooltipV2ContentKey);
  53672. const arrowStyle = computed(() => {
  53673. const { style, width, height } = props;
  53674. const namespace = ns.namespace.value;
  53675. return {
  53676. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  53677. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  53678. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  53679. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  53680. ...style || {}
  53681. };
  53682. });
  53683. return (_ctx, _cache) => {
  53684. return openBlock(), createElementBlock("span", {
  53685. ref_key: "arrowRef",
  53686. ref: arrowRef,
  53687. style: normalizeStyle(unref(arrowStyle)),
  53688. class: normalizeClass(unref(ns).e("arrow"))
  53689. }, null, 6);
  53690. };
  53691. }
  53692. });
  53693. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip-v2/src/arrow.vue"]]);
  53694. const visualHiddenProps = buildProps({
  53695. style: {
  53696. type: definePropType([String, Object, Array]),
  53697. default: () => ({})
  53698. }
  53699. });
  53700. const __default__$e = /* @__PURE__ */ defineComponent({
  53701. name: "ElVisuallyHidden"
  53702. });
  53703. const _sfc_main$n = /* @__PURE__ */ defineComponent({
  53704. ...__default__$e,
  53705. props: visualHiddenProps,
  53706. setup(__props) {
  53707. const props = __props;
  53708. const computedStyle = computed(() => {
  53709. return [
  53710. props.style,
  53711. {
  53712. position: "absolute",
  53713. border: 0,
  53714. width: 1,
  53715. height: 1,
  53716. padding: 0,
  53717. margin: -1,
  53718. overflow: "hidden",
  53719. clip: "rect(0, 0, 0, 0)",
  53720. whiteSpace: "nowrap",
  53721. wordWrap: "normal"
  53722. }
  53723. ];
  53724. });
  53725. return (_ctx, _cache) => {
  53726. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: unref(computedStyle) }), [
  53727. renderSlot(_ctx.$slots, "default")
  53728. ], 16);
  53729. };
  53730. }
  53731. });
  53732. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/visual-hidden/src/visual-hidden.vue"]]);
  53733. const _hoisted_1$b = ["data-side"];
  53734. const __default__$d = /* @__PURE__ */ defineComponent({
  53735. name: "ElTooltipV2Content"
  53736. });
  53737. const _sfc_main$m = /* @__PURE__ */ defineComponent({
  53738. ...__default__$d,
  53739. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  53740. setup(__props) {
  53741. const props = __props;
  53742. const { triggerRef: triggerRef2, contentId } = inject(tooltipV2RootKey);
  53743. const placement = ref(props.placement);
  53744. const strategy = ref(props.strategy);
  53745. const arrowRef = ref(null);
  53746. const { referenceRef, contentRef, middlewareData, x: x2, y, update } = useFloating({
  53747. placement,
  53748. strategy,
  53749. middleware: computed(() => {
  53750. const middleware = [offset(props.offset)];
  53751. if (props.showArrow) {
  53752. middleware.push(arrowMiddleware({
  53753. arrowRef
  53754. }));
  53755. }
  53756. return middleware;
  53757. })
  53758. });
  53759. const zIndex2 = useZIndex().nextZIndex();
  53760. const ns = useNamespace("tooltip-v2");
  53761. const side = computed(() => {
  53762. return placement.value.split("-")[0];
  53763. });
  53764. const contentStyle = computed(() => {
  53765. return {
  53766. position: unref(strategy),
  53767. top: `${unref(y) || 0}px`,
  53768. left: `${unref(x2) || 0}px`,
  53769. zIndex: zIndex2
  53770. };
  53771. });
  53772. const arrowStyle = computed(() => {
  53773. if (!props.showArrow)
  53774. return {};
  53775. const { arrow: arrow2 } = unref(middlewareData);
  53776. return {
  53777. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow2 == null ? void 0 : arrow2.x}px` || "",
  53778. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow2 == null ? void 0 : arrow2.y}px` || ""
  53779. };
  53780. });
  53781. const contentClass = computed(() => [
  53782. ns.e("content"),
  53783. ns.is("dark", props.effect === "dark"),
  53784. ns.is(unref(strategy)),
  53785. props.contentClass
  53786. ]);
  53787. watch(arrowRef, () => update());
  53788. watch(() => props.placement, (val) => placement.value = val);
  53789. onMounted(() => {
  53790. watch(() => props.reference || triggerRef2.value, (el) => {
  53791. referenceRef.value = el || void 0;
  53792. }, {
  53793. immediate: true
  53794. });
  53795. });
  53796. provide(tooltipV2ContentKey, { arrowRef });
  53797. return (_ctx, _cache) => {
  53798. return openBlock(), createElementBlock("div", {
  53799. ref_key: "contentRef",
  53800. ref: contentRef,
  53801. style: normalizeStyle(unref(contentStyle)),
  53802. "data-tooltip-v2-root": ""
  53803. }, [
  53804. !_ctx.nowrap ? (openBlock(), createElementBlock("div", {
  53805. key: 0,
  53806. "data-side": unref(side),
  53807. class: normalizeClass(unref(contentClass))
  53808. }, [
  53809. renderSlot(_ctx.$slots, "default", {
  53810. contentStyle: unref(contentStyle),
  53811. contentClass: unref(contentClass)
  53812. }),
  53813. createVNode(unref(ElVisuallyHidden), {
  53814. id: unref(contentId),
  53815. role: "tooltip"
  53816. }, {
  53817. default: withCtx(() => [
  53818. _ctx.ariaLabel ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  53819. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  53820. ], 64)) : renderSlot(_ctx.$slots, "default", { key: 1 })
  53821. ]),
  53822. _: 3
  53823. }, 8, ["id"]),
  53824. renderSlot(_ctx.$slots, "arrow", {
  53825. style: normalizeStyle(unref(arrowStyle)),
  53826. side: unref(side)
  53827. })
  53828. ], 10, _hoisted_1$b)) : createCommentVNode("v-if", true)
  53829. ], 4);
  53830. };
  53831. }
  53832. });
  53833. var TooltipV2Content = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip-v2/src/content.vue"]]);
  53834. const forwardRefProps = buildProps({
  53835. setRef: {
  53836. type: definePropType(Function),
  53837. required: true
  53838. },
  53839. onlyChild: Boolean
  53840. });
  53841. var ForwardRef = /* @__PURE__ */ defineComponent({
  53842. props: forwardRefProps,
  53843. setup(props, {
  53844. slots
  53845. }) {
  53846. const fragmentRef = ref();
  53847. const setRef2 = composeRefs(fragmentRef, (el) => {
  53848. if (el) {
  53849. props.setRef(el.nextElementSibling);
  53850. } else {
  53851. props.setRef(null);
  53852. }
  53853. });
  53854. return () => {
  53855. var _a2;
  53856. const [firstChild] = ((_a2 = slots.default) == null ? void 0 : _a2.call(slots)) || [];
  53857. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  53858. return createVNode(Fragment, {
  53859. "ref": setRef2
  53860. }, [child]);
  53861. };
  53862. }
  53863. });
  53864. const __default__$c = /* @__PURE__ */ defineComponent({
  53865. name: "ElTooltipV2Trigger"
  53866. });
  53867. const _sfc_main$l = /* @__PURE__ */ defineComponent({
  53868. ...__default__$c,
  53869. props: {
  53870. ...tooltipV2CommonProps,
  53871. ...tooltipV2TriggerProps
  53872. },
  53873. setup(__props) {
  53874. const props = __props;
  53875. const { onClose, onOpen, onDelayOpen, triggerRef: triggerRef2, contentId } = inject(tooltipV2RootKey);
  53876. let isMousedown = false;
  53877. const setTriggerRef = (el) => {
  53878. triggerRef2.value = el;
  53879. };
  53880. const onMouseup = () => {
  53881. isMousedown = false;
  53882. };
  53883. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  53884. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  53885. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  53886. onClose();
  53887. isMousedown = true;
  53888. document.addEventListener("mouseup", onMouseup, { once: true });
  53889. });
  53890. const onFocus = composeEventHandlers(props.onFocus, () => {
  53891. if (!isMousedown)
  53892. onOpen();
  53893. });
  53894. const onBlur = composeEventHandlers(props.onBlur, onClose);
  53895. const onClick = composeEventHandlers(props.onClick, (e) => {
  53896. if (e.detail === 0)
  53897. onClose();
  53898. });
  53899. const events = {
  53900. blur: onBlur,
  53901. click: onClick,
  53902. focus: onFocus,
  53903. mousedown: onMousedown,
  53904. mouseenter: onMouseenter,
  53905. mouseleave: onMouseleave
  53906. };
  53907. const setEvents = (el, events2, type2) => {
  53908. if (el) {
  53909. Object.entries(events2).forEach(([name, handler]) => {
  53910. el[type2](name, handler);
  53911. });
  53912. }
  53913. };
  53914. watch(triggerRef2, (triggerEl, previousTriggerEl) => {
  53915. setEvents(triggerEl, events, "addEventListener");
  53916. setEvents(previousTriggerEl, events, "removeEventListener");
  53917. if (triggerEl) {
  53918. triggerEl.setAttribute("aria-describedby", contentId.value);
  53919. }
  53920. });
  53921. onBeforeUnmount(() => {
  53922. setEvents(triggerRef2.value, events, "removeEventListener");
  53923. document.removeEventListener("mouseup", onMouseup);
  53924. });
  53925. return (_ctx, _cache) => {
  53926. return _ctx.nowrap ? (openBlock(), createBlock(unref(ForwardRef), {
  53927. key: 0,
  53928. "set-ref": setTriggerRef,
  53929. "only-child": ""
  53930. }, {
  53931. default: withCtx(() => [
  53932. renderSlot(_ctx.$slots, "default")
  53933. ]),
  53934. _: 3
  53935. })) : (openBlock(), createElementBlock("button", mergeProps({
  53936. key: 1,
  53937. ref_key: "triggerRef",
  53938. ref: triggerRef2
  53939. }, _ctx.$attrs), [
  53940. renderSlot(_ctx.$slots, "default")
  53941. ], 16));
  53942. };
  53943. }
  53944. });
  53945. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip-v2/src/trigger.vue"]]);
  53946. const __default__$b = /* @__PURE__ */ defineComponent({
  53947. name: "ElTooltipV2"
  53948. });
  53949. const _sfc_main$k = /* @__PURE__ */ defineComponent({
  53950. ...__default__$b,
  53951. props: tooltipV2Props,
  53952. setup(__props) {
  53953. const props = __props;
  53954. const refedProps = toRefs(props);
  53955. const arrowProps = reactive(pick$1(refedProps, Object.keys(tooltipV2ArrowProps)));
  53956. const contentProps = reactive(pick$1(refedProps, Object.keys(tooltipV2ContentProps)));
  53957. const rootProps = reactive(pick$1(refedProps, Object.keys(tooltipV2RootProps)));
  53958. const triggerProps = reactive(pick$1(refedProps, Object.keys(tooltipV2TriggerProps)));
  53959. return (_ctx, _cache) => {
  53960. return openBlock(), createBlock(TooltipV2Root, normalizeProps(guardReactiveProps(rootProps)), {
  53961. default: withCtx(({ open }) => [
  53962. createVNode(TooltipV2Trigger, mergeProps(triggerProps, { nowrap: "" }), {
  53963. default: withCtx(() => [
  53964. renderSlot(_ctx.$slots, "trigger")
  53965. ]),
  53966. _: 3
  53967. }, 16),
  53968. (openBlock(), createBlock(Teleport, {
  53969. to: _ctx.to,
  53970. disabled: !_ctx.teleported
  53971. }, [
  53972. _ctx.fullTransition ? (openBlock(), createBlock(Transition, normalizeProps(mergeProps({ key: 0 }, _ctx.transitionProps)), {
  53973. default: withCtx(() => [
  53974. _ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
  53975. arrow: withCtx(({ style, side }) => [
  53976. _ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
  53977. style,
  53978. side
  53979. }), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
  53980. ]),
  53981. default: withCtx(() => [
  53982. renderSlot(_ctx.$slots, "default")
  53983. ]),
  53984. _: 3
  53985. }, 16)) : createCommentVNode("v-if", true)
  53986. ]),
  53987. _: 2
  53988. }, 1040)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  53989. _ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
  53990. arrow: withCtx(({ style, side }) => [
  53991. _ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
  53992. style,
  53993. side
  53994. }), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
  53995. ]),
  53996. default: withCtx(() => [
  53997. renderSlot(_ctx.$slots, "default")
  53998. ]),
  53999. _: 3
  54000. }, 16)) : createCommentVNode("v-if", true)
  54001. ], 64))
  54002. ], 8, ["to", "disabled"]))
  54003. ]),
  54004. _: 3
  54005. }, 16);
  54006. };
  54007. }
  54008. });
  54009. var TooltipV2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip-v2/src/tooltip.vue"]]);
  54010. const ElTooltipV2 = withInstall(TooltipV2);
  54011. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  54012. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  54013. const transferProps = buildProps({
  54014. data: {
  54015. type: definePropType(Array),
  54016. default: () => []
  54017. },
  54018. titles: {
  54019. type: definePropType(Array),
  54020. default: () => []
  54021. },
  54022. buttonTexts: {
  54023. type: definePropType(Array),
  54024. default: () => []
  54025. },
  54026. filterPlaceholder: String,
  54027. filterMethod: {
  54028. type: definePropType(Function)
  54029. },
  54030. leftDefaultChecked: {
  54031. type: definePropType(Array),
  54032. default: () => []
  54033. },
  54034. rightDefaultChecked: {
  54035. type: definePropType(Array),
  54036. default: () => []
  54037. },
  54038. renderContent: {
  54039. type: definePropType(Function)
  54040. },
  54041. modelValue: {
  54042. type: definePropType(Array),
  54043. default: () => []
  54044. },
  54045. format: {
  54046. type: definePropType(Object),
  54047. default: () => ({})
  54048. },
  54049. filterable: Boolean,
  54050. props: {
  54051. type: definePropType(Object),
  54052. default: () => mutable({
  54053. label: "label",
  54054. key: "key",
  54055. disabled: "disabled"
  54056. })
  54057. },
  54058. targetOrder: {
  54059. type: String,
  54060. values: ["original", "push", "unshift"],
  54061. default: "original"
  54062. },
  54063. validateEvent: {
  54064. type: Boolean,
  54065. default: true
  54066. }
  54067. });
  54068. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$3) || isArray$3(value) && isNil(movedKeys);
  54069. const transferEmits = {
  54070. [CHANGE_EVENT]: (value, direction2, movedKeys) => [value, movedKeys].every(isArray$3) && ["left", "right"].includes(direction2),
  54071. [UPDATE_MODEL_EVENT]: (value) => isArray$3(value),
  54072. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  54073. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  54074. };
  54075. const CHECKED_CHANGE_EVENT = "checked-change";
  54076. const transferPanelProps = buildProps({
  54077. data: transferProps.data,
  54078. optionRender: {
  54079. type: definePropType(Function)
  54080. },
  54081. placeholder: String,
  54082. title: String,
  54083. filterable: Boolean,
  54084. format: transferProps.format,
  54085. filterMethod: transferProps.filterMethod,
  54086. defaultChecked: transferProps.leftDefaultChecked,
  54087. props: transferProps.props
  54088. });
  54089. const transferPanelEmits = {
  54090. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  54091. };
  54092. const usePropsAlias = (props) => {
  54093. const initProps2 = {
  54094. label: "label",
  54095. key: "key",
  54096. disabled: "disabled"
  54097. };
  54098. return computed(() => ({
  54099. ...initProps2,
  54100. ...props.props
  54101. }));
  54102. };
  54103. const useCheck$1 = (props, panelState, emit2) => {
  54104. const propsAlias = usePropsAlias(props);
  54105. const filteredData = computed(() => {
  54106. return props.data.filter((item) => {
  54107. if (isFunction$2(props.filterMethod)) {
  54108. return props.filterMethod(panelState.query, item);
  54109. } else {
  54110. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  54111. return label.toLowerCase().includes(panelState.query.toLowerCase());
  54112. }
  54113. });
  54114. });
  54115. const checkableData = computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  54116. const checkedSummary = computed(() => {
  54117. const checkedLength = panelState.checked.length;
  54118. const dataLength = props.data.length;
  54119. const { noChecked, hasChecked } = props.format;
  54120. if (noChecked && hasChecked) {
  54121. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  54122. } else {
  54123. return `${checkedLength}/${dataLength}`;
  54124. }
  54125. });
  54126. const isIndeterminate = computed(() => {
  54127. const checkedLength = panelState.checked.length;
  54128. return checkedLength > 0 && checkedLength < checkableData.value.length;
  54129. });
  54130. const updateAllChecked = () => {
  54131. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  54132. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  54133. };
  54134. const handleAllCheckedChange = (value) => {
  54135. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  54136. };
  54137. watch(() => panelState.checked, (val, oldVal) => {
  54138. updateAllChecked();
  54139. if (panelState.checkChangeByUser) {
  54140. const movedKeys = val.concat(oldVal).filter((v2) => !val.includes(v2) || !oldVal.includes(v2));
  54141. emit2(CHECKED_CHANGE_EVENT, val, movedKeys);
  54142. } else {
  54143. emit2(CHECKED_CHANGE_EVENT, val);
  54144. panelState.checkChangeByUser = true;
  54145. }
  54146. });
  54147. watch(checkableData, () => {
  54148. updateAllChecked();
  54149. });
  54150. watch(() => props.data, () => {
  54151. const checked = [];
  54152. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  54153. panelState.checked.forEach((item) => {
  54154. if (filteredDataKeys.includes(item)) {
  54155. checked.push(item);
  54156. }
  54157. });
  54158. panelState.checkChangeByUser = false;
  54159. panelState.checked = checked;
  54160. });
  54161. watch(() => props.defaultChecked, (val, oldVal) => {
  54162. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  54163. return;
  54164. const checked = [];
  54165. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  54166. val.forEach((item) => {
  54167. if (checkableDataKeys.includes(item)) {
  54168. checked.push(item);
  54169. }
  54170. });
  54171. panelState.checkChangeByUser = false;
  54172. panelState.checked = checked;
  54173. }, {
  54174. immediate: true
  54175. });
  54176. return {
  54177. filteredData,
  54178. checkableData,
  54179. checkedSummary,
  54180. isIndeterminate,
  54181. updateAllChecked,
  54182. handleAllCheckedChange
  54183. };
  54184. };
  54185. const useCheckedChange = (checkedState, emit2) => {
  54186. const onSourceCheckedChange = (val, movedKeys) => {
  54187. checkedState.leftChecked = val;
  54188. if (!movedKeys)
  54189. return;
  54190. emit2(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  54191. };
  54192. const onTargetCheckedChange = (val, movedKeys) => {
  54193. checkedState.rightChecked = val;
  54194. if (!movedKeys)
  54195. return;
  54196. emit2(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  54197. };
  54198. return {
  54199. onSourceCheckedChange,
  54200. onTargetCheckedChange
  54201. };
  54202. };
  54203. const useComputedData = (props) => {
  54204. const propsAlias = usePropsAlias(props);
  54205. const dataObj = computed(() => props.data.reduce((o2, cur) => (o2[cur[propsAlias.value.key]] = cur) && o2, {}));
  54206. const sourceData = computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  54207. const targetData = computed(() => {
  54208. if (props.targetOrder === "original") {
  54209. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  54210. } else {
  54211. return props.modelValue.reduce((arr, cur) => {
  54212. const val = dataObj.value[cur];
  54213. if (val) {
  54214. arr.push(val);
  54215. }
  54216. return arr;
  54217. }, []);
  54218. }
  54219. });
  54220. return {
  54221. sourceData,
  54222. targetData
  54223. };
  54224. };
  54225. const useMove = (props, checkedState, emit2) => {
  54226. const propsAlias = usePropsAlias(props);
  54227. const _emit = (value, direction2, movedKeys) => {
  54228. emit2(UPDATE_MODEL_EVENT, value);
  54229. emit2(CHANGE_EVENT, value, direction2, movedKeys);
  54230. };
  54231. const addToLeft = () => {
  54232. const currentValue = props.modelValue.slice();
  54233. checkedState.rightChecked.forEach((item) => {
  54234. const index2 = currentValue.indexOf(item);
  54235. if (index2 > -1) {
  54236. currentValue.splice(index2, 1);
  54237. }
  54238. });
  54239. _emit(currentValue, "left", checkedState.rightChecked);
  54240. };
  54241. const addToRight = () => {
  54242. let currentValue = props.modelValue.slice();
  54243. const itemsToBeMoved = props.data.filter((item) => {
  54244. const itemKey = item[propsAlias.value.key];
  54245. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  54246. }).map((item) => item[propsAlias.value.key]);
  54247. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  54248. if (props.targetOrder === "original") {
  54249. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  54250. }
  54251. _emit(currentValue, "right", checkedState.leftChecked);
  54252. };
  54253. return {
  54254. addToLeft,
  54255. addToRight
  54256. };
  54257. };
  54258. const __default__$a = /* @__PURE__ */ defineComponent({
  54259. name: "ElTransferPanel"
  54260. });
  54261. const _sfc_main$j = /* @__PURE__ */ defineComponent({
  54262. ...__default__$a,
  54263. props: transferPanelProps,
  54264. emits: transferPanelEmits,
  54265. setup(__props, { expose, emit: emit2 }) {
  54266. const props = __props;
  54267. const slots = useSlots();
  54268. const OptionContent = ({ option }) => option;
  54269. const { t } = useLocale();
  54270. const ns = useNamespace("transfer");
  54271. const panelState = reactive({
  54272. checked: [],
  54273. allChecked: false,
  54274. query: "",
  54275. checkChangeByUser: true
  54276. });
  54277. const propsAlias = usePropsAlias(props);
  54278. const {
  54279. filteredData,
  54280. checkedSummary,
  54281. isIndeterminate,
  54282. handleAllCheckedChange
  54283. } = useCheck$1(props, panelState, emit2);
  54284. const hasNoMatch = computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  54285. const hasFooter = computed(() => !isEmpty(slots.default()[0].children));
  54286. const { checked, allChecked, query } = toRefs(panelState);
  54287. expose({
  54288. query
  54289. });
  54290. return (_ctx, _cache) => {
  54291. return openBlock(), createElementBlock("div", {
  54292. class: normalizeClass(unref(ns).b("panel"))
  54293. }, [
  54294. createBaseVNode("p", {
  54295. class: normalizeClass(unref(ns).be("panel", "header"))
  54296. }, [
  54297. createVNode(unref(ElCheckbox), {
  54298. modelValue: unref(allChecked),
  54299. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(allChecked) ? allChecked.value = $event : null),
  54300. indeterminate: unref(isIndeterminate),
  54301. "validate-event": false,
  54302. onChange: unref(handleAllCheckedChange)
  54303. }, {
  54304. default: withCtx(() => [
  54305. createTextVNode(toDisplayString(_ctx.title) + " ", 1),
  54306. createBaseVNode("span", null, toDisplayString(unref(checkedSummary)), 1)
  54307. ]),
  54308. _: 1
  54309. }, 8, ["modelValue", "indeterminate", "onChange"])
  54310. ], 2),
  54311. createBaseVNode("div", {
  54312. class: normalizeClass([unref(ns).be("panel", "body"), unref(ns).is("with-footer", unref(hasFooter))])
  54313. }, [
  54314. _ctx.filterable ? (openBlock(), createBlock(unref(ElInput), {
  54315. key: 0,
  54316. modelValue: unref(query),
  54317. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(query) ? query.value = $event : null),
  54318. class: normalizeClass(unref(ns).be("panel", "filter")),
  54319. size: "default",
  54320. placeholder: _ctx.placeholder,
  54321. "prefix-icon": unref(search_default),
  54322. clearable: "",
  54323. "validate-event": false
  54324. }, null, 8, ["modelValue", "class", "placeholder", "prefix-icon"])) : createCommentVNode("v-if", true),
  54325. withDirectives(createVNode(unref(ElCheckboxGroup$1), {
  54326. modelValue: unref(checked),
  54327. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(checked) ? checked.value = $event : null),
  54328. "validate-event": false,
  54329. class: normalizeClass([unref(ns).is("filterable", _ctx.filterable), unref(ns).be("panel", "list")])
  54330. }, {
  54331. default: withCtx(() => [
  54332. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredData), (item) => {
  54333. return openBlock(), createBlock(unref(ElCheckbox), {
  54334. key: item[unref(propsAlias).key],
  54335. class: normalizeClass(unref(ns).be("panel", "item")),
  54336. label: item[unref(propsAlias).key],
  54337. disabled: item[unref(propsAlias).disabled],
  54338. "validate-event": false
  54339. }, {
  54340. default: withCtx(() => {
  54341. var _a2;
  54342. return [
  54343. createVNode(OptionContent, {
  54344. option: (_a2 = _ctx.optionRender) == null ? void 0 : _a2.call(_ctx, item)
  54345. }, null, 8, ["option"])
  54346. ];
  54347. }),
  54348. _: 2
  54349. }, 1032, ["class", "label", "disabled"]);
  54350. }), 128))
  54351. ]),
  54352. _: 1
  54353. }, 8, ["modelValue", "class"]), [
  54354. [vShow, !unref(hasNoMatch) && !unref(isEmpty)(_ctx.data)]
  54355. ]),
  54356. withDirectives(createBaseVNode("p", {
  54357. class: normalizeClass(unref(ns).be("panel", "empty"))
  54358. }, toDisplayString(unref(hasNoMatch) ? unref(t)("el.transfer.noMatch") : unref(t)("el.transfer.noData")), 3), [
  54359. [vShow, unref(hasNoMatch) || unref(isEmpty)(_ctx.data)]
  54360. ])
  54361. ], 2),
  54362. unref(hasFooter) ? (openBlock(), createElementBlock("p", {
  54363. key: 0,
  54364. class: normalizeClass(unref(ns).be("panel", "footer"))
  54365. }, [
  54366. renderSlot(_ctx.$slots, "default")
  54367. ], 2)) : createCommentVNode("v-if", true)
  54368. ], 2);
  54369. };
  54370. }
  54371. });
  54372. var TransferPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/transfer/src/transfer-panel.vue"]]);
  54373. const _hoisted_1$a = { key: 0 };
  54374. const _hoisted_2$7 = { key: 0 };
  54375. const __default__$9 = /* @__PURE__ */ defineComponent({
  54376. name: "ElTransfer"
  54377. });
  54378. const _sfc_main$i = /* @__PURE__ */ defineComponent({
  54379. ...__default__$9,
  54380. props: transferProps,
  54381. emits: transferEmits,
  54382. setup(__props, { expose, emit: emit2 }) {
  54383. const props = __props;
  54384. const slots = useSlots();
  54385. const { t } = useLocale();
  54386. const ns = useNamespace("transfer");
  54387. const { formItem } = useFormItem();
  54388. const checkedState = reactive({
  54389. leftChecked: [],
  54390. rightChecked: []
  54391. });
  54392. const propsAlias = usePropsAlias(props);
  54393. const { sourceData, targetData } = useComputedData(props);
  54394. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit2);
  54395. const { addToLeft, addToRight } = useMove(props, checkedState, emit2);
  54396. const leftPanel = ref();
  54397. const rightPanel = ref();
  54398. const clearQuery = (which) => {
  54399. switch (which) {
  54400. case "left":
  54401. leftPanel.value.query = "";
  54402. break;
  54403. case "right":
  54404. rightPanel.value.query = "";
  54405. break;
  54406. }
  54407. };
  54408. const hasButtonTexts = computed(() => props.buttonTexts.length === 2);
  54409. const leftPanelTitle = computed(() => props.titles[0] || t("el.transfer.titles.0"));
  54410. const rightPanelTitle = computed(() => props.titles[1] || t("el.transfer.titles.1"));
  54411. const panelFilterPlaceholder = computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  54412. watch(() => props.modelValue, () => {
  54413. var _a2;
  54414. if (props.validateEvent) {
  54415. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  54416. }
  54417. });
  54418. const optionRender = computed(() => (option) => {
  54419. if (props.renderContent)
  54420. return props.renderContent(h$1, option);
  54421. if (slots.default)
  54422. return slots.default({ option });
  54423. return h$1("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  54424. });
  54425. expose({
  54426. clearQuery,
  54427. leftPanel,
  54428. rightPanel
  54429. });
  54430. return (_ctx, _cache) => {
  54431. return openBlock(), createElementBlock("div", {
  54432. class: normalizeClass(unref(ns).b())
  54433. }, [
  54434. createVNode(TransferPanel, {
  54435. ref_key: "leftPanel",
  54436. ref: leftPanel,
  54437. data: unref(sourceData),
  54438. "option-render": unref(optionRender),
  54439. placeholder: unref(panelFilterPlaceholder),
  54440. title: unref(leftPanelTitle),
  54441. filterable: _ctx.filterable,
  54442. format: _ctx.format,
  54443. "filter-method": _ctx.filterMethod,
  54444. "default-checked": _ctx.leftDefaultChecked,
  54445. props: props.props,
  54446. onCheckedChange: unref(onSourceCheckedChange)
  54447. }, {
  54448. default: withCtx(() => [
  54449. renderSlot(_ctx.$slots, "left-footer")
  54450. ]),
  54451. _: 3
  54452. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  54453. createBaseVNode("div", {
  54454. class: normalizeClass(unref(ns).e("buttons"))
  54455. }, [
  54456. createVNode(unref(ElButton), {
  54457. type: "primary",
  54458. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  54459. disabled: unref(isEmpty)(checkedState.rightChecked),
  54460. onClick: unref(addToLeft)
  54461. }, {
  54462. default: withCtx(() => [
  54463. createVNode(unref(ElIcon), null, {
  54464. default: withCtx(() => [
  54465. createVNode(unref(arrow_left_default))
  54466. ]),
  54467. _: 1
  54468. }),
  54469. !unref(isUndefined)(_ctx.buttonTexts[0]) ? (openBlock(), createElementBlock("span", _hoisted_1$a, toDisplayString(_ctx.buttonTexts[0]), 1)) : createCommentVNode("v-if", true)
  54470. ]),
  54471. _: 1
  54472. }, 8, ["class", "disabled", "onClick"]),
  54473. createVNode(unref(ElButton), {
  54474. type: "primary",
  54475. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  54476. disabled: unref(isEmpty)(checkedState.leftChecked),
  54477. onClick: unref(addToRight)
  54478. }, {
  54479. default: withCtx(() => [
  54480. !unref(isUndefined)(_ctx.buttonTexts[1]) ? (openBlock(), createElementBlock("span", _hoisted_2$7, toDisplayString(_ctx.buttonTexts[1]), 1)) : createCommentVNode("v-if", true),
  54481. createVNode(unref(ElIcon), null, {
  54482. default: withCtx(() => [
  54483. createVNode(unref(arrow_right_default))
  54484. ]),
  54485. _: 1
  54486. })
  54487. ]),
  54488. _: 1
  54489. }, 8, ["class", "disabled", "onClick"])
  54490. ], 2),
  54491. createVNode(TransferPanel, {
  54492. ref_key: "rightPanel",
  54493. ref: rightPanel,
  54494. data: unref(targetData),
  54495. "option-render": unref(optionRender),
  54496. placeholder: unref(panelFilterPlaceholder),
  54497. filterable: _ctx.filterable,
  54498. format: _ctx.format,
  54499. "filter-method": _ctx.filterMethod,
  54500. title: unref(rightPanelTitle),
  54501. "default-checked": _ctx.rightDefaultChecked,
  54502. props: props.props,
  54503. onCheckedChange: unref(onTargetCheckedChange)
  54504. }, {
  54505. default: withCtx(() => [
  54506. renderSlot(_ctx.$slots, "right-footer")
  54507. ]),
  54508. _: 3
  54509. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  54510. ], 2);
  54511. };
  54512. }
  54513. });
  54514. var Transfer = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/transfer/src/transfer.vue"]]);
  54515. const ElTransfer = withInstall(Transfer);
  54516. const NODE_KEY = "$treeNodeId";
  54517. const markNodeData = function(node, data) {
  54518. if (!data || data[NODE_KEY])
  54519. return;
  54520. Object.defineProperty(data, NODE_KEY, {
  54521. value: node.id,
  54522. enumerable: false,
  54523. configurable: false,
  54524. writable: false
  54525. });
  54526. };
  54527. const getNodeKey = function(key, data) {
  54528. if (!key)
  54529. return data[NODE_KEY];
  54530. return data[key];
  54531. };
  54532. const handleCurrentChange = (store, emit2, setCurrent) => {
  54533. const preCurrentNode = store.value.currentNode;
  54534. setCurrent();
  54535. const currentNode = store.value.currentNode;
  54536. if (preCurrentNode === currentNode)
  54537. return;
  54538. emit2("current-change", currentNode ? currentNode.data : null, currentNode);
  54539. };
  54540. const getChildState = (node) => {
  54541. let all = true;
  54542. let none = true;
  54543. let allWithoutDisable = true;
  54544. for (let i = 0, j = node.length; i < j; i++) {
  54545. const n = node[i];
  54546. if (n.checked !== true || n.indeterminate) {
  54547. all = false;
  54548. if (!n.disabled) {
  54549. allWithoutDisable = false;
  54550. }
  54551. }
  54552. if (n.checked !== false || n.indeterminate) {
  54553. none = false;
  54554. }
  54555. }
  54556. return { all, none, allWithoutDisable, half: !all && !none };
  54557. };
  54558. const reInitChecked = function(node) {
  54559. if (node.childNodes.length === 0 || node.loading)
  54560. return;
  54561. const { all, none, half } = getChildState(node.childNodes);
  54562. if (all) {
  54563. node.checked = true;
  54564. node.indeterminate = false;
  54565. } else if (half) {
  54566. node.checked = false;
  54567. node.indeterminate = true;
  54568. } else if (none) {
  54569. node.checked = false;
  54570. node.indeterminate = false;
  54571. }
  54572. const parent = node.parent;
  54573. if (!parent || parent.level === 0)
  54574. return;
  54575. if (!node.store.checkStrictly) {
  54576. reInitChecked(parent);
  54577. }
  54578. };
  54579. const getPropertyFromData = function(node, prop) {
  54580. const props = node.store.props;
  54581. const data = node.data || {};
  54582. const config = props[prop];
  54583. if (typeof config === "function") {
  54584. return config(data, node);
  54585. } else if (typeof config === "string") {
  54586. return data[config];
  54587. } else if (typeof config === "undefined") {
  54588. const dataProp = data[prop];
  54589. return dataProp === void 0 ? "" : dataProp;
  54590. }
  54591. };
  54592. let nodeIdSeed = 0;
  54593. let Node$1 = class Node2 {
  54594. constructor(options) {
  54595. this.id = nodeIdSeed++;
  54596. this.text = null;
  54597. this.checked = false;
  54598. this.indeterminate = false;
  54599. this.data = null;
  54600. this.expanded = false;
  54601. this.parent = null;
  54602. this.visible = true;
  54603. this.isCurrent = false;
  54604. this.canFocus = false;
  54605. for (const name in options) {
  54606. if (hasOwn(options, name)) {
  54607. this[name] = options[name];
  54608. }
  54609. }
  54610. this.level = 0;
  54611. this.loaded = false;
  54612. this.childNodes = [];
  54613. this.loading = false;
  54614. if (this.parent) {
  54615. this.level = this.parent.level + 1;
  54616. }
  54617. }
  54618. initialize() {
  54619. const store = this.store;
  54620. if (!store) {
  54621. throw new Error("[Node]store is required!");
  54622. }
  54623. store.registerNode(this);
  54624. const props = store.props;
  54625. if (props && typeof props.isLeaf !== "undefined") {
  54626. const isLeaf2 = getPropertyFromData(this, "isLeaf");
  54627. if (typeof isLeaf2 === "boolean") {
  54628. this.isLeafByUser = isLeaf2;
  54629. }
  54630. }
  54631. if (store.lazy !== true && this.data) {
  54632. this.setData(this.data);
  54633. if (store.defaultExpandAll) {
  54634. this.expanded = true;
  54635. this.canFocus = true;
  54636. }
  54637. } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
  54638. this.expand();
  54639. }
  54640. if (!Array.isArray(this.data)) {
  54641. markNodeData(this, this.data);
  54642. }
  54643. if (!this.data)
  54644. return;
  54645. const defaultExpandedKeys = store.defaultExpandedKeys;
  54646. const key = store.key;
  54647. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  54648. this.expand(null, store.autoExpandParent);
  54649. }
  54650. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  54651. store.currentNode = this;
  54652. store.currentNode.isCurrent = true;
  54653. }
  54654. if (store.lazy) {
  54655. store._initDefaultCheckedNode(this);
  54656. }
  54657. this.updateLeafState();
  54658. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  54659. this.canFocus = true;
  54660. }
  54661. setData(data) {
  54662. if (!Array.isArray(data)) {
  54663. markNodeData(this, data);
  54664. }
  54665. this.data = data;
  54666. this.childNodes = [];
  54667. let children;
  54668. if (this.level === 0 && Array.isArray(this.data)) {
  54669. children = this.data;
  54670. } else {
  54671. children = getPropertyFromData(this, "children") || [];
  54672. }
  54673. for (let i = 0, j = children.length; i < j; i++) {
  54674. this.insertChild({ data: children[i] });
  54675. }
  54676. }
  54677. get label() {
  54678. return getPropertyFromData(this, "label");
  54679. }
  54680. get key() {
  54681. const nodeKey = this.store.key;
  54682. if (this.data)
  54683. return this.data[nodeKey];
  54684. return null;
  54685. }
  54686. get disabled() {
  54687. return getPropertyFromData(this, "disabled");
  54688. }
  54689. get nextSibling() {
  54690. const parent = this.parent;
  54691. if (parent) {
  54692. const index2 = parent.childNodes.indexOf(this);
  54693. if (index2 > -1) {
  54694. return parent.childNodes[index2 + 1];
  54695. }
  54696. }
  54697. return null;
  54698. }
  54699. get previousSibling() {
  54700. const parent = this.parent;
  54701. if (parent) {
  54702. const index2 = parent.childNodes.indexOf(this);
  54703. if (index2 > -1) {
  54704. return index2 > 0 ? parent.childNodes[index2 - 1] : null;
  54705. }
  54706. }
  54707. return null;
  54708. }
  54709. contains(target, deep = true) {
  54710. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  54711. }
  54712. remove() {
  54713. const parent = this.parent;
  54714. if (parent) {
  54715. parent.removeChild(this);
  54716. }
  54717. }
  54718. insertChild(child, index2, batch) {
  54719. if (!child)
  54720. throw new Error("InsertChild error: child is required.");
  54721. if (!(child instanceof Node2)) {
  54722. if (!batch) {
  54723. const children = this.getChildren(true);
  54724. if (!children.includes(child.data)) {
  54725. if (typeof index2 === "undefined" || index2 < 0) {
  54726. children.push(child.data);
  54727. } else {
  54728. children.splice(index2, 0, child.data);
  54729. }
  54730. }
  54731. }
  54732. Object.assign(child, {
  54733. parent: this,
  54734. store: this.store
  54735. });
  54736. child = reactive(new Node2(child));
  54737. if (child instanceof Node2) {
  54738. child.initialize();
  54739. }
  54740. }
  54741. child.level = this.level + 1;
  54742. if (typeof index2 === "undefined" || index2 < 0) {
  54743. this.childNodes.push(child);
  54744. } else {
  54745. this.childNodes.splice(index2, 0, child);
  54746. }
  54747. this.updateLeafState();
  54748. }
  54749. insertBefore(child, ref2) {
  54750. let index2;
  54751. if (ref2) {
  54752. index2 = this.childNodes.indexOf(ref2);
  54753. }
  54754. this.insertChild(child, index2);
  54755. }
  54756. insertAfter(child, ref2) {
  54757. let index2;
  54758. if (ref2) {
  54759. index2 = this.childNodes.indexOf(ref2);
  54760. if (index2 !== -1)
  54761. index2 += 1;
  54762. }
  54763. this.insertChild(child, index2);
  54764. }
  54765. removeChild(child) {
  54766. const children = this.getChildren() || [];
  54767. const dataIndex = children.indexOf(child.data);
  54768. if (dataIndex > -1) {
  54769. children.splice(dataIndex, 1);
  54770. }
  54771. const index2 = this.childNodes.indexOf(child);
  54772. if (index2 > -1) {
  54773. this.store && this.store.deregisterNode(child);
  54774. child.parent = null;
  54775. this.childNodes.splice(index2, 1);
  54776. }
  54777. this.updateLeafState();
  54778. }
  54779. removeChildByData(data) {
  54780. let targetNode = null;
  54781. for (let i = 0; i < this.childNodes.length; i++) {
  54782. if (this.childNodes[i].data === data) {
  54783. targetNode = this.childNodes[i];
  54784. break;
  54785. }
  54786. }
  54787. if (targetNode) {
  54788. this.removeChild(targetNode);
  54789. }
  54790. }
  54791. expand(callback, expandParent) {
  54792. const done = () => {
  54793. if (expandParent) {
  54794. let parent = this.parent;
  54795. while (parent.level > 0) {
  54796. parent.expanded = true;
  54797. parent = parent.parent;
  54798. }
  54799. }
  54800. this.expanded = true;
  54801. if (callback)
  54802. callback();
  54803. this.childNodes.forEach((item) => {
  54804. item.canFocus = true;
  54805. });
  54806. };
  54807. if (this.shouldLoadData()) {
  54808. this.loadData((data) => {
  54809. if (Array.isArray(data)) {
  54810. if (this.checked) {
  54811. this.setChecked(true, true);
  54812. } else if (!this.store.checkStrictly) {
  54813. reInitChecked(this);
  54814. }
  54815. done();
  54816. }
  54817. });
  54818. } else {
  54819. done();
  54820. }
  54821. }
  54822. doCreateChildren(array2, defaultProps2 = {}) {
  54823. array2.forEach((item) => {
  54824. this.insertChild(Object.assign({ data: item }, defaultProps2), void 0, true);
  54825. });
  54826. }
  54827. collapse() {
  54828. this.expanded = false;
  54829. this.childNodes.forEach((item) => {
  54830. item.canFocus = false;
  54831. });
  54832. }
  54833. shouldLoadData() {
  54834. return this.store.lazy === true && this.store.load && !this.loaded;
  54835. }
  54836. updateLeafState() {
  54837. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  54838. this.isLeaf = this.isLeafByUser;
  54839. return;
  54840. }
  54841. const childNodes = this.childNodes;
  54842. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  54843. this.isLeaf = !childNodes || childNodes.length === 0;
  54844. return;
  54845. }
  54846. this.isLeaf = false;
  54847. }
  54848. setChecked(value, deep, recursion, passValue) {
  54849. this.indeterminate = value === "half";
  54850. this.checked = value === true;
  54851. if (this.store.checkStrictly)
  54852. return;
  54853. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  54854. const { all, allWithoutDisable } = getChildState(this.childNodes);
  54855. if (!this.isLeaf && !all && allWithoutDisable) {
  54856. this.checked = false;
  54857. value = false;
  54858. }
  54859. const handleDescendants = () => {
  54860. if (deep) {
  54861. const childNodes = this.childNodes;
  54862. for (let i = 0, j = childNodes.length; i < j; i++) {
  54863. const child = childNodes[i];
  54864. passValue = passValue || value !== false;
  54865. const isCheck = child.disabled ? child.checked : passValue;
  54866. child.setChecked(isCheck, deep, true, passValue);
  54867. }
  54868. const { half, all: all2 } = getChildState(childNodes);
  54869. if (!all2) {
  54870. this.checked = all2;
  54871. this.indeterminate = half;
  54872. }
  54873. }
  54874. };
  54875. if (this.shouldLoadData()) {
  54876. this.loadData(() => {
  54877. handleDescendants();
  54878. reInitChecked(this);
  54879. }, {
  54880. checked: value !== false
  54881. });
  54882. return;
  54883. } else {
  54884. handleDescendants();
  54885. }
  54886. }
  54887. const parent = this.parent;
  54888. if (!parent || parent.level === 0)
  54889. return;
  54890. if (!recursion) {
  54891. reInitChecked(parent);
  54892. }
  54893. }
  54894. getChildren(forceInit = false) {
  54895. if (this.level === 0)
  54896. return this.data;
  54897. const data = this.data;
  54898. if (!data)
  54899. return null;
  54900. const props = this.store.props;
  54901. let children = "children";
  54902. if (props) {
  54903. children = props.children || "children";
  54904. }
  54905. if (data[children] === void 0) {
  54906. data[children] = null;
  54907. }
  54908. if (forceInit && !data[children]) {
  54909. data[children] = [];
  54910. }
  54911. return data[children];
  54912. }
  54913. updateChildren() {
  54914. const newData = this.getChildren() || [];
  54915. const oldData = this.childNodes.map((node) => node.data);
  54916. const newDataMap = {};
  54917. const newNodes = [];
  54918. newData.forEach((item, index2) => {
  54919. const key = item[NODE_KEY];
  54920. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  54921. if (isNodeExists) {
  54922. newDataMap[key] = { index: index2, data: item };
  54923. } else {
  54924. newNodes.push({ index: index2, data: item });
  54925. }
  54926. });
  54927. if (!this.store.lazy) {
  54928. oldData.forEach((item) => {
  54929. if (!newDataMap[item[NODE_KEY]])
  54930. this.removeChildByData(item);
  54931. });
  54932. }
  54933. newNodes.forEach(({ index: index2, data }) => {
  54934. this.insertChild({ data }, index2);
  54935. });
  54936. this.updateLeafState();
  54937. }
  54938. loadData(callback, defaultProps2 = {}) {
  54939. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps2).length)) {
  54940. this.loading = true;
  54941. const resolve2 = (children) => {
  54942. this.childNodes = [];
  54943. this.doCreateChildren(children, defaultProps2);
  54944. this.loaded = true;
  54945. this.loading = false;
  54946. this.updateLeafState();
  54947. if (callback) {
  54948. callback.call(this, children);
  54949. }
  54950. };
  54951. this.store.load(this, resolve2);
  54952. } else {
  54953. if (callback) {
  54954. callback.call(this);
  54955. }
  54956. }
  54957. }
  54958. };
  54959. class TreeStore {
  54960. constructor(options) {
  54961. this.currentNode = null;
  54962. this.currentNodeKey = null;
  54963. for (const option in options) {
  54964. if (hasOwn(options, option)) {
  54965. this[option] = options[option];
  54966. }
  54967. }
  54968. this.nodesMap = {};
  54969. }
  54970. initialize() {
  54971. this.root = new Node$1({
  54972. data: this.data,
  54973. store: this
  54974. });
  54975. this.root.initialize();
  54976. if (this.lazy && this.load) {
  54977. const loadFn = this.load;
  54978. loadFn(this.root, (data) => {
  54979. this.root.doCreateChildren(data);
  54980. this._initDefaultCheckedNodes();
  54981. });
  54982. } else {
  54983. this._initDefaultCheckedNodes();
  54984. }
  54985. }
  54986. filter(value) {
  54987. const filterNodeMethod = this.filterNodeMethod;
  54988. const lazy = this.lazy;
  54989. const traverse2 = function(node) {
  54990. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  54991. childNodes.forEach((child) => {
  54992. child.visible = filterNodeMethod.call(child, value, child.data, child);
  54993. traverse2(child);
  54994. });
  54995. if (!node.visible && childNodes.length) {
  54996. let allHidden = true;
  54997. allHidden = !childNodes.some((child) => child.visible);
  54998. if (node.root) {
  54999. node.root.visible = allHidden === false;
  55000. } else {
  55001. node.visible = allHidden === false;
  55002. }
  55003. }
  55004. if (!value)
  55005. return;
  55006. if (node.visible && !node.isLeaf && !lazy)
  55007. node.expand();
  55008. };
  55009. traverse2(this);
  55010. }
  55011. setData(newVal) {
  55012. const instanceChanged = newVal !== this.root.data;
  55013. if (instanceChanged) {
  55014. this.root.setData(newVal);
  55015. this._initDefaultCheckedNodes();
  55016. } else {
  55017. this.root.updateChildren();
  55018. }
  55019. }
  55020. getNode(data) {
  55021. if (data instanceof Node$1)
  55022. return data;
  55023. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  55024. return this.nodesMap[key] || null;
  55025. }
  55026. insertBefore(data, refData) {
  55027. const refNode = this.getNode(refData);
  55028. refNode.parent.insertBefore({ data }, refNode);
  55029. }
  55030. insertAfter(data, refData) {
  55031. const refNode = this.getNode(refData);
  55032. refNode.parent.insertAfter({ data }, refNode);
  55033. }
  55034. remove(data) {
  55035. const node = this.getNode(data);
  55036. if (node && node.parent) {
  55037. if (node === this.currentNode) {
  55038. this.currentNode = null;
  55039. }
  55040. node.parent.removeChild(node);
  55041. }
  55042. }
  55043. append(data, parentData) {
  55044. const parentNode = parentData ? this.getNode(parentData) : this.root;
  55045. if (parentNode) {
  55046. parentNode.insertChild({ data });
  55047. }
  55048. }
  55049. _initDefaultCheckedNodes() {
  55050. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  55051. const nodesMap = this.nodesMap;
  55052. defaultCheckedKeys.forEach((checkedKey) => {
  55053. const node = nodesMap[checkedKey];
  55054. if (node) {
  55055. node.setChecked(true, !this.checkStrictly);
  55056. }
  55057. });
  55058. }
  55059. _initDefaultCheckedNode(node) {
  55060. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  55061. if (defaultCheckedKeys.includes(node.key)) {
  55062. node.setChecked(true, !this.checkStrictly);
  55063. }
  55064. }
  55065. setDefaultCheckedKey(newVal) {
  55066. if (newVal !== this.defaultCheckedKeys) {
  55067. this.defaultCheckedKeys = newVal;
  55068. this._initDefaultCheckedNodes();
  55069. }
  55070. }
  55071. registerNode(node) {
  55072. const key = this.key;
  55073. if (!node || !node.data)
  55074. return;
  55075. if (!key) {
  55076. this.nodesMap[node.id] = node;
  55077. } else {
  55078. const nodeKey = node.key;
  55079. if (nodeKey !== void 0)
  55080. this.nodesMap[node.key] = node;
  55081. }
  55082. }
  55083. deregisterNode(node) {
  55084. const key = this.key;
  55085. if (!key || !node || !node.data)
  55086. return;
  55087. node.childNodes.forEach((child) => {
  55088. this.deregisterNode(child);
  55089. });
  55090. delete this.nodesMap[node.key];
  55091. }
  55092. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  55093. const checkedNodes = [];
  55094. const traverse2 = function(node) {
  55095. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  55096. childNodes.forEach((child) => {
  55097. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  55098. checkedNodes.push(child.data);
  55099. }
  55100. traverse2(child);
  55101. });
  55102. };
  55103. traverse2(this);
  55104. return checkedNodes;
  55105. }
  55106. getCheckedKeys(leafOnly = false) {
  55107. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  55108. }
  55109. getHalfCheckedNodes() {
  55110. const nodes = [];
  55111. const traverse2 = function(node) {
  55112. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  55113. childNodes.forEach((child) => {
  55114. if (child.indeterminate) {
  55115. nodes.push(child.data);
  55116. }
  55117. traverse2(child);
  55118. });
  55119. };
  55120. traverse2(this);
  55121. return nodes;
  55122. }
  55123. getHalfCheckedKeys() {
  55124. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  55125. }
  55126. _getAllNodes() {
  55127. const allNodes = [];
  55128. const nodesMap = this.nodesMap;
  55129. for (const nodeKey in nodesMap) {
  55130. if (hasOwn(nodesMap, nodeKey)) {
  55131. allNodes.push(nodesMap[nodeKey]);
  55132. }
  55133. }
  55134. return allNodes;
  55135. }
  55136. updateChildren(key, data) {
  55137. const node = this.nodesMap[key];
  55138. if (!node)
  55139. return;
  55140. const childNodes = node.childNodes;
  55141. for (let i = childNodes.length - 1; i >= 0; i--) {
  55142. const child = childNodes[i];
  55143. this.remove(child.data);
  55144. }
  55145. for (let i = 0, j = data.length; i < j; i++) {
  55146. const child = data[i];
  55147. this.append(child, node.data);
  55148. }
  55149. }
  55150. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  55151. const allNodes = this._getAllNodes().sort((a2, b2) => b2.level - a2.level);
  55152. const cache2 = /* @__PURE__ */ Object.create(null);
  55153. const keys2 = Object.keys(checkedKeys);
  55154. allNodes.forEach((node) => node.setChecked(false, false));
  55155. for (let i = 0, j = allNodes.length; i < j; i++) {
  55156. const node = allNodes[i];
  55157. const nodeKey = node.data[key].toString();
  55158. const checked = keys2.includes(nodeKey);
  55159. if (!checked) {
  55160. if (node.checked && !cache2[nodeKey]) {
  55161. node.setChecked(false, false);
  55162. }
  55163. continue;
  55164. }
  55165. let parent = node.parent;
  55166. while (parent && parent.level > 0) {
  55167. cache2[parent.data[key]] = true;
  55168. parent = parent.parent;
  55169. }
  55170. if (node.isLeaf || this.checkStrictly) {
  55171. node.setChecked(true, false);
  55172. continue;
  55173. }
  55174. node.setChecked(true, true);
  55175. if (leafOnly) {
  55176. node.setChecked(false, false);
  55177. const traverse2 = function(node2) {
  55178. const childNodes = node2.childNodes;
  55179. childNodes.forEach((child) => {
  55180. if (!child.isLeaf) {
  55181. child.setChecked(false, false);
  55182. }
  55183. traverse2(child);
  55184. });
  55185. };
  55186. traverse2(node);
  55187. }
  55188. }
  55189. }
  55190. setCheckedNodes(array2, leafOnly = false) {
  55191. const key = this.key;
  55192. const checkedKeys = {};
  55193. array2.forEach((item) => {
  55194. checkedKeys[(item || {})[key]] = true;
  55195. });
  55196. this._setCheckedKeys(key, leafOnly, checkedKeys);
  55197. }
  55198. setCheckedKeys(keys2, leafOnly = false) {
  55199. this.defaultCheckedKeys = keys2;
  55200. const key = this.key;
  55201. const checkedKeys = {};
  55202. keys2.forEach((key2) => {
  55203. checkedKeys[key2] = true;
  55204. });
  55205. this._setCheckedKeys(key, leafOnly, checkedKeys);
  55206. }
  55207. setDefaultExpandedKeys(keys2) {
  55208. keys2 = keys2 || [];
  55209. this.defaultExpandedKeys = keys2;
  55210. keys2.forEach((key) => {
  55211. const node = this.getNode(key);
  55212. if (node)
  55213. node.expand(null, this.autoExpandParent);
  55214. });
  55215. }
  55216. setChecked(data, checked, deep) {
  55217. const node = this.getNode(data);
  55218. if (node) {
  55219. node.setChecked(!!checked, deep);
  55220. }
  55221. }
  55222. getCurrentNode() {
  55223. return this.currentNode;
  55224. }
  55225. setCurrentNode(currentNode) {
  55226. const prevCurrentNode = this.currentNode;
  55227. if (prevCurrentNode) {
  55228. prevCurrentNode.isCurrent = false;
  55229. }
  55230. this.currentNode = currentNode;
  55231. this.currentNode.isCurrent = true;
  55232. }
  55233. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  55234. const key = node[this.key];
  55235. const currNode = this.nodesMap[key];
  55236. this.setCurrentNode(currNode);
  55237. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  55238. this.currentNode.parent.expand(null, true);
  55239. }
  55240. }
  55241. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  55242. if (key === null || key === void 0) {
  55243. this.currentNode && (this.currentNode.isCurrent = false);
  55244. this.currentNode = null;
  55245. return;
  55246. }
  55247. const node = this.getNode(key);
  55248. if (node) {
  55249. this.setCurrentNode(node);
  55250. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  55251. this.currentNode.parent.expand(null, true);
  55252. }
  55253. }
  55254. }
  55255. }
  55256. const _sfc_main$h = /* @__PURE__ */ defineComponent({
  55257. name: "ElTreeNodeContent",
  55258. props: {
  55259. node: {
  55260. type: Object,
  55261. required: true
  55262. },
  55263. renderContent: Function
  55264. },
  55265. setup(props) {
  55266. const ns = useNamespace("tree");
  55267. const nodeInstance = inject("NodeInstance");
  55268. const tree = inject("RootTree");
  55269. return () => {
  55270. const node = props.node;
  55271. const { data, store } = node;
  55272. return props.renderContent ? props.renderContent(h$1, { _self: nodeInstance, node, data, store }) : renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  55273. h$1("span", { class: ns.be("node", "label") }, [node.label])
  55274. ]);
  55275. };
  55276. }
  55277. });
  55278. var NodeContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node-content.vue"]]);
  55279. function useNodeExpandEventBroadcast(props) {
  55280. const parentNodeMap = inject("TreeNodeMap", null);
  55281. const currentNodeMap = {
  55282. treeNodeExpand: (node) => {
  55283. if (props.node !== node) {
  55284. props.node.collapse();
  55285. }
  55286. },
  55287. children: []
  55288. };
  55289. if (parentNodeMap) {
  55290. parentNodeMap.children.push(currentNodeMap);
  55291. }
  55292. provide("TreeNodeMap", currentNodeMap);
  55293. return {
  55294. broadcastExpanded: (node) => {
  55295. if (!props.accordion)
  55296. return;
  55297. for (const childNode of currentNodeMap.children) {
  55298. childNode.treeNodeExpand(node);
  55299. }
  55300. }
  55301. };
  55302. }
  55303. const dragEventsKey = Symbol("dragEvents");
  55304. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  55305. const ns = useNamespace("tree");
  55306. const dragState = ref({
  55307. showDropIndicator: false,
  55308. draggingNode: null,
  55309. dropNode: null,
  55310. allowDrop: true,
  55311. dropType: null
  55312. });
  55313. const treeNodeDragStart = ({ event, treeNode }) => {
  55314. if (typeof props.allowDrag === "function" && !props.allowDrag(treeNode.node)) {
  55315. event.preventDefault();
  55316. return false;
  55317. }
  55318. event.dataTransfer.effectAllowed = "move";
  55319. try {
  55320. event.dataTransfer.setData("text/plain", "");
  55321. } catch (e) {
  55322. }
  55323. dragState.value.draggingNode = treeNode;
  55324. ctx.emit("node-drag-start", treeNode.node, event);
  55325. };
  55326. const treeNodeDragOver = ({ event, treeNode }) => {
  55327. const dropNode = treeNode;
  55328. const oldDropNode = dragState.value.dropNode;
  55329. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  55330. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  55331. }
  55332. const draggingNode = dragState.value.draggingNode;
  55333. if (!draggingNode || !dropNode)
  55334. return;
  55335. let dropPrev = true;
  55336. let dropInner = true;
  55337. let dropNext = true;
  55338. let userAllowDropInner = true;
  55339. if (typeof props.allowDrop === "function") {
  55340. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  55341. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  55342. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  55343. }
  55344. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  55345. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  55346. if (oldDropNode) {
  55347. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  55348. }
  55349. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  55350. }
  55351. if (dropPrev || dropInner || dropNext) {
  55352. dragState.value.dropNode = dropNode;
  55353. }
  55354. if (dropNode.node.nextSibling === draggingNode.node) {
  55355. dropNext = false;
  55356. }
  55357. if (dropNode.node.previousSibling === draggingNode.node) {
  55358. dropPrev = false;
  55359. }
  55360. if (dropNode.node.contains(draggingNode.node, false)) {
  55361. dropInner = false;
  55362. }
  55363. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  55364. dropPrev = false;
  55365. dropInner = false;
  55366. dropNext = false;
  55367. }
  55368. const targetPosition = dropNode.$el.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  55369. const treePosition = el$.value.getBoundingClientRect();
  55370. let dropType;
  55371. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  55372. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  55373. let indicatorTop = -9999;
  55374. const distance = event.clientY - targetPosition.top;
  55375. if (distance < targetPosition.height * prevPercent) {
  55376. dropType = "before";
  55377. } else if (distance > targetPosition.height * nextPercent) {
  55378. dropType = "after";
  55379. } else if (dropInner) {
  55380. dropType = "inner";
  55381. } else {
  55382. dropType = "none";
  55383. }
  55384. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  55385. const dropIndicator = dropIndicator$.value;
  55386. if (dropType === "before") {
  55387. indicatorTop = iconPosition.top - treePosition.top;
  55388. } else if (dropType === "after") {
  55389. indicatorTop = iconPosition.bottom - treePosition.top;
  55390. }
  55391. dropIndicator.style.top = `${indicatorTop}px`;
  55392. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  55393. if (dropType === "inner") {
  55394. addClass(dropNode.$el, ns.is("drop-inner"));
  55395. } else {
  55396. removeClass(dropNode.$el, ns.is("drop-inner"));
  55397. }
  55398. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  55399. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  55400. dragState.value.dropType = dropType;
  55401. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  55402. };
  55403. const treeNodeDragEnd = (event) => {
  55404. const { draggingNode, dropType, dropNode } = dragState.value;
  55405. event.preventDefault();
  55406. event.dataTransfer.dropEffect = "move";
  55407. if (draggingNode && dropNode) {
  55408. const draggingNodeCopy = { data: draggingNode.node.data };
  55409. if (dropType !== "none") {
  55410. draggingNode.node.remove();
  55411. }
  55412. if (dropType === "before") {
  55413. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  55414. } else if (dropType === "after") {
  55415. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  55416. } else if (dropType === "inner") {
  55417. dropNode.node.insertChild(draggingNodeCopy);
  55418. }
  55419. if (dropType !== "none") {
  55420. store.value.registerNode(draggingNodeCopy);
  55421. }
  55422. removeClass(dropNode.$el, ns.is("drop-inner"));
  55423. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  55424. if (dropType !== "none") {
  55425. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  55426. }
  55427. }
  55428. if (draggingNode && !dropNode) {
  55429. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  55430. }
  55431. dragState.value.showDropIndicator = false;
  55432. dragState.value.draggingNode = null;
  55433. dragState.value.dropNode = null;
  55434. dragState.value.allowDrop = true;
  55435. };
  55436. provide(dragEventsKey, {
  55437. treeNodeDragStart,
  55438. treeNodeDragOver,
  55439. treeNodeDragEnd
  55440. });
  55441. return {
  55442. dragState
  55443. };
  55444. }
  55445. const _sfc_main$g = /* @__PURE__ */ defineComponent({
  55446. name: "ElTreeNode",
  55447. components: {
  55448. ElCollapseTransition: _CollapseTransition,
  55449. ElCheckbox,
  55450. NodeContent,
  55451. ElIcon,
  55452. Loading: loading_default
  55453. },
  55454. props: {
  55455. node: {
  55456. type: Node$1,
  55457. default: () => ({})
  55458. },
  55459. props: {
  55460. type: Object,
  55461. default: () => ({})
  55462. },
  55463. accordion: Boolean,
  55464. renderContent: Function,
  55465. renderAfterExpand: Boolean,
  55466. showCheckbox: {
  55467. type: Boolean,
  55468. default: false
  55469. }
  55470. },
  55471. emits: ["node-expand"],
  55472. setup(props, ctx) {
  55473. const ns = useNamespace("tree");
  55474. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  55475. const tree = inject("RootTree");
  55476. const expanded = ref(false);
  55477. const childNodeRendered = ref(false);
  55478. const oldChecked = ref(null);
  55479. const oldIndeterminate = ref(null);
  55480. const node$ = ref(null);
  55481. const dragEvents = inject(dragEventsKey);
  55482. const instance = getCurrentInstance();
  55483. provide("NodeInstance", instance);
  55484. if (props.node.expanded) {
  55485. expanded.value = true;
  55486. childNodeRendered.value = true;
  55487. }
  55488. const childrenKey = tree.props.props["children"] || "children";
  55489. watch(() => {
  55490. const children = props.node.data[childrenKey];
  55491. return children && [...children];
  55492. }, () => {
  55493. props.node.updateChildren();
  55494. });
  55495. watch(() => props.node.indeterminate, (val) => {
  55496. handleSelectChange(props.node.checked, val);
  55497. });
  55498. watch(() => props.node.checked, (val) => {
  55499. handleSelectChange(val, props.node.indeterminate);
  55500. });
  55501. watch(() => props.node.expanded, (val) => {
  55502. nextTick(() => expanded.value = val);
  55503. if (val) {
  55504. childNodeRendered.value = true;
  55505. }
  55506. });
  55507. const getNodeKey$1 = (node) => {
  55508. return getNodeKey(tree.props.nodeKey, node.data);
  55509. };
  55510. const getNodeClass = (node) => {
  55511. const nodeClassFunc = props.props.class;
  55512. if (!nodeClassFunc) {
  55513. return {};
  55514. }
  55515. let className;
  55516. if (isFunction$2(nodeClassFunc)) {
  55517. const { data } = node;
  55518. className = nodeClassFunc(data, node);
  55519. } else {
  55520. className = nodeClassFunc;
  55521. }
  55522. if (isString$1(className)) {
  55523. return { [className]: true };
  55524. } else {
  55525. return className;
  55526. }
  55527. };
  55528. const handleSelectChange = (checked, indeterminate) => {
  55529. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  55530. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  55531. }
  55532. oldChecked.value = checked;
  55533. oldIndeterminate.value = indeterminate;
  55534. };
  55535. const handleClick = (e) => {
  55536. handleCurrentChange(tree.store, tree.ctx.emit, () => tree.store.value.setCurrentNode(props.node));
  55537. tree.currentNode.value = props.node;
  55538. if (tree.props.expandOnClickNode) {
  55539. handleExpandIconClick();
  55540. }
  55541. if (tree.props.checkOnClickNode && !props.node.disabled) {
  55542. handleCheckChange(null, {
  55543. target: { checked: !props.node.checked }
  55544. });
  55545. }
  55546. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  55547. };
  55548. const handleContextMenu = (event) => {
  55549. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  55550. event.stopPropagation();
  55551. event.preventDefault();
  55552. }
  55553. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  55554. };
  55555. const handleExpandIconClick = () => {
  55556. if (props.node.isLeaf)
  55557. return;
  55558. if (expanded.value) {
  55559. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  55560. props.node.collapse();
  55561. } else {
  55562. props.node.expand();
  55563. ctx.emit("node-expand", props.node.data, props.node, instance);
  55564. }
  55565. };
  55566. const handleCheckChange = (value, ev) => {
  55567. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  55568. nextTick(() => {
  55569. const store = tree.store.value;
  55570. tree.ctx.emit("check", props.node.data, {
  55571. checkedNodes: store.getCheckedNodes(),
  55572. checkedKeys: store.getCheckedKeys(),
  55573. halfCheckedNodes: store.getHalfCheckedNodes(),
  55574. halfCheckedKeys: store.getHalfCheckedKeys()
  55575. });
  55576. });
  55577. };
  55578. const handleChildNodeExpand = (nodeData, node, instance2) => {
  55579. broadcastExpanded(node);
  55580. tree.ctx.emit("node-expand", nodeData, node, instance2);
  55581. };
  55582. const handleDragStart = (event) => {
  55583. if (!tree.props.draggable)
  55584. return;
  55585. dragEvents.treeNodeDragStart({ event, treeNode: props });
  55586. };
  55587. const handleDragOver = (event) => {
  55588. event.preventDefault();
  55589. if (!tree.props.draggable)
  55590. return;
  55591. dragEvents.treeNodeDragOver({
  55592. event,
  55593. treeNode: { $el: node$.value, node: props.node }
  55594. });
  55595. };
  55596. const handleDrop = (event) => {
  55597. event.preventDefault();
  55598. };
  55599. const handleDragEnd = (event) => {
  55600. if (!tree.props.draggable)
  55601. return;
  55602. dragEvents.treeNodeDragEnd(event);
  55603. };
  55604. return {
  55605. ns,
  55606. node$,
  55607. tree,
  55608. expanded,
  55609. childNodeRendered,
  55610. oldChecked,
  55611. oldIndeterminate,
  55612. getNodeKey: getNodeKey$1,
  55613. getNodeClass,
  55614. handleSelectChange,
  55615. handleClick,
  55616. handleContextMenu,
  55617. handleExpandIconClick,
  55618. handleCheckChange,
  55619. handleChildNodeExpand,
  55620. handleDragStart,
  55621. handleDragOver,
  55622. handleDrop,
  55623. handleDragEnd,
  55624. CaretRight: caret_right_default
  55625. };
  55626. }
  55627. });
  55628. const _hoisted_1$9 = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"];
  55629. const _hoisted_2$6 = ["aria-expanded"];
  55630. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  55631. const _component_el_icon = resolveComponent("el-icon");
  55632. const _component_el_checkbox = resolveComponent("el-checkbox");
  55633. const _component_loading = resolveComponent("loading");
  55634. const _component_node_content = resolveComponent("node-content");
  55635. const _component_el_tree_node = resolveComponent("el-tree-node");
  55636. const _component_el_collapse_transition = resolveComponent("el-collapse-transition");
  55637. return withDirectives((openBlock(), createElementBlock("div", {
  55638. ref: "node$",
  55639. class: normalizeClass([
  55640. _ctx.ns.b("node"),
  55641. _ctx.ns.is("expanded", _ctx.expanded),
  55642. _ctx.ns.is("current", _ctx.node.isCurrent),
  55643. _ctx.ns.is("hidden", !_ctx.node.visible),
  55644. _ctx.ns.is("focusable", !_ctx.node.disabled),
  55645. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  55646. _ctx.getNodeClass(_ctx.node)
  55647. ]),
  55648. role: "treeitem",
  55649. tabindex: "-1",
  55650. "aria-expanded": _ctx.expanded,
  55651. "aria-disabled": _ctx.node.disabled,
  55652. "aria-checked": _ctx.node.checked,
  55653. draggable: _ctx.tree.props.draggable,
  55654. "data-key": _ctx.getNodeKey(_ctx.node),
  55655. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
  55656. onContextmenu: _cache[2] || (_cache[2] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
  55657. onDragstart: _cache[3] || (_cache[3] = withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
  55658. onDragover: _cache[4] || (_cache[4] = withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
  55659. onDragend: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
  55660. onDrop: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
  55661. }, [
  55662. createBaseVNode("div", {
  55663. class: normalizeClass(_ctx.ns.be("node", "content")),
  55664. style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  55665. }, [
  55666. _ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
  55667. key: 0,
  55668. class: normalizeClass([
  55669. _ctx.ns.be("node", "expand-icon"),
  55670. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  55671. {
  55672. expanded: !_ctx.node.isLeaf && _ctx.expanded
  55673. }
  55674. ]),
  55675. onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
  55676. }, {
  55677. default: withCtx(() => [
  55678. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  55679. ]),
  55680. _: 1
  55681. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  55682. _ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
  55683. key: 1,
  55684. "model-value": _ctx.node.checked,
  55685. indeterminate: _ctx.node.indeterminate,
  55686. disabled: !!_ctx.node.disabled,
  55687. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  55688. }, ["stop"])),
  55689. onChange: _ctx.handleCheckChange
  55690. }, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : createCommentVNode("v-if", true),
  55691. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  55692. key: 2,
  55693. class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  55694. }, {
  55695. default: withCtx(() => [
  55696. createVNode(_component_loading)
  55697. ]),
  55698. _: 1
  55699. }, 8, ["class"])) : createCommentVNode("v-if", true),
  55700. createVNode(_component_node_content, {
  55701. node: _ctx.node,
  55702. "render-content": _ctx.renderContent
  55703. }, null, 8, ["node", "render-content"])
  55704. ], 6),
  55705. createVNode(_component_el_collapse_transition, null, {
  55706. default: withCtx(() => [
  55707. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
  55708. key: 0,
  55709. class: normalizeClass(_ctx.ns.be("node", "children")),
  55710. role: "group",
  55711. "aria-expanded": _ctx.expanded
  55712. }, [
  55713. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.childNodes, (child) => {
  55714. return openBlock(), createBlock(_component_el_tree_node, {
  55715. key: _ctx.getNodeKey(child),
  55716. "render-content": _ctx.renderContent,
  55717. "render-after-expand": _ctx.renderAfterExpand,
  55718. "show-checkbox": _ctx.showCheckbox,
  55719. node: child,
  55720. accordion: _ctx.accordion,
  55721. props: _ctx.props,
  55722. onNodeExpand: _ctx.handleChildNodeExpand
  55723. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  55724. }), 128))
  55725. ], 10, _hoisted_2$6)), [
  55726. [vShow, _ctx.expanded]
  55727. ]) : createCommentVNode("v-if", true)
  55728. ]),
  55729. _: 1
  55730. })
  55731. ], 42, _hoisted_1$9)), [
  55732. [vShow, _ctx.node.visible]
  55733. ]);
  55734. }
  55735. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node.vue"]]);
  55736. function useKeydown({ el$ }, store) {
  55737. const ns = useNamespace("tree");
  55738. const treeItems = shallowRef([]);
  55739. const checkboxItems = shallowRef([]);
  55740. onMounted(() => {
  55741. initTabIndex();
  55742. });
  55743. onUpdated(() => {
  55744. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  55745. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  55746. });
  55747. watch(checkboxItems, (val) => {
  55748. val.forEach((checkbox) => {
  55749. checkbox.setAttribute("tabindex", "-1");
  55750. });
  55751. });
  55752. const handleKeydown = (ev) => {
  55753. const currentItem = ev.target;
  55754. if (!currentItem.className.includes(ns.b("node")))
  55755. return;
  55756. const code = ev.code;
  55757. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  55758. const currentIndex = treeItems.value.indexOf(currentItem);
  55759. let nextIndex;
  55760. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  55761. ev.preventDefault();
  55762. if (code === EVENT_CODE.up) {
  55763. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  55764. const startIndex = nextIndex;
  55765. while (true) {
  55766. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  55767. break;
  55768. nextIndex--;
  55769. if (nextIndex === startIndex) {
  55770. nextIndex = -1;
  55771. break;
  55772. }
  55773. if (nextIndex < 0) {
  55774. nextIndex = treeItems.value.length - 1;
  55775. }
  55776. }
  55777. } else {
  55778. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  55779. const startIndex = nextIndex;
  55780. while (true) {
  55781. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  55782. break;
  55783. nextIndex++;
  55784. if (nextIndex === startIndex) {
  55785. nextIndex = -1;
  55786. break;
  55787. }
  55788. if (nextIndex >= treeItems.value.length) {
  55789. nextIndex = 0;
  55790. }
  55791. }
  55792. }
  55793. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  55794. }
  55795. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  55796. ev.preventDefault();
  55797. currentItem.click();
  55798. }
  55799. const hasInput = currentItem.querySelector('[type="checkbox"]');
  55800. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && hasInput) {
  55801. ev.preventDefault();
  55802. hasInput.click();
  55803. }
  55804. };
  55805. useEventListener(el$, "keydown", handleKeydown);
  55806. const initTabIndex = () => {
  55807. var _a2;
  55808. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  55809. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  55810. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  55811. if (checkedItem.length) {
  55812. checkedItem[0].setAttribute("tabindex", "0");
  55813. return;
  55814. }
  55815. (_a2 = treeItems.value[0]) == null ? void 0 : _a2.setAttribute("tabindex", "0");
  55816. };
  55817. }
  55818. const _sfc_main$f = /* @__PURE__ */ defineComponent({
  55819. name: "ElTree",
  55820. components: { ElTreeNode: ElTreeNode$1 },
  55821. props: {
  55822. data: {
  55823. type: Array,
  55824. default: () => []
  55825. },
  55826. emptyText: {
  55827. type: String
  55828. },
  55829. renderAfterExpand: {
  55830. type: Boolean,
  55831. default: true
  55832. },
  55833. nodeKey: String,
  55834. checkStrictly: Boolean,
  55835. defaultExpandAll: Boolean,
  55836. expandOnClickNode: {
  55837. type: Boolean,
  55838. default: true
  55839. },
  55840. checkOnClickNode: Boolean,
  55841. checkDescendants: {
  55842. type: Boolean,
  55843. default: false
  55844. },
  55845. autoExpandParent: {
  55846. type: Boolean,
  55847. default: true
  55848. },
  55849. defaultCheckedKeys: Array,
  55850. defaultExpandedKeys: Array,
  55851. currentNodeKey: [String, Number],
  55852. renderContent: Function,
  55853. showCheckbox: {
  55854. type: Boolean,
  55855. default: false
  55856. },
  55857. draggable: {
  55858. type: Boolean,
  55859. default: false
  55860. },
  55861. allowDrag: Function,
  55862. allowDrop: Function,
  55863. props: {
  55864. type: Object,
  55865. default: () => ({
  55866. children: "children",
  55867. label: "label",
  55868. disabled: "disabled"
  55869. })
  55870. },
  55871. lazy: {
  55872. type: Boolean,
  55873. default: false
  55874. },
  55875. highlightCurrent: Boolean,
  55876. load: Function,
  55877. filterNodeMethod: Function,
  55878. accordion: Boolean,
  55879. indent: {
  55880. type: Number,
  55881. default: 18
  55882. },
  55883. icon: {
  55884. type: iconPropType
  55885. }
  55886. },
  55887. emits: [
  55888. "check-change",
  55889. "current-change",
  55890. "node-click",
  55891. "node-contextmenu",
  55892. "node-collapse",
  55893. "node-expand",
  55894. "check",
  55895. "node-drag-start",
  55896. "node-drag-end",
  55897. "node-drop",
  55898. "node-drag-leave",
  55899. "node-drag-enter",
  55900. "node-drag-over"
  55901. ],
  55902. setup(props, ctx) {
  55903. const { t } = useLocale();
  55904. const ns = useNamespace("tree");
  55905. const store = ref(new TreeStore({
  55906. key: props.nodeKey,
  55907. data: props.data,
  55908. lazy: props.lazy,
  55909. props: props.props,
  55910. load: props.load,
  55911. currentNodeKey: props.currentNodeKey,
  55912. checkStrictly: props.checkStrictly,
  55913. checkDescendants: props.checkDescendants,
  55914. defaultCheckedKeys: props.defaultCheckedKeys,
  55915. defaultExpandedKeys: props.defaultExpandedKeys,
  55916. autoExpandParent: props.autoExpandParent,
  55917. defaultExpandAll: props.defaultExpandAll,
  55918. filterNodeMethod: props.filterNodeMethod
  55919. }));
  55920. store.value.initialize();
  55921. const root2 = ref(store.value.root);
  55922. const currentNode = ref(null);
  55923. const el$ = ref(null);
  55924. const dropIndicator$ = ref(null);
  55925. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  55926. const { dragState } = useDragNodeHandler({
  55927. props,
  55928. ctx,
  55929. el$,
  55930. dropIndicator$,
  55931. store
  55932. });
  55933. useKeydown({ el$ }, store);
  55934. const isEmpty2 = computed(() => {
  55935. const { childNodes } = root2.value;
  55936. return !childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible);
  55937. });
  55938. watch(() => props.currentNodeKey, (newVal) => {
  55939. store.value.setCurrentNodeKey(newVal);
  55940. });
  55941. watch(() => props.defaultCheckedKeys, (newVal) => {
  55942. store.value.setDefaultCheckedKey(newVal);
  55943. });
  55944. watch(() => props.defaultExpandedKeys, (newVal) => {
  55945. store.value.setDefaultExpandedKeys(newVal);
  55946. });
  55947. watch(() => props.data, (newVal) => {
  55948. store.value.setData(newVal);
  55949. }, { deep: true });
  55950. watch(() => props.checkStrictly, (newVal) => {
  55951. store.value.checkStrictly = newVal;
  55952. });
  55953. const filter = (value) => {
  55954. if (!props.filterNodeMethod)
  55955. throw new Error("[Tree] filterNodeMethod is required when filter");
  55956. store.value.filter(value);
  55957. };
  55958. const getNodeKey$1 = (node) => {
  55959. return getNodeKey(props.nodeKey, node.data);
  55960. };
  55961. const getNodePath = (data) => {
  55962. if (!props.nodeKey)
  55963. throw new Error("[Tree] nodeKey is required in getNodePath");
  55964. const node = store.value.getNode(data);
  55965. if (!node)
  55966. return [];
  55967. const path = [node.data];
  55968. let parent = node.parent;
  55969. while (parent && parent !== root2.value) {
  55970. path.push(parent.data);
  55971. parent = parent.parent;
  55972. }
  55973. return path.reverse();
  55974. };
  55975. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  55976. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  55977. };
  55978. const getCheckedKeys = (leafOnly) => {
  55979. return store.value.getCheckedKeys(leafOnly);
  55980. };
  55981. const getCurrentNode = () => {
  55982. const currentNode2 = store.value.getCurrentNode();
  55983. return currentNode2 ? currentNode2.data : null;
  55984. };
  55985. const getCurrentKey = () => {
  55986. if (!props.nodeKey)
  55987. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  55988. const currentNode2 = getCurrentNode();
  55989. return currentNode2 ? currentNode2[props.nodeKey] : null;
  55990. };
  55991. const setCheckedNodes = (nodes, leafOnly) => {
  55992. if (!props.nodeKey)
  55993. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  55994. store.value.setCheckedNodes(nodes, leafOnly);
  55995. };
  55996. const setCheckedKeys = (keys2, leafOnly) => {
  55997. if (!props.nodeKey)
  55998. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  55999. store.value.setCheckedKeys(keys2, leafOnly);
  56000. };
  56001. const setChecked2 = (data, checked, deep) => {
  56002. store.value.setChecked(data, checked, deep);
  56003. };
  56004. const getHalfCheckedNodes = () => {
  56005. return store.value.getHalfCheckedNodes();
  56006. };
  56007. const getHalfCheckedKeys = () => {
  56008. return store.value.getHalfCheckedKeys();
  56009. };
  56010. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  56011. if (!props.nodeKey)
  56012. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  56013. handleCurrentChange(store, ctx.emit, () => store.value.setUserCurrentNode(node, shouldAutoExpandParent));
  56014. };
  56015. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  56016. if (!props.nodeKey)
  56017. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  56018. handleCurrentChange(store, ctx.emit, () => store.value.setCurrentNodeKey(key, shouldAutoExpandParent));
  56019. };
  56020. const getNode = (data) => {
  56021. return store.value.getNode(data);
  56022. };
  56023. const remove2 = (data) => {
  56024. store.value.remove(data);
  56025. };
  56026. const append = (data, parentNode) => {
  56027. store.value.append(data, parentNode);
  56028. };
  56029. const insertBefore = (data, refNode) => {
  56030. store.value.insertBefore(data, refNode);
  56031. };
  56032. const insertAfter = (data, refNode) => {
  56033. store.value.insertAfter(data, refNode);
  56034. };
  56035. const handleNodeExpand = (nodeData, node, instance) => {
  56036. broadcastExpanded(node);
  56037. ctx.emit("node-expand", nodeData, node, instance);
  56038. };
  56039. const updateKeyChildren = (key, data) => {
  56040. if (!props.nodeKey)
  56041. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  56042. store.value.updateChildren(key, data);
  56043. };
  56044. provide("RootTree", {
  56045. ctx,
  56046. props,
  56047. store,
  56048. root: root2,
  56049. currentNode,
  56050. instance: getCurrentInstance()
  56051. });
  56052. provide(formItemContextKey, void 0);
  56053. return {
  56054. ns,
  56055. store,
  56056. root: root2,
  56057. currentNode,
  56058. dragState,
  56059. el$,
  56060. dropIndicator$,
  56061. isEmpty: isEmpty2,
  56062. filter,
  56063. getNodeKey: getNodeKey$1,
  56064. getNodePath,
  56065. getCheckedNodes,
  56066. getCheckedKeys,
  56067. getCurrentNode,
  56068. getCurrentKey,
  56069. setCheckedNodes,
  56070. setCheckedKeys,
  56071. setChecked: setChecked2,
  56072. getHalfCheckedNodes,
  56073. getHalfCheckedKeys,
  56074. setCurrentNode,
  56075. setCurrentKey,
  56076. t,
  56077. getNode,
  56078. remove: remove2,
  56079. append,
  56080. insertBefore,
  56081. insertAfter,
  56082. handleNodeExpand,
  56083. updateKeyChildren
  56084. };
  56085. }
  56086. });
  56087. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  56088. const _component_el_tree_node = resolveComponent("el-tree-node");
  56089. return openBlock(), createElementBlock("div", {
  56090. ref: "el$",
  56091. class: normalizeClass([
  56092. _ctx.ns.b(),
  56093. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  56094. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  56095. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  56096. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  56097. ]),
  56098. role: "tree"
  56099. }, [
  56100. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, (child) => {
  56101. return openBlock(), createBlock(_component_el_tree_node, {
  56102. key: _ctx.getNodeKey(child),
  56103. node: child,
  56104. props: _ctx.props,
  56105. accordion: _ctx.accordion,
  56106. "render-after-expand": _ctx.renderAfterExpand,
  56107. "show-checkbox": _ctx.showCheckbox,
  56108. "render-content": _ctx.renderContent,
  56109. onNodeExpand: _ctx.handleNodeExpand
  56110. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  56111. }), 128)),
  56112. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  56113. key: 0,
  56114. class: normalizeClass(_ctx.ns.e("empty-block"))
  56115. }, [
  56116. renderSlot(_ctx.$slots, "empty", {}, () => {
  56117. var _a2;
  56118. return [
  56119. createBaseVNode("span", {
  56120. class: normalizeClass(_ctx.ns.e("empty-text"))
  56121. }, toDisplayString((_a2 = _ctx.emptyText) != null ? _a2 : _ctx.t("el.tree.emptyText")), 3)
  56122. ];
  56123. })
  56124. ], 2)) : createCommentVNode("v-if", true),
  56125. withDirectives(createBaseVNode("div", {
  56126. ref: "dropIndicator$",
  56127. class: normalizeClass(_ctx.ns.e("drop-indicator"))
  56128. }, null, 2), [
  56129. [vShow, _ctx.dragState.showDropIndicator]
  56130. ])
  56131. ], 2);
  56132. }
  56133. var Tree = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$1], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree.vue"]]);
  56134. Tree.install = (app) => {
  56135. app.component(Tree.name, Tree);
  56136. };
  56137. const _Tree = Tree;
  56138. const ElTree = _Tree;
  56139. const useSelect = (props, { attrs, emit: emit2 }, {
  56140. tree,
  56141. key
  56142. }) => {
  56143. const ns = useNamespace("tree-select");
  56144. const result = {
  56145. ...pick$1(toRefs(props), Object.keys(ElSelect.props)),
  56146. ...attrs,
  56147. "onUpdate:modelValue": (value) => emit2(UPDATE_MODEL_EVENT, value),
  56148. valueKey: key,
  56149. popperClass: computed(() => {
  56150. const classes = [ns.e("popper")];
  56151. if (props.popperClass)
  56152. classes.push(props.popperClass);
  56153. return classes.join(" ");
  56154. }),
  56155. filterMethod: (keyword = "") => {
  56156. if (props.filterMethod)
  56157. props.filterMethod(keyword);
  56158. nextTick(() => {
  56159. var _a2;
  56160. (_a2 = tree.value) == null ? void 0 : _a2.filter(keyword);
  56161. });
  56162. },
  56163. onVisibleChange: (visible) => {
  56164. var _a2;
  56165. (_a2 = attrs.onVisibleChange) == null ? void 0 : _a2.call(attrs, visible);
  56166. if (props.filterable && visible) {
  56167. result.filterMethod();
  56168. }
  56169. }
  56170. };
  56171. return result;
  56172. };
  56173. const component = /* @__PURE__ */ defineComponent({
  56174. extends: ElOption,
  56175. setup(props, ctx) {
  56176. const result = ElOption.setup(props, ctx);
  56177. delete result.selectOptionClick;
  56178. const vm = getCurrentInstance().proxy;
  56179. nextTick(() => {
  56180. if (!result.select.cachedOptions.get(vm.value)) {
  56181. result.select.onOptionCreate(vm);
  56182. }
  56183. });
  56184. return result;
  56185. },
  56186. methods: {
  56187. selectOptionClick() {
  56188. this.$el.parentElement.click();
  56189. }
  56190. }
  56191. });
  56192. function isValidValue(val) {
  56193. return val || val === 0;
  56194. }
  56195. function isValidArray(val) {
  56196. return Array.isArray(val) && val.length;
  56197. }
  56198. function toValidArray(val) {
  56199. return Array.isArray(val) ? val : isValidValue(val) ? [val] : [];
  56200. }
  56201. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  56202. for (let i = 0; i < treeData.length; i++) {
  56203. const data = treeData[i];
  56204. if (findCallback(data, i, treeData, parent)) {
  56205. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  56206. } else {
  56207. const children = getChildren(data);
  56208. if (isValidArray(children)) {
  56209. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  56210. if (find)
  56211. return find;
  56212. }
  56213. }
  56214. }
  56215. }
  56216. function treeEach(treeData, callback, getChildren, parent) {
  56217. for (let i = 0; i < treeData.length; i++) {
  56218. const data = treeData[i];
  56219. callback(data, i, treeData, parent);
  56220. const children = getChildren(data);
  56221. if (isValidArray(children)) {
  56222. treeEach(children, callback, getChildren, data);
  56223. }
  56224. }
  56225. }
  56226. const useTree$1 = (props, { attrs, slots, emit: emit2 }, {
  56227. select,
  56228. tree,
  56229. key
  56230. }) => {
  56231. watch(() => props.modelValue, () => {
  56232. if (props.showCheckbox) {
  56233. nextTick(() => {
  56234. const treeInstance = tree.value;
  56235. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  56236. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  56237. }
  56238. });
  56239. }
  56240. }, {
  56241. immediate: true,
  56242. deep: true
  56243. });
  56244. const propsMap = computed(() => ({
  56245. value: key.value,
  56246. label: "label",
  56247. children: "children",
  56248. disabled: "disabled",
  56249. isLeaf: "isLeaf",
  56250. ...props.props
  56251. }));
  56252. const getNodeValByProp = (prop, data) => {
  56253. var _a2;
  56254. const propVal = propsMap.value[prop];
  56255. if (isFunction$2(propVal)) {
  56256. return propVal(data, (_a2 = tree.value) == null ? void 0 : _a2.getNode(getNodeValByProp("value", data)));
  56257. } else {
  56258. return data[propVal];
  56259. }
  56260. };
  56261. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  56262. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index2, array2, parent) => parent && getNodeValByProp("value", parent));
  56263. }).filter((item) => isValidValue(item));
  56264. const cacheOptions = computed(() => {
  56265. if (!props.renderAfterExpand && !props.lazy)
  56266. return [];
  56267. const options = [];
  56268. treeEach(props.data.concat(props.cacheData), (node) => {
  56269. const value = getNodeValByProp("value", node);
  56270. options.push({
  56271. value,
  56272. currentLabel: getNodeValByProp("label", node),
  56273. isDisabled: getNodeValByProp("disabled", node)
  56274. });
  56275. }, (data) => getNodeValByProp("children", data));
  56276. return options;
  56277. });
  56278. const cacheOptionsMap = computed(() => {
  56279. return cacheOptions.value.reduce((prev, next) => ({ ...prev, [next.value]: next }), {});
  56280. });
  56281. return {
  56282. ...pick$1(toRefs(props), Object.keys(_Tree.props)),
  56283. ...attrs,
  56284. nodeKey: key,
  56285. expandOnClickNode: computed(() => {
  56286. return !props.checkStrictly && props.expandOnClickNode;
  56287. }),
  56288. defaultExpandedKeys: computed(() => {
  56289. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  56290. }),
  56291. renderContent: (h2, { node, data, store }) => {
  56292. return h2(component, {
  56293. value: getNodeValByProp("value", data),
  56294. label: getNodeValByProp("label", data),
  56295. disabled: getNodeValByProp("disabled", data)
  56296. }, props.renderContent ? () => props.renderContent(h2, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  56297. },
  56298. filterNodeMethod: (value, data, node) => {
  56299. var _a2;
  56300. if (props.filterNodeMethod)
  56301. return props.filterNodeMethod(value, data, node);
  56302. if (!value)
  56303. return true;
  56304. return (_a2 = getNodeValByProp("label", data)) == null ? void 0 : _a2.includes(value);
  56305. },
  56306. onNodeClick: (data, node, e) => {
  56307. var _a2, _b, _c;
  56308. (_a2 = attrs.onNodeClick) == null ? void 0 : _a2.call(attrs, data, node, e);
  56309. if (props.showCheckbox && props.checkOnClickNode)
  56310. return;
  56311. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  56312. if (!getNodeValByProp("disabled", data)) {
  56313. const option = (_b = select.value) == null ? void 0 : _b.options.get(getNodeValByProp("value", data));
  56314. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  56315. }
  56316. } else if (props.expandOnClickNode) {
  56317. e.proxy.handleExpandIconClick();
  56318. }
  56319. },
  56320. onCheck: (data, params) => {
  56321. if (!props.showCheckbox)
  56322. return;
  56323. const dataValue = getNodeValByProp("value", data);
  56324. const uncachedCheckedKeys = params.checkedKeys;
  56325. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => item in cacheOptionsMap.value && !tree.value.getNode(item) && !uncachedCheckedKeys.includes(item)) : [];
  56326. const checkedKeys = uncachedCheckedKeys.concat(cachedKeys);
  56327. if (props.checkStrictly) {
  56328. emit2(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  56329. } else {
  56330. if (props.multiple) {
  56331. emit2(UPDATE_MODEL_EVENT, tree.value.getCheckedKeys(true));
  56332. } else {
  56333. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  56334. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  56335. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  56336. emit2(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  56337. }
  56338. }
  56339. nextTick(() => {
  56340. var _a2;
  56341. const checkedKeys2 = toValidArray(props.modelValue);
  56342. tree.value.setCheckedKeys(checkedKeys2);
  56343. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  56344. checkedKeys: tree.value.getCheckedKeys(),
  56345. checkedNodes: tree.value.getCheckedNodes(),
  56346. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  56347. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  56348. });
  56349. });
  56350. },
  56351. cacheOptions
  56352. };
  56353. };
  56354. var CacheOptions = /* @__PURE__ */ defineComponent({
  56355. props: {
  56356. data: {
  56357. type: Array,
  56358. default: () => []
  56359. }
  56360. },
  56361. setup(props) {
  56362. const select = inject(selectKey);
  56363. watch(() => props.data, () => {
  56364. var _a2;
  56365. props.data.forEach((item) => {
  56366. if (!select.cachedOptions.has(item.value)) {
  56367. select.cachedOptions.set(item.value, item);
  56368. }
  56369. });
  56370. const inputs = ((_a2 = select.selectWrapper) == null ? void 0 : _a2.querySelectorAll("input")) || [];
  56371. if (!Array.from(inputs).includes(document.activeElement)) {
  56372. select.setSelected();
  56373. }
  56374. }, { flush: "post", immediate: true });
  56375. return () => void 0;
  56376. }
  56377. });
  56378. const _sfc_main$e = /* @__PURE__ */ defineComponent({
  56379. name: "ElTreeSelect",
  56380. inheritAttrs: false,
  56381. props: {
  56382. ...ElSelect.props,
  56383. ..._Tree.props,
  56384. cacheData: {
  56385. type: Array,
  56386. default: () => []
  56387. }
  56388. },
  56389. setup(props, context) {
  56390. const { slots, expose } = context;
  56391. const select = ref();
  56392. const tree = ref();
  56393. const key = computed(() => props.nodeKey || props.valueKey || "value");
  56394. const selectProps = useSelect(props, context, { select, tree, key });
  56395. const { cacheOptions, ...treeProps2 } = useTree$1(props, context, {
  56396. select,
  56397. tree,
  56398. key
  56399. });
  56400. const methods = reactive({});
  56401. expose(methods);
  56402. onMounted(() => {
  56403. Object.assign(methods, {
  56404. ...pick$1(tree.value, [
  56405. "filter",
  56406. "updateKeyChildren",
  56407. "getCheckedNodes",
  56408. "setCheckedNodes",
  56409. "getCheckedKeys",
  56410. "setCheckedKeys",
  56411. "setChecked",
  56412. "getHalfCheckedNodes",
  56413. "getHalfCheckedKeys",
  56414. "getCurrentKey",
  56415. "getCurrentNode",
  56416. "setCurrentKey",
  56417. "setCurrentNode",
  56418. "getNode",
  56419. "remove",
  56420. "append",
  56421. "insertBefore",
  56422. "insertAfter"
  56423. ]),
  56424. ...pick$1(select.value, ["focus", "blur"])
  56425. });
  56426. });
  56427. return () => h$1(ElSelect, reactive({
  56428. ...selectProps,
  56429. ref: (ref2) => select.value = ref2
  56430. }), {
  56431. ...slots,
  56432. default: () => [
  56433. h$1(CacheOptions, { data: cacheOptions.value }),
  56434. h$1(_Tree, reactive({
  56435. ...treeProps2,
  56436. ref: (ref2) => tree.value = ref2
  56437. }))
  56438. ]
  56439. });
  56440. }
  56441. });
  56442. var TreeSelect = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree-select/src/tree-select.vue"]]);
  56443. TreeSelect.install = (app) => {
  56444. app.component(TreeSelect.name, TreeSelect);
  56445. };
  56446. const _TreeSelect = TreeSelect;
  56447. const ElTreeSelect = _TreeSelect;
  56448. const ROOT_TREE_INJECTION_KEY = Symbol();
  56449. const EMPTY_NODE = {
  56450. key: -1,
  56451. level: -1,
  56452. data: {}
  56453. };
  56454. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  56455. TreeOptionsEnum2["KEY"] = "id";
  56456. TreeOptionsEnum2["LABEL"] = "label";
  56457. TreeOptionsEnum2["CHILDREN"] = "children";
  56458. TreeOptionsEnum2["DISABLED"] = "disabled";
  56459. return TreeOptionsEnum2;
  56460. })(TreeOptionsEnum || {});
  56461. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  56462. SetOperationEnum2["ADD"] = "add";
  56463. SetOperationEnum2["DELETE"] = "delete";
  56464. return SetOperationEnum2;
  56465. })(SetOperationEnum || {});
  56466. const itemSize = {
  56467. type: Number,
  56468. default: 26
  56469. };
  56470. const treeProps = buildProps({
  56471. data: {
  56472. type: definePropType(Array),
  56473. default: () => mutable([])
  56474. },
  56475. emptyText: {
  56476. type: String
  56477. },
  56478. height: {
  56479. type: Number,
  56480. default: 200
  56481. },
  56482. props: {
  56483. type: definePropType(Object),
  56484. default: () => mutable({
  56485. children: "children",
  56486. label: "label",
  56487. disabled: "disabled",
  56488. value: "id"
  56489. /* KEY */
  56490. })
  56491. },
  56492. highlightCurrent: {
  56493. type: Boolean,
  56494. default: false
  56495. },
  56496. showCheckbox: {
  56497. type: Boolean,
  56498. default: false
  56499. },
  56500. defaultCheckedKeys: {
  56501. type: definePropType(Array),
  56502. default: () => mutable([])
  56503. },
  56504. checkStrictly: {
  56505. type: Boolean,
  56506. default: false
  56507. },
  56508. defaultExpandedKeys: {
  56509. type: definePropType(Array),
  56510. default: () => mutable([])
  56511. },
  56512. indent: {
  56513. type: Number,
  56514. default: 16
  56515. },
  56516. itemSize,
  56517. icon: {
  56518. type: iconPropType
  56519. },
  56520. expandOnClickNode: {
  56521. type: Boolean,
  56522. default: true
  56523. },
  56524. checkOnClickNode: {
  56525. type: Boolean,
  56526. default: false
  56527. },
  56528. currentNodeKey: {
  56529. type: definePropType([String, Number])
  56530. },
  56531. accordion: {
  56532. type: Boolean,
  56533. default: false
  56534. },
  56535. filterMethod: {
  56536. type: definePropType(Function)
  56537. },
  56538. perfMode: {
  56539. type: Boolean,
  56540. default: true
  56541. }
  56542. });
  56543. const treeNodeProps = buildProps({
  56544. node: {
  56545. type: definePropType(Object),
  56546. default: () => mutable(EMPTY_NODE)
  56547. },
  56548. expanded: {
  56549. type: Boolean,
  56550. default: false
  56551. },
  56552. checked: {
  56553. type: Boolean,
  56554. default: false
  56555. },
  56556. indeterminate: {
  56557. type: Boolean,
  56558. default: false
  56559. },
  56560. showCheckbox: {
  56561. type: Boolean,
  56562. default: false
  56563. },
  56564. disabled: {
  56565. type: Boolean,
  56566. default: false
  56567. },
  56568. current: {
  56569. type: Boolean,
  56570. default: false
  56571. },
  56572. hiddenExpandIcon: {
  56573. type: Boolean,
  56574. default: false
  56575. },
  56576. itemSize
  56577. });
  56578. const treeNodeContentProps = buildProps({
  56579. node: {
  56580. type: definePropType(Object),
  56581. required: true
  56582. }
  56583. });
  56584. const NODE_CLICK = "node-click";
  56585. const NODE_EXPAND = "node-expand";
  56586. const NODE_COLLAPSE = "node-collapse";
  56587. const CURRENT_CHANGE = "current-change";
  56588. const NODE_CHECK = "check";
  56589. const NODE_CHECK_CHANGE = "check-change";
  56590. const NODE_CONTEXTMENU = "node-contextmenu";
  56591. const treeEmits = {
  56592. [NODE_CLICK]: (data, node, e) => data && node && e,
  56593. [NODE_EXPAND]: (data, node) => data && node,
  56594. [NODE_COLLAPSE]: (data, node) => data && node,
  56595. [CURRENT_CHANGE]: (data, node) => data && node,
  56596. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  56597. [NODE_CHECK_CHANGE]: (data, checked) => data && typeof checked === "boolean",
  56598. [NODE_CONTEXTMENU]: (event, data, node) => event && data && node
  56599. };
  56600. const treeNodeEmits = {
  56601. click: (node, e) => !!(node && e),
  56602. toggle: (node) => !!node,
  56603. check: (node, checked) => node && typeof checked === "boolean"
  56604. };
  56605. function useCheck(props, tree) {
  56606. const checkedKeys = ref(/* @__PURE__ */ new Set());
  56607. const indeterminateKeys = ref(/* @__PURE__ */ new Set());
  56608. const { emit: emit2 } = getCurrentInstance();
  56609. watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  56610. return nextTick(() => {
  56611. _setCheckedKeys(props.defaultCheckedKeys);
  56612. });
  56613. }, {
  56614. immediate: true
  56615. });
  56616. const updateCheckedKeys = () => {
  56617. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  56618. return;
  56619. }
  56620. const { levelTreeNodeMap, maxLevel } = tree.value;
  56621. const checkedKeySet = checkedKeys.value;
  56622. const indeterminateKeySet = /* @__PURE__ */ new Set();
  56623. for (let level = maxLevel - 1; level >= 1; --level) {
  56624. const nodes = levelTreeNodeMap.get(level);
  56625. if (!nodes)
  56626. continue;
  56627. nodes.forEach((node) => {
  56628. const children = node.children;
  56629. if (children) {
  56630. let allChecked = true;
  56631. let hasChecked = false;
  56632. for (const childNode of children) {
  56633. const key = childNode.key;
  56634. if (checkedKeySet.has(key)) {
  56635. hasChecked = true;
  56636. } else if (indeterminateKeySet.has(key)) {
  56637. allChecked = false;
  56638. hasChecked = true;
  56639. break;
  56640. } else {
  56641. allChecked = false;
  56642. }
  56643. }
  56644. if (allChecked) {
  56645. checkedKeySet.add(node.key);
  56646. } else if (hasChecked) {
  56647. indeterminateKeySet.add(node.key);
  56648. checkedKeySet.delete(node.key);
  56649. } else {
  56650. checkedKeySet.delete(node.key);
  56651. indeterminateKeySet.delete(node.key);
  56652. }
  56653. }
  56654. });
  56655. }
  56656. indeterminateKeys.value = indeterminateKeySet;
  56657. };
  56658. const isChecked = (node) => checkedKeys.value.has(node.key);
  56659. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  56660. const toggleCheckbox = (node, isChecked2, nodeClick = true) => {
  56661. const checkedKeySet = checkedKeys.value;
  56662. const toggle = (node2, checked) => {
  56663. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  56664. const children = node2.children;
  56665. if (!props.checkStrictly && children) {
  56666. children.forEach((childNode) => {
  56667. if (!childNode.disabled) {
  56668. toggle(childNode, checked);
  56669. }
  56670. });
  56671. }
  56672. };
  56673. toggle(node, isChecked2);
  56674. updateCheckedKeys();
  56675. if (nodeClick) {
  56676. afterNodeCheck(node, isChecked2);
  56677. }
  56678. };
  56679. const afterNodeCheck = (node, checked) => {
  56680. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  56681. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  56682. emit2(NODE_CHECK, node.data, {
  56683. checkedKeys: checkedKeys2,
  56684. checkedNodes,
  56685. halfCheckedKeys,
  56686. halfCheckedNodes
  56687. });
  56688. emit2(NODE_CHECK_CHANGE, node.data, checked);
  56689. };
  56690. function getCheckedKeys(leafOnly = false) {
  56691. return getChecked(leafOnly).checkedKeys;
  56692. }
  56693. function getCheckedNodes(leafOnly = false) {
  56694. return getChecked(leafOnly).checkedNodes;
  56695. }
  56696. function getHalfCheckedKeys() {
  56697. return getHalfChecked().halfCheckedKeys;
  56698. }
  56699. function getHalfCheckedNodes() {
  56700. return getHalfChecked().halfCheckedNodes;
  56701. }
  56702. function getChecked(leafOnly = false) {
  56703. const checkedNodes = [];
  56704. const keys2 = [];
  56705. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56706. const { treeNodeMap } = tree.value;
  56707. checkedKeys.value.forEach((key) => {
  56708. const node = treeNodeMap.get(key);
  56709. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  56710. keys2.push(key);
  56711. checkedNodes.push(node.data);
  56712. }
  56713. });
  56714. }
  56715. return {
  56716. checkedKeys: keys2,
  56717. checkedNodes
  56718. };
  56719. }
  56720. function getHalfChecked() {
  56721. const halfCheckedNodes = [];
  56722. const halfCheckedKeys = [];
  56723. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56724. const { treeNodeMap } = tree.value;
  56725. indeterminateKeys.value.forEach((key) => {
  56726. const node = treeNodeMap.get(key);
  56727. if (node) {
  56728. halfCheckedKeys.push(key);
  56729. halfCheckedNodes.push(node.data);
  56730. }
  56731. });
  56732. }
  56733. return {
  56734. halfCheckedNodes,
  56735. halfCheckedKeys
  56736. };
  56737. }
  56738. function setCheckedKeys(keys2) {
  56739. checkedKeys.value.clear();
  56740. indeterminateKeys.value.clear();
  56741. _setCheckedKeys(keys2);
  56742. }
  56743. function setChecked2(key, isChecked2) {
  56744. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56745. const node = tree.value.treeNodeMap.get(key);
  56746. if (node) {
  56747. toggleCheckbox(node, isChecked2, false);
  56748. }
  56749. }
  56750. }
  56751. function _setCheckedKeys(keys2) {
  56752. if (tree == null ? void 0 : tree.value) {
  56753. const { treeNodeMap } = tree.value;
  56754. if (props.showCheckbox && treeNodeMap && keys2) {
  56755. for (const key of keys2) {
  56756. const node = treeNodeMap.get(key);
  56757. if (node && !isChecked(node)) {
  56758. toggleCheckbox(node, true, false);
  56759. }
  56760. }
  56761. }
  56762. }
  56763. }
  56764. return {
  56765. updateCheckedKeys,
  56766. toggleCheckbox,
  56767. isChecked,
  56768. isIndeterminate,
  56769. getCheckedKeys,
  56770. getCheckedNodes,
  56771. getHalfCheckedKeys,
  56772. getHalfCheckedNodes,
  56773. setChecked: setChecked2,
  56774. setCheckedKeys
  56775. };
  56776. }
  56777. function useFilter(props, tree) {
  56778. const hiddenNodeKeySet = ref(/* @__PURE__ */ new Set([]));
  56779. const hiddenExpandIconKeySet = ref(/* @__PURE__ */ new Set([]));
  56780. const filterable = computed(() => {
  56781. return isFunction$2(props.filterMethod);
  56782. });
  56783. function doFilter(query) {
  56784. var _a2;
  56785. if (!filterable.value) {
  56786. return;
  56787. }
  56788. const expandKeySet = /* @__PURE__ */ new Set();
  56789. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  56790. const hiddenKeys = hiddenNodeKeySet.value;
  56791. const family = [];
  56792. const nodes = ((_a2 = tree.value) == null ? void 0 : _a2.treeNodes) || [];
  56793. const filter = props.filterMethod;
  56794. hiddenKeys.clear();
  56795. function traverse2(nodes2) {
  56796. nodes2.forEach((node) => {
  56797. family.push(node);
  56798. if (filter == null ? void 0 : filter(query, node.data)) {
  56799. family.forEach((member) => {
  56800. expandKeySet.add(member.key);
  56801. });
  56802. } else if (node.isLeaf) {
  56803. hiddenKeys.add(node.key);
  56804. }
  56805. const children = node.children;
  56806. if (children) {
  56807. traverse2(children);
  56808. }
  56809. if (!node.isLeaf) {
  56810. if (!expandKeySet.has(node.key)) {
  56811. hiddenKeys.add(node.key);
  56812. } else if (children) {
  56813. let allHidden = true;
  56814. for (const childNode of children) {
  56815. if (!hiddenKeys.has(childNode.key)) {
  56816. allHidden = false;
  56817. break;
  56818. }
  56819. }
  56820. if (allHidden) {
  56821. hiddenExpandIconKeys.add(node.key);
  56822. } else {
  56823. hiddenExpandIconKeys.delete(node.key);
  56824. }
  56825. }
  56826. }
  56827. family.pop();
  56828. });
  56829. }
  56830. traverse2(nodes);
  56831. return expandKeySet;
  56832. }
  56833. function isForceHiddenExpandIcon(node) {
  56834. return hiddenExpandIconKeySet.value.has(node.key);
  56835. }
  56836. return {
  56837. hiddenExpandIconKeySet,
  56838. hiddenNodeKeySet,
  56839. doFilter,
  56840. isForceHiddenExpandIcon
  56841. };
  56842. }
  56843. function useTree(props, emit2) {
  56844. const expandedKeySet = ref(new Set(props.defaultExpandedKeys));
  56845. const currentKey = ref();
  56846. const tree = shallowRef();
  56847. watch(() => props.currentNodeKey, (key) => {
  56848. currentKey.value = key;
  56849. }, {
  56850. immediate: true
  56851. });
  56852. watch(() => props.data, (data) => {
  56853. setData(data);
  56854. }, {
  56855. immediate: true
  56856. });
  56857. const {
  56858. isIndeterminate,
  56859. isChecked,
  56860. toggleCheckbox,
  56861. getCheckedKeys,
  56862. getCheckedNodes,
  56863. getHalfCheckedKeys,
  56864. getHalfCheckedNodes,
  56865. setChecked: setChecked2,
  56866. setCheckedKeys
  56867. } = useCheck(props, tree);
  56868. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  56869. const valueKey = computed(() => {
  56870. var _a2;
  56871. return ((_a2 = props.props) == null ? void 0 : _a2.value) || TreeOptionsEnum.KEY;
  56872. });
  56873. const childrenKey = computed(() => {
  56874. var _a2;
  56875. return ((_a2 = props.props) == null ? void 0 : _a2.children) || TreeOptionsEnum.CHILDREN;
  56876. });
  56877. const disabledKey = computed(() => {
  56878. var _a2;
  56879. return ((_a2 = props.props) == null ? void 0 : _a2.disabled) || TreeOptionsEnum.DISABLED;
  56880. });
  56881. const labelKey = computed(() => {
  56882. var _a2;
  56883. return ((_a2 = props.props) == null ? void 0 : _a2.label) || TreeOptionsEnum.LABEL;
  56884. });
  56885. const flattenTree = computed(() => {
  56886. const expandedKeys = expandedKeySet.value;
  56887. const hiddenKeys = hiddenNodeKeySet.value;
  56888. const flattenNodes = [];
  56889. const nodes = tree.value && tree.value.treeNodes || [];
  56890. function traverse2() {
  56891. const stack = [];
  56892. for (let i = nodes.length - 1; i >= 0; --i) {
  56893. stack.push(nodes[i]);
  56894. }
  56895. while (stack.length) {
  56896. const node = stack.pop();
  56897. if (!node)
  56898. continue;
  56899. if (!hiddenKeys.has(node.key)) {
  56900. flattenNodes.push(node);
  56901. }
  56902. if (expandedKeys.has(node.key)) {
  56903. const children = node.children;
  56904. if (children) {
  56905. const length = children.length;
  56906. for (let i = length - 1; i >= 0; --i) {
  56907. stack.push(children[i]);
  56908. }
  56909. }
  56910. }
  56911. }
  56912. }
  56913. traverse2();
  56914. return flattenNodes;
  56915. });
  56916. const isNotEmpty = computed(() => {
  56917. return flattenTree.value.length > 0;
  56918. });
  56919. function createTree(data) {
  56920. const treeNodeMap = /* @__PURE__ */ new Map();
  56921. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  56922. let maxLevel = 1;
  56923. function traverse2(nodes, level = 1, parent = void 0) {
  56924. var _a2;
  56925. const siblings = [];
  56926. for (const rawNode of nodes) {
  56927. const value = getKey(rawNode);
  56928. const node = {
  56929. level,
  56930. key: value,
  56931. data: rawNode
  56932. };
  56933. node.label = getLabel(rawNode);
  56934. node.parent = parent;
  56935. const children = getChildren(rawNode);
  56936. node.disabled = getDisabled(rawNode);
  56937. node.isLeaf = !children || children.length === 0;
  56938. if (children && children.length) {
  56939. node.children = traverse2(children, level + 1, node);
  56940. }
  56941. siblings.push(node);
  56942. treeNodeMap.set(value, node);
  56943. if (!levelTreeNodeMap.has(level)) {
  56944. levelTreeNodeMap.set(level, []);
  56945. }
  56946. (_a2 = levelTreeNodeMap.get(level)) == null ? void 0 : _a2.push(node);
  56947. }
  56948. if (level > maxLevel) {
  56949. maxLevel = level;
  56950. }
  56951. return siblings;
  56952. }
  56953. const treeNodes = traverse2(data);
  56954. return {
  56955. treeNodeMap,
  56956. levelTreeNodeMap,
  56957. maxLevel,
  56958. treeNodes
  56959. };
  56960. }
  56961. function filter(query) {
  56962. const keys2 = doFilter(query);
  56963. if (keys2) {
  56964. expandedKeySet.value = keys2;
  56965. }
  56966. }
  56967. function getChildren(node) {
  56968. return node[childrenKey.value];
  56969. }
  56970. function getKey(node) {
  56971. if (!node) {
  56972. return "";
  56973. }
  56974. return node[valueKey.value];
  56975. }
  56976. function getDisabled(node) {
  56977. return node[disabledKey.value];
  56978. }
  56979. function getLabel(node) {
  56980. return node[labelKey.value];
  56981. }
  56982. function toggleExpand(node) {
  56983. const expandedKeys = expandedKeySet.value;
  56984. if (expandedKeys.has(node.key)) {
  56985. collapseNode(node);
  56986. } else {
  56987. expandNode(node);
  56988. }
  56989. }
  56990. function setExpandedKeys(keys2) {
  56991. expandedKeySet.value = new Set(keys2);
  56992. }
  56993. function handleNodeClick(node, e) {
  56994. emit2(NODE_CLICK, node.data, node, e);
  56995. handleCurrentChange2(node);
  56996. if (props.expandOnClickNode) {
  56997. toggleExpand(node);
  56998. }
  56999. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  57000. toggleCheckbox(node, !isChecked(node), true);
  57001. }
  57002. }
  57003. function handleCurrentChange2(node) {
  57004. if (!isCurrent(node)) {
  57005. currentKey.value = node.key;
  57006. emit2(CURRENT_CHANGE, node.data, node);
  57007. }
  57008. }
  57009. function handleNodeCheck(node, checked) {
  57010. toggleCheckbox(node, checked);
  57011. }
  57012. function expandNode(node) {
  57013. const keySet = expandedKeySet.value;
  57014. if (tree.value && props.accordion) {
  57015. const { treeNodeMap } = tree.value;
  57016. keySet.forEach((key) => {
  57017. const treeNode = treeNodeMap.get(key);
  57018. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  57019. keySet.delete(key);
  57020. }
  57021. });
  57022. }
  57023. keySet.add(node.key);
  57024. emit2(NODE_EXPAND, node.data, node);
  57025. }
  57026. function collapseNode(node) {
  57027. expandedKeySet.value.delete(node.key);
  57028. emit2(NODE_COLLAPSE, node.data, node);
  57029. }
  57030. function isExpanded(node) {
  57031. return expandedKeySet.value.has(node.key);
  57032. }
  57033. function isDisabled(node) {
  57034. return !!node.disabled;
  57035. }
  57036. function isCurrent(node) {
  57037. const current = currentKey.value;
  57038. return current !== void 0 && current === node.key;
  57039. }
  57040. function getCurrentNode() {
  57041. var _a2, _b;
  57042. if (!currentKey.value)
  57043. return void 0;
  57044. return (_b = (_a2 = tree.value) == null ? void 0 : _a2.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  57045. }
  57046. function getCurrentKey() {
  57047. return currentKey.value;
  57048. }
  57049. function setCurrentKey(key) {
  57050. currentKey.value = key;
  57051. }
  57052. function setData(data) {
  57053. nextTick(() => tree.value = createTree(data));
  57054. }
  57055. function getNode(data) {
  57056. var _a2;
  57057. const key = isObject$1(data) ? getKey(data) : data;
  57058. return (_a2 = tree.value) == null ? void 0 : _a2.treeNodeMap.get(key);
  57059. }
  57060. return {
  57061. tree,
  57062. flattenTree,
  57063. isNotEmpty,
  57064. getKey,
  57065. getChildren,
  57066. toggleExpand,
  57067. toggleCheckbox,
  57068. isExpanded,
  57069. isChecked,
  57070. isIndeterminate,
  57071. isDisabled,
  57072. isCurrent,
  57073. isForceHiddenExpandIcon,
  57074. handleNodeClick,
  57075. handleNodeCheck,
  57076. getCurrentNode,
  57077. getCurrentKey,
  57078. setCurrentKey,
  57079. getCheckedKeys,
  57080. getCheckedNodes,
  57081. getHalfCheckedKeys,
  57082. getHalfCheckedNodes,
  57083. setChecked: setChecked2,
  57084. setCheckedKeys,
  57085. filter,
  57086. setData,
  57087. getNode,
  57088. expandNode,
  57089. collapseNode,
  57090. setExpandedKeys
  57091. };
  57092. }
  57093. var ElNodeContent = /* @__PURE__ */ defineComponent({
  57094. name: "ElTreeNodeContent",
  57095. props: treeNodeContentProps,
  57096. setup(props) {
  57097. const tree = inject(ROOT_TREE_INJECTION_KEY);
  57098. const ns = useNamespace("tree");
  57099. return () => {
  57100. const node = props.node;
  57101. const { data } = node;
  57102. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : h$1("span", { class: ns.be("node", "label") }, [node == null ? void 0 : node.label]);
  57103. };
  57104. }
  57105. });
  57106. const _hoisted_1$8 = ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"];
  57107. const __default__$8 = /* @__PURE__ */ defineComponent({
  57108. name: "ElTreeNode"
  57109. });
  57110. const _sfc_main$d = /* @__PURE__ */ defineComponent({
  57111. ...__default__$8,
  57112. props: treeNodeProps,
  57113. emits: treeNodeEmits,
  57114. setup(__props, { emit: emit2 }) {
  57115. const props = __props;
  57116. const tree = inject(ROOT_TREE_INJECTION_KEY);
  57117. const ns = useNamespace("tree");
  57118. const indent = computed(() => {
  57119. var _a2;
  57120. return (_a2 = tree == null ? void 0 : tree.props.indent) != null ? _a2 : 16;
  57121. });
  57122. const icon = computed(() => {
  57123. var _a2;
  57124. return (_a2 = tree == null ? void 0 : tree.props.icon) != null ? _a2 : caret_right_default;
  57125. });
  57126. const handleClick = (e) => {
  57127. emit2("click", props.node, e);
  57128. };
  57129. const handleExpandIconClick = () => {
  57130. emit2("toggle", props.node);
  57131. };
  57132. const handleCheckChange = (value) => {
  57133. emit2("check", props.node, value);
  57134. };
  57135. const handleContextMenu = (event) => {
  57136. var _a2, _b, _c, _d;
  57137. if ((_c = (_b = (_a2 = tree == null ? void 0 : tree.instance) == null ? void 0 : _a2.vnode) == null ? void 0 : _b.props) == null ? void 0 : _c["onNodeContextmenu"]) {
  57138. event.stopPropagation();
  57139. event.preventDefault();
  57140. }
  57141. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  57142. };
  57143. return (_ctx, _cache) => {
  57144. var _a2, _b, _c;
  57145. return openBlock(), createElementBlock("div", {
  57146. ref: "node$",
  57147. class: normalizeClass([
  57148. unref(ns).b("node"),
  57149. unref(ns).is("expanded", _ctx.expanded),
  57150. unref(ns).is("current", _ctx.current),
  57151. unref(ns).is("focusable", !_ctx.disabled),
  57152. unref(ns).is("checked", !_ctx.disabled && _ctx.checked)
  57153. ]),
  57154. role: "treeitem",
  57155. tabindex: "-1",
  57156. "aria-expanded": _ctx.expanded,
  57157. "aria-disabled": _ctx.disabled,
  57158. "aria-checked": _ctx.checked,
  57159. "data-key": (_a2 = _ctx.node) == null ? void 0 : _a2.key,
  57160. onClick: withModifiers(handleClick, ["stop"]),
  57161. onContextmenu: handleContextMenu
  57162. }, [
  57163. createBaseVNode("div", {
  57164. class: normalizeClass(unref(ns).be("node", "content")),
  57165. style: normalizeStyle({
  57166. paddingLeft: `${(_ctx.node.level - 1) * unref(indent)}px`,
  57167. height: _ctx.itemSize + "px"
  57168. })
  57169. }, [
  57170. unref(icon) ? (openBlock(), createBlock(unref(ElIcon), {
  57171. key: 0,
  57172. class: normalizeClass([
  57173. unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  57174. unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  57175. {
  57176. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  57177. },
  57178. unref(ns).be("node", "expand-icon")
  57179. ]),
  57180. onClick: withModifiers(handleExpandIconClick, ["stop"])
  57181. }, {
  57182. default: withCtx(() => [
  57183. (openBlock(), createBlock(resolveDynamicComponent(unref(icon))))
  57184. ]),
  57185. _: 1
  57186. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  57187. _ctx.showCheckbox ? (openBlock(), createBlock(unref(ElCheckbox), {
  57188. key: 1,
  57189. "model-value": _ctx.checked,
  57190. indeterminate: _ctx.indeterminate,
  57191. disabled: _ctx.disabled,
  57192. onChange: handleCheckChange,
  57193. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  57194. }, ["stop"]))
  57195. }, null, 8, ["model-value", "indeterminate", "disabled"])) : createCommentVNode("v-if", true),
  57196. createVNode(unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  57197. ], 6)
  57198. ], 42, _hoisted_1$8);
  57199. };
  57200. }
  57201. });
  57202. var ElTreeNode = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree-v2/src/tree-node.vue"]]);
  57203. const __default__$7 = /* @__PURE__ */ defineComponent({
  57204. name: "ElTreeV2"
  57205. });
  57206. const _sfc_main$c = /* @__PURE__ */ defineComponent({
  57207. ...__default__$7,
  57208. props: treeProps,
  57209. emits: treeEmits,
  57210. setup(__props, { expose, emit: emit2 }) {
  57211. const props = __props;
  57212. const slots = useSlots();
  57213. const treeNodeSize = computed(() => props.itemSize);
  57214. provide(ROOT_TREE_INJECTION_KEY, {
  57215. ctx: {
  57216. emit: emit2,
  57217. slots
  57218. },
  57219. props,
  57220. instance: getCurrentInstance()
  57221. });
  57222. provide(formItemContextKey, void 0);
  57223. const { t } = useLocale();
  57224. const ns = useNamespace("tree");
  57225. const {
  57226. flattenTree,
  57227. isNotEmpty,
  57228. toggleExpand,
  57229. isExpanded,
  57230. isIndeterminate,
  57231. isChecked,
  57232. isDisabled,
  57233. isCurrent,
  57234. isForceHiddenExpandIcon,
  57235. handleNodeClick,
  57236. handleNodeCheck,
  57237. toggleCheckbox,
  57238. getCurrentNode,
  57239. getCurrentKey,
  57240. setCurrentKey,
  57241. getCheckedKeys,
  57242. getCheckedNodes,
  57243. getHalfCheckedKeys,
  57244. getHalfCheckedNodes,
  57245. setChecked: setChecked2,
  57246. setCheckedKeys,
  57247. filter,
  57248. setData,
  57249. getNode,
  57250. expandNode,
  57251. collapseNode,
  57252. setExpandedKeys
  57253. } = useTree(props, emit2);
  57254. expose({
  57255. toggleCheckbox,
  57256. getCurrentNode,
  57257. getCurrentKey,
  57258. setCurrentKey,
  57259. getCheckedKeys,
  57260. getCheckedNodes,
  57261. getHalfCheckedKeys,
  57262. getHalfCheckedNodes,
  57263. setChecked: setChecked2,
  57264. setCheckedKeys,
  57265. filter,
  57266. setData,
  57267. getNode,
  57268. expandNode,
  57269. collapseNode,
  57270. setExpandedKeys
  57271. });
  57272. return (_ctx, _cache) => {
  57273. var _a2;
  57274. return openBlock(), createElementBlock("div", {
  57275. class: normalizeClass([unref(ns).b(), { [unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  57276. role: "tree"
  57277. }, [
  57278. unref(isNotEmpty) ? (openBlock(), createBlock(unref(FixedSizeList), {
  57279. key: 0,
  57280. "class-name": unref(ns).b("virtual-list"),
  57281. data: unref(flattenTree),
  57282. total: unref(flattenTree).length,
  57283. height: _ctx.height,
  57284. "item-size": unref(treeNodeSize),
  57285. "perf-mode": _ctx.perfMode
  57286. }, {
  57287. default: withCtx(({ data, index: index2, style }) => [
  57288. (openBlock(), createBlock(ElTreeNode, {
  57289. key: data[index2].key,
  57290. style: normalizeStyle(style),
  57291. node: data[index2],
  57292. expanded: unref(isExpanded)(data[index2]),
  57293. "show-checkbox": _ctx.showCheckbox,
  57294. checked: unref(isChecked)(data[index2]),
  57295. indeterminate: unref(isIndeterminate)(data[index2]),
  57296. "item-size": unref(treeNodeSize),
  57297. disabled: unref(isDisabled)(data[index2]),
  57298. current: unref(isCurrent)(data[index2]),
  57299. "hidden-expand-icon": unref(isForceHiddenExpandIcon)(data[index2]),
  57300. onClick: unref(handleNodeClick),
  57301. onToggle: unref(toggleExpand),
  57302. onCheck: unref(handleNodeCheck)
  57303. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"]))
  57304. ]),
  57305. _: 1
  57306. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (openBlock(), createElementBlock("div", {
  57307. key: 1,
  57308. class: normalizeClass(unref(ns).e("empty-block"))
  57309. }, [
  57310. createBaseVNode("span", {
  57311. class: normalizeClass(unref(ns).e("empty-text"))
  57312. }, toDisplayString((_a2 = _ctx.emptyText) != null ? _a2 : unref(t)("el.tree.emptyText")), 3)
  57313. ], 2))
  57314. ], 2);
  57315. };
  57316. }
  57317. });
  57318. var TreeV2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tree-v2/src/tree.vue"]]);
  57319. const ElTreeV2 = withInstall(TreeV2);
  57320. const uploadContextKey = Symbol("uploadContextKey");
  57321. const SCOPE$2 = "ElUpload";
  57322. class UploadAjaxError extends Error {
  57323. constructor(message2, status, method2, url) {
  57324. super(message2);
  57325. this.name = "UploadAjaxError";
  57326. this.status = status;
  57327. this.method = method2;
  57328. this.url = url;
  57329. }
  57330. }
  57331. function getError(action, option, xhr) {
  57332. let msg;
  57333. if (xhr.response) {
  57334. msg = `${xhr.response.error || xhr.response}`;
  57335. } else if (xhr.responseText) {
  57336. msg = `${xhr.responseText}`;
  57337. } else {
  57338. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  57339. }
  57340. return new UploadAjaxError(msg, xhr.status, option.method, action);
  57341. }
  57342. function getBody(xhr) {
  57343. const text = xhr.responseText || xhr.response;
  57344. if (!text) {
  57345. return text;
  57346. }
  57347. try {
  57348. return JSON.parse(text);
  57349. } catch (e) {
  57350. return text;
  57351. }
  57352. }
  57353. const ajaxUpload = (option) => {
  57354. if (typeof XMLHttpRequest === "undefined")
  57355. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  57356. const xhr = new XMLHttpRequest();
  57357. const action = option.action;
  57358. if (xhr.upload) {
  57359. xhr.upload.addEventListener("progress", (evt) => {
  57360. const progressEvt = evt;
  57361. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  57362. option.onProgress(progressEvt);
  57363. });
  57364. }
  57365. const formData = new FormData();
  57366. if (option.data) {
  57367. for (const [key, value] of Object.entries(option.data)) {
  57368. if (isArray$3(value) && value.length)
  57369. formData.append(key, ...value);
  57370. else
  57371. formData.append(key, value);
  57372. }
  57373. }
  57374. formData.append(option.filename, option.file, option.file.name);
  57375. xhr.addEventListener("error", () => {
  57376. option.onError(getError(action, option, xhr));
  57377. });
  57378. xhr.addEventListener("load", () => {
  57379. if (xhr.status < 200 || xhr.status >= 300) {
  57380. return option.onError(getError(action, option, xhr));
  57381. }
  57382. option.onSuccess(getBody(xhr));
  57383. });
  57384. xhr.open(option.method, action, true);
  57385. if (option.withCredentials && "withCredentials" in xhr) {
  57386. xhr.withCredentials = true;
  57387. }
  57388. const headers = option.headers || {};
  57389. if (headers instanceof Headers) {
  57390. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  57391. } else {
  57392. for (const [key, value] of Object.entries(headers)) {
  57393. if (isNil(value))
  57394. continue;
  57395. xhr.setRequestHeader(key, String(value));
  57396. }
  57397. }
  57398. xhr.send(formData);
  57399. return xhr;
  57400. };
  57401. const uploadListTypes = ["text", "picture", "picture-card"];
  57402. let fileId = 1;
  57403. const genFileId = () => Date.now() + fileId++;
  57404. const uploadBaseProps = buildProps({
  57405. action: {
  57406. type: String,
  57407. default: "#"
  57408. },
  57409. headers: {
  57410. type: definePropType(Object)
  57411. },
  57412. method: {
  57413. type: String,
  57414. default: "post"
  57415. },
  57416. data: {
  57417. type: definePropType([Object, Function, Promise]),
  57418. default: () => mutable({})
  57419. },
  57420. multiple: {
  57421. type: Boolean,
  57422. default: false
  57423. },
  57424. name: {
  57425. type: String,
  57426. default: "file"
  57427. },
  57428. drag: {
  57429. type: Boolean,
  57430. default: false
  57431. },
  57432. withCredentials: Boolean,
  57433. showFileList: {
  57434. type: Boolean,
  57435. default: true
  57436. },
  57437. accept: {
  57438. type: String,
  57439. default: ""
  57440. },
  57441. fileList: {
  57442. type: definePropType(Array),
  57443. default: () => mutable([])
  57444. },
  57445. autoUpload: {
  57446. type: Boolean,
  57447. default: true
  57448. },
  57449. listType: {
  57450. type: String,
  57451. values: uploadListTypes,
  57452. default: "text"
  57453. },
  57454. httpRequest: {
  57455. type: definePropType(Function),
  57456. default: ajaxUpload
  57457. },
  57458. disabled: Boolean,
  57459. limit: Number
  57460. });
  57461. const uploadProps = buildProps({
  57462. ...uploadBaseProps,
  57463. beforeUpload: {
  57464. type: definePropType(Function),
  57465. default: NOOP
  57466. },
  57467. beforeRemove: {
  57468. type: definePropType(Function)
  57469. },
  57470. onRemove: {
  57471. type: definePropType(Function),
  57472. default: NOOP
  57473. },
  57474. onChange: {
  57475. type: definePropType(Function),
  57476. default: NOOP
  57477. },
  57478. onPreview: {
  57479. type: definePropType(Function),
  57480. default: NOOP
  57481. },
  57482. onSuccess: {
  57483. type: definePropType(Function),
  57484. default: NOOP
  57485. },
  57486. onProgress: {
  57487. type: definePropType(Function),
  57488. default: NOOP
  57489. },
  57490. onError: {
  57491. type: definePropType(Function),
  57492. default: NOOP
  57493. },
  57494. onExceed: {
  57495. type: definePropType(Function),
  57496. default: NOOP
  57497. }
  57498. });
  57499. const uploadListProps = buildProps({
  57500. files: {
  57501. type: definePropType(Array),
  57502. default: () => mutable([])
  57503. },
  57504. disabled: {
  57505. type: Boolean,
  57506. default: false
  57507. },
  57508. handlePreview: {
  57509. type: definePropType(Function),
  57510. default: NOOP
  57511. },
  57512. listType: {
  57513. type: String,
  57514. values: uploadListTypes,
  57515. default: "text"
  57516. }
  57517. });
  57518. const uploadListEmits = {
  57519. remove: (file) => !!file
  57520. };
  57521. const _hoisted_1$7 = ["onKeydown"];
  57522. const _hoisted_2$5 = ["src"];
  57523. const _hoisted_3$2 = ["onClick"];
  57524. const _hoisted_4$1 = ["title"];
  57525. const _hoisted_5 = ["onClick"];
  57526. const _hoisted_6 = ["onClick"];
  57527. const __default__$6 = /* @__PURE__ */ defineComponent({
  57528. name: "ElUploadList"
  57529. });
  57530. const _sfc_main$b = /* @__PURE__ */ defineComponent({
  57531. ...__default__$6,
  57532. props: uploadListProps,
  57533. emits: uploadListEmits,
  57534. setup(__props, { emit: emit2 }) {
  57535. const props = __props;
  57536. const { t } = useLocale();
  57537. const nsUpload = useNamespace("upload");
  57538. const nsIcon = useNamespace("icon");
  57539. const nsList = useNamespace("list");
  57540. const disabled = useFormDisabled();
  57541. const focusing = ref(false);
  57542. const containerKls = computed(() => [
  57543. nsUpload.b("list"),
  57544. nsUpload.bm("list", props.listType),
  57545. nsUpload.is("disabled", props.disabled)
  57546. ]);
  57547. const handleRemove = (file) => {
  57548. emit2("remove", file);
  57549. };
  57550. return (_ctx, _cache) => {
  57551. return openBlock(), createBlock(TransitionGroup, {
  57552. tag: "ul",
  57553. class: normalizeClass(unref(containerKls)),
  57554. name: unref(nsList).b()
  57555. }, {
  57556. default: withCtx(() => [
  57557. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
  57558. return openBlock(), createElementBlock("li", {
  57559. key: file.uid || file.name,
  57560. class: normalizeClass([
  57561. unref(nsUpload).be("list", "item"),
  57562. unref(nsUpload).is(file.status),
  57563. { focusing: focusing.value }
  57564. ]),
  57565. tabindex: "0",
  57566. onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
  57567. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  57568. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  57569. onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
  57570. }, [
  57571. renderSlot(_ctx.$slots, "default", { file }, () => [
  57572. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  57573. key: 0,
  57574. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  57575. src: file.url,
  57576. alt: ""
  57577. }, null, 10, _hoisted_2$5)) : createCommentVNode("v-if", true),
  57578. file.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
  57579. key: 1,
  57580. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  57581. }, [
  57582. createBaseVNode("a", {
  57583. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  57584. onClick: withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  57585. }, [
  57586. createVNode(unref(ElIcon), {
  57587. class: normalizeClass(unref(nsIcon).m("document"))
  57588. }, {
  57589. default: withCtx(() => [
  57590. createVNode(unref(document_default))
  57591. ]),
  57592. _: 1
  57593. }, 8, ["class"]),
  57594. createBaseVNode("span", {
  57595. class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
  57596. title: file.name
  57597. }, toDisplayString(file.name), 11, _hoisted_4$1)
  57598. ], 10, _hoisted_3$2),
  57599. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  57600. key: 0,
  57601. type: _ctx.listType === "picture-card" ? "circle" : "line",
  57602. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  57603. percentage: Number(file.percentage),
  57604. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  57605. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  57606. ], 2)) : createCommentVNode("v-if", true),
  57607. createBaseVNode("label", {
  57608. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  57609. }, [
  57610. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  57611. key: 0,
  57612. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  57613. }, {
  57614. default: withCtx(() => [
  57615. createVNode(unref(circle_check_default))
  57616. ]),
  57617. _: 1
  57618. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  57619. key: 1,
  57620. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  57621. }, {
  57622. default: withCtx(() => [
  57623. createVNode(unref(check_default))
  57624. ]),
  57625. _: 1
  57626. }, 8, ["class"])) : createCommentVNode("v-if", true)
  57627. ], 2),
  57628. !unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
  57629. key: 2,
  57630. class: normalizeClass(unref(nsIcon).m("close")),
  57631. onClick: ($event) => handleRemove(file)
  57632. }, {
  57633. default: withCtx(() => [
  57634. createVNode(unref(close_default))
  57635. ]),
  57636. _: 2
  57637. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  57638. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  57639. createCommentVNode(" This is a bug which needs to be fixed "),
  57640. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  57641. !unref(disabled) ? (openBlock(), createElementBlock("i", {
  57642. key: 3,
  57643. class: normalizeClass(unref(nsIcon).m("close-tip"))
  57644. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  57645. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  57646. key: 4,
  57647. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  57648. }, [
  57649. createBaseVNode("span", {
  57650. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  57651. onClick: ($event) => _ctx.handlePreview(file)
  57652. }, [
  57653. createVNode(unref(ElIcon), {
  57654. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  57655. }, {
  57656. default: withCtx(() => [
  57657. createVNode(unref(zoom_in_default))
  57658. ]),
  57659. _: 1
  57660. }, 8, ["class"])
  57661. ], 10, _hoisted_5),
  57662. !unref(disabled) ? (openBlock(), createElementBlock("span", {
  57663. key: 0,
  57664. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  57665. onClick: ($event) => handleRemove(file)
  57666. }, [
  57667. createVNode(unref(ElIcon), {
  57668. class: normalizeClass(unref(nsIcon).m("delete"))
  57669. }, {
  57670. default: withCtx(() => [
  57671. createVNode(unref(delete_default))
  57672. ]),
  57673. _: 1
  57674. }, 8, ["class"])
  57675. ], 10, _hoisted_6)) : createCommentVNode("v-if", true)
  57676. ], 2)) : createCommentVNode("v-if", true)
  57677. ])
  57678. ], 42, _hoisted_1$7);
  57679. }), 128)),
  57680. renderSlot(_ctx.$slots, "append")
  57681. ]),
  57682. _: 3
  57683. }, 8, ["class", "name"]);
  57684. };
  57685. }
  57686. });
  57687. var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
  57688. const uploadDraggerProps = buildProps({
  57689. disabled: {
  57690. type: Boolean,
  57691. default: false
  57692. }
  57693. });
  57694. const uploadDraggerEmits = {
  57695. file: (file) => isArray$3(file)
  57696. };
  57697. const _hoisted_1$6 = ["onDrop", "onDragover"];
  57698. const COMPONENT_NAME = "ElUploadDrag";
  57699. const __default__$5 = /* @__PURE__ */ defineComponent({
  57700. name: COMPONENT_NAME
  57701. });
  57702. const _sfc_main$a = /* @__PURE__ */ defineComponent({
  57703. ...__default__$5,
  57704. props: uploadDraggerProps,
  57705. emits: uploadDraggerEmits,
  57706. setup(__props, { emit: emit2 }) {
  57707. const uploaderContext = inject(uploadContextKey);
  57708. if (!uploaderContext) {
  57709. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  57710. }
  57711. const ns = useNamespace("upload");
  57712. const dragover = ref(false);
  57713. const disabled = useFormDisabled();
  57714. const onDrop = (e) => {
  57715. if (disabled.value)
  57716. return;
  57717. dragover.value = false;
  57718. e.stopPropagation();
  57719. const files = Array.from(e.dataTransfer.files);
  57720. const accept = uploaderContext.accept.value;
  57721. if (!accept) {
  57722. emit2("file", files);
  57723. return;
  57724. }
  57725. const filesFiltered = files.filter((file) => {
  57726. const { type: type2, name } = file;
  57727. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  57728. const baseType = type2.replace(/\/.*$/, "");
  57729. return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
  57730. if (acceptedType.startsWith(".")) {
  57731. return extension === acceptedType;
  57732. }
  57733. if (/\/\*$/.test(acceptedType)) {
  57734. return baseType === acceptedType.replace(/\/\*$/, "");
  57735. }
  57736. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  57737. return type2 === acceptedType;
  57738. }
  57739. return false;
  57740. });
  57741. });
  57742. emit2("file", filesFiltered);
  57743. };
  57744. const onDragover = () => {
  57745. if (!disabled.value)
  57746. dragover.value = true;
  57747. };
  57748. return (_ctx, _cache) => {
  57749. return openBlock(), createElementBlock("div", {
  57750. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  57751. onDrop: withModifiers(onDrop, ["prevent"]),
  57752. onDragover: withModifiers(onDragover, ["prevent"]),
  57753. onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
  57754. }, [
  57755. renderSlot(_ctx.$slots, "default")
  57756. ], 42, _hoisted_1$6);
  57757. };
  57758. }
  57759. });
  57760. var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
  57761. const uploadContentProps = buildProps({
  57762. ...uploadBaseProps,
  57763. beforeUpload: {
  57764. type: definePropType(Function),
  57765. default: NOOP
  57766. },
  57767. onRemove: {
  57768. type: definePropType(Function),
  57769. default: NOOP
  57770. },
  57771. onStart: {
  57772. type: definePropType(Function),
  57773. default: NOOP
  57774. },
  57775. onSuccess: {
  57776. type: definePropType(Function),
  57777. default: NOOP
  57778. },
  57779. onProgress: {
  57780. type: definePropType(Function),
  57781. default: NOOP
  57782. },
  57783. onError: {
  57784. type: definePropType(Function),
  57785. default: NOOP
  57786. },
  57787. onExceed: {
  57788. type: definePropType(Function),
  57789. default: NOOP
  57790. }
  57791. });
  57792. const _hoisted_1$5 = ["onKeydown"];
  57793. const _hoisted_2$4 = ["name", "multiple", "accept"];
  57794. const __default__$4 = /* @__PURE__ */ defineComponent({
  57795. name: "ElUploadContent",
  57796. inheritAttrs: false
  57797. });
  57798. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  57799. ...__default__$4,
  57800. props: uploadContentProps,
  57801. setup(__props, { expose }) {
  57802. const props = __props;
  57803. const ns = useNamespace("upload");
  57804. const disabled = useFormDisabled();
  57805. const requests = shallowRef({});
  57806. const inputRef = shallowRef();
  57807. const uploadFiles = (files) => {
  57808. if (files.length === 0)
  57809. return;
  57810. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  57811. if (limit && fileList.length + files.length > limit) {
  57812. onExceed(files, fileList);
  57813. return;
  57814. }
  57815. if (!multiple) {
  57816. files = files.slice(0, 1);
  57817. }
  57818. for (const file of files) {
  57819. const rawFile = file;
  57820. rawFile.uid = genFileId();
  57821. onStart(rawFile);
  57822. if (autoUpload)
  57823. upload(rawFile);
  57824. }
  57825. };
  57826. const upload = async (rawFile) => {
  57827. inputRef.value.value = "";
  57828. if (!props.beforeUpload) {
  57829. return doUpload(rawFile);
  57830. }
  57831. let hookResult;
  57832. let beforeData = {};
  57833. try {
  57834. const originData = props.data;
  57835. const beforeUploadPromise = props.beforeUpload(rawFile);
  57836. beforeData = isPlainObject$2(props.data) ? cloneDeep(props.data) : props.data;
  57837. hookResult = await beforeUploadPromise;
  57838. if (isPlainObject$2(props.data) && isEqual$1(originData, beforeData)) {
  57839. beforeData = cloneDeep(props.data);
  57840. }
  57841. } catch (e) {
  57842. hookResult = false;
  57843. }
  57844. if (hookResult === false) {
  57845. props.onRemove(rawFile);
  57846. return;
  57847. }
  57848. let file = rawFile;
  57849. if (hookResult instanceof Blob) {
  57850. if (hookResult instanceof File) {
  57851. file = hookResult;
  57852. } else {
  57853. file = new File([hookResult], rawFile.name, {
  57854. type: rawFile.type
  57855. });
  57856. }
  57857. }
  57858. doUpload(Object.assign(file, {
  57859. uid: rawFile.uid
  57860. }), beforeData);
  57861. };
  57862. const resolveData = async (data, rawFile) => {
  57863. if (isFunction$2(data)) {
  57864. return data(rawFile);
  57865. }
  57866. return data;
  57867. };
  57868. const doUpload = async (rawFile, beforeData) => {
  57869. const {
  57870. headers,
  57871. data,
  57872. method: method2,
  57873. withCredentials,
  57874. name: filename,
  57875. action,
  57876. onProgress,
  57877. onSuccess,
  57878. onError,
  57879. httpRequest
  57880. } = props;
  57881. try {
  57882. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  57883. } catch (e) {
  57884. props.onRemove(rawFile);
  57885. return;
  57886. }
  57887. const { uid: uid2 } = rawFile;
  57888. const options = {
  57889. headers: headers || {},
  57890. withCredentials,
  57891. file: rawFile,
  57892. data: beforeData,
  57893. method: method2,
  57894. filename,
  57895. action,
  57896. onProgress: (evt) => {
  57897. onProgress(evt, rawFile);
  57898. },
  57899. onSuccess: (res) => {
  57900. onSuccess(res, rawFile);
  57901. delete requests.value[uid2];
  57902. },
  57903. onError: (err) => {
  57904. onError(err, rawFile);
  57905. delete requests.value[uid2];
  57906. }
  57907. };
  57908. const request = httpRequest(options);
  57909. requests.value[uid2] = request;
  57910. if (request instanceof Promise) {
  57911. request.then(options.onSuccess, options.onError);
  57912. }
  57913. };
  57914. const handleChange = (e) => {
  57915. const files = e.target.files;
  57916. if (!files)
  57917. return;
  57918. uploadFiles(Array.from(files));
  57919. };
  57920. const handleClick = () => {
  57921. if (!disabled.value) {
  57922. inputRef.value.value = "";
  57923. inputRef.value.click();
  57924. }
  57925. };
  57926. const handleKeydown = () => {
  57927. handleClick();
  57928. };
  57929. const abort = (file) => {
  57930. const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
  57931. _reqs.forEach(([uid2, req]) => {
  57932. if (req instanceof XMLHttpRequest)
  57933. req.abort();
  57934. delete requests.value[uid2];
  57935. });
  57936. };
  57937. expose({
  57938. abort,
  57939. upload
  57940. });
  57941. return (_ctx, _cache) => {
  57942. return openBlock(), createElementBlock("div", {
  57943. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType), unref(ns).is("drag", _ctx.drag)]),
  57944. tabindex: "0",
  57945. onClick: handleClick,
  57946. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  57947. }, [
  57948. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  57949. key: 0,
  57950. disabled: unref(disabled),
  57951. onFile: uploadFiles
  57952. }, {
  57953. default: withCtx(() => [
  57954. renderSlot(_ctx.$slots, "default")
  57955. ]),
  57956. _: 3
  57957. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  57958. createBaseVNode("input", {
  57959. ref_key: "inputRef",
  57960. ref: inputRef,
  57961. class: normalizeClass(unref(ns).e("input")),
  57962. name: _ctx.name,
  57963. multiple: _ctx.multiple,
  57964. accept: _ctx.accept,
  57965. type: "file",
  57966. onChange: handleChange,
  57967. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  57968. }, ["stop"]))
  57969. }, null, 42, _hoisted_2$4)
  57970. ], 42, _hoisted_1$5);
  57971. };
  57972. }
  57973. });
  57974. var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
  57975. const SCOPE$1 = "ElUpload";
  57976. const revokeFileObjectURL = (file) => {
  57977. var _a2;
  57978. if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
  57979. URL.revokeObjectURL(file.url);
  57980. }
  57981. };
  57982. const useHandlers = (props, uploadRef) => {
  57983. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  57984. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  57985. function abort(file) {
  57986. var _a2;
  57987. (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
  57988. }
  57989. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  57990. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  57991. }
  57992. const handleError2 = (err, rawFile) => {
  57993. const file = getFile(rawFile);
  57994. if (!file)
  57995. return;
  57996. console.error(err);
  57997. file.status = "fail";
  57998. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  57999. props.onError(err, file, uploadFiles.value);
  58000. props.onChange(file, uploadFiles.value);
  58001. };
  58002. const handleProgress = (evt, rawFile) => {
  58003. const file = getFile(rawFile);
  58004. if (!file)
  58005. return;
  58006. props.onProgress(evt, file, uploadFiles.value);
  58007. file.status = "uploading";
  58008. file.percentage = Math.round(evt.percent);
  58009. };
  58010. const handleSuccess = (response, rawFile) => {
  58011. const file = getFile(rawFile);
  58012. if (!file)
  58013. return;
  58014. file.status = "success";
  58015. file.response = response;
  58016. props.onSuccess(response, file, uploadFiles.value);
  58017. props.onChange(file, uploadFiles.value);
  58018. };
  58019. const handleStart = (file) => {
  58020. if (isNil(file.uid))
  58021. file.uid = genFileId();
  58022. const uploadFile = {
  58023. name: file.name,
  58024. percentage: 0,
  58025. status: "ready",
  58026. size: file.size,
  58027. raw: file,
  58028. uid: file.uid
  58029. };
  58030. if (props.listType === "picture-card" || props.listType === "picture") {
  58031. try {
  58032. uploadFile.url = URL.createObjectURL(file);
  58033. } catch (err) {
  58034. debugWarn(SCOPE$1, err.message);
  58035. props.onError(err, uploadFile, uploadFiles.value);
  58036. }
  58037. }
  58038. uploadFiles.value = [...uploadFiles.value, uploadFile];
  58039. props.onChange(uploadFile, uploadFiles.value);
  58040. };
  58041. const handleRemove = async (file) => {
  58042. const uploadFile = file instanceof File ? getFile(file) : file;
  58043. if (!uploadFile)
  58044. throwError(SCOPE$1, "file to be removed not found");
  58045. const doRemove = (file2) => {
  58046. abort(file2);
  58047. const fileList = uploadFiles.value;
  58048. fileList.splice(fileList.indexOf(file2), 1);
  58049. props.onRemove(file2, fileList);
  58050. revokeFileObjectURL(file2);
  58051. };
  58052. if (props.beforeRemove) {
  58053. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  58054. if (before !== false)
  58055. doRemove(uploadFile);
  58056. } else {
  58057. doRemove(uploadFile);
  58058. }
  58059. };
  58060. function submit() {
  58061. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  58062. var _a2;
  58063. return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
  58064. });
  58065. }
  58066. watch(() => props.listType, (val) => {
  58067. if (val !== "picture-card" && val !== "picture") {
  58068. return;
  58069. }
  58070. uploadFiles.value = uploadFiles.value.map((file) => {
  58071. const { raw, url } = file;
  58072. if (!url && raw) {
  58073. try {
  58074. file.url = URL.createObjectURL(raw);
  58075. } catch (err) {
  58076. props.onError(err, file, uploadFiles.value);
  58077. }
  58078. }
  58079. return file;
  58080. });
  58081. });
  58082. watch(uploadFiles, (files) => {
  58083. for (const file of files) {
  58084. file.uid || (file.uid = genFileId());
  58085. file.status || (file.status = "success");
  58086. }
  58087. }, { immediate: true, deep: true });
  58088. return {
  58089. uploadFiles,
  58090. abort,
  58091. clearFiles,
  58092. handleError: handleError2,
  58093. handleProgress,
  58094. handleStart,
  58095. handleSuccess,
  58096. handleRemove,
  58097. submit,
  58098. revokeFileObjectURL
  58099. };
  58100. };
  58101. const __default__$3 = /* @__PURE__ */ defineComponent({
  58102. name: "ElUpload"
  58103. });
  58104. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  58105. ...__default__$3,
  58106. props: uploadProps,
  58107. setup(__props, { expose }) {
  58108. const props = __props;
  58109. const disabled = useFormDisabled();
  58110. const uploadRef = shallowRef();
  58111. const {
  58112. abort,
  58113. submit,
  58114. clearFiles,
  58115. uploadFiles,
  58116. handleStart,
  58117. handleError: handleError2,
  58118. handleRemove,
  58119. handleSuccess,
  58120. handleProgress,
  58121. revokeFileObjectURL: revokeFileObjectURL2
  58122. } = useHandlers(props, uploadRef);
  58123. const isPictureCard = computed(() => props.listType === "picture-card");
  58124. const uploadContentProps2 = computed(() => ({
  58125. ...props,
  58126. fileList: uploadFiles.value,
  58127. onStart: handleStart,
  58128. onProgress: handleProgress,
  58129. onSuccess: handleSuccess,
  58130. onError: handleError2,
  58131. onRemove: handleRemove
  58132. }));
  58133. onBeforeUnmount(() => {
  58134. uploadFiles.value.forEach(revokeFileObjectURL2);
  58135. });
  58136. provide(uploadContextKey, {
  58137. accept: toRef(props, "accept")
  58138. });
  58139. expose({
  58140. abort,
  58141. submit,
  58142. clearFiles,
  58143. handleStart,
  58144. handleRemove
  58145. });
  58146. return (_ctx, _cache) => {
  58147. return openBlock(), createElementBlock("div", null, [
  58148. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  58149. key: 0,
  58150. disabled: unref(disabled),
  58151. "list-type": _ctx.listType,
  58152. files: unref(uploadFiles),
  58153. "handle-preview": _ctx.onPreview,
  58154. onRemove: unref(handleRemove)
  58155. }, createSlots({
  58156. append: withCtx(() => [
  58157. createVNode(UploadContent, mergeProps({
  58158. ref_key: "uploadRef",
  58159. ref: uploadRef
  58160. }, unref(uploadContentProps2)), {
  58161. default: withCtx(() => [
  58162. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  58163. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  58164. ]),
  58165. _: 3
  58166. }, 16)
  58167. ]),
  58168. _: 2
  58169. }, [
  58170. _ctx.$slots.file ? {
  58171. name: "default",
  58172. fn: withCtx(({ file }) => [
  58173. renderSlot(_ctx.$slots, "file", { file })
  58174. ])
  58175. } : void 0
  58176. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  58177. !unref(isPictureCard) || unref(isPictureCard) && !_ctx.showFileList ? (openBlock(), createBlock(UploadContent, mergeProps({
  58178. key: 1,
  58179. ref_key: "uploadRef",
  58180. ref: uploadRef
  58181. }, unref(uploadContentProps2)), {
  58182. default: withCtx(() => [
  58183. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  58184. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  58185. ]),
  58186. _: 3
  58187. }, 16)) : createCommentVNode("v-if", true),
  58188. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  58189. renderSlot(_ctx.$slots, "tip"),
  58190. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  58191. key: 3,
  58192. disabled: unref(disabled),
  58193. "list-type": _ctx.listType,
  58194. files: unref(uploadFiles),
  58195. "handle-preview": _ctx.onPreview,
  58196. onRemove: unref(handleRemove)
  58197. }, createSlots({ _: 2 }, [
  58198. _ctx.$slots.file ? {
  58199. name: "default",
  58200. fn: withCtx(({ file }) => [
  58201. renderSlot(_ctx.$slots, "file", { file })
  58202. ])
  58203. } : void 0
  58204. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  58205. ]);
  58206. };
  58207. }
  58208. });
  58209. var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
  58210. const ElUpload = withInstall(Upload);
  58211. const watermarkProps = buildProps({
  58212. zIndex: {
  58213. type: Number,
  58214. default: 9
  58215. },
  58216. rotate: {
  58217. type: Number,
  58218. default: -22
  58219. },
  58220. width: Number,
  58221. height: Number,
  58222. image: String,
  58223. content: {
  58224. type: definePropType([String, Array]),
  58225. default: "Element Plus"
  58226. },
  58227. font: {
  58228. type: definePropType(Object)
  58229. },
  58230. gap: {
  58231. type: definePropType(Array),
  58232. default: () => [100, 100]
  58233. },
  58234. offset: {
  58235. type: definePropType(Array)
  58236. }
  58237. });
  58238. function toLowercaseSeparator(key) {
  58239. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  58240. }
  58241. function getStyleStr(style) {
  58242. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  58243. }
  58244. function getPixelRatio() {
  58245. return window.devicePixelRatio || 1;
  58246. }
  58247. const reRendering = (mutation, watermarkElement) => {
  58248. let flag = false;
  58249. if (mutation.removedNodes.length && watermarkElement) {
  58250. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  58251. }
  58252. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  58253. flag = true;
  58254. }
  58255. return flag;
  58256. };
  58257. const FontGap = 3;
  58258. function prepareCanvas(width, height, ratio = 1) {
  58259. const canvas = document.createElement("canvas");
  58260. const ctx = canvas.getContext("2d");
  58261. const realWidth = width * ratio;
  58262. const realHeight = height * ratio;
  58263. canvas.setAttribute("width", `${realWidth}px`);
  58264. canvas.setAttribute("height", `${realHeight}px`);
  58265. ctx.save();
  58266. return [ctx, canvas, realWidth, realHeight];
  58267. }
  58268. function useClips() {
  58269. function getClips(content, rotate, ratio, width, height, font, gapX, gapY) {
  58270. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  58271. if (content instanceof HTMLImageElement) {
  58272. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  58273. } else {
  58274. const {
  58275. color,
  58276. fontSize,
  58277. fontStyle,
  58278. fontWeight,
  58279. fontFamily,
  58280. textAlign,
  58281. textBaseline
  58282. } = font;
  58283. const mergedFontSize = Number(fontSize) * ratio;
  58284. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  58285. ctx.fillStyle = color;
  58286. ctx.textAlign = textAlign;
  58287. ctx.textBaseline = textBaseline;
  58288. const contents = Array.isArray(content) ? content : [content];
  58289. contents == null ? void 0 : contents.forEach((item, index2) => {
  58290. ctx.fillText(item != null ? item : "", contentWidth / 2, index2 * (mergedFontSize + FontGap * ratio));
  58291. });
  58292. }
  58293. const angle = Math.PI / 180 * Number(rotate);
  58294. const maxSize = Math.max(width, height);
  58295. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  58296. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  58297. rCtx.rotate(angle);
  58298. if (contentWidth > 0 && contentHeight > 0) {
  58299. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  58300. }
  58301. function getRotatePos(x2, y) {
  58302. const targetX = x2 * Math.cos(angle) - y * Math.sin(angle);
  58303. const targetY = x2 * Math.sin(angle) + y * Math.cos(angle);
  58304. return [targetX, targetY];
  58305. }
  58306. let left2 = 0;
  58307. let right2 = 0;
  58308. let top = 0;
  58309. let bottom = 0;
  58310. const halfWidth = contentWidth / 2;
  58311. const halfHeight = contentHeight / 2;
  58312. const points = [
  58313. [0 - halfWidth, 0 - halfHeight],
  58314. [0 + halfWidth, 0 - halfHeight],
  58315. [0 + halfWidth, 0 + halfHeight],
  58316. [0 - halfWidth, 0 + halfHeight]
  58317. ];
  58318. points.forEach(([x2, y]) => {
  58319. const [targetX, targetY] = getRotatePos(x2, y);
  58320. left2 = Math.min(left2, targetX);
  58321. right2 = Math.max(right2, targetX);
  58322. top = Math.min(top, targetY);
  58323. bottom = Math.max(bottom, targetY);
  58324. });
  58325. const cutLeft = left2 + realMaxSize / 2;
  58326. const cutTop = top + realMaxSize / 2;
  58327. const cutWidth = right2 - left2;
  58328. const cutHeight = bottom - top;
  58329. const realGapX = gapX * ratio;
  58330. const realGapY = gapY * ratio;
  58331. const filledWidth = (cutWidth + realGapX) * 2;
  58332. const filledHeight = cutHeight + realGapY;
  58333. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  58334. function drawImg(targetX = 0, targetY = 0) {
  58335. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  58336. }
  58337. drawImg();
  58338. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  58339. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  58340. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  58341. }
  58342. return getClips;
  58343. }
  58344. const __default__$2 = /* @__PURE__ */ defineComponent({
  58345. name: "ElWatermark"
  58346. });
  58347. const _sfc_main$7 = /* @__PURE__ */ defineComponent({
  58348. ...__default__$2,
  58349. props: watermarkProps,
  58350. setup(__props) {
  58351. const props = __props;
  58352. const style = {
  58353. position: "relative"
  58354. };
  58355. const color = computed(() => {
  58356. var _a2, _b;
  58357. return (_b = (_a2 = props.font) == null ? void 0 : _a2.color) != null ? _b : "rgba(0,0,0,.15)";
  58358. });
  58359. const fontSize = computed(() => {
  58360. var _a2, _b;
  58361. return (_b = (_a2 = props.font) == null ? void 0 : _a2.fontSize) != null ? _b : 16;
  58362. });
  58363. const fontWeight = computed(() => {
  58364. var _a2, _b;
  58365. return (_b = (_a2 = props.font) == null ? void 0 : _a2.fontWeight) != null ? _b : "normal";
  58366. });
  58367. const fontStyle = computed(() => {
  58368. var _a2, _b;
  58369. return (_b = (_a2 = props.font) == null ? void 0 : _a2.fontStyle) != null ? _b : "normal";
  58370. });
  58371. const fontFamily = computed(() => {
  58372. var _a2, _b;
  58373. return (_b = (_a2 = props.font) == null ? void 0 : _a2.fontFamily) != null ? _b : "sans-serif";
  58374. });
  58375. const textAlign = computed(() => {
  58376. var _a2, _b;
  58377. return (_b = (_a2 = props.font) == null ? void 0 : _a2.textAlign) != null ? _b : "center";
  58378. });
  58379. const textBaseline = computed(() => {
  58380. var _a2, _b;
  58381. return (_b = (_a2 = props.font) == null ? void 0 : _a2.textBaseline) != null ? _b : "top";
  58382. });
  58383. const gapX = computed(() => props.gap[0]);
  58384. const gapY = computed(() => props.gap[1]);
  58385. const gapXCenter = computed(() => gapX.value / 2);
  58386. const gapYCenter = computed(() => gapY.value / 2);
  58387. const offsetLeft = computed(() => {
  58388. var _a2, _b;
  58389. return (_b = (_a2 = props.offset) == null ? void 0 : _a2[0]) != null ? _b : gapXCenter.value;
  58390. });
  58391. const offsetTop = computed(() => {
  58392. var _a2, _b;
  58393. return (_b = (_a2 = props.offset) == null ? void 0 : _a2[1]) != null ? _b : gapYCenter.value;
  58394. });
  58395. const getMarkStyle = () => {
  58396. const markStyle = {
  58397. zIndex: props.zIndex,
  58398. position: "absolute",
  58399. left: 0,
  58400. top: 0,
  58401. width: "100%",
  58402. height: "100%",
  58403. pointerEvents: "none",
  58404. backgroundRepeat: "repeat"
  58405. };
  58406. let positionLeft = offsetLeft.value - gapXCenter.value;
  58407. let positionTop = offsetTop.value - gapYCenter.value;
  58408. if (positionLeft > 0) {
  58409. markStyle.left = `${positionLeft}px`;
  58410. markStyle.width = `calc(100% - ${positionLeft}px)`;
  58411. positionLeft = 0;
  58412. }
  58413. if (positionTop > 0) {
  58414. markStyle.top = `${positionTop}px`;
  58415. markStyle.height = `calc(100% - ${positionTop}px)`;
  58416. positionTop = 0;
  58417. }
  58418. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  58419. return markStyle;
  58420. };
  58421. const containerRef = shallowRef(null);
  58422. const watermarkRef = shallowRef();
  58423. const stopObservation = ref(false);
  58424. const destroyWatermark = () => {
  58425. if (watermarkRef.value) {
  58426. watermarkRef.value.remove();
  58427. watermarkRef.value = void 0;
  58428. }
  58429. };
  58430. const appendWatermark = (base64Url, markWidth) => {
  58431. var _a2;
  58432. if (containerRef.value && watermarkRef.value) {
  58433. stopObservation.value = true;
  58434. watermarkRef.value.setAttribute("style", getStyleStr({
  58435. ...getMarkStyle(),
  58436. backgroundImage: `url('${base64Url}')`,
  58437. backgroundSize: `${Math.floor(markWidth)}px`
  58438. }));
  58439. (_a2 = containerRef.value) == null ? void 0 : _a2.append(watermarkRef.value);
  58440. setTimeout(() => {
  58441. stopObservation.value = false;
  58442. });
  58443. }
  58444. };
  58445. const getMarkSize = (ctx) => {
  58446. let defaultWidth = 120;
  58447. let defaultHeight = 64;
  58448. const image = props.image;
  58449. const content = props.content;
  58450. const width = props.width;
  58451. const height = props.height;
  58452. if (!image && ctx.measureText) {
  58453. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  58454. const contents = Array.isArray(content) ? content : [content];
  58455. const sizes = contents.map((item) => {
  58456. const metrics = ctx.measureText(item);
  58457. return [
  58458. metrics.width,
  58459. metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent
  58460. ];
  58461. });
  58462. defaultWidth = Math.ceil(Math.max(...sizes.map((size2) => size2[0])));
  58463. defaultHeight = Math.ceil(Math.max(...sizes.map((size2) => size2[1]))) * contents.length + (contents.length - 1) * FontGap;
  58464. }
  58465. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
  58466. };
  58467. const getClips = useClips();
  58468. const renderWatermark = () => {
  58469. const canvas = document.createElement("canvas");
  58470. const ctx = canvas.getContext("2d");
  58471. const image = props.image;
  58472. const content = props.content;
  58473. const rotate = props.rotate;
  58474. if (ctx) {
  58475. if (!watermarkRef.value) {
  58476. watermarkRef.value = document.createElement("div");
  58477. }
  58478. const ratio = getPixelRatio();
  58479. const [markWidth, markHeight] = getMarkSize(ctx);
  58480. const drawCanvas = (drawContent) => {
  58481. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  58482. color: color.value,
  58483. fontSize: fontSize.value,
  58484. fontStyle: fontStyle.value,
  58485. fontWeight: fontWeight.value,
  58486. fontFamily: fontFamily.value,
  58487. textAlign: textAlign.value,
  58488. textBaseline: textBaseline.value
  58489. }, gapX.value, gapY.value);
  58490. appendWatermark(textClips, clipWidth);
  58491. };
  58492. if (image) {
  58493. const img = new Image();
  58494. img.onload = () => {
  58495. drawCanvas(img);
  58496. };
  58497. img.onerror = () => {
  58498. drawCanvas(content);
  58499. };
  58500. img.crossOrigin = "anonymous";
  58501. img.referrerPolicy = "no-referrer";
  58502. img.src = image;
  58503. } else {
  58504. drawCanvas(content);
  58505. }
  58506. }
  58507. };
  58508. onMounted(() => {
  58509. renderWatermark();
  58510. });
  58511. watch(() => props, () => {
  58512. renderWatermark();
  58513. }, {
  58514. deep: true,
  58515. flush: "post"
  58516. });
  58517. onBeforeUnmount(() => {
  58518. destroyWatermark();
  58519. });
  58520. const onMutate = (mutations) => {
  58521. if (stopObservation.value) {
  58522. return;
  58523. }
  58524. mutations.forEach((mutation) => {
  58525. if (reRendering(mutation, watermarkRef.value)) {
  58526. destroyWatermark();
  58527. renderWatermark();
  58528. }
  58529. });
  58530. };
  58531. useMutationObserver(containerRef, onMutate, {
  58532. attributes: true
  58533. });
  58534. return (_ctx, _cache) => {
  58535. return openBlock(), createElementBlock("div", {
  58536. ref_key: "containerRef",
  58537. ref: containerRef,
  58538. style: normalizeStyle([style])
  58539. }, [
  58540. renderSlot(_ctx.$slots, "default")
  58541. ], 4);
  58542. };
  58543. }
  58544. });
  58545. var Watermark = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/watermark/src/watermark.vue"]]);
  58546. const ElWatermark = withInstall(Watermark);
  58547. var Components = [
  58548. ElAffix,
  58549. ElAlert,
  58550. ElAutocomplete,
  58551. ElAutoResizer,
  58552. ElAvatar,
  58553. ElBacktop,
  58554. ElBadge,
  58555. ElBreadcrumb,
  58556. ElBreadcrumbItem,
  58557. ElButton,
  58558. ElButtonGroup$1,
  58559. ElCalendar,
  58560. ElCard,
  58561. ElCarousel,
  58562. ElCarouselItem,
  58563. ElCascader,
  58564. ElCascaderPanel,
  58565. ElCheckTag,
  58566. ElCheckbox,
  58567. ElCheckboxButton,
  58568. ElCheckboxGroup$1,
  58569. ElCol,
  58570. ElCollapse,
  58571. ElCollapseItem,
  58572. ElCollapseTransition,
  58573. ElColorPicker,
  58574. ElConfigProvider,
  58575. ElContainer,
  58576. ElAside,
  58577. ElFooter,
  58578. ElHeader,
  58579. ElMain,
  58580. ElDatePicker,
  58581. ElDescriptions,
  58582. ElDescriptionsItem,
  58583. ElDialog,
  58584. ElDivider,
  58585. ElDrawer,
  58586. ElDropdown,
  58587. ElDropdownItem,
  58588. ElDropdownMenu,
  58589. ElEmpty,
  58590. ElForm,
  58591. ElFormItem,
  58592. ElIcon,
  58593. ElImage,
  58594. ElImageViewer,
  58595. ElInput,
  58596. ElInputNumber,
  58597. ElLink,
  58598. ElMenu,
  58599. ElMenuItem,
  58600. ElMenuItemGroup,
  58601. ElSubMenu,
  58602. ElPageHeader,
  58603. ElPagination,
  58604. ElPopconfirm,
  58605. ElPopover,
  58606. ElPopper,
  58607. ElProgress,
  58608. ElRadio,
  58609. ElRadioButton,
  58610. ElRadioGroup,
  58611. ElRate,
  58612. ElResult,
  58613. ElRow,
  58614. ElScrollbar,
  58615. ElSelect,
  58616. ElOption,
  58617. ElOptionGroup,
  58618. ElSelectV2,
  58619. ElSkeleton,
  58620. ElSkeletonItem,
  58621. ElSlider,
  58622. ElSpace,
  58623. ElStatistic,
  58624. ElCountdown,
  58625. ElSteps,
  58626. ElStep,
  58627. ElSwitch,
  58628. ElTable,
  58629. ElTableColumn,
  58630. ElTableV2,
  58631. ElTabs,
  58632. ElTabPane,
  58633. ElTag,
  58634. ElText,
  58635. ElTimePicker,
  58636. ElTimeSelect,
  58637. ElTimeline,
  58638. ElTimelineItem,
  58639. ElTooltip,
  58640. ElTooltipV2,
  58641. ElTransfer,
  58642. ElTree,
  58643. ElTreeSelect,
  58644. ElTreeV2,
  58645. ElUpload,
  58646. ElWatermark
  58647. ];
  58648. const SCOPE = "ElInfiniteScroll";
  58649. const CHECK_INTERVAL = 50;
  58650. const DEFAULT_DELAY = 200;
  58651. const DEFAULT_DISTANCE = 0;
  58652. const attributes = {
  58653. delay: {
  58654. type: Number,
  58655. default: DEFAULT_DELAY
  58656. },
  58657. distance: {
  58658. type: Number,
  58659. default: DEFAULT_DISTANCE
  58660. },
  58661. disabled: {
  58662. type: Boolean,
  58663. default: false
  58664. },
  58665. immediate: {
  58666. type: Boolean,
  58667. default: true
  58668. }
  58669. };
  58670. const getScrollOptions = (el, instance) => {
  58671. return Object.entries(attributes).reduce((acm, [name, option]) => {
  58672. var _a2, _b;
  58673. const { type: type2, default: defaultValue } = option;
  58674. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  58675. let value = (_b = (_a2 = instance[attrVal]) != null ? _a2 : attrVal) != null ? _b : defaultValue;
  58676. value = value === "false" ? false : value;
  58677. value = type2(value);
  58678. acm[name] = Number.isNaN(value) ? defaultValue : value;
  58679. return acm;
  58680. }, {});
  58681. };
  58682. const destroyObserver = (el) => {
  58683. const { observer } = el[SCOPE];
  58684. if (observer) {
  58685. observer.disconnect();
  58686. delete el[SCOPE].observer;
  58687. }
  58688. };
  58689. const handleScroll = (el, cb) => {
  58690. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  58691. const { disabled, distance } = getScrollOptions(el, instance);
  58692. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  58693. const delta = scrollTop - lastScrollTop;
  58694. el[SCOPE].lastScrollTop = scrollTop;
  58695. if (observer || disabled || delta < 0)
  58696. return;
  58697. let shouldTrigger = false;
  58698. if (container === el) {
  58699. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  58700. } else {
  58701. const { clientTop, scrollHeight: height } = el;
  58702. const offsetTop = getOffsetTopDistance(el, containerEl);
  58703. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  58704. }
  58705. if (shouldTrigger) {
  58706. cb.call(instance);
  58707. }
  58708. };
  58709. function checkFull(el, cb) {
  58710. const { containerEl, instance } = el[SCOPE];
  58711. const { disabled } = getScrollOptions(el, instance);
  58712. if (disabled || containerEl.clientHeight === 0)
  58713. return;
  58714. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  58715. cb.call(instance);
  58716. } else {
  58717. destroyObserver(el);
  58718. }
  58719. }
  58720. const InfiniteScroll = {
  58721. async mounted(el, binding) {
  58722. const { instance, value: cb } = binding;
  58723. if (!isFunction$2(cb)) {
  58724. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  58725. }
  58726. await nextTick();
  58727. const { delay, immediate } = getScrollOptions(el, instance);
  58728. const container = getScrollContainer(el, true);
  58729. const containerEl = container === window ? document.documentElement : container;
  58730. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  58731. if (!container)
  58732. return;
  58733. el[SCOPE] = {
  58734. instance,
  58735. container,
  58736. containerEl,
  58737. delay,
  58738. cb,
  58739. onScroll,
  58740. lastScrollTop: containerEl.scrollTop
  58741. };
  58742. if (immediate) {
  58743. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  58744. el[SCOPE].observer = observer;
  58745. observer.observe(el, { childList: true, subtree: true });
  58746. checkFull(el, cb);
  58747. }
  58748. container.addEventListener("scroll", onScroll);
  58749. },
  58750. unmounted(el) {
  58751. const { container, onScroll } = el[SCOPE];
  58752. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  58753. destroyObserver(el);
  58754. },
  58755. async updated(el) {
  58756. if (!el[SCOPE]) {
  58757. await nextTick();
  58758. } else {
  58759. const { containerEl, cb, observer } = el[SCOPE];
  58760. if (containerEl.clientHeight && observer) {
  58761. checkFull(el, cb);
  58762. }
  58763. }
  58764. }
  58765. };
  58766. const _InfiniteScroll = InfiniteScroll;
  58767. _InfiniteScroll.install = (app) => {
  58768. app.directive("InfiniteScroll", _InfiniteScroll);
  58769. };
  58770. const ElInfiniteScroll = _InfiniteScroll;
  58771. function createLoadingComponent(options) {
  58772. let afterLeaveTimer;
  58773. const afterLeaveFlag = ref(false);
  58774. const data = reactive({
  58775. ...options,
  58776. originalPosition: "",
  58777. originalOverflow: "",
  58778. visible: false
  58779. });
  58780. function setText(text) {
  58781. data.text = text;
  58782. }
  58783. function destroySelf() {
  58784. const target = data.parent;
  58785. const ns = vm.ns;
  58786. if (!target.vLoadingAddClassList) {
  58787. let loadingNumber = target.getAttribute("loading-number");
  58788. loadingNumber = Number.parseInt(loadingNumber) - 1;
  58789. if (!loadingNumber) {
  58790. removeClass(target, ns.bm("parent", "relative"));
  58791. target.removeAttribute("loading-number");
  58792. } else {
  58793. target.setAttribute("loading-number", loadingNumber.toString());
  58794. }
  58795. removeClass(target, ns.bm("parent", "hidden"));
  58796. }
  58797. removeElLoadingChild();
  58798. loadingInstance.unmount();
  58799. }
  58800. function removeElLoadingChild() {
  58801. var _a2, _b;
  58802. (_b = (_a2 = vm.$el) == null ? void 0 : _a2.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  58803. }
  58804. function close2() {
  58805. var _a2;
  58806. if (options.beforeClose && !options.beforeClose())
  58807. return;
  58808. afterLeaveFlag.value = true;
  58809. clearTimeout(afterLeaveTimer);
  58810. afterLeaveTimer = window.setTimeout(handleAfterLeave, 400);
  58811. data.visible = false;
  58812. (_a2 = options.closed) == null ? void 0 : _a2.call(options);
  58813. }
  58814. function handleAfterLeave() {
  58815. if (!afterLeaveFlag.value)
  58816. return;
  58817. const target = data.parent;
  58818. afterLeaveFlag.value = false;
  58819. target.vLoadingAddClassList = void 0;
  58820. destroySelf();
  58821. }
  58822. const elLoadingComponent = /* @__PURE__ */ defineComponent({
  58823. name: "ElLoading",
  58824. setup(_2, { expose }) {
  58825. const { ns, zIndex: zIndex2 } = useGlobalComponentSettings("loading");
  58826. expose({
  58827. ns,
  58828. zIndex: zIndex2
  58829. });
  58830. return () => {
  58831. const svg = data.spinner || data.svg;
  58832. const spinner = h$1("svg", {
  58833. class: "circular",
  58834. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  58835. ...svg ? { innerHTML: svg } : {}
  58836. }, [
  58837. h$1("circle", {
  58838. class: "path",
  58839. cx: "25",
  58840. cy: "25",
  58841. r: "20",
  58842. fill: "none"
  58843. })
  58844. ]);
  58845. const spinnerText = data.text ? h$1("p", { class: ns.b("text") }, [data.text]) : void 0;
  58846. return h$1(Transition, {
  58847. name: ns.b("fade"),
  58848. onAfterLeave: handleAfterLeave
  58849. }, {
  58850. default: withCtx(() => [
  58851. withDirectives(createVNode("div", {
  58852. style: {
  58853. backgroundColor: data.background || ""
  58854. },
  58855. class: [
  58856. ns.b("mask"),
  58857. data.customClass,
  58858. data.fullscreen ? "is-fullscreen" : ""
  58859. ]
  58860. }, [
  58861. h$1("div", {
  58862. class: ns.b("spinner")
  58863. }, [spinner, spinnerText])
  58864. ]), [[vShow, data.visible]])
  58865. ])
  58866. });
  58867. };
  58868. }
  58869. });
  58870. const loadingInstance = createApp(elLoadingComponent);
  58871. const vm = loadingInstance.mount(document.createElement("div"));
  58872. return {
  58873. ...toRefs(data),
  58874. setText,
  58875. removeElLoadingChild,
  58876. close: close2,
  58877. handleAfterLeave,
  58878. vm,
  58879. get $el() {
  58880. return vm.$el;
  58881. }
  58882. };
  58883. }
  58884. let fullscreenInstance = void 0;
  58885. const Loading = function(options = {}) {
  58886. if (!isClient)
  58887. return void 0;
  58888. const resolved = resolveOptions(options);
  58889. if (resolved.fullscreen && fullscreenInstance) {
  58890. return fullscreenInstance;
  58891. }
  58892. const instance = createLoadingComponent({
  58893. ...resolved,
  58894. closed: () => {
  58895. var _a2;
  58896. (_a2 = resolved.closed) == null ? void 0 : _a2.call(resolved);
  58897. if (resolved.fullscreen)
  58898. fullscreenInstance = void 0;
  58899. }
  58900. });
  58901. addStyle(resolved, resolved.parent, instance);
  58902. addClassList(resolved, resolved.parent, instance);
  58903. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  58904. let loadingNumber = resolved.parent.getAttribute("loading-number");
  58905. if (!loadingNumber) {
  58906. loadingNumber = "1";
  58907. } else {
  58908. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  58909. }
  58910. resolved.parent.setAttribute("loading-number", loadingNumber);
  58911. resolved.parent.appendChild(instance.$el);
  58912. nextTick(() => instance.visible.value = resolved.visible);
  58913. if (resolved.fullscreen) {
  58914. fullscreenInstance = instance;
  58915. }
  58916. return instance;
  58917. };
  58918. const resolveOptions = (options) => {
  58919. var _a2, _b, _c, _d;
  58920. let target;
  58921. if (isString$1(options.target)) {
  58922. target = (_a2 = document.querySelector(options.target)) != null ? _a2 : document.body;
  58923. } else {
  58924. target = options.target || document.body;
  58925. }
  58926. return {
  58927. parent: target === document.body || options.body ? document.body : target,
  58928. background: options.background || "",
  58929. svg: options.svg || "",
  58930. svgViewBox: options.svgViewBox || "",
  58931. spinner: options.spinner || false,
  58932. text: options.text || "",
  58933. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  58934. lock: (_c = options.lock) != null ? _c : false,
  58935. customClass: options.customClass || "",
  58936. visible: (_d = options.visible) != null ? _d : true,
  58937. target
  58938. };
  58939. };
  58940. const addStyle = async (options, parent, instance) => {
  58941. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  58942. const maskStyle = {};
  58943. if (options.fullscreen) {
  58944. instance.originalPosition.value = getStyle(document.body, "position");
  58945. instance.originalOverflow.value = getStyle(document.body, "overflow");
  58946. maskStyle.zIndex = nextZIndex();
  58947. } else if (options.parent === document.body) {
  58948. instance.originalPosition.value = getStyle(document.body, "position");
  58949. await nextTick();
  58950. for (const property2 of ["top", "left"]) {
  58951. const scroll = property2 === "top" ? "scrollTop" : "scrollLeft";
  58952. maskStyle[property2] = `${options.target.getBoundingClientRect()[property2] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property2}`), 10)}px`;
  58953. }
  58954. for (const property2 of ["height", "width"]) {
  58955. maskStyle[property2] = `${options.target.getBoundingClientRect()[property2]}px`;
  58956. }
  58957. } else {
  58958. instance.originalPosition.value = getStyle(parent, "position");
  58959. }
  58960. for (const [key, value] of Object.entries(maskStyle)) {
  58961. instance.$el.style[key] = value;
  58962. }
  58963. };
  58964. const addClassList = (options, parent, instance) => {
  58965. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  58966. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  58967. addClass(parent, ns.bm("parent", "relative"));
  58968. } else {
  58969. removeClass(parent, ns.bm("parent", "relative"));
  58970. }
  58971. if (options.fullscreen && options.lock) {
  58972. addClass(parent, ns.bm("parent", "hidden"));
  58973. } else {
  58974. removeClass(parent, ns.bm("parent", "hidden"));
  58975. }
  58976. };
  58977. const INSTANCE_KEY = Symbol("ElLoading");
  58978. const createInstance = (el, binding) => {
  58979. var _a2, _b, _c, _d;
  58980. const vm = binding.instance;
  58981. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  58982. const resolveExpression = (key) => {
  58983. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  58984. if (data)
  58985. return ref(data);
  58986. else
  58987. return data;
  58988. };
  58989. const getProp2 = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  58990. const fullscreen = (_a2 = getBindingProp("fullscreen")) != null ? _a2 : binding.modifiers.fullscreen;
  58991. const options = {
  58992. text: getProp2("text"),
  58993. svg: getProp2("svg"),
  58994. svgViewBox: getProp2("svgViewBox"),
  58995. spinner: getProp2("spinner"),
  58996. background: getProp2("background"),
  58997. customClass: getProp2("customClass"),
  58998. fullscreen,
  58999. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  59000. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  59001. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  59002. };
  59003. el[INSTANCE_KEY] = {
  59004. options,
  59005. instance: Loading(options)
  59006. };
  59007. };
  59008. const updateOptions = (newOptions, originalOptions) => {
  59009. for (const key of Object.keys(originalOptions)) {
  59010. if (isRef(originalOptions[key]))
  59011. originalOptions[key].value = newOptions[key];
  59012. }
  59013. };
  59014. const vLoading = {
  59015. mounted(el, binding) {
  59016. if (binding.value) {
  59017. createInstance(el, binding);
  59018. }
  59019. },
  59020. updated(el, binding) {
  59021. const instance = el[INSTANCE_KEY];
  59022. if (binding.oldValue !== binding.value) {
  59023. if (binding.value && !binding.oldValue) {
  59024. createInstance(el, binding);
  59025. } else if (binding.value && binding.oldValue) {
  59026. if (isObject$1(binding.value))
  59027. updateOptions(binding.value, instance.options);
  59028. } else {
  59029. instance == null ? void 0 : instance.instance.close();
  59030. }
  59031. }
  59032. },
  59033. unmounted(el) {
  59034. var _a2;
  59035. (_a2 = el[INSTANCE_KEY]) == null ? void 0 : _a2.instance.close();
  59036. }
  59037. };
  59038. const ElLoading = {
  59039. install(app) {
  59040. app.directive("loading", vLoading);
  59041. app.config.globalProperties.$loading = Loading;
  59042. },
  59043. directive: vLoading,
  59044. service: Loading
  59045. };
  59046. const messageTypes = ["success", "info", "warning", "error"];
  59047. const messageDefaults = mutable({
  59048. customClass: "",
  59049. center: false,
  59050. dangerouslyUseHTMLString: false,
  59051. duration: 3e3,
  59052. icon: void 0,
  59053. id: "",
  59054. message: "",
  59055. onClose: void 0,
  59056. showClose: false,
  59057. type: "info",
  59058. offset: 16,
  59059. zIndex: 0,
  59060. grouping: false,
  59061. repeatNum: 1,
  59062. appendTo: isClient ? document.body : void 0
  59063. });
  59064. const messageProps = buildProps({
  59065. customClass: {
  59066. type: String,
  59067. default: messageDefaults.customClass
  59068. },
  59069. center: {
  59070. type: Boolean,
  59071. default: messageDefaults.center
  59072. },
  59073. dangerouslyUseHTMLString: {
  59074. type: Boolean,
  59075. default: messageDefaults.dangerouslyUseHTMLString
  59076. },
  59077. duration: {
  59078. type: Number,
  59079. default: messageDefaults.duration
  59080. },
  59081. icon: {
  59082. type: iconPropType,
  59083. default: messageDefaults.icon
  59084. },
  59085. id: {
  59086. type: String,
  59087. default: messageDefaults.id
  59088. },
  59089. message: {
  59090. type: definePropType([
  59091. String,
  59092. Object,
  59093. Function
  59094. ]),
  59095. default: messageDefaults.message
  59096. },
  59097. onClose: {
  59098. type: definePropType(Function),
  59099. required: false
  59100. },
  59101. showClose: {
  59102. type: Boolean,
  59103. default: messageDefaults.showClose
  59104. },
  59105. type: {
  59106. type: String,
  59107. values: messageTypes,
  59108. default: messageDefaults.type
  59109. },
  59110. offset: {
  59111. type: Number,
  59112. default: messageDefaults.offset
  59113. },
  59114. zIndex: {
  59115. type: Number,
  59116. default: messageDefaults.zIndex
  59117. },
  59118. grouping: {
  59119. type: Boolean,
  59120. default: messageDefaults.grouping
  59121. },
  59122. repeatNum: {
  59123. type: Number,
  59124. default: messageDefaults.repeatNum
  59125. }
  59126. });
  59127. const messageEmits = {
  59128. destroy: () => true
  59129. };
  59130. const instances = shallowReactive([]);
  59131. const getInstance = (id) => {
  59132. const idx = instances.findIndex((instance) => instance.id === id);
  59133. const current = instances[idx];
  59134. let prev;
  59135. if (idx > 0) {
  59136. prev = instances[idx - 1];
  59137. }
  59138. return { current, prev };
  59139. };
  59140. const getLastOffset = (id) => {
  59141. const { prev } = getInstance(id);
  59142. if (!prev)
  59143. return 0;
  59144. return prev.vm.exposed.bottom.value;
  59145. };
  59146. const getOffsetOrSpace = (id, offset2) => {
  59147. const idx = instances.findIndex((instance) => instance.id === id);
  59148. return idx > 0 ? 20 : offset2;
  59149. };
  59150. const _hoisted_1$4 = ["id"];
  59151. const _hoisted_2$3 = ["innerHTML"];
  59152. const __default__$1 = /* @__PURE__ */ defineComponent({
  59153. name: "ElMessage"
  59154. });
  59155. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  59156. ...__default__$1,
  59157. props: messageProps,
  59158. emits: messageEmits,
  59159. setup(__props, { expose }) {
  59160. const props = __props;
  59161. const { Close } = TypeComponents;
  59162. const { ns, zIndex: zIndex2 } = useGlobalComponentSettings("message");
  59163. const { currentZIndex, nextZIndex } = zIndex2;
  59164. const messageRef = ref();
  59165. const visible = ref(false);
  59166. const height = ref(0);
  59167. let stopTimer = void 0;
  59168. const badgeType = computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  59169. const typeClass = computed(() => {
  59170. const type2 = props.type;
  59171. return { [ns.bm("icon", type2)]: type2 && TypeComponentsMap[type2] };
  59172. });
  59173. const iconComponent = computed(() => props.icon || TypeComponentsMap[props.type] || "");
  59174. const lastOffset = computed(() => getLastOffset(props.id));
  59175. const offset2 = computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  59176. const bottom = computed(() => height.value + offset2.value);
  59177. const customStyle = computed(() => ({
  59178. top: `${offset2.value}px`,
  59179. zIndex: currentZIndex.value
  59180. }));
  59181. function startTimer() {
  59182. if (props.duration === 0)
  59183. return;
  59184. ({ stop: stopTimer } = useTimeoutFn(() => {
  59185. close2();
  59186. }, props.duration));
  59187. }
  59188. function clearTimer() {
  59189. stopTimer == null ? void 0 : stopTimer();
  59190. }
  59191. function close2() {
  59192. visible.value = false;
  59193. }
  59194. function keydown({ code }) {
  59195. if (code === EVENT_CODE.esc) {
  59196. close2();
  59197. }
  59198. }
  59199. onMounted(() => {
  59200. startTimer();
  59201. nextZIndex();
  59202. visible.value = true;
  59203. });
  59204. watch(() => props.repeatNum, () => {
  59205. clearTimer();
  59206. startTimer();
  59207. });
  59208. useEventListener(document, "keydown", keydown);
  59209. useResizeObserver(messageRef, () => {
  59210. height.value = messageRef.value.getBoundingClientRect().height;
  59211. });
  59212. expose({
  59213. visible,
  59214. bottom,
  59215. close: close2
  59216. });
  59217. return (_ctx, _cache) => {
  59218. return openBlock(), createBlock(Transition, {
  59219. name: unref(ns).b("fade"),
  59220. onBeforeLeave: _ctx.onClose,
  59221. onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")),
  59222. persisted: ""
  59223. }, {
  59224. default: withCtx(() => [
  59225. withDirectives(createBaseVNode("div", {
  59226. id: _ctx.id,
  59227. ref_key: "messageRef",
  59228. ref: messageRef,
  59229. class: normalizeClass([
  59230. unref(ns).b(),
  59231. { [unref(ns).m(_ctx.type)]: _ctx.type && !_ctx.icon },
  59232. unref(ns).is("center", _ctx.center),
  59233. unref(ns).is("closable", _ctx.showClose),
  59234. _ctx.customClass
  59235. ]),
  59236. style: normalizeStyle(unref(customStyle)),
  59237. role: "alert",
  59238. onMouseenter: clearTimer,
  59239. onMouseleave: startTimer
  59240. }, [
  59241. _ctx.repeatNum > 1 ? (openBlock(), createBlock(unref(ElBadge), {
  59242. key: 0,
  59243. value: _ctx.repeatNum,
  59244. type: unref(badgeType),
  59245. class: normalizeClass(unref(ns).e("badge"))
  59246. }, null, 8, ["value", "type", "class"])) : createCommentVNode("v-if", true),
  59247. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  59248. key: 1,
  59249. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  59250. }, {
  59251. default: withCtx(() => [
  59252. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  59253. ]),
  59254. _: 1
  59255. }, 8, ["class"])) : createCommentVNode("v-if", true),
  59256. renderSlot(_ctx.$slots, "default", {}, () => [
  59257. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", {
  59258. key: 0,
  59259. class: normalizeClass(unref(ns).e("content"))
  59260. }, toDisplayString(_ctx.message), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  59261. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  59262. createBaseVNode("p", {
  59263. class: normalizeClass(unref(ns).e("content")),
  59264. innerHTML: _ctx.message
  59265. }, null, 10, _hoisted_2$3)
  59266. ], 2112))
  59267. ]),
  59268. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  59269. key: 2,
  59270. class: normalizeClass(unref(ns).e("closeBtn")),
  59271. onClick: withModifiers(close2, ["stop"])
  59272. }, {
  59273. default: withCtx(() => [
  59274. createVNode(unref(Close))
  59275. ]),
  59276. _: 1
  59277. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  59278. ], 46, _hoisted_1$4), [
  59279. [vShow, visible.value]
  59280. ])
  59281. ]),
  59282. _: 3
  59283. }, 8, ["name", "onBeforeLeave"]);
  59284. };
  59285. }
  59286. });
  59287. var MessageConstructor = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);
  59288. let seed$1 = 1;
  59289. const normalizeOptions = (params) => {
  59290. const options = !params || isString$1(params) || isVNode(params) || isFunction$2(params) ? { message: params } : params;
  59291. const normalized = {
  59292. ...messageDefaults,
  59293. ...options
  59294. };
  59295. if (!normalized.appendTo) {
  59296. normalized.appendTo = document.body;
  59297. } else if (isString$1(normalized.appendTo)) {
  59298. let appendTo = document.querySelector(normalized.appendTo);
  59299. if (!isElement$1(appendTo)) {
  59300. appendTo = document.body;
  59301. }
  59302. normalized.appendTo = appendTo;
  59303. }
  59304. return normalized;
  59305. };
  59306. const closeMessage = (instance) => {
  59307. const idx = instances.indexOf(instance);
  59308. if (idx === -1)
  59309. return;
  59310. instances.splice(idx, 1);
  59311. const { handler } = instance;
  59312. handler.close();
  59313. };
  59314. const createMessage = ({ appendTo, ...options }, context) => {
  59315. const id = `message_${seed$1++}`;
  59316. const userOnClose = options.onClose;
  59317. const container = document.createElement("div");
  59318. const props = {
  59319. ...options,
  59320. id,
  59321. onClose: () => {
  59322. userOnClose == null ? void 0 : userOnClose();
  59323. closeMessage(instance);
  59324. },
  59325. onDestroy: () => {
  59326. render(null, container);
  59327. }
  59328. };
  59329. const vnode = createVNode(MessageConstructor, props, isFunction$2(props.message) || isVNode(props.message) ? {
  59330. default: isFunction$2(props.message) ? props.message : () => props.message
  59331. } : null);
  59332. vnode.appContext = context || message._context;
  59333. render(vnode, container);
  59334. appendTo.appendChild(container.firstElementChild);
  59335. const vm = vnode.component;
  59336. const handler = {
  59337. close: () => {
  59338. vm.exposed.visible.value = false;
  59339. }
  59340. };
  59341. const instance = {
  59342. id,
  59343. vnode,
  59344. vm,
  59345. handler,
  59346. props: vnode.component.props
  59347. };
  59348. return instance;
  59349. };
  59350. const message = (options = {}, context) => {
  59351. if (!isClient)
  59352. return { close: () => void 0 };
  59353. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  59354. return { close: () => void 0 };
  59355. }
  59356. const normalized = normalizeOptions(options);
  59357. if (normalized.grouping && instances.length) {
  59358. const instance2 = instances.find(({ vnode: vm }) => {
  59359. var _a2;
  59360. return ((_a2 = vm.props) == null ? void 0 : _a2.message) === normalized.message;
  59361. });
  59362. if (instance2) {
  59363. instance2.props.repeatNum += 1;
  59364. instance2.props.type = normalized.type;
  59365. return instance2.handler;
  59366. }
  59367. }
  59368. const instance = createMessage(normalized, context);
  59369. instances.push(instance);
  59370. return instance.handler;
  59371. };
  59372. messageTypes.forEach((type2) => {
  59373. message[type2] = (options = {}, appContext) => {
  59374. const normalized = normalizeOptions(options);
  59375. return message({ ...normalized, type: type2 }, appContext);
  59376. };
  59377. });
  59378. function closeAll$1(type2) {
  59379. for (const instance of instances) {
  59380. if (!type2 || type2 === instance.props.type) {
  59381. instance.handler.close();
  59382. }
  59383. }
  59384. }
  59385. message.closeAll = closeAll$1;
  59386. message._context = null;
  59387. const ElMessage = withInstallFunction(message, "$message");
  59388. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  59389. name: "ElMessageBox",
  59390. directives: {
  59391. TrapFocus
  59392. },
  59393. components: {
  59394. ElButton,
  59395. ElFocusTrap,
  59396. ElInput,
  59397. ElOverlay,
  59398. ElIcon,
  59399. ...TypeComponents
  59400. },
  59401. inheritAttrs: false,
  59402. props: {
  59403. buttonSize: {
  59404. type: String,
  59405. validator: isValidComponentSize
  59406. },
  59407. modal: {
  59408. type: Boolean,
  59409. default: true
  59410. },
  59411. lockScroll: {
  59412. type: Boolean,
  59413. default: true
  59414. },
  59415. showClose: {
  59416. type: Boolean,
  59417. default: true
  59418. },
  59419. closeOnClickModal: {
  59420. type: Boolean,
  59421. default: true
  59422. },
  59423. closeOnPressEscape: {
  59424. type: Boolean,
  59425. default: true
  59426. },
  59427. closeOnHashChange: {
  59428. type: Boolean,
  59429. default: true
  59430. },
  59431. center: Boolean,
  59432. draggable: Boolean,
  59433. roundButton: {
  59434. default: false,
  59435. type: Boolean
  59436. },
  59437. container: {
  59438. type: String,
  59439. default: "body"
  59440. },
  59441. boxType: {
  59442. type: String,
  59443. default: ""
  59444. }
  59445. },
  59446. emits: ["vanish", "action"],
  59447. setup(props, { emit: emit2 }) {
  59448. const {
  59449. locale,
  59450. zIndex: zIndex2,
  59451. ns,
  59452. size: btnSize
  59453. } = useGlobalComponentSettings("message-box", computed(() => props.buttonSize));
  59454. const { t } = locale;
  59455. const { nextZIndex } = zIndex2;
  59456. const visible = ref(false);
  59457. const state = reactive({
  59458. autofocus: true,
  59459. beforeClose: null,
  59460. callback: null,
  59461. cancelButtonText: "",
  59462. cancelButtonClass: "",
  59463. confirmButtonText: "",
  59464. confirmButtonClass: "",
  59465. customClass: "",
  59466. customStyle: {},
  59467. dangerouslyUseHTMLString: false,
  59468. distinguishCancelAndClose: false,
  59469. icon: "",
  59470. inputPattern: null,
  59471. inputPlaceholder: "",
  59472. inputType: "text",
  59473. inputValue: null,
  59474. inputValidator: null,
  59475. inputErrorMessage: "",
  59476. message: null,
  59477. modalFade: true,
  59478. modalClass: "",
  59479. showCancelButton: false,
  59480. showConfirmButton: true,
  59481. type: "",
  59482. title: void 0,
  59483. showInput: false,
  59484. action: "",
  59485. confirmButtonLoading: false,
  59486. cancelButtonLoading: false,
  59487. confirmButtonDisabled: false,
  59488. editorErrorMessage: "",
  59489. validateError: false,
  59490. zIndex: nextZIndex()
  59491. });
  59492. const typeClass = computed(() => {
  59493. const type2 = state.type;
  59494. return { [ns.bm("icon", type2)]: type2 && TypeComponentsMap[type2] };
  59495. });
  59496. const contentId = useId();
  59497. const inputId = useId();
  59498. const iconComponent = computed(() => state.icon || TypeComponentsMap[state.type] || "");
  59499. const hasMessage = computed(() => !!state.message);
  59500. const rootRef = ref();
  59501. const headerRef = ref();
  59502. const focusStartRef = ref();
  59503. const inputRef = ref();
  59504. const confirmRef = ref();
  59505. const confirmButtonClasses = computed(() => state.confirmButtonClass);
  59506. watch(() => state.inputValue, async (val) => {
  59507. await nextTick();
  59508. if (props.boxType === "prompt" && val !== null) {
  59509. validate();
  59510. }
  59511. }, { immediate: true });
  59512. watch(() => visible.value, (val) => {
  59513. var _a2, _b;
  59514. if (val) {
  59515. if (props.boxType !== "prompt") {
  59516. if (state.autofocus) {
  59517. focusStartRef.value = (_b = (_a2 = confirmRef.value) == null ? void 0 : _a2.$el) != null ? _b : rootRef.value;
  59518. } else {
  59519. focusStartRef.value = rootRef.value;
  59520. }
  59521. }
  59522. state.zIndex = nextZIndex();
  59523. }
  59524. if (props.boxType !== "prompt")
  59525. return;
  59526. if (val) {
  59527. nextTick().then(() => {
  59528. var _a22;
  59529. if (inputRef.value && inputRef.value.$el) {
  59530. if (state.autofocus) {
  59531. focusStartRef.value = (_a22 = getInputElement()) != null ? _a22 : rootRef.value;
  59532. } else {
  59533. focusStartRef.value = rootRef.value;
  59534. }
  59535. }
  59536. });
  59537. } else {
  59538. state.editorErrorMessage = "";
  59539. state.validateError = false;
  59540. }
  59541. });
  59542. const draggable2 = computed(() => props.draggable);
  59543. useDraggable(rootRef, headerRef, draggable2);
  59544. onMounted(async () => {
  59545. await nextTick();
  59546. if (props.closeOnHashChange) {
  59547. window.addEventListener("hashchange", doClose);
  59548. }
  59549. });
  59550. onBeforeUnmount(() => {
  59551. if (props.closeOnHashChange) {
  59552. window.removeEventListener("hashchange", doClose);
  59553. }
  59554. });
  59555. function doClose() {
  59556. if (!visible.value)
  59557. return;
  59558. visible.value = false;
  59559. nextTick(() => {
  59560. if (state.action)
  59561. emit2("action", state.action);
  59562. });
  59563. }
  59564. const handleWrapperClick = () => {
  59565. if (props.closeOnClickModal) {
  59566. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  59567. }
  59568. };
  59569. const overlayEvent = useSameTarget(handleWrapperClick);
  59570. const handleInputEnter = (e) => {
  59571. if (state.inputType !== "textarea") {
  59572. e.preventDefault();
  59573. return handleAction("confirm");
  59574. }
  59575. };
  59576. const handleAction = (action) => {
  59577. var _a2;
  59578. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  59579. return;
  59580. }
  59581. state.action = action;
  59582. if (state.beforeClose) {
  59583. (_a2 = state.beforeClose) == null ? void 0 : _a2.call(state, action, state, doClose);
  59584. } else {
  59585. doClose();
  59586. }
  59587. };
  59588. const validate = () => {
  59589. if (props.boxType === "prompt") {
  59590. const inputPattern = state.inputPattern;
  59591. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  59592. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  59593. state.validateError = true;
  59594. return false;
  59595. }
  59596. const inputValidator = state.inputValidator;
  59597. if (typeof inputValidator === "function") {
  59598. const validateResult = inputValidator(state.inputValue);
  59599. if (validateResult === false) {
  59600. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  59601. state.validateError = true;
  59602. return false;
  59603. }
  59604. if (typeof validateResult === "string") {
  59605. state.editorErrorMessage = validateResult;
  59606. state.validateError = true;
  59607. return false;
  59608. }
  59609. }
  59610. }
  59611. state.editorErrorMessage = "";
  59612. state.validateError = false;
  59613. return true;
  59614. };
  59615. const getInputElement = () => {
  59616. const inputRefs = inputRef.value.$refs;
  59617. return inputRefs.input || inputRefs.textarea;
  59618. };
  59619. const handleClose = () => {
  59620. handleAction("close");
  59621. };
  59622. const onCloseRequested = () => {
  59623. if (props.closeOnPressEscape) {
  59624. handleClose();
  59625. }
  59626. };
  59627. if (props.lockScroll) {
  59628. useLockscreen(visible);
  59629. }
  59630. return {
  59631. ...toRefs(state),
  59632. ns,
  59633. overlayEvent,
  59634. visible,
  59635. hasMessage,
  59636. typeClass,
  59637. contentId,
  59638. inputId,
  59639. btnSize,
  59640. iconComponent,
  59641. confirmButtonClasses,
  59642. rootRef,
  59643. focusStartRef,
  59644. headerRef,
  59645. inputRef,
  59646. confirmRef,
  59647. doClose,
  59648. handleClose,
  59649. onCloseRequested,
  59650. handleWrapperClick,
  59651. handleInputEnter,
  59652. handleAction,
  59653. t
  59654. };
  59655. }
  59656. });
  59657. const _hoisted_1$3 = ["aria-label", "aria-describedby"];
  59658. const _hoisted_2$2 = ["aria-label"];
  59659. const _hoisted_3$1 = ["id"];
  59660. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  59661. const _component_el_icon = resolveComponent("el-icon");
  59662. const _component_close = resolveComponent("close");
  59663. const _component_el_input = resolveComponent("el-input");
  59664. const _component_el_button = resolveComponent("el-button");
  59665. const _component_el_focus_trap = resolveComponent("el-focus-trap");
  59666. const _component_el_overlay = resolveComponent("el-overlay");
  59667. return openBlock(), createBlock(Transition, {
  59668. name: "fade-in-linear",
  59669. onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")),
  59670. persisted: ""
  59671. }, {
  59672. default: withCtx(() => [
  59673. withDirectives(createVNode(_component_el_overlay, {
  59674. "z-index": _ctx.zIndex,
  59675. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  59676. mask: _ctx.modal
  59677. }, {
  59678. default: withCtx(() => [
  59679. createBaseVNode("div", {
  59680. role: "dialog",
  59681. "aria-label": _ctx.title,
  59682. "aria-modal": "true",
  59683. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  59684. class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  59685. onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
  59686. onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
  59687. onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
  59688. }, [
  59689. createVNode(_component_el_focus_trap, {
  59690. loop: "",
  59691. trapped: _ctx.visible,
  59692. "focus-trap-el": _ctx.rootRef,
  59693. "focus-start-el": _ctx.focusStartRef,
  59694. onReleaseRequested: _ctx.onCloseRequested
  59695. }, {
  59696. default: withCtx(() => [
  59697. createBaseVNode("div", {
  59698. ref: "rootRef",
  59699. class: normalizeClass([
  59700. _ctx.ns.b(),
  59701. _ctx.customClass,
  59702. _ctx.ns.is("draggable", _ctx.draggable),
  59703. { [_ctx.ns.m("center")]: _ctx.center }
  59704. ]),
  59705. style: normalizeStyle(_ctx.customStyle),
  59706. tabindex: "-1",
  59707. onClick: _cache[7] || (_cache[7] = withModifiers(() => {
  59708. }, ["stop"]))
  59709. }, [
  59710. _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
  59711. key: 0,
  59712. ref: "headerRef",
  59713. class: normalizeClass(_ctx.ns.e("header"))
  59714. }, [
  59715. createBaseVNode("div", {
  59716. class: normalizeClass(_ctx.ns.e("title"))
  59717. }, [
  59718. _ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_el_icon, {
  59719. key: 0,
  59720. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  59721. }, {
  59722. default: withCtx(() => [
  59723. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  59724. ]),
  59725. _: 1
  59726. }, 8, ["class"])) : createCommentVNode("v-if", true),
  59727. createBaseVNode("span", null, toDisplayString(_ctx.title), 1)
  59728. ], 2),
  59729. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  59730. key: 0,
  59731. type: "button",
  59732. class: normalizeClass(_ctx.ns.e("headerbtn")),
  59733. "aria-label": _ctx.t("el.messagebox.close"),
  59734. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
  59735. onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
  59736. }, [
  59737. createVNode(_component_el_icon, {
  59738. class: normalizeClass(_ctx.ns.e("close"))
  59739. }, {
  59740. default: withCtx(() => [
  59741. createVNode(_component_close)
  59742. ]),
  59743. _: 1
  59744. }, 8, ["class"])
  59745. ], 42, _hoisted_2$2)) : createCommentVNode("v-if", true)
  59746. ], 2)) : createCommentVNode("v-if", true),
  59747. createBaseVNode("div", {
  59748. id: _ctx.contentId,
  59749. class: normalizeClass(_ctx.ns.e("content"))
  59750. }, [
  59751. createBaseVNode("div", {
  59752. class: normalizeClass(_ctx.ns.e("container"))
  59753. }, [
  59754. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_el_icon, {
  59755. key: 0,
  59756. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  59757. }, {
  59758. default: withCtx(() => [
  59759. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  59760. ]),
  59761. _: 1
  59762. }, 8, ["class"])) : createCommentVNode("v-if", true),
  59763. _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
  59764. key: 1,
  59765. class: normalizeClass(_ctx.ns.e("message"))
  59766. }, [
  59767. renderSlot(_ctx.$slots, "default", {}, () => [
  59768. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  59769. key: 0,
  59770. for: _ctx.showInput ? _ctx.inputId : void 0
  59771. }, {
  59772. default: withCtx(() => [
  59773. createTextVNode(toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  59774. ]),
  59775. _: 1
  59776. }, 8, ["for"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  59777. key: 1,
  59778. for: _ctx.showInput ? _ctx.inputId : void 0,
  59779. innerHTML: _ctx.message
  59780. }, null, 8, ["for", "innerHTML"]))
  59781. ])
  59782. ], 2)) : createCommentVNode("v-if", true)
  59783. ], 2),
  59784. withDirectives(createBaseVNode("div", {
  59785. class: normalizeClass(_ctx.ns.e("input"))
  59786. }, [
  59787. createVNode(_component_el_input, {
  59788. id: _ctx.inputId,
  59789. ref: "inputRef",
  59790. modelValue: _ctx.inputValue,
  59791. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
  59792. type: _ctx.inputType,
  59793. placeholder: _ctx.inputPlaceholder,
  59794. "aria-invalid": _ctx.validateError,
  59795. class: normalizeClass({ invalid: _ctx.validateError }),
  59796. onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
  59797. }, null, 8, ["id", "modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  59798. createBaseVNode("div", {
  59799. class: normalizeClass(_ctx.ns.e("errormsg")),
  59800. style: normalizeStyle({
  59801. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  59802. })
  59803. }, toDisplayString(_ctx.editorErrorMessage), 7)
  59804. ], 2), [
  59805. [vShow, _ctx.showInput]
  59806. ])
  59807. ], 10, _hoisted_3$1),
  59808. createBaseVNode("div", {
  59809. class: normalizeClass(_ctx.ns.e("btns"))
  59810. }, [
  59811. _ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
  59812. key: 0,
  59813. loading: _ctx.cancelButtonLoading,
  59814. class: normalizeClass([_ctx.cancelButtonClass]),
  59815. round: _ctx.roundButton,
  59816. size: _ctx.btnSize,
  59817. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
  59818. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
  59819. }, {
  59820. default: withCtx(() => [
  59821. createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  59822. ]),
  59823. _: 1
  59824. }, 8, ["loading", "class", "round", "size"])) : createCommentVNode("v-if", true),
  59825. withDirectives(createVNode(_component_el_button, {
  59826. ref: "confirmRef",
  59827. type: "primary",
  59828. loading: _ctx.confirmButtonLoading,
  59829. class: normalizeClass([_ctx.confirmButtonClasses]),
  59830. round: _ctx.roundButton,
  59831. disabled: _ctx.confirmButtonDisabled,
  59832. size: _ctx.btnSize,
  59833. onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
  59834. onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
  59835. }, {
  59836. default: withCtx(() => [
  59837. createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  59838. ]),
  59839. _: 1
  59840. }, 8, ["loading", "class", "round", "disabled", "size"]), [
  59841. [vShow, _ctx.showConfirmButton]
  59842. ])
  59843. ], 2)
  59844. ], 6)
  59845. ]),
  59846. _: 3
  59847. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  59848. ], 42, _hoisted_1$3)
  59849. ]),
  59850. _: 3
  59851. }, 8, ["z-index", "overlay-class", "mask"]), [
  59852. [vShow, _ctx.visible]
  59853. ])
  59854. ]),
  59855. _: 3
  59856. });
  59857. }
  59858. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/message-box/src/index.vue"]]);
  59859. const messageInstance = /* @__PURE__ */ new Map();
  59860. const getAppendToElement = (props) => {
  59861. let appendTo = document.body;
  59862. if (props.appendTo) {
  59863. if (isString$1(props.appendTo)) {
  59864. appendTo = document.querySelector(props.appendTo);
  59865. }
  59866. if (isElement$1(props.appendTo)) {
  59867. appendTo = props.appendTo;
  59868. }
  59869. if (!isElement$1(appendTo)) {
  59870. appendTo = document.body;
  59871. }
  59872. }
  59873. return appendTo;
  59874. };
  59875. const initInstance = (props, container, appContext = null) => {
  59876. const vnode = createVNode(MessageBoxConstructor, props, isFunction$2(props.message) || isVNode(props.message) ? {
  59877. default: isFunction$2(props.message) ? props.message : () => props.message
  59878. } : null);
  59879. vnode.appContext = appContext;
  59880. render(vnode, container);
  59881. getAppendToElement(props).appendChild(container.firstElementChild);
  59882. return vnode.component;
  59883. };
  59884. const genContainer = () => {
  59885. return document.createElement("div");
  59886. };
  59887. const showMessage = (options, appContext) => {
  59888. const container = genContainer();
  59889. options.onVanish = () => {
  59890. render(null, container);
  59891. messageInstance.delete(vm);
  59892. };
  59893. options.onAction = (action) => {
  59894. const currentMsg = messageInstance.get(vm);
  59895. let resolve2;
  59896. if (options.showInput) {
  59897. resolve2 = { value: vm.inputValue, action };
  59898. } else {
  59899. resolve2 = action;
  59900. }
  59901. if (options.callback) {
  59902. options.callback(resolve2, instance.proxy);
  59903. } else {
  59904. if (action === "cancel" || action === "close") {
  59905. if (options.distinguishCancelAndClose && action !== "cancel") {
  59906. currentMsg.reject("close");
  59907. } else {
  59908. currentMsg.reject("cancel");
  59909. }
  59910. } else {
  59911. currentMsg.resolve(resolve2);
  59912. }
  59913. }
  59914. };
  59915. const instance = initInstance(options, container, appContext);
  59916. const vm = instance.proxy;
  59917. for (const prop in options) {
  59918. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  59919. vm[prop] = options[prop];
  59920. }
  59921. }
  59922. vm.visible = true;
  59923. return vm;
  59924. };
  59925. function MessageBox(options, appContext = null) {
  59926. if (!isClient)
  59927. return Promise.reject();
  59928. let callback;
  59929. if (isString$1(options) || isVNode(options)) {
  59930. options = {
  59931. message: options
  59932. };
  59933. } else {
  59934. callback = options.callback;
  59935. }
  59936. return new Promise((resolve2, reject) => {
  59937. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  59938. messageInstance.set(vm, {
  59939. options,
  59940. callback,
  59941. resolve: resolve2,
  59942. reject
  59943. });
  59944. });
  59945. }
  59946. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  59947. const MESSAGE_BOX_DEFAULT_OPTS = {
  59948. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  59949. confirm: { showCancelButton: true },
  59950. prompt: { showCancelButton: true, showInput: true }
  59951. };
  59952. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  59953. MessageBox[boxType] = messageBoxFactory(boxType);
  59954. });
  59955. function messageBoxFactory(boxType) {
  59956. return (message2, title, options, appContext) => {
  59957. let titleOrOpts = "";
  59958. if (isObject$1(title)) {
  59959. options = title;
  59960. titleOrOpts = "";
  59961. } else if (isUndefined(title)) {
  59962. titleOrOpts = "";
  59963. } else {
  59964. titleOrOpts = title;
  59965. }
  59966. return MessageBox(Object.assign({
  59967. title: titleOrOpts,
  59968. message: message2,
  59969. type: "",
  59970. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  59971. }, options, {
  59972. boxType
  59973. }), appContext);
  59974. };
  59975. }
  59976. MessageBox.close = () => {
  59977. messageInstance.forEach((_2, vm) => {
  59978. vm.doClose();
  59979. });
  59980. messageInstance.clear();
  59981. };
  59982. MessageBox._context = null;
  59983. const _MessageBox = MessageBox;
  59984. _MessageBox.install = (app) => {
  59985. _MessageBox._context = app._context;
  59986. app.config.globalProperties.$msgbox = _MessageBox;
  59987. app.config.globalProperties.$messageBox = _MessageBox;
  59988. app.config.globalProperties.$alert = _MessageBox.alert;
  59989. app.config.globalProperties.$confirm = _MessageBox.confirm;
  59990. app.config.globalProperties.$prompt = _MessageBox.prompt;
  59991. };
  59992. const ElMessageBox = _MessageBox;
  59993. const notificationTypes = [
  59994. "success",
  59995. "info",
  59996. "warning",
  59997. "error"
  59998. ];
  59999. const notificationProps = buildProps({
  60000. customClass: {
  60001. type: String,
  60002. default: ""
  60003. },
  60004. dangerouslyUseHTMLString: {
  60005. type: Boolean,
  60006. default: false
  60007. },
  60008. duration: {
  60009. type: Number,
  60010. default: 4500
  60011. },
  60012. icon: {
  60013. type: iconPropType
  60014. },
  60015. id: {
  60016. type: String,
  60017. default: ""
  60018. },
  60019. message: {
  60020. type: definePropType([String, Object]),
  60021. default: ""
  60022. },
  60023. offset: {
  60024. type: Number,
  60025. default: 0
  60026. },
  60027. onClick: {
  60028. type: definePropType(Function),
  60029. default: () => void 0
  60030. },
  60031. onClose: {
  60032. type: definePropType(Function),
  60033. required: true
  60034. },
  60035. position: {
  60036. type: String,
  60037. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  60038. default: "top-right"
  60039. },
  60040. showClose: {
  60041. type: Boolean,
  60042. default: true
  60043. },
  60044. title: {
  60045. type: String,
  60046. default: ""
  60047. },
  60048. type: {
  60049. type: String,
  60050. values: [...notificationTypes, ""],
  60051. default: ""
  60052. },
  60053. zIndex: Number
  60054. });
  60055. const notificationEmits = {
  60056. destroy: () => true
  60057. };
  60058. const _hoisted_1$2 = ["id"];
  60059. const _hoisted_2$1 = ["textContent"];
  60060. const _hoisted_3 = { key: 0 };
  60061. const _hoisted_4 = ["innerHTML"];
  60062. const __default__ = /* @__PURE__ */ defineComponent({
  60063. name: "ElNotification"
  60064. });
  60065. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  60066. ...__default__,
  60067. props: notificationProps,
  60068. emits: notificationEmits,
  60069. setup(__props, { expose }) {
  60070. const props = __props;
  60071. const { ns, zIndex: zIndex2 } = useGlobalComponentSettings("notification");
  60072. const { nextZIndex, currentZIndex } = zIndex2;
  60073. const { Close } = CloseComponents;
  60074. const visible = ref(false);
  60075. let timer = void 0;
  60076. const typeClass = computed(() => {
  60077. const type2 = props.type;
  60078. return type2 && TypeComponentsMap[props.type] ? ns.m(type2) : "";
  60079. });
  60080. const iconComponent = computed(() => {
  60081. if (!props.type)
  60082. return props.icon;
  60083. return TypeComponentsMap[props.type] || props.icon;
  60084. });
  60085. const horizontalClass = computed(() => props.position.endsWith("right") ? "right" : "left");
  60086. const verticalProperty = computed(() => props.position.startsWith("top") ? "top" : "bottom");
  60087. const positionStyle = computed(() => {
  60088. var _a2;
  60089. return {
  60090. [verticalProperty.value]: `${props.offset}px`,
  60091. zIndex: (_a2 = props.zIndex) != null ? _a2 : currentZIndex.value
  60092. };
  60093. });
  60094. function startTimer() {
  60095. if (props.duration > 0) {
  60096. ({ stop: timer } = useTimeoutFn(() => {
  60097. if (visible.value)
  60098. close2();
  60099. }, props.duration));
  60100. }
  60101. }
  60102. function clearTimer() {
  60103. timer == null ? void 0 : timer();
  60104. }
  60105. function close2() {
  60106. visible.value = false;
  60107. }
  60108. function onKeydown({ code }) {
  60109. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  60110. clearTimer();
  60111. } else if (code === EVENT_CODE.esc) {
  60112. if (visible.value) {
  60113. close2();
  60114. }
  60115. } else {
  60116. startTimer();
  60117. }
  60118. }
  60119. onMounted(() => {
  60120. startTimer();
  60121. nextZIndex();
  60122. visible.value = true;
  60123. });
  60124. useEventListener(document, "keydown", onKeydown);
  60125. expose({
  60126. visible,
  60127. close: close2
  60128. });
  60129. return (_ctx, _cache) => {
  60130. return openBlock(), createBlock(Transition, {
  60131. name: unref(ns).b("fade"),
  60132. onBeforeLeave: _ctx.onClose,
  60133. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  60134. persisted: ""
  60135. }, {
  60136. default: withCtx(() => [
  60137. withDirectives(createBaseVNode("div", {
  60138. id: _ctx.id,
  60139. class: normalizeClass([unref(ns).b(), _ctx.customClass, unref(horizontalClass)]),
  60140. style: normalizeStyle(unref(positionStyle)),
  60141. role: "alert",
  60142. onMouseenter: clearTimer,
  60143. onMouseleave: startTimer,
  60144. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
  60145. }, [
  60146. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  60147. key: 0,
  60148. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  60149. }, {
  60150. default: withCtx(() => [
  60151. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  60152. ]),
  60153. _: 1
  60154. }, 8, ["class"])) : createCommentVNode("v-if", true),
  60155. createBaseVNode("div", {
  60156. class: normalizeClass(unref(ns).e("group"))
  60157. }, [
  60158. createBaseVNode("h2", {
  60159. class: normalizeClass(unref(ns).e("title")),
  60160. textContent: toDisplayString(_ctx.title)
  60161. }, null, 10, _hoisted_2$1),
  60162. withDirectives(createBaseVNode("div", {
  60163. class: normalizeClass(unref(ns).e("content")),
  60164. style: normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  60165. }, [
  60166. renderSlot(_ctx.$slots, "default", {}, () => [
  60167. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(_ctx.message), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  60168. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  60169. createBaseVNode("p", { innerHTML: _ctx.message }, null, 8, _hoisted_4)
  60170. ], 2112))
  60171. ])
  60172. ], 6), [
  60173. [vShow, _ctx.message]
  60174. ]),
  60175. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  60176. key: 0,
  60177. class: normalizeClass(unref(ns).e("closeBtn")),
  60178. onClick: withModifiers(close2, ["stop"])
  60179. }, {
  60180. default: withCtx(() => [
  60181. createVNode(unref(Close))
  60182. ]),
  60183. _: 1
  60184. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  60185. ], 2)
  60186. ], 46, _hoisted_1$2), [
  60187. [vShow, visible.value]
  60188. ])
  60189. ]),
  60190. _: 3
  60191. }, 8, ["name", "onBeforeLeave"]);
  60192. };
  60193. }
  60194. });
  60195. var NotificationConstructor = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/notification/src/notification.vue"]]);
  60196. const notifications = {
  60197. "top-left": [],
  60198. "top-right": [],
  60199. "bottom-left": [],
  60200. "bottom-right": []
  60201. };
  60202. const GAP_SIZE = 16;
  60203. let seed = 1;
  60204. const notify = function(options = {}, context = null) {
  60205. if (!isClient)
  60206. return { close: () => void 0 };
  60207. if (typeof options === "string" || isVNode(options)) {
  60208. options = { message: options };
  60209. }
  60210. const position = options.position || "top-right";
  60211. let verticalOffset = options.offset || 0;
  60212. notifications[position].forEach(({ vm: vm2 }) => {
  60213. var _a2;
  60214. verticalOffset += (((_a2 = vm2.el) == null ? void 0 : _a2.offsetHeight) || 0) + GAP_SIZE;
  60215. });
  60216. verticalOffset += GAP_SIZE;
  60217. const id = `notification_${seed++}`;
  60218. const userOnClose = options.onClose;
  60219. const props = {
  60220. ...options,
  60221. offset: verticalOffset,
  60222. id,
  60223. onClose: () => {
  60224. close(id, position, userOnClose);
  60225. }
  60226. };
  60227. let appendTo = document.body;
  60228. if (isElement$1(options.appendTo)) {
  60229. appendTo = options.appendTo;
  60230. } else if (isString$1(options.appendTo)) {
  60231. appendTo = document.querySelector(options.appendTo);
  60232. }
  60233. if (!isElement$1(appendTo)) {
  60234. appendTo = document.body;
  60235. }
  60236. const container = document.createElement("div");
  60237. const vm = createVNode(NotificationConstructor, props, isVNode(props.message) ? {
  60238. default: () => props.message
  60239. } : null);
  60240. vm.appContext = context != null ? context : notify._context;
  60241. vm.props.onDestroy = () => {
  60242. render(null, container);
  60243. };
  60244. render(vm, container);
  60245. notifications[position].push({ vm });
  60246. appendTo.appendChild(container.firstElementChild);
  60247. return {
  60248. close: () => {
  60249. vm.component.exposed.visible.value = false;
  60250. }
  60251. };
  60252. };
  60253. notificationTypes.forEach((type2) => {
  60254. notify[type2] = (options = {}) => {
  60255. if (typeof options === "string" || isVNode(options)) {
  60256. options = {
  60257. message: options
  60258. };
  60259. }
  60260. return notify({
  60261. ...options,
  60262. type: type2
  60263. });
  60264. };
  60265. });
  60266. function close(id, position, userOnClose) {
  60267. const orientedNotifications = notifications[position];
  60268. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  60269. var _a2;
  60270. return ((_a2 = vm2.component) == null ? void 0 : _a2.props.id) === id;
  60271. });
  60272. if (idx === -1)
  60273. return;
  60274. const { vm } = orientedNotifications[idx];
  60275. if (!vm)
  60276. return;
  60277. userOnClose == null ? void 0 : userOnClose(vm);
  60278. const removedHeight = vm.el.offsetHeight;
  60279. const verticalPos = position.split("-")[0];
  60280. orientedNotifications.splice(idx, 1);
  60281. const len = orientedNotifications.length;
  60282. if (len < 1)
  60283. return;
  60284. for (let i = idx; i < len; i++) {
  60285. const { el, component: component2 } = orientedNotifications[i].vm;
  60286. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  60287. component2.props.offset = pos;
  60288. }
  60289. }
  60290. function closeAll() {
  60291. for (const orientedNotifications of Object.values(notifications)) {
  60292. orientedNotifications.forEach(({ vm }) => {
  60293. vm.component.exposed.visible.value = false;
  60294. });
  60295. }
  60296. }
  60297. notify.closeAll = closeAll;
  60298. notify._context = null;
  60299. const ElNotification = withInstallFunction(notify, "$notify");
  60300. var Plugins = [
  60301. ElInfiniteScroll,
  60302. ElLoading,
  60303. ElMessage,
  60304. ElMessageBox,
  60305. ElNotification,
  60306. ElPopoverDirective
  60307. ];
  60308. var installer = makeInstaller([...Components, ...Plugins]);
  60309. const useReservStore = defineStore("reservdata", () => {
  60310. const count = ref(0);
  60311. const mqttstat = ref(false);
  60312. ref("");
  60313. const doubleCount = computed(() => count * 2);
  60314. function increment() {
  60315. count.value++;
  60316. }
  60317. return { count, mqttstat, doubleCount, increment };
  60318. });
  60319. const LoginPage_vue_vue_type_style_index_0_scoped_d565364c_lang = "";
  60320. const _export_sfc = (sfc, props) => {
  60321. const target = sfc.__vccOpts || sfc;
  60322. for (const [key, val] of props) {
  60323. target[key] = val;
  60324. }
  60325. return target;
  60326. };
  60327. const _withScopeId = (n) => (pushScopeId("data-v-d565364c"), n = n(), popScopeId(), n);
  60328. const _hoisted_1$1 = { class: "custom-container" };
  60329. const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("h1", null, "Sign In", -1));
  60330. const _sfc_main$3 = {
  60331. __name: "LoginPage",
  60332. setup(__props) {
  60333. const { ipcRenderer } = window.require("electron");
  60334. const dayjs2 = require("dayjs");
  60335. const utc = require("dayjs/plugin/utc");
  60336. const router2 = useRouter();
  60337. const reservstore = useReservStore();
  60338. const username = ref("886235000025_1");
  60339. const password = ref("");
  60340. const loginStat = ref(0);
  60341. const login = () => {
  60342. console.log(reservstore.mqttstat);
  60343. dayjs2.extend(utc);
  60344. dayjs2().utc().format("YYYY/MM/DD_HH:mm:ss").toString();
  60345. var data = username.value.split("_");
  60346. if (data.length == 2) {
  60347. var cmd2 = {
  60348. action: "loginVerify",
  60349. data: {
  60350. cid: data[0],
  60351. userID: data[1],
  60352. vpasswd: password.value
  60353. }
  60354. };
  60355. loginStat.value = 1;
  60356. ipcRenderer.send("cms:loginVerify", cmd2);
  60357. }
  60358. };
  60359. ipcRenderer.on("cms:loginVerifyReply", (event, param) => {
  60360. DebugLog("LoginPage 接收到 cms:loginVerifyReply : " + JSON.stringify(param));
  60361. if (param.data.code == 200) {
  60362. ElMessage({
  60363. type: "success",
  60364. message: "登錄 成功"
  60365. });
  60366. reservstore.mqttToken = param.data.token;
  60367. loginStat.value = 2;
  60368. router2.push("reserv");
  60369. } else {
  60370. ElMessage.error("登錄 失敗");
  60371. loginStat.value = 0;
  60372. }
  60373. });
  60374. const DebugLog = (item) => {
  60375. ipcRenderer.send("debug-log", item);
  60376. };
  60377. return (_ctx, _cache) => {
  60378. const _component_el_input = resolveComponent("el-input");
  60379. const _component_el_form_item = resolveComponent("el-form-item");
  60380. const _component_el_button = resolveComponent("el-button");
  60381. const _component_el_form = resolveComponent("el-form");
  60382. return openBlock(), createElementBlock("div", _hoisted_1$1, [
  60383. createBaseVNode("div", null, [
  60384. _hoisted_2,
  60385. createVNode(_component_el_form, null, {
  60386. default: withCtx(() => [
  60387. createVNode(_component_el_form_item, { label: "Username" }, {
  60388. default: withCtx(() => [
  60389. createVNode(_component_el_input, {
  60390. modelValue: username.value,
  60391. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => username.value = $event),
  60392. placeholder: "Enter your username"
  60393. }, null, 8, ["modelValue"])
  60394. ]),
  60395. _: 1
  60396. }),
  60397. createVNode(_component_el_form_item, { label: "Password" }, {
  60398. default: withCtx(() => [
  60399. createVNode(_component_el_input, {
  60400. modelValue: password.value,
  60401. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => password.value = $event),
  60402. placeholder: "Enter your password",
  60403. type: "password"
  60404. }, null, 8, ["modelValue"])
  60405. ]),
  60406. _: 1
  60407. }),
  60408. createVNode(_component_el_form_item, null, {
  60409. default: withCtx(() => [
  60410. createVNode(_component_el_button, {
  60411. type: "primary",
  60412. disabled: !unref(reservstore).mqttstat || loginStat.value != 0,
  60413. onClick: login
  60414. }, {
  60415. default: withCtx(() => [
  60416. createTextVNode("Login")
  60417. ]),
  60418. _: 1
  60419. }, 8, ["disabled"])
  60420. ]),
  60421. _: 1
  60422. })
  60423. ]),
  60424. _: 1
  60425. })
  60426. ])
  60427. ]);
  60428. };
  60429. }
  60430. };
  60431. const Login = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-d565364c"]]);
  60432. const _hoisted_1 = /* @__PURE__ */ createBaseVNode("h1", null, "預約系統", -1);
  60433. const _sfc_main$2 = {
  60434. __name: "ReservMain",
  60435. setup(__props) {
  60436. const { ipcRenderer } = window.require("electron");
  60437. require("@electron/remote");
  60438. require("@electron/remote").getCurrentWindow();
  60439. require("fs");
  60440. const reservstore = useReservStore();
  60441. const btnLogin = async (e) => {
  60442. console.log("btn press");
  60443. reservstore.increment();
  60444. var cmd = {
  60445. action: "setData",
  60446. data: {
  60447. name: "mqttstat",
  60448. user: "",
  60449. type: "Number",
  60450. value: "12345"
  60451. }
  60452. };
  60453. ipcRenderer.send("ipc:setData", cmd);
  60454. var cmd1 = {
  60455. action: "getData",
  60456. data: {
  60457. name: "mqttstat",
  60458. user: "",
  60459. type: "Number"
  60460. }
  60461. };
  60462. ipcRenderer.send("ipc:getData", cmd1);
  60463. };
  60464. const DebugLog = (item) => {
  60465. ipcRenderer.send("debug-log", item);
  60466. };
  60467. ipcRenderer.on("ipc:getDataReply", async (event, param) => {
  60468. DebugLog("ReservMain 接收到 ipc:getDataReply : " + JSON.stringify(param));
  60469. });
  60470. return (_ctx, _cache) => {
  60471. const _component_el_button = resolveComponent("el-button");
  60472. return openBlock(), createElementBlock(Fragment, null, [
  60473. createBaseVNode("div", null, [
  60474. _hoisted_1,
  60475. createBaseVNode("h1", null, "count: " + toDisplayString(unref(reservstore).count), 1)
  60476. ]),
  60477. createBaseVNode("div", null, [
  60478. createVNode(_component_el_button, {
  60479. type: "danger",
  60480. onClick: btnLogin
  60481. }, {
  60482. default: withCtx(() => [
  60483. createTextVNode("登入")
  60484. ]),
  60485. _: 1
  60486. })
  60487. ])
  60488. ], 64);
  60489. };
  60490. }
  60491. };
  60492. const router = createRouter({
  60493. //history: createWebHistory(),
  60494. history: createWebHashHistory(),
  60495. routes: [
  60496. { path: "/", name: "home", component: Login },
  60497. { path: "/reserv", name: "reserv", component: _sfc_main$2 }
  60498. ]
  60499. });
  60500. const index = "";
  60501. const _sfc_main$1 = {
  60502. __name: "BackGround",
  60503. setup(__props) {
  60504. const { ipcRenderer } = window.require("electron");
  60505. require("@electron/remote");
  60506. require("@electron/remote").getCurrentWindow();
  60507. require("fs");
  60508. console.log("BackGround run ......");
  60509. const reservstore = useReservStore();
  60510. onMounted(() => {
  60511. console.log("onMounted...");
  60512. ipcRenderer.send("renderer:cmd", "onMounted");
  60513. });
  60514. const DebugLog = (item) => {
  60515. ipcRenderer.send("debug-log", item);
  60516. };
  60517. ipcRenderer.on("mqtt:connectReply", async (event, param) => {
  60518. DebugLog("ReservMain 接收到 mqtt:connectReply : " + JSON.stringify(param));
  60519. console.log("ReservMain 接收到 mqtt:connectReply : " + JSON.stringify(param));
  60520. if (param.action == "mqttconnect") {
  60521. if (param.success) {
  60522. if (!reservstore.mqttstat) {
  60523. ElMessage({
  60524. type: "success",
  60525. message: "MQTT連線 成功"
  60526. });
  60527. reservstore.mqttstat = true;
  60528. }
  60529. } else {
  60530. if (reservstore.mqttstat) {
  60531. ElMessage.error("MQTT連線 失敗");
  60532. reservstore.mqttstat = false;
  60533. }
  60534. }
  60535. }
  60536. });
  60537. return (_ctx, _cache) => {
  60538. return openBlock(), createElementBlock("div");
  60539. };
  60540. }
  60541. };
  60542. const App_vue_vue_type_style_index_0_lang = "";
  60543. const _sfc_main = {
  60544. __name: "App",
  60545. setup(__props) {
  60546. return (_ctx, _cache) => {
  60547. const _component_router_view = resolveComponent("router-view");
  60548. return openBlock(), createElementBlock(Fragment, null, [
  60549. createVNode(_sfc_main$1),
  60550. createVNode(_component_router_view)
  60551. ], 64);
  60552. };
  60553. }
  60554. };
  60555. createApp(_sfc_main).use(createPinia()).use(router).use(installer).mount("#app");
  60556. }
  60557. });
  60558. export default require_index_001();