index.full.js 2.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774
  1. /*! Element Plus v2.9.8 */
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
  4. typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
  5. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElementPlus = {}, global.Vue));
  6. })(this, (function (exports, vue) { 'use strict';
  7. 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])`;
  8. const isVisible = (element) => {
  9. const computed = getComputedStyle(element);
  10. return computed.position === "fixed" ? false : element.offsetParent !== null;
  11. };
  12. const obtainAllFocusableElements$1 = (element) => {
  13. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  14. };
  15. const isFocusable = (element) => {
  16. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  17. return true;
  18. }
  19. if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") {
  20. return false;
  21. }
  22. switch (element.nodeName) {
  23. case "A": {
  24. return !!element.href && element.rel !== "ignore";
  25. }
  26. case "INPUT": {
  27. return !(element.type === "hidden" || element.type === "file");
  28. }
  29. case "BUTTON":
  30. case "SELECT":
  31. case "TEXTAREA": {
  32. return true;
  33. }
  34. default: {
  35. return false;
  36. }
  37. }
  38. };
  39. const triggerEvent = function(elm, name, ...opts) {
  40. let eventName;
  41. if (name.includes("mouse") || name.includes("click")) {
  42. eventName = "MouseEvents";
  43. } else if (name.includes("key")) {
  44. eventName = "KeyboardEvent";
  45. } else {
  46. eventName = "HTMLEvents";
  47. }
  48. const evt = document.createEvent(eventName);
  49. evt.initEvent(name, ...opts);
  50. elm.dispatchEvent(evt);
  51. return elm;
  52. };
  53. const isLeaf = (el) => !el.getAttribute("aria-owns");
  54. const getSibling = (el, distance, elClass) => {
  55. const { parentNode } = el;
  56. if (!parentNode)
  57. return null;
  58. const siblings = parentNode.querySelectorAll(elClass);
  59. const index = Array.prototype.indexOf.call(siblings, el);
  60. return siblings[index + distance] || null;
  61. };
  62. const focusNode = (el) => {
  63. if (!el)
  64. return;
  65. el.focus();
  66. !isLeaf(el) && el.click();
  67. };
  68. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  69. const handleEvent = (event) => {
  70. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  71. if (checkForDefaultPrevented === false || !shouldPrevent) {
  72. return oursHandler == null ? void 0 : oursHandler(event);
  73. }
  74. };
  75. return handleEvent;
  76. };
  77. const whenMouse = (handler) => {
  78. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  79. };
  80. var __defProp$9 = Object.defineProperty;
  81. var __defProps$6 = Object.defineProperties;
  82. var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
  83. var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
  84. var __hasOwnProp$b = Object.prototype.hasOwnProperty;
  85. var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
  86. var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  87. var __spreadValues$9 = (a, b) => {
  88. for (var prop in b || (b = {}))
  89. if (__hasOwnProp$b.call(b, prop))
  90. __defNormalProp$9(a, prop, b[prop]);
  91. if (__getOwnPropSymbols$b)
  92. for (var prop of __getOwnPropSymbols$b(b)) {
  93. if (__propIsEnum$b.call(b, prop))
  94. __defNormalProp$9(a, prop, b[prop]);
  95. }
  96. return a;
  97. };
  98. var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
  99. function computedEager(fn, options) {
  100. var _a;
  101. const result = vue.shallowRef();
  102. vue.watchEffect(() => {
  103. result.value = fn();
  104. }, __spreadProps$6(__spreadValues$9({}, options), {
  105. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  106. }));
  107. return vue.readonly(result);
  108. }
  109. var _a;
  110. const isClient = typeof window !== "undefined";
  111. const isDef = (val) => typeof val !== "undefined";
  112. const isString$2 = (val) => typeof val === "string";
  113. const noop$1 = () => {
  114. };
  115. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  116. function resolveUnref(r) {
  117. return typeof r === "function" ? r() : vue.unref(r);
  118. }
  119. function createFilterWrapper(filter, fn) {
  120. function wrapper(...args) {
  121. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  122. }
  123. return wrapper;
  124. }
  125. function debounceFilter(ms, options = {}) {
  126. let timer;
  127. let maxTimer;
  128. const filter = (invoke) => {
  129. const duration = resolveUnref(ms);
  130. const maxDuration = resolveUnref(options.maxWait);
  131. if (timer)
  132. clearTimeout(timer);
  133. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  134. if (maxTimer) {
  135. clearTimeout(maxTimer);
  136. maxTimer = null;
  137. }
  138. return invoke();
  139. }
  140. if (maxDuration && !maxTimer) {
  141. maxTimer = setTimeout(() => {
  142. if (timer)
  143. clearTimeout(timer);
  144. maxTimer = null;
  145. invoke();
  146. }, maxDuration);
  147. }
  148. timer = setTimeout(() => {
  149. if (maxTimer)
  150. clearTimeout(maxTimer);
  151. maxTimer = null;
  152. invoke();
  153. }, duration);
  154. };
  155. return filter;
  156. }
  157. function throttleFilter(ms, trailing = true, leading = true) {
  158. let lastExec = 0;
  159. let timer;
  160. let isLeading = true;
  161. const clear = () => {
  162. if (timer) {
  163. clearTimeout(timer);
  164. timer = void 0;
  165. }
  166. };
  167. const filter = (invoke) => {
  168. const duration = resolveUnref(ms);
  169. const elapsed = Date.now() - lastExec;
  170. clear();
  171. if (duration <= 0) {
  172. lastExec = Date.now();
  173. return invoke();
  174. }
  175. if (elapsed > duration && (leading || !isLeading)) {
  176. lastExec = Date.now();
  177. invoke();
  178. } else if (trailing) {
  179. timer = setTimeout(() => {
  180. lastExec = Date.now();
  181. isLeading = true;
  182. clear();
  183. invoke();
  184. }, duration);
  185. }
  186. if (!leading && !timer)
  187. timer = setTimeout(() => isLeading = true, duration);
  188. isLeading = false;
  189. };
  190. return filter;
  191. }
  192. function identity$1(arg) {
  193. return arg;
  194. }
  195. function tryOnScopeDispose(fn) {
  196. if (vue.getCurrentScope()) {
  197. vue.onScopeDispose(fn);
  198. return true;
  199. }
  200. return false;
  201. }
  202. function useDebounceFn(fn, ms = 200, options = {}) {
  203. return createFilterWrapper(debounceFilter(ms, options), fn);
  204. }
  205. function refDebounced(value, ms = 200, options = {}) {
  206. if (ms <= 0)
  207. return value;
  208. const debounced = vue.ref(value.value);
  209. const updater = useDebounceFn(() => {
  210. debounced.value = value.value;
  211. }, ms, options);
  212. vue.watch(value, () => updater());
  213. return debounced;
  214. }
  215. function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
  216. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  217. }
  218. function tryOnMounted(fn, sync = true) {
  219. if (vue.getCurrentInstance())
  220. vue.onMounted(fn);
  221. else if (sync)
  222. fn();
  223. else
  224. vue.nextTick(fn);
  225. }
  226. function useTimeoutFn(cb, interval, options = {}) {
  227. const {
  228. immediate = true
  229. } = options;
  230. const isPending = vue.ref(false);
  231. let timer = null;
  232. function clear() {
  233. if (timer) {
  234. clearTimeout(timer);
  235. timer = null;
  236. }
  237. }
  238. function stop() {
  239. isPending.value = false;
  240. clear();
  241. }
  242. function start(...args) {
  243. clear();
  244. isPending.value = true;
  245. timer = setTimeout(() => {
  246. isPending.value = false;
  247. timer = null;
  248. cb(...args);
  249. }, resolveUnref(interval));
  250. }
  251. if (immediate) {
  252. isPending.value = true;
  253. if (isClient)
  254. start();
  255. }
  256. tryOnScopeDispose(stop);
  257. return {
  258. isPending,
  259. start,
  260. stop
  261. };
  262. }
  263. function unrefElement(elRef) {
  264. var _a;
  265. const plain = resolveUnref(elRef);
  266. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  267. }
  268. const defaultWindow = isClient ? window : void 0;
  269. const defaultDocument = isClient ? window.document : void 0;
  270. function useEventListener(...args) {
  271. let target;
  272. let event;
  273. let listener;
  274. let options;
  275. if (isString$2(args[0])) {
  276. [event, listener, options] = args;
  277. target = defaultWindow;
  278. } else {
  279. [target, event, listener, options] = args;
  280. }
  281. if (!target)
  282. return noop$1;
  283. let cleanup = noop$1;
  284. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  285. cleanup();
  286. if (!el)
  287. return;
  288. el.addEventListener(event, listener, options);
  289. cleanup = () => {
  290. el.removeEventListener(event, listener, options);
  291. cleanup = noop$1;
  292. };
  293. }, { immediate: true, flush: "post" });
  294. const stop = () => {
  295. stopWatch();
  296. cleanup();
  297. };
  298. tryOnScopeDispose(stop);
  299. return stop;
  300. }
  301. function onClickOutside(target, handler, options = {}) {
  302. const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options;
  303. if (!window)
  304. return;
  305. const shouldListen = vue.ref(true);
  306. let fallback;
  307. const listener = (event) => {
  308. window.clearTimeout(fallback);
  309. const el = unrefElement(target);
  310. const composedPath = event.composedPath();
  311. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  312. return;
  313. if (ignore && ignore.length > 0) {
  314. if (ignore.some((target2) => {
  315. const el2 = unrefElement(target2);
  316. return el2 && (event.target === el2 || composedPath.includes(el2));
  317. }))
  318. return;
  319. }
  320. handler(event);
  321. };
  322. const cleanup = [
  323. useEventListener(window, "click", listener, { passive: true, capture }),
  324. useEventListener(window, "pointerdown", (e) => {
  325. const el = unrefElement(target);
  326. shouldListen.value = !!el && !e.composedPath().includes(el);
  327. }, { passive: true }),
  328. useEventListener(window, "pointerup", (e) => {
  329. if (e.button === 0) {
  330. const path = e.composedPath();
  331. e.composedPath = () => path;
  332. fallback = window.setTimeout(() => listener(e), 50);
  333. }
  334. }, { passive: true }),
  335. detectIframe && useEventListener(window, "blur", (event) => {
  336. var _a;
  337. const el = unrefElement(target);
  338. if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
  339. handler(event);
  340. })
  341. ].filter(Boolean);
  342. const stop = () => cleanup.forEach((fn) => fn());
  343. return stop;
  344. }
  345. function useActiveElement(options = {}) {
  346. const { window = defaultWindow } = options;
  347. const counter = vue.ref(0);
  348. if (window) {
  349. useEventListener(window, "blur", () => counter.value += 1, true);
  350. useEventListener(window, "focus", () => counter.value += 1, true);
  351. }
  352. return vue.computed(() => {
  353. counter.value;
  354. return window == null ? void 0 : window.document.activeElement;
  355. });
  356. }
  357. function useSupported(callback, sync = false) {
  358. const isSupported = vue.ref();
  359. const update = () => isSupported.value = Boolean(callback());
  360. update();
  361. tryOnMounted(update, sync);
  362. return isSupported;
  363. }
  364. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  365. const globalKey = "__vueuse_ssr_handlers__";
  366. _global[globalKey] = _global[globalKey] || {};
  367. _global[globalKey];
  368. function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
  369. const variable = vue.ref(initialValue);
  370. const elRef = vue.computed(() => {
  371. var _a;
  372. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  373. });
  374. vue.watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  375. var _a;
  376. if (el && window) {
  377. const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim();
  378. variable.value = value || initialValue;
  379. }
  380. }, { immediate: true });
  381. vue.watch(variable, (val) => {
  382. var _a;
  383. if ((_a = elRef.value) == null ? void 0 : _a.style)
  384. elRef.value.style.setProperty(resolveUnref(prop), val);
  385. });
  386. return variable;
  387. }
  388. function useDocumentVisibility({ document = defaultDocument } = {}) {
  389. if (!document)
  390. return vue.ref("visible");
  391. const visibility = vue.ref(document.visibilityState);
  392. useEventListener(document, "visibilitychange", () => {
  393. visibility.value = document.visibilityState;
  394. });
  395. return visibility;
  396. }
  397. var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
  398. var __hasOwnProp$f = Object.prototype.hasOwnProperty;
  399. var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
  400. var __objRest$2 = (source, exclude) => {
  401. var target = {};
  402. for (var prop in source)
  403. if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
  404. target[prop] = source[prop];
  405. if (source != null && __getOwnPropSymbols$f)
  406. for (var prop of __getOwnPropSymbols$f(source)) {
  407. if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
  408. target[prop] = source[prop];
  409. }
  410. return target;
  411. };
  412. function useResizeObserver(target, callback, options = {}) {
  413. const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
  414. let observer;
  415. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  416. const cleanup = () => {
  417. if (observer) {
  418. observer.disconnect();
  419. observer = void 0;
  420. }
  421. };
  422. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  423. cleanup();
  424. if (isSupported.value && window && el) {
  425. observer = new ResizeObserver(callback);
  426. observer.observe(el, observerOptions);
  427. }
  428. }, { immediate: true, flush: "post" });
  429. const stop = () => {
  430. cleanup();
  431. stopWatch();
  432. };
  433. tryOnScopeDispose(stop);
  434. return {
  435. isSupported,
  436. stop
  437. };
  438. }
  439. function useElementBounding(target, options = {}) {
  440. const {
  441. reset = true,
  442. windowResize = true,
  443. windowScroll = true,
  444. immediate = true
  445. } = options;
  446. const height = vue.ref(0);
  447. const bottom = vue.ref(0);
  448. const left = vue.ref(0);
  449. const right = vue.ref(0);
  450. const top = vue.ref(0);
  451. const width = vue.ref(0);
  452. const x = vue.ref(0);
  453. const y = vue.ref(0);
  454. function update() {
  455. const el = unrefElement(target);
  456. if (!el) {
  457. if (reset) {
  458. height.value = 0;
  459. bottom.value = 0;
  460. left.value = 0;
  461. right.value = 0;
  462. top.value = 0;
  463. width.value = 0;
  464. x.value = 0;
  465. y.value = 0;
  466. }
  467. return;
  468. }
  469. const rect = el.getBoundingClientRect();
  470. height.value = rect.height;
  471. bottom.value = rect.bottom;
  472. left.value = rect.left;
  473. right.value = rect.right;
  474. top.value = rect.top;
  475. width.value = rect.width;
  476. x.value = rect.x;
  477. y.value = rect.y;
  478. }
  479. useResizeObserver(target, update);
  480. vue.watch(() => unrefElement(target), (ele) => !ele && update());
  481. if (windowScroll)
  482. useEventListener("scroll", update, { passive: true });
  483. if (windowResize)
  484. useEventListener("resize", update, { passive: true });
  485. tryOnMounted(() => {
  486. if (immediate)
  487. update();
  488. });
  489. return {
  490. height,
  491. bottom,
  492. left,
  493. right,
  494. top,
  495. width,
  496. x,
  497. y,
  498. update
  499. };
  500. }
  501. var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
  502. var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
  503. var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
  504. var __objRest$1 = (source, exclude) => {
  505. var target = {};
  506. for (var prop in source)
  507. if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
  508. target[prop] = source[prop];
  509. if (source != null && __getOwnPropSymbols$7)
  510. for (var prop of __getOwnPropSymbols$7(source)) {
  511. if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
  512. target[prop] = source[prop];
  513. }
  514. return target;
  515. };
  516. function useMutationObserver(target, callback, options = {}) {
  517. const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest$1(_a, ["window"]);
  518. let observer;
  519. const isSupported = useSupported(() => window && "MutationObserver" in window);
  520. const cleanup = () => {
  521. if (observer) {
  522. observer.disconnect();
  523. observer = void 0;
  524. }
  525. };
  526. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  527. cleanup();
  528. if (isSupported.value && window && el) {
  529. observer = new MutationObserver(callback);
  530. observer.observe(el, mutationOptions);
  531. }
  532. }, { immediate: true });
  533. const stop = () => {
  534. cleanup();
  535. stopWatch();
  536. };
  537. tryOnScopeDispose(stop);
  538. return {
  539. isSupported,
  540. stop
  541. };
  542. }
  543. var SwipeDirection;
  544. (function(SwipeDirection2) {
  545. SwipeDirection2["UP"] = "UP";
  546. SwipeDirection2["RIGHT"] = "RIGHT";
  547. SwipeDirection2["DOWN"] = "DOWN";
  548. SwipeDirection2["LEFT"] = "LEFT";
  549. SwipeDirection2["NONE"] = "NONE";
  550. })(SwipeDirection || (SwipeDirection = {}));
  551. var __defProp = Object.defineProperty;
  552. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  553. var __hasOwnProp = Object.prototype.hasOwnProperty;
  554. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  555. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  556. var __spreadValues = (a, b) => {
  557. for (var prop in b || (b = {}))
  558. if (__hasOwnProp.call(b, prop))
  559. __defNormalProp(a, prop, b[prop]);
  560. if (__getOwnPropSymbols)
  561. for (var prop of __getOwnPropSymbols(b)) {
  562. if (__propIsEnum.call(b, prop))
  563. __defNormalProp(a, prop, b[prop]);
  564. }
  565. return a;
  566. };
  567. const _TransitionPresets = {
  568. easeInSine: [0.12, 0, 0.39, 0],
  569. easeOutSine: [0.61, 1, 0.88, 1],
  570. easeInOutSine: [0.37, 0, 0.63, 1],
  571. easeInQuad: [0.11, 0, 0.5, 0],
  572. easeOutQuad: [0.5, 1, 0.89, 1],
  573. easeInOutQuad: [0.45, 0, 0.55, 1],
  574. easeInCubic: [0.32, 0, 0.67, 0],
  575. easeOutCubic: [0.33, 1, 0.68, 1],
  576. easeInOutCubic: [0.65, 0, 0.35, 1],
  577. easeInQuart: [0.5, 0, 0.75, 0],
  578. easeOutQuart: [0.25, 1, 0.5, 1],
  579. easeInOutQuart: [0.76, 0, 0.24, 1],
  580. easeInQuint: [0.64, 0, 0.78, 0],
  581. easeOutQuint: [0.22, 1, 0.36, 1],
  582. easeInOutQuint: [0.83, 0, 0.17, 1],
  583. easeInExpo: [0.7, 0, 0.84, 0],
  584. easeOutExpo: [0.16, 1, 0.3, 1],
  585. easeInOutExpo: [0.87, 0, 0.13, 1],
  586. easeInCirc: [0.55, 0, 1, 0.45],
  587. easeOutCirc: [0, 0.55, 0.45, 1],
  588. easeInOutCirc: [0.85, 0, 0.15, 1],
  589. easeInBack: [0.36, 0, 0.66, -0.56],
  590. easeOutBack: [0.34, 1.56, 0.64, 1],
  591. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  592. };
  593. __spreadValues({
  594. linear: identity$1
  595. }, _TransitionPresets);
  596. function useVModel(props, key, emit, options = {}) {
  597. var _a, _b, _c;
  598. const {
  599. passive = false,
  600. eventName,
  601. deep = false,
  602. defaultValue
  603. } = options;
  604. const vm = vue.getCurrentInstance();
  605. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.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));
  606. let event = eventName;
  607. if (!key) {
  608. {
  609. key = "modelValue";
  610. }
  611. }
  612. event = eventName || event || `update:${key.toString()}`;
  613. const getValue = () => isDef(props[key]) ? props[key] : defaultValue;
  614. if (passive) {
  615. const proxy = vue.ref(getValue());
  616. vue.watch(() => props[key], (v) => proxy.value = v);
  617. vue.watch(proxy, (v) => {
  618. if (v !== props[key] || deep)
  619. _emit(event, v);
  620. }, {
  621. deep
  622. });
  623. return proxy;
  624. } else {
  625. return vue.computed({
  626. get() {
  627. return getValue();
  628. },
  629. set(value) {
  630. _emit(event, value);
  631. }
  632. });
  633. }
  634. }
  635. function useWindowFocus({ window = defaultWindow } = {}) {
  636. if (!window)
  637. return vue.ref(false);
  638. const focused = vue.ref(window.document.hasFocus());
  639. useEventListener(window, "blur", () => {
  640. focused.value = false;
  641. });
  642. useEventListener(window, "focus", () => {
  643. focused.value = true;
  644. });
  645. return focused;
  646. }
  647. function useWindowSize(options = {}) {
  648. const {
  649. window = defaultWindow,
  650. initialWidth = Infinity,
  651. initialHeight = Infinity,
  652. listenOrientation = true
  653. } = options;
  654. const width = vue.ref(initialWidth);
  655. const height = vue.ref(initialHeight);
  656. const update = () => {
  657. if (window) {
  658. width.value = window.innerWidth;
  659. height.value = window.innerHeight;
  660. }
  661. };
  662. update();
  663. tryOnMounted(update);
  664. useEventListener("resize", update, { passive: true });
  665. if (listenOrientation)
  666. useEventListener("orientationchange", update, { passive: true });
  667. return { width, height };
  668. }
  669. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  670. const isInContainer = (el, container) => {
  671. if (!isClient || !el || !container)
  672. return false;
  673. const elRect = el.getBoundingClientRect();
  674. let containerRect;
  675. if (container instanceof Element) {
  676. containerRect = container.getBoundingClientRect();
  677. } else {
  678. containerRect = {
  679. top: 0,
  680. right: window.innerWidth,
  681. bottom: window.innerHeight,
  682. left: 0
  683. };
  684. }
  685. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  686. };
  687. const getOffsetTop = (el) => {
  688. let offset = 0;
  689. let parent = el;
  690. while (parent) {
  691. offset += parent.offsetTop;
  692. parent = parent.offsetParent;
  693. }
  694. return offset;
  695. };
  696. const getOffsetTopDistance = (el, containerEl) => {
  697. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  698. };
  699. const getClientXY = (event) => {
  700. let clientX;
  701. let clientY;
  702. if (event.type === "touchend") {
  703. clientY = event.changedTouches[0].clientY;
  704. clientX = event.changedTouches[0].clientX;
  705. } else if (event.type.startsWith("touch")) {
  706. clientY = event.touches[0].clientY;
  707. clientX = event.touches[0].clientX;
  708. } else {
  709. clientY = event.clientY;
  710. clientX = event.clientX;
  711. }
  712. return {
  713. clientX,
  714. clientY
  715. };
  716. };
  717. function easeInOutCubic(t, b, c, d) {
  718. const cc = c - b;
  719. t /= d / 2;
  720. if (t < 1) {
  721. return cc / 2 * t * t * t + b;
  722. }
  723. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  724. }
  725. const NOOP = () => {
  726. };
  727. const hasOwnProperty$p = Object.prototype.hasOwnProperty;
  728. const hasOwn = (val, key) => hasOwnProperty$p.call(val, key);
  729. const isArray$1 = Array.isArray;
  730. const isDate$1 = (val) => toTypeString(val) === "[object Date]";
  731. const isFunction$1 = (val) => typeof val === "function";
  732. const isString$1 = (val) => typeof val === "string";
  733. const isObject$1 = (val) => val !== null && typeof val === "object";
  734. const isPromise = (val) => {
  735. return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch);
  736. };
  737. const objectToString$1 = Object.prototype.toString;
  738. const toTypeString = (value) => objectToString$1.call(value);
  739. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  740. const cacheStringFunction = (fn) => {
  741. const cache = /* @__PURE__ */ Object.create(null);
  742. return (str) => {
  743. const hit = cache[str];
  744. return hit || (cache[str] = fn(str));
  745. };
  746. };
  747. const camelizeRE = /-(\w)/g;
  748. const camelize = cacheStringFunction((str) => {
  749. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  750. });
  751. const hyphenateRE = /\B([A-Z])/g;
  752. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  753. const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  754. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  755. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  756. var root = freeGlobal || freeSelf || Function("return this")();
  757. var Symbol$1 = root.Symbol;
  758. var objectProto$s = Object.prototype;
  759. var hasOwnProperty$o = objectProto$s.hasOwnProperty;
  760. var nativeObjectToString$3 = objectProto$s.toString;
  761. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  762. function getRawTag(value) {
  763. var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  764. try {
  765. value[symToStringTag$1] = void 0;
  766. var unmasked = true;
  767. } catch (e) {
  768. }
  769. var result = nativeObjectToString$3.call(value);
  770. if (unmasked) {
  771. if (isOwn) {
  772. value[symToStringTag$1] = tag;
  773. } else {
  774. delete value[symToStringTag$1];
  775. }
  776. }
  777. return result;
  778. }
  779. var objectProto$r = Object.prototype;
  780. var nativeObjectToString$2 = objectProto$r.toString;
  781. function objectToString(value) {
  782. return nativeObjectToString$2.call(value);
  783. }
  784. var nullTag = "[object Null]";
  785. var undefinedTag = "[object Undefined]";
  786. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  787. function baseGetTag(value) {
  788. if (value == null) {
  789. return value === void 0 ? undefinedTag : nullTag;
  790. }
  791. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  792. }
  793. function isObjectLike(value) {
  794. return value != null && typeof value == "object";
  795. }
  796. var symbolTag$3 = "[object Symbol]";
  797. function isSymbol(value) {
  798. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  799. }
  800. var NAN$2 = 0 / 0;
  801. function baseToNumber(value) {
  802. if (typeof value == "number") {
  803. return value;
  804. }
  805. if (isSymbol(value)) {
  806. return NAN$2;
  807. }
  808. return +value;
  809. }
  810. function arrayMap(array, iteratee) {
  811. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  812. while (++index < length) {
  813. result[index] = iteratee(array[index], index, array);
  814. }
  815. return result;
  816. }
  817. var isArray = Array.isArray;
  818. var INFINITY$5 = 1 / 0;
  819. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  820. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  821. function baseToString(value) {
  822. if (typeof value == "string") {
  823. return value;
  824. }
  825. if (isArray(value)) {
  826. return arrayMap(value, baseToString) + "";
  827. }
  828. if (isSymbol(value)) {
  829. return symbolToString ? symbolToString.call(value) : "";
  830. }
  831. var result = value + "";
  832. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  833. }
  834. function createMathOperation(operator, defaultValue) {
  835. return function(value, other) {
  836. var result;
  837. if (value === void 0 && other === void 0) {
  838. return defaultValue;
  839. }
  840. if (value !== void 0) {
  841. result = value;
  842. }
  843. if (other !== void 0) {
  844. if (result === void 0) {
  845. return other;
  846. }
  847. if (typeof value == "string" || typeof other == "string") {
  848. value = baseToString(value);
  849. other = baseToString(other);
  850. } else {
  851. value = baseToNumber(value);
  852. other = baseToNumber(other);
  853. }
  854. result = operator(value, other);
  855. }
  856. return result;
  857. };
  858. }
  859. var add = createMathOperation(function(augend, addend) {
  860. return augend + addend;
  861. }, 0);
  862. var reWhitespace = /\s/;
  863. function trimmedEndIndex(string) {
  864. var index = string.length;
  865. while (index-- && reWhitespace.test(string.charAt(index))) {
  866. }
  867. return index;
  868. }
  869. var reTrimStart$2 = /^\s+/;
  870. function baseTrim(string) {
  871. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  872. }
  873. function isObject(value) {
  874. var type = typeof value;
  875. return value != null && (type == "object" || type == "function");
  876. }
  877. var NAN$1 = 0 / 0;
  878. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  879. var reIsBinary = /^0b[01]+$/i;
  880. var reIsOctal = /^0o[0-7]+$/i;
  881. var freeParseInt = parseInt;
  882. function toNumber(value) {
  883. if (typeof value == "number") {
  884. return value;
  885. }
  886. if (isSymbol(value)) {
  887. return NAN$1;
  888. }
  889. if (isObject(value)) {
  890. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  891. value = isObject(other) ? other + "" : other;
  892. }
  893. if (typeof value != "string") {
  894. return value === 0 ? value : +value;
  895. }
  896. value = baseTrim(value);
  897. var isBinary = reIsBinary.test(value);
  898. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  899. }
  900. var INFINITY$4 = 1 / 0;
  901. var MAX_INTEGER = 17976931348623157e292;
  902. function toFinite(value) {
  903. if (!value) {
  904. return value === 0 ? value : 0;
  905. }
  906. value = toNumber(value);
  907. if (value === INFINITY$4 || value === -INFINITY$4) {
  908. var sign = value < 0 ? -1 : 1;
  909. return sign * MAX_INTEGER;
  910. }
  911. return value === value ? value : 0;
  912. }
  913. function toInteger(value) {
  914. var result = toFinite(value), remainder = result % 1;
  915. return result === result ? remainder ? result - remainder : result : 0;
  916. }
  917. var FUNC_ERROR_TEXT$b = "Expected a function";
  918. function after(n, func) {
  919. if (typeof func != "function") {
  920. throw new TypeError(FUNC_ERROR_TEXT$b);
  921. }
  922. n = toInteger(n);
  923. return function() {
  924. if (--n < 1) {
  925. return func.apply(this, arguments);
  926. }
  927. };
  928. }
  929. function identity(value) {
  930. return value;
  931. }
  932. var asyncTag = "[object AsyncFunction]";
  933. var funcTag$2 = "[object Function]";
  934. var genTag$1 = "[object GeneratorFunction]";
  935. var proxyTag = "[object Proxy]";
  936. function isFunction(value) {
  937. if (!isObject(value)) {
  938. return false;
  939. }
  940. var tag = baseGetTag(value);
  941. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  942. }
  943. var coreJsData = root["__core-js_shared__"];
  944. var maskSrcKey = function() {
  945. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  946. return uid ? "Symbol(src)_1." + uid : "";
  947. }();
  948. function isMasked(func) {
  949. return !!maskSrcKey && maskSrcKey in func;
  950. }
  951. var funcProto$2 = Function.prototype;
  952. var funcToString$2 = funcProto$2.toString;
  953. function toSource(func) {
  954. if (func != null) {
  955. try {
  956. return funcToString$2.call(func);
  957. } catch (e) {
  958. }
  959. try {
  960. return func + "";
  961. } catch (e) {
  962. }
  963. }
  964. return "";
  965. }
  966. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  967. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  968. var funcProto$1 = Function.prototype;
  969. var objectProto$q = Object.prototype;
  970. var funcToString$1 = funcProto$1.toString;
  971. var hasOwnProperty$n = objectProto$q.hasOwnProperty;
  972. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  973. function baseIsNative(value) {
  974. if (!isObject(value) || isMasked(value)) {
  975. return false;
  976. }
  977. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  978. return pattern.test(toSource(value));
  979. }
  980. function getValue$1(object, key) {
  981. return object == null ? void 0 : object[key];
  982. }
  983. function getNative(object, key) {
  984. var value = getValue$1(object, key);
  985. return baseIsNative(value) ? value : void 0;
  986. }
  987. var WeakMap = getNative(root, "WeakMap");
  988. var metaMap = WeakMap && new WeakMap();
  989. var baseSetData = !metaMap ? identity : function(func, data) {
  990. metaMap.set(func, data);
  991. return func;
  992. };
  993. var objectCreate = Object.create;
  994. var baseCreate = function() {
  995. function object() {
  996. }
  997. return function(proto) {
  998. if (!isObject(proto)) {
  999. return {};
  1000. }
  1001. if (objectCreate) {
  1002. return objectCreate(proto);
  1003. }
  1004. object.prototype = proto;
  1005. var result = new object();
  1006. object.prototype = void 0;
  1007. return result;
  1008. };
  1009. }();
  1010. function createCtor(Ctor) {
  1011. return function() {
  1012. var args = arguments;
  1013. switch (args.length) {
  1014. case 0:
  1015. return new Ctor();
  1016. case 1:
  1017. return new Ctor(args[0]);
  1018. case 2:
  1019. return new Ctor(args[0], args[1]);
  1020. case 3:
  1021. return new Ctor(args[0], args[1], args[2]);
  1022. case 4:
  1023. return new Ctor(args[0], args[1], args[2], args[3]);
  1024. case 5:
  1025. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  1026. case 6:
  1027. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  1028. case 7:
  1029. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  1030. }
  1031. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  1032. return isObject(result) ? result : thisBinding;
  1033. };
  1034. }
  1035. var WRAP_BIND_FLAG$8 = 1;
  1036. function createBind(func, bitmask, thisArg) {
  1037. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  1038. function wrapper() {
  1039. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1040. return fn.apply(isBind ? thisArg : this, arguments);
  1041. }
  1042. return wrapper;
  1043. }
  1044. function apply(func, thisArg, args) {
  1045. switch (args.length) {
  1046. case 0:
  1047. return func.call(thisArg);
  1048. case 1:
  1049. return func.call(thisArg, args[0]);
  1050. case 2:
  1051. return func.call(thisArg, args[0], args[1]);
  1052. case 3:
  1053. return func.call(thisArg, args[0], args[1], args[2]);
  1054. }
  1055. return func.apply(thisArg, args);
  1056. }
  1057. var nativeMax$g = Math.max;
  1058. function composeArgs(args, partials, holders, isCurried) {
  1059. var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax$g(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried;
  1060. while (++leftIndex < leftLength) {
  1061. result[leftIndex] = partials[leftIndex];
  1062. }
  1063. while (++argsIndex < holdersLength) {
  1064. if (isUncurried || argsIndex < argsLength) {
  1065. result[holders[argsIndex]] = args[argsIndex];
  1066. }
  1067. }
  1068. while (rangeLength--) {
  1069. result[leftIndex++] = args[argsIndex++];
  1070. }
  1071. return result;
  1072. }
  1073. var nativeMax$f = Math.max;
  1074. function composeArgsRight(args, partials, holders, isCurried) {
  1075. var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax$f(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried;
  1076. while (++argsIndex < rangeLength) {
  1077. result[argsIndex] = args[argsIndex];
  1078. }
  1079. var offset = argsIndex;
  1080. while (++rightIndex < rightLength) {
  1081. result[offset + rightIndex] = partials[rightIndex];
  1082. }
  1083. while (++holdersIndex < holdersLength) {
  1084. if (isUncurried || argsIndex < argsLength) {
  1085. result[offset + holders[holdersIndex]] = args[argsIndex++];
  1086. }
  1087. }
  1088. return result;
  1089. }
  1090. function countHolders(array, placeholder) {
  1091. var length = array.length, result = 0;
  1092. while (length--) {
  1093. if (array[length] === placeholder) {
  1094. ++result;
  1095. }
  1096. }
  1097. return result;
  1098. }
  1099. function baseLodash() {
  1100. }
  1101. var MAX_ARRAY_LENGTH$6 = 4294967295;
  1102. function LazyWrapper(value) {
  1103. this.__wrapped__ = value;
  1104. this.__actions__ = [];
  1105. this.__dir__ = 1;
  1106. this.__filtered__ = false;
  1107. this.__iteratees__ = [];
  1108. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  1109. this.__views__ = [];
  1110. }
  1111. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  1112. LazyWrapper.prototype.constructor = LazyWrapper;
  1113. function noop() {
  1114. }
  1115. var getData = !metaMap ? noop : function(func) {
  1116. return metaMap.get(func);
  1117. };
  1118. var realNames = {};
  1119. var objectProto$p = Object.prototype;
  1120. var hasOwnProperty$m = objectProto$p.hasOwnProperty;
  1121. function getFuncName(func) {
  1122. var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0;
  1123. while (length--) {
  1124. var data = array[length], otherFunc = data.func;
  1125. if (otherFunc == null || otherFunc == func) {
  1126. return data.name;
  1127. }
  1128. }
  1129. return result;
  1130. }
  1131. function LodashWrapper(value, chainAll) {
  1132. this.__wrapped__ = value;
  1133. this.__actions__ = [];
  1134. this.__chain__ = !!chainAll;
  1135. this.__index__ = 0;
  1136. this.__values__ = void 0;
  1137. }
  1138. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  1139. LodashWrapper.prototype.constructor = LodashWrapper;
  1140. function copyArray(source, array) {
  1141. var index = -1, length = source.length;
  1142. array || (array = Array(length));
  1143. while (++index < length) {
  1144. array[index] = source[index];
  1145. }
  1146. return array;
  1147. }
  1148. function wrapperClone(wrapper) {
  1149. if (wrapper instanceof LazyWrapper) {
  1150. return wrapper.clone();
  1151. }
  1152. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  1153. result.__actions__ = copyArray(wrapper.__actions__);
  1154. result.__index__ = wrapper.__index__;
  1155. result.__values__ = wrapper.__values__;
  1156. return result;
  1157. }
  1158. var objectProto$o = Object.prototype;
  1159. var hasOwnProperty$l = objectProto$o.hasOwnProperty;
  1160. function lodash(value) {
  1161. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  1162. if (value instanceof LodashWrapper) {
  1163. return value;
  1164. }
  1165. if (hasOwnProperty$l.call(value, "__wrapped__")) {
  1166. return wrapperClone(value);
  1167. }
  1168. }
  1169. return new LodashWrapper(value);
  1170. }
  1171. lodash.prototype = baseLodash.prototype;
  1172. lodash.prototype.constructor = lodash;
  1173. function isLaziable(func) {
  1174. var funcName = getFuncName(func), other = lodash[funcName];
  1175. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  1176. return false;
  1177. }
  1178. if (func === other) {
  1179. return true;
  1180. }
  1181. var data = getData(other);
  1182. return !!data && func === data[0];
  1183. }
  1184. var HOT_COUNT = 800;
  1185. var HOT_SPAN = 16;
  1186. var nativeNow = Date.now;
  1187. function shortOut(func) {
  1188. var count = 0, lastCalled = 0;
  1189. return function() {
  1190. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1191. lastCalled = stamp;
  1192. if (remaining > 0) {
  1193. if (++count >= HOT_COUNT) {
  1194. return arguments[0];
  1195. }
  1196. } else {
  1197. count = 0;
  1198. }
  1199. return func.apply(void 0, arguments);
  1200. };
  1201. }
  1202. var setData = shortOut(baseSetData);
  1203. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  1204. var reSplitDetails = /,? & /;
  1205. function getWrapDetails(source) {
  1206. var match = source.match(reWrapDetails);
  1207. return match ? match[1].split(reSplitDetails) : [];
  1208. }
  1209. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  1210. function insertWrapDetails(source, details) {
  1211. var length = details.length;
  1212. if (!length) {
  1213. return source;
  1214. }
  1215. var lastIndex = length - 1;
  1216. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  1217. details = details.join(length > 2 ? ", " : " ");
  1218. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  1219. }
  1220. function constant(value) {
  1221. return function() {
  1222. return value;
  1223. };
  1224. }
  1225. var defineProperty = function() {
  1226. try {
  1227. var func = getNative(Object, "defineProperty");
  1228. func({}, "", {});
  1229. return func;
  1230. } catch (e) {
  1231. }
  1232. }();
  1233. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1234. return defineProperty(func, "toString", {
  1235. "configurable": true,
  1236. "enumerable": false,
  1237. "value": constant(string),
  1238. "writable": true
  1239. });
  1240. };
  1241. var setToString = shortOut(baseSetToString);
  1242. function arrayEach(array, iteratee) {
  1243. var index = -1, length = array == null ? 0 : array.length;
  1244. while (++index < length) {
  1245. if (iteratee(array[index], index, array) === false) {
  1246. break;
  1247. }
  1248. }
  1249. return array;
  1250. }
  1251. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1252. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1253. while (fromRight ? index-- : ++index < length) {
  1254. if (predicate(array[index], index, array)) {
  1255. return index;
  1256. }
  1257. }
  1258. return -1;
  1259. }
  1260. function baseIsNaN(value) {
  1261. return value !== value;
  1262. }
  1263. function strictIndexOf(array, value, fromIndex) {
  1264. var index = fromIndex - 1, length = array.length;
  1265. while (++index < length) {
  1266. if (array[index] === value) {
  1267. return index;
  1268. }
  1269. }
  1270. return -1;
  1271. }
  1272. function baseIndexOf(array, value, fromIndex) {
  1273. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1274. }
  1275. function arrayIncludes(array, value) {
  1276. var length = array == null ? 0 : array.length;
  1277. return !!length && baseIndexOf(array, value, 0) > -1;
  1278. }
  1279. var WRAP_BIND_FLAG$7 = 1;
  1280. var WRAP_BIND_KEY_FLAG$6 = 2;
  1281. var WRAP_CURRY_FLAG$6 = 8;
  1282. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  1283. var WRAP_PARTIAL_FLAG$6 = 32;
  1284. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  1285. var WRAP_ARY_FLAG$4 = 128;
  1286. var WRAP_REARG_FLAG$3 = 256;
  1287. var WRAP_FLIP_FLAG$2 = 512;
  1288. var wrapFlags = [
  1289. ["ary", WRAP_ARY_FLAG$4],
  1290. ["bind", WRAP_BIND_FLAG$7],
  1291. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  1292. ["curry", WRAP_CURRY_FLAG$6],
  1293. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  1294. ["flip", WRAP_FLIP_FLAG$2],
  1295. ["partial", WRAP_PARTIAL_FLAG$6],
  1296. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  1297. ["rearg", WRAP_REARG_FLAG$3]
  1298. ];
  1299. function updateWrapDetails(details, bitmask) {
  1300. arrayEach(wrapFlags, function(pair) {
  1301. var value = "_." + pair[0];
  1302. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  1303. details.push(value);
  1304. }
  1305. });
  1306. return details.sort();
  1307. }
  1308. function setWrapToString(wrapper, reference, bitmask) {
  1309. var source = reference + "";
  1310. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  1311. }
  1312. var WRAP_BIND_FLAG$6 = 1;
  1313. var WRAP_BIND_KEY_FLAG$5 = 2;
  1314. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  1315. var WRAP_CURRY_FLAG$5 = 8;
  1316. var WRAP_PARTIAL_FLAG$5 = 32;
  1317. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  1318. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  1319. var isCurry = bitmask & WRAP_CURRY_FLAG$5, newHolders = isCurry ? holders : void 0, newHoldersRight = isCurry ? void 0 : holders, newPartials = isCurry ? partials : void 0, newPartialsRight = isCurry ? void 0 : partials;
  1320. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  1321. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  1322. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  1323. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  1324. }
  1325. var newData = [
  1326. func,
  1327. bitmask,
  1328. thisArg,
  1329. newPartials,
  1330. newHolders,
  1331. newPartialsRight,
  1332. newHoldersRight,
  1333. argPos,
  1334. ary,
  1335. arity
  1336. ];
  1337. var result = wrapFunc.apply(void 0, newData);
  1338. if (isLaziable(func)) {
  1339. setData(result, newData);
  1340. }
  1341. result.placeholder = placeholder;
  1342. return setWrapToString(result, func, bitmask);
  1343. }
  1344. function getHolder(func) {
  1345. var object = func;
  1346. return object.placeholder;
  1347. }
  1348. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  1349. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1350. function isIndex(value, length) {
  1351. var type = typeof value;
  1352. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  1353. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  1354. }
  1355. var nativeMin$e = Math.min;
  1356. function reorder(array, indexes) {
  1357. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  1358. while (length--) {
  1359. var index = indexes[length];
  1360. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  1361. }
  1362. return array;
  1363. }
  1364. var PLACEHOLDER$1 = "__lodash_placeholder__";
  1365. function replaceHolders(array, placeholder) {
  1366. var index = -1, length = array.length, resIndex = 0, result = [];
  1367. while (++index < length) {
  1368. var value = array[index];
  1369. if (value === placeholder || value === PLACEHOLDER$1) {
  1370. array[index] = PLACEHOLDER$1;
  1371. result[resIndex++] = index;
  1372. }
  1373. }
  1374. return result;
  1375. }
  1376. var WRAP_BIND_FLAG$5 = 1;
  1377. var WRAP_BIND_KEY_FLAG$4 = 2;
  1378. var WRAP_CURRY_FLAG$4 = 8;
  1379. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  1380. var WRAP_ARY_FLAG$3 = 128;
  1381. var WRAP_FLIP_FLAG$1 = 512;
  1382. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  1383. var isAry = bitmask & WRAP_ARY_FLAG$3, isBind = bitmask & WRAP_BIND_FLAG$5, isBindKey = bitmask & WRAP_BIND_KEY_FLAG$4, isCurried = bitmask & (WRAP_CURRY_FLAG$4 | WRAP_CURRY_RIGHT_FLAG$2), isFlip = bitmask & WRAP_FLIP_FLAG$1, Ctor = isBindKey ? void 0 : createCtor(func);
  1384. function wrapper() {
  1385. var length = arguments.length, args = Array(length), index = length;
  1386. while (index--) {
  1387. args[index] = arguments[index];
  1388. }
  1389. if (isCurried) {
  1390. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  1391. }
  1392. if (partials) {
  1393. args = composeArgs(args, partials, holders, isCurried);
  1394. }
  1395. if (partialsRight) {
  1396. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  1397. }
  1398. length -= holdersCount;
  1399. if (isCurried && length < arity) {
  1400. var newHolders = replaceHolders(args, placeholder);
  1401. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  1402. }
  1403. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  1404. length = args.length;
  1405. if (argPos) {
  1406. args = reorder(args, argPos);
  1407. } else if (isFlip && length > 1) {
  1408. args.reverse();
  1409. }
  1410. if (isAry && ary < length) {
  1411. args.length = ary;
  1412. }
  1413. if (this && this !== root && this instanceof wrapper) {
  1414. fn = Ctor || createCtor(fn);
  1415. }
  1416. return fn.apply(thisBinding, args);
  1417. }
  1418. return wrapper;
  1419. }
  1420. function createCurry(func, bitmask, arity) {
  1421. var Ctor = createCtor(func);
  1422. function wrapper() {
  1423. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  1424. while (index--) {
  1425. args[index] = arguments[index];
  1426. }
  1427. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  1428. length -= holders.length;
  1429. if (length < arity) {
  1430. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  1431. }
  1432. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1433. return apply(fn, this, args);
  1434. }
  1435. return wrapper;
  1436. }
  1437. var WRAP_BIND_FLAG$4 = 1;
  1438. function createPartial(func, bitmask, thisArg, partials) {
  1439. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  1440. function wrapper() {
  1441. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1442. while (++leftIndex < leftLength) {
  1443. args[leftIndex] = partials[leftIndex];
  1444. }
  1445. while (argsLength--) {
  1446. args[leftIndex++] = arguments[++argsIndex];
  1447. }
  1448. return apply(fn, isBind ? thisArg : this, args);
  1449. }
  1450. return wrapper;
  1451. }
  1452. var PLACEHOLDER = "__lodash_placeholder__";
  1453. var WRAP_BIND_FLAG$3 = 1;
  1454. var WRAP_BIND_KEY_FLAG$3 = 2;
  1455. var WRAP_CURRY_BOUND_FLAG = 4;
  1456. var WRAP_CURRY_FLAG$3 = 8;
  1457. var WRAP_ARY_FLAG$2 = 128;
  1458. var WRAP_REARG_FLAG$2 = 256;
  1459. var nativeMin$d = Math.min;
  1460. function mergeData(data, source) {
  1461. var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG$3 | WRAP_BIND_KEY_FLAG$3 | WRAP_ARY_FLAG$2);
  1462. var isCombo = srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_CURRY_FLAG$3 || srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_REARG_FLAG$2 && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG$2 | WRAP_REARG_FLAG$2) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG$3;
  1463. if (!(isCommon || isCombo)) {
  1464. return data;
  1465. }
  1466. if (srcBitmask & WRAP_BIND_FLAG$3) {
  1467. data[2] = source[2];
  1468. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  1469. }
  1470. var value = source[3];
  1471. if (value) {
  1472. var partials = data[3];
  1473. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  1474. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  1475. }
  1476. value = source[5];
  1477. if (value) {
  1478. partials = data[5];
  1479. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  1480. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  1481. }
  1482. value = source[7];
  1483. if (value) {
  1484. data[7] = value;
  1485. }
  1486. if (srcBitmask & WRAP_ARY_FLAG$2) {
  1487. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  1488. }
  1489. if (data[9] == null) {
  1490. data[9] = source[9];
  1491. }
  1492. data[0] = source[0];
  1493. data[1] = newBitmask;
  1494. return data;
  1495. }
  1496. var FUNC_ERROR_TEXT$a = "Expected a function";
  1497. var WRAP_BIND_FLAG$2 = 1;
  1498. var WRAP_BIND_KEY_FLAG$2 = 2;
  1499. var WRAP_CURRY_FLAG$2 = 8;
  1500. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  1501. var WRAP_PARTIAL_FLAG$4 = 32;
  1502. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  1503. var nativeMax$e = Math.max;
  1504. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  1505. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  1506. if (!isBindKey && typeof func != "function") {
  1507. throw new TypeError(FUNC_ERROR_TEXT$a);
  1508. }
  1509. var length = partials ? partials.length : 0;
  1510. if (!length) {
  1511. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  1512. partials = holders = void 0;
  1513. }
  1514. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  1515. arity = arity === void 0 ? arity : toInteger(arity);
  1516. length -= holders ? holders.length : 0;
  1517. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  1518. var partialsRight = partials, holdersRight = holders;
  1519. partials = holders = void 0;
  1520. }
  1521. var data = isBindKey ? void 0 : getData(func);
  1522. var newData = [
  1523. func,
  1524. bitmask,
  1525. thisArg,
  1526. partials,
  1527. holders,
  1528. partialsRight,
  1529. holdersRight,
  1530. argPos,
  1531. ary,
  1532. arity
  1533. ];
  1534. if (data) {
  1535. mergeData(newData, data);
  1536. }
  1537. func = newData[0];
  1538. bitmask = newData[1];
  1539. thisArg = newData[2];
  1540. partials = newData[3];
  1541. holders = newData[4];
  1542. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  1543. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  1544. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  1545. }
  1546. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  1547. var result = createBind(func, bitmask, thisArg);
  1548. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  1549. result = createCurry(func, bitmask, arity);
  1550. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  1551. result = createPartial(func, bitmask, thisArg, partials);
  1552. } else {
  1553. result = createHybrid.apply(void 0, newData);
  1554. }
  1555. var setter = data ? baseSetData : setData;
  1556. return setWrapToString(setter(result, newData), func, bitmask);
  1557. }
  1558. var WRAP_ARY_FLAG$1 = 128;
  1559. function ary(func, n, guard) {
  1560. n = guard ? void 0 : n;
  1561. n = func && n == null ? func.length : n;
  1562. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  1563. }
  1564. function baseAssignValue(object, key, value) {
  1565. if (key == "__proto__" && defineProperty) {
  1566. defineProperty(object, key, {
  1567. "configurable": true,
  1568. "enumerable": true,
  1569. "value": value,
  1570. "writable": true
  1571. });
  1572. } else {
  1573. object[key] = value;
  1574. }
  1575. }
  1576. function eq(value, other) {
  1577. return value === other || value !== value && other !== other;
  1578. }
  1579. var objectProto$n = Object.prototype;
  1580. var hasOwnProperty$k = objectProto$n.hasOwnProperty;
  1581. function assignValue(object, key, value) {
  1582. var objValue = object[key];
  1583. if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  1584. baseAssignValue(object, key, value);
  1585. }
  1586. }
  1587. function copyObject(source, props, object, customizer) {
  1588. var isNew = !object;
  1589. object || (object = {});
  1590. var index = -1, length = props.length;
  1591. while (++index < length) {
  1592. var key = props[index];
  1593. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1594. if (newValue === void 0) {
  1595. newValue = source[key];
  1596. }
  1597. if (isNew) {
  1598. baseAssignValue(object, key, newValue);
  1599. } else {
  1600. assignValue(object, key, newValue);
  1601. }
  1602. }
  1603. return object;
  1604. }
  1605. var nativeMax$d = Math.max;
  1606. function overRest(func, start, transform) {
  1607. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  1608. return function() {
  1609. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  1610. while (++index < length) {
  1611. array[index] = args[start + index];
  1612. }
  1613. index = -1;
  1614. var otherArgs = Array(start + 1);
  1615. while (++index < start) {
  1616. otherArgs[index] = args[index];
  1617. }
  1618. otherArgs[start] = transform(array);
  1619. return apply(func, this, otherArgs);
  1620. };
  1621. }
  1622. function baseRest(func, start) {
  1623. return setToString(overRest(func, start, identity), func + "");
  1624. }
  1625. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  1626. function isLength(value) {
  1627. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  1628. }
  1629. function isArrayLike(value) {
  1630. return value != null && isLength(value.length) && !isFunction(value);
  1631. }
  1632. function isIterateeCall(value, index, object) {
  1633. if (!isObject(object)) {
  1634. return false;
  1635. }
  1636. var type = typeof index;
  1637. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  1638. return eq(object[index], value);
  1639. }
  1640. return false;
  1641. }
  1642. function createAssigner(assigner) {
  1643. return baseRest(function(object, sources) {
  1644. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1645. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1646. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1647. customizer = length < 3 ? void 0 : customizer;
  1648. length = 1;
  1649. }
  1650. object = Object(object);
  1651. while (++index < length) {
  1652. var source = sources[index];
  1653. if (source) {
  1654. assigner(object, source, index, customizer);
  1655. }
  1656. }
  1657. return object;
  1658. });
  1659. }
  1660. var objectProto$m = Object.prototype;
  1661. function isPrototype(value) {
  1662. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  1663. return value === proto;
  1664. }
  1665. function baseTimes(n, iteratee) {
  1666. var index = -1, result = Array(n);
  1667. while (++index < n) {
  1668. result[index] = iteratee(index);
  1669. }
  1670. return result;
  1671. }
  1672. var argsTag$3 = "[object Arguments]";
  1673. function baseIsArguments(value) {
  1674. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  1675. }
  1676. var objectProto$l = Object.prototype;
  1677. var hasOwnProperty$j = objectProto$l.hasOwnProperty;
  1678. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  1679. var isArguments = baseIsArguments(function() {
  1680. return arguments;
  1681. }()) ? baseIsArguments : function(value) {
  1682. return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  1683. };
  1684. function stubFalse() {
  1685. return false;
  1686. }
  1687. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1688. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  1689. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  1690. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  1691. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  1692. var isBuffer = nativeIsBuffer || stubFalse;
  1693. var argsTag$2 = "[object Arguments]";
  1694. var arrayTag$2 = "[object Array]";
  1695. var boolTag$4 = "[object Boolean]";
  1696. var dateTag$4 = "[object Date]";
  1697. var errorTag$3 = "[object Error]";
  1698. var funcTag$1 = "[object Function]";
  1699. var mapTag$9 = "[object Map]";
  1700. var numberTag$4 = "[object Number]";
  1701. var objectTag$4 = "[object Object]";
  1702. var regexpTag$4 = "[object RegExp]";
  1703. var setTag$9 = "[object Set]";
  1704. var stringTag$4 = "[object String]";
  1705. var weakMapTag$3 = "[object WeakMap]";
  1706. var arrayBufferTag$4 = "[object ArrayBuffer]";
  1707. var dataViewTag$4 = "[object DataView]";
  1708. var float32Tag$2 = "[object Float32Array]";
  1709. var float64Tag$2 = "[object Float64Array]";
  1710. var int8Tag$2 = "[object Int8Array]";
  1711. var int16Tag$2 = "[object Int16Array]";
  1712. var int32Tag$2 = "[object Int32Array]";
  1713. var uint8Tag$2 = "[object Uint8Array]";
  1714. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  1715. var uint16Tag$2 = "[object Uint16Array]";
  1716. var uint32Tag$2 = "[object Uint32Array]";
  1717. var typedArrayTags = {};
  1718. 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;
  1719. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$4] = typedArrayTags[boolTag$4] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$4] = typedArrayTags[errorTag$3] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$9] = typedArrayTags[numberTag$4] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$4] = typedArrayTags[setTag$9] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$3] = false;
  1720. function baseIsTypedArray(value) {
  1721. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  1722. }
  1723. function baseUnary(func) {
  1724. return function(value) {
  1725. return func(value);
  1726. };
  1727. }
  1728. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1729. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  1730. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  1731. var freeProcess = moduleExports$1 && freeGlobal.process;
  1732. var nodeUtil = function() {
  1733. try {
  1734. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  1735. if (types) {
  1736. return types;
  1737. }
  1738. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  1739. } catch (e) {
  1740. }
  1741. }();
  1742. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1743. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  1744. var objectProto$k = Object.prototype;
  1745. var hasOwnProperty$i = objectProto$k.hasOwnProperty;
  1746. function arrayLikeKeys(value, inherited) {
  1747. var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  1748. for (var key in value) {
  1749. if ((inherited || hasOwnProperty$i.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  1750. result.push(key);
  1751. }
  1752. }
  1753. return result;
  1754. }
  1755. function overArg(func, transform) {
  1756. return function(arg) {
  1757. return func(transform(arg));
  1758. };
  1759. }
  1760. var nativeKeys = overArg(Object.keys, Object);
  1761. var objectProto$j = Object.prototype;
  1762. var hasOwnProperty$h = objectProto$j.hasOwnProperty;
  1763. function baseKeys(object) {
  1764. if (!isPrototype(object)) {
  1765. return nativeKeys(object);
  1766. }
  1767. var result = [];
  1768. for (var key in Object(object)) {
  1769. if (hasOwnProperty$h.call(object, key) && key != "constructor") {
  1770. result.push(key);
  1771. }
  1772. }
  1773. return result;
  1774. }
  1775. function keys(object) {
  1776. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1777. }
  1778. var objectProto$i = Object.prototype;
  1779. var hasOwnProperty$g = objectProto$i.hasOwnProperty;
  1780. var assign = createAssigner(function(object, source) {
  1781. if (isPrototype(source) || isArrayLike(source)) {
  1782. copyObject(source, keys(source), object);
  1783. return;
  1784. }
  1785. for (var key in source) {
  1786. if (hasOwnProperty$g.call(source, key)) {
  1787. assignValue(object, key, source[key]);
  1788. }
  1789. }
  1790. });
  1791. function nativeKeysIn(object) {
  1792. var result = [];
  1793. if (object != null) {
  1794. for (var key in Object(object)) {
  1795. result.push(key);
  1796. }
  1797. }
  1798. return result;
  1799. }
  1800. var objectProto$h = Object.prototype;
  1801. var hasOwnProperty$f = objectProto$h.hasOwnProperty;
  1802. function baseKeysIn(object) {
  1803. if (!isObject(object)) {
  1804. return nativeKeysIn(object);
  1805. }
  1806. var isProto = isPrototype(object), result = [];
  1807. for (var key in object) {
  1808. if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
  1809. result.push(key);
  1810. }
  1811. }
  1812. return result;
  1813. }
  1814. function keysIn(object) {
  1815. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1816. }
  1817. var assignIn = createAssigner(function(object, source) {
  1818. copyObject(source, keysIn(source), object);
  1819. });
  1820. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  1821. copyObject(source, keysIn(source), object, customizer);
  1822. });
  1823. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  1824. copyObject(source, keys(source), object, customizer);
  1825. });
  1826. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  1827. var reIsPlainProp = /^\w*$/;
  1828. function isKey(value, object) {
  1829. if (isArray(value)) {
  1830. return false;
  1831. }
  1832. var type = typeof value;
  1833. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  1834. return true;
  1835. }
  1836. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1837. }
  1838. var nativeCreate = getNative(Object, "create");
  1839. function hashClear() {
  1840. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1841. this.size = 0;
  1842. }
  1843. function hashDelete(key) {
  1844. var result = this.has(key) && delete this.__data__[key];
  1845. this.size -= result ? 1 : 0;
  1846. return result;
  1847. }
  1848. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1849. var objectProto$g = Object.prototype;
  1850. var hasOwnProperty$e = objectProto$g.hasOwnProperty;
  1851. function hashGet(key) {
  1852. var data = this.__data__;
  1853. if (nativeCreate) {
  1854. var result = data[key];
  1855. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1856. }
  1857. return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
  1858. }
  1859. var objectProto$f = Object.prototype;
  1860. var hasOwnProperty$d = objectProto$f.hasOwnProperty;
  1861. function hashHas(key) {
  1862. var data = this.__data__;
  1863. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
  1864. }
  1865. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1866. function hashSet(key, value) {
  1867. var data = this.__data__;
  1868. this.size += this.has(key) ? 0 : 1;
  1869. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1870. return this;
  1871. }
  1872. function Hash(entries) {
  1873. var index = -1, length = entries == null ? 0 : entries.length;
  1874. this.clear();
  1875. while (++index < length) {
  1876. var entry = entries[index];
  1877. this.set(entry[0], entry[1]);
  1878. }
  1879. }
  1880. Hash.prototype.clear = hashClear;
  1881. Hash.prototype["delete"] = hashDelete;
  1882. Hash.prototype.get = hashGet;
  1883. Hash.prototype.has = hashHas;
  1884. Hash.prototype.set = hashSet;
  1885. function listCacheClear() {
  1886. this.__data__ = [];
  1887. this.size = 0;
  1888. }
  1889. function assocIndexOf(array, key) {
  1890. var length = array.length;
  1891. while (length--) {
  1892. if (eq(array[length][0], key)) {
  1893. return length;
  1894. }
  1895. }
  1896. return -1;
  1897. }
  1898. var arrayProto$5 = Array.prototype;
  1899. var splice$2 = arrayProto$5.splice;
  1900. function listCacheDelete(key) {
  1901. var data = this.__data__, index = assocIndexOf(data, key);
  1902. if (index < 0) {
  1903. return false;
  1904. }
  1905. var lastIndex = data.length - 1;
  1906. if (index == lastIndex) {
  1907. data.pop();
  1908. } else {
  1909. splice$2.call(data, index, 1);
  1910. }
  1911. --this.size;
  1912. return true;
  1913. }
  1914. function listCacheGet(key) {
  1915. var data = this.__data__, index = assocIndexOf(data, key);
  1916. return index < 0 ? void 0 : data[index][1];
  1917. }
  1918. function listCacheHas(key) {
  1919. return assocIndexOf(this.__data__, key) > -1;
  1920. }
  1921. function listCacheSet(key, value) {
  1922. var data = this.__data__, index = assocIndexOf(data, key);
  1923. if (index < 0) {
  1924. ++this.size;
  1925. data.push([key, value]);
  1926. } else {
  1927. data[index][1] = value;
  1928. }
  1929. return this;
  1930. }
  1931. function ListCache(entries) {
  1932. var index = -1, length = entries == null ? 0 : entries.length;
  1933. this.clear();
  1934. while (++index < length) {
  1935. var entry = entries[index];
  1936. this.set(entry[0], entry[1]);
  1937. }
  1938. }
  1939. ListCache.prototype.clear = listCacheClear;
  1940. ListCache.prototype["delete"] = listCacheDelete;
  1941. ListCache.prototype.get = listCacheGet;
  1942. ListCache.prototype.has = listCacheHas;
  1943. ListCache.prototype.set = listCacheSet;
  1944. var Map$1 = getNative(root, "Map");
  1945. function mapCacheClear() {
  1946. this.size = 0;
  1947. this.__data__ = {
  1948. "hash": new Hash(),
  1949. "map": new (Map$1 || ListCache)(),
  1950. "string": new Hash()
  1951. };
  1952. }
  1953. function isKeyable(value) {
  1954. var type = typeof value;
  1955. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1956. }
  1957. function getMapData(map, key) {
  1958. var data = map.__data__;
  1959. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1960. }
  1961. function mapCacheDelete(key) {
  1962. var result = getMapData(this, key)["delete"](key);
  1963. this.size -= result ? 1 : 0;
  1964. return result;
  1965. }
  1966. function mapCacheGet(key) {
  1967. return getMapData(this, key).get(key);
  1968. }
  1969. function mapCacheHas(key) {
  1970. return getMapData(this, key).has(key);
  1971. }
  1972. function mapCacheSet(key, value) {
  1973. var data = getMapData(this, key), size = data.size;
  1974. data.set(key, value);
  1975. this.size += data.size == size ? 0 : 1;
  1976. return this;
  1977. }
  1978. function MapCache(entries) {
  1979. var index = -1, length = entries == null ? 0 : entries.length;
  1980. this.clear();
  1981. while (++index < length) {
  1982. var entry = entries[index];
  1983. this.set(entry[0], entry[1]);
  1984. }
  1985. }
  1986. MapCache.prototype.clear = mapCacheClear;
  1987. MapCache.prototype["delete"] = mapCacheDelete;
  1988. MapCache.prototype.get = mapCacheGet;
  1989. MapCache.prototype.has = mapCacheHas;
  1990. MapCache.prototype.set = mapCacheSet;
  1991. var FUNC_ERROR_TEXT$9 = "Expected a function";
  1992. function memoize(func, resolver) {
  1993. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1994. throw new TypeError(FUNC_ERROR_TEXT$9);
  1995. }
  1996. var memoized = function() {
  1997. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1998. if (cache.has(key)) {
  1999. return cache.get(key);
  2000. }
  2001. var result = func.apply(this, args);
  2002. memoized.cache = cache.set(key, result) || cache;
  2003. return result;
  2004. };
  2005. memoized.cache = new (memoize.Cache || MapCache)();
  2006. return memoized;
  2007. }
  2008. memoize.Cache = MapCache;
  2009. var MAX_MEMOIZE_SIZE = 500;
  2010. function memoizeCapped(func) {
  2011. var result = memoize(func, function(key) {
  2012. if (cache.size === MAX_MEMOIZE_SIZE) {
  2013. cache.clear();
  2014. }
  2015. return key;
  2016. });
  2017. var cache = result.cache;
  2018. return result;
  2019. }
  2020. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2021. var reEscapeChar = /\\(\\)?/g;
  2022. var stringToPath = memoizeCapped(function(string) {
  2023. var result = [];
  2024. if (string.charCodeAt(0) === 46) {
  2025. result.push("");
  2026. }
  2027. string.replace(rePropName, function(match, number, quote, subString) {
  2028. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  2029. });
  2030. return result;
  2031. });
  2032. function toString(value) {
  2033. return value == null ? "" : baseToString(value);
  2034. }
  2035. function castPath(value, object) {
  2036. if (isArray(value)) {
  2037. return value;
  2038. }
  2039. return isKey(value, object) ? [value] : stringToPath(toString(value));
  2040. }
  2041. var INFINITY$3 = 1 / 0;
  2042. function toKey(value) {
  2043. if (typeof value == "string" || isSymbol(value)) {
  2044. return value;
  2045. }
  2046. var result = value + "";
  2047. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  2048. }
  2049. function baseGet(object, path) {
  2050. path = castPath(path, object);
  2051. var index = 0, length = path.length;
  2052. while (object != null && index < length) {
  2053. object = object[toKey(path[index++])];
  2054. }
  2055. return index && index == length ? object : void 0;
  2056. }
  2057. function get(object, path, defaultValue) {
  2058. var result = object == null ? void 0 : baseGet(object, path);
  2059. return result === void 0 ? defaultValue : result;
  2060. }
  2061. function baseAt(object, paths) {
  2062. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  2063. while (++index < length) {
  2064. result[index] = skip ? void 0 : get(object, paths[index]);
  2065. }
  2066. return result;
  2067. }
  2068. function arrayPush(array, values) {
  2069. var index = -1, length = values.length, offset = array.length;
  2070. while (++index < length) {
  2071. array[offset + index] = values[index];
  2072. }
  2073. return array;
  2074. }
  2075. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  2076. function isFlattenable(value) {
  2077. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  2078. }
  2079. function baseFlatten(array, depth, predicate, isStrict, result) {
  2080. var index = -1, length = array.length;
  2081. predicate || (predicate = isFlattenable);
  2082. result || (result = []);
  2083. while (++index < length) {
  2084. var value = array[index];
  2085. if (depth > 0 && predicate(value)) {
  2086. if (depth > 1) {
  2087. baseFlatten(value, depth - 1, predicate, isStrict, result);
  2088. } else {
  2089. arrayPush(result, value);
  2090. }
  2091. } else if (!isStrict) {
  2092. result[result.length] = value;
  2093. }
  2094. }
  2095. return result;
  2096. }
  2097. function flatten(array) {
  2098. var length = array == null ? 0 : array.length;
  2099. return length ? baseFlatten(array, 1) : [];
  2100. }
  2101. function flatRest(func) {
  2102. return setToString(overRest(func, void 0, flatten), func + "");
  2103. }
  2104. var at$1 = flatRest(baseAt);
  2105. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2106. var objectTag$3 = "[object Object]";
  2107. var funcProto = Function.prototype;
  2108. var objectProto$e = Object.prototype;
  2109. var funcToString = funcProto.toString;
  2110. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  2111. var objectCtorString = funcToString.call(Object);
  2112. function isPlainObject(value) {
  2113. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  2114. return false;
  2115. }
  2116. var proto = getPrototype(value);
  2117. if (proto === null) {
  2118. return true;
  2119. }
  2120. var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
  2121. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2122. }
  2123. var domExcTag = "[object DOMException]";
  2124. var errorTag$2 = "[object Error]";
  2125. function isError(value) {
  2126. if (!isObjectLike(value)) {
  2127. return false;
  2128. }
  2129. var tag = baseGetTag(value);
  2130. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  2131. }
  2132. var attempt = baseRest(function(func, args) {
  2133. try {
  2134. return apply(func, void 0, args);
  2135. } catch (e) {
  2136. return isError(e) ? e : new Error(e);
  2137. }
  2138. });
  2139. var FUNC_ERROR_TEXT$8 = "Expected a function";
  2140. function before(n, func) {
  2141. var result;
  2142. if (typeof func != "function") {
  2143. throw new TypeError(FUNC_ERROR_TEXT$8);
  2144. }
  2145. n = toInteger(n);
  2146. return function() {
  2147. if (--n > 0) {
  2148. result = func.apply(this, arguments);
  2149. }
  2150. if (n <= 1) {
  2151. func = void 0;
  2152. }
  2153. return result;
  2154. };
  2155. }
  2156. var WRAP_BIND_FLAG$1 = 1;
  2157. var WRAP_PARTIAL_FLAG$3 = 32;
  2158. var bind = baseRest(function(func, thisArg, partials) {
  2159. var bitmask = WRAP_BIND_FLAG$1;
  2160. if (partials.length) {
  2161. var holders = replaceHolders(partials, getHolder(bind));
  2162. bitmask |= WRAP_PARTIAL_FLAG$3;
  2163. }
  2164. return createWrap(func, bitmask, thisArg, partials, holders);
  2165. });
  2166. bind.placeholder = {};
  2167. var bindAll = flatRest(function(object, methodNames) {
  2168. arrayEach(methodNames, function(key) {
  2169. key = toKey(key);
  2170. baseAssignValue(object, key, bind(object[key], object));
  2171. });
  2172. return object;
  2173. });
  2174. var WRAP_BIND_FLAG = 1;
  2175. var WRAP_BIND_KEY_FLAG$1 = 2;
  2176. var WRAP_PARTIAL_FLAG$2 = 32;
  2177. var bindKey = baseRest(function(object, key, partials) {
  2178. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  2179. if (partials.length) {
  2180. var holders = replaceHolders(partials, getHolder(bindKey));
  2181. bitmask |= WRAP_PARTIAL_FLAG$2;
  2182. }
  2183. return createWrap(key, bitmask, object, partials, holders);
  2184. });
  2185. bindKey.placeholder = {};
  2186. function baseSlice(array, start, end) {
  2187. var index = -1, length = array.length;
  2188. if (start < 0) {
  2189. start = -start > length ? 0 : length + start;
  2190. }
  2191. end = end > length ? length : end;
  2192. if (end < 0) {
  2193. end += length;
  2194. }
  2195. length = start > end ? 0 : end - start >>> 0;
  2196. start >>>= 0;
  2197. var result = Array(length);
  2198. while (++index < length) {
  2199. result[index] = array[index + start];
  2200. }
  2201. return result;
  2202. }
  2203. function castSlice(array, start, end) {
  2204. var length = array.length;
  2205. end = end === void 0 ? length : end;
  2206. return !start && end >= length ? array : baseSlice(array, start, end);
  2207. }
  2208. var rsAstralRange$3 = "\\ud800-\\udfff";
  2209. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  2210. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  2211. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  2212. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  2213. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  2214. var rsZWJ$3 = "\\u200d";
  2215. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  2216. function hasUnicode(string) {
  2217. return reHasUnicode.test(string);
  2218. }
  2219. function asciiToArray(string) {
  2220. return string.split("");
  2221. }
  2222. var rsAstralRange$2 = "\\ud800-\\udfff";
  2223. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  2224. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  2225. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  2226. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  2227. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  2228. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  2229. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  2230. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  2231. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  2232. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  2233. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2234. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2235. var rsZWJ$2 = "\\u200d";
  2236. var reOptMod$2 = rsModifier$2 + "?";
  2237. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  2238. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  2239. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  2240. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  2241. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  2242. function unicodeToArray(string) {
  2243. return string.match(reUnicode$1) || [];
  2244. }
  2245. function stringToArray(string) {
  2246. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  2247. }
  2248. function createCaseFirst(methodName) {
  2249. return function(string) {
  2250. string = toString(string);
  2251. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  2252. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  2253. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  2254. return chr[methodName]() + trailing;
  2255. };
  2256. }
  2257. var upperFirst = createCaseFirst("toUpperCase");
  2258. function capitalize$1(string) {
  2259. return upperFirst(toString(string).toLowerCase());
  2260. }
  2261. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2262. var index = -1, length = array == null ? 0 : array.length;
  2263. if (initAccum && length) {
  2264. accumulator = array[++index];
  2265. }
  2266. while (++index < length) {
  2267. accumulator = iteratee(accumulator, array[index], index, array);
  2268. }
  2269. return accumulator;
  2270. }
  2271. function basePropertyOf(object) {
  2272. return function(key) {
  2273. return object == null ? void 0 : object[key];
  2274. };
  2275. }
  2276. var deburredLetters = {
  2277. "\xC0": "A",
  2278. "\xC1": "A",
  2279. "\xC2": "A",
  2280. "\xC3": "A",
  2281. "\xC4": "A",
  2282. "\xC5": "A",
  2283. "\xE0": "a",
  2284. "\xE1": "a",
  2285. "\xE2": "a",
  2286. "\xE3": "a",
  2287. "\xE4": "a",
  2288. "\xE5": "a",
  2289. "\xC7": "C",
  2290. "\xE7": "c",
  2291. "\xD0": "D",
  2292. "\xF0": "d",
  2293. "\xC8": "E",
  2294. "\xC9": "E",
  2295. "\xCA": "E",
  2296. "\xCB": "E",
  2297. "\xE8": "e",
  2298. "\xE9": "e",
  2299. "\xEA": "e",
  2300. "\xEB": "e",
  2301. "\xCC": "I",
  2302. "\xCD": "I",
  2303. "\xCE": "I",
  2304. "\xCF": "I",
  2305. "\xEC": "i",
  2306. "\xED": "i",
  2307. "\xEE": "i",
  2308. "\xEF": "i",
  2309. "\xD1": "N",
  2310. "\xF1": "n",
  2311. "\xD2": "O",
  2312. "\xD3": "O",
  2313. "\xD4": "O",
  2314. "\xD5": "O",
  2315. "\xD6": "O",
  2316. "\xD8": "O",
  2317. "\xF2": "o",
  2318. "\xF3": "o",
  2319. "\xF4": "o",
  2320. "\xF5": "o",
  2321. "\xF6": "o",
  2322. "\xF8": "o",
  2323. "\xD9": "U",
  2324. "\xDA": "U",
  2325. "\xDB": "U",
  2326. "\xDC": "U",
  2327. "\xF9": "u",
  2328. "\xFA": "u",
  2329. "\xFB": "u",
  2330. "\xFC": "u",
  2331. "\xDD": "Y",
  2332. "\xFD": "y",
  2333. "\xFF": "y",
  2334. "\xC6": "Ae",
  2335. "\xE6": "ae",
  2336. "\xDE": "Th",
  2337. "\xFE": "th",
  2338. "\xDF": "ss",
  2339. "\u0100": "A",
  2340. "\u0102": "A",
  2341. "\u0104": "A",
  2342. "\u0101": "a",
  2343. "\u0103": "a",
  2344. "\u0105": "a",
  2345. "\u0106": "C",
  2346. "\u0108": "C",
  2347. "\u010A": "C",
  2348. "\u010C": "C",
  2349. "\u0107": "c",
  2350. "\u0109": "c",
  2351. "\u010B": "c",
  2352. "\u010D": "c",
  2353. "\u010E": "D",
  2354. "\u0110": "D",
  2355. "\u010F": "d",
  2356. "\u0111": "d",
  2357. "\u0112": "E",
  2358. "\u0114": "E",
  2359. "\u0116": "E",
  2360. "\u0118": "E",
  2361. "\u011A": "E",
  2362. "\u0113": "e",
  2363. "\u0115": "e",
  2364. "\u0117": "e",
  2365. "\u0119": "e",
  2366. "\u011B": "e",
  2367. "\u011C": "G",
  2368. "\u011E": "G",
  2369. "\u0120": "G",
  2370. "\u0122": "G",
  2371. "\u011D": "g",
  2372. "\u011F": "g",
  2373. "\u0121": "g",
  2374. "\u0123": "g",
  2375. "\u0124": "H",
  2376. "\u0126": "H",
  2377. "\u0125": "h",
  2378. "\u0127": "h",
  2379. "\u0128": "I",
  2380. "\u012A": "I",
  2381. "\u012C": "I",
  2382. "\u012E": "I",
  2383. "\u0130": "I",
  2384. "\u0129": "i",
  2385. "\u012B": "i",
  2386. "\u012D": "i",
  2387. "\u012F": "i",
  2388. "\u0131": "i",
  2389. "\u0134": "J",
  2390. "\u0135": "j",
  2391. "\u0136": "K",
  2392. "\u0137": "k",
  2393. "\u0138": "k",
  2394. "\u0139": "L",
  2395. "\u013B": "L",
  2396. "\u013D": "L",
  2397. "\u013F": "L",
  2398. "\u0141": "L",
  2399. "\u013A": "l",
  2400. "\u013C": "l",
  2401. "\u013E": "l",
  2402. "\u0140": "l",
  2403. "\u0142": "l",
  2404. "\u0143": "N",
  2405. "\u0145": "N",
  2406. "\u0147": "N",
  2407. "\u014A": "N",
  2408. "\u0144": "n",
  2409. "\u0146": "n",
  2410. "\u0148": "n",
  2411. "\u014B": "n",
  2412. "\u014C": "O",
  2413. "\u014E": "O",
  2414. "\u0150": "O",
  2415. "\u014D": "o",
  2416. "\u014F": "o",
  2417. "\u0151": "o",
  2418. "\u0154": "R",
  2419. "\u0156": "R",
  2420. "\u0158": "R",
  2421. "\u0155": "r",
  2422. "\u0157": "r",
  2423. "\u0159": "r",
  2424. "\u015A": "S",
  2425. "\u015C": "S",
  2426. "\u015E": "S",
  2427. "\u0160": "S",
  2428. "\u015B": "s",
  2429. "\u015D": "s",
  2430. "\u015F": "s",
  2431. "\u0161": "s",
  2432. "\u0162": "T",
  2433. "\u0164": "T",
  2434. "\u0166": "T",
  2435. "\u0163": "t",
  2436. "\u0165": "t",
  2437. "\u0167": "t",
  2438. "\u0168": "U",
  2439. "\u016A": "U",
  2440. "\u016C": "U",
  2441. "\u016E": "U",
  2442. "\u0170": "U",
  2443. "\u0172": "U",
  2444. "\u0169": "u",
  2445. "\u016B": "u",
  2446. "\u016D": "u",
  2447. "\u016F": "u",
  2448. "\u0171": "u",
  2449. "\u0173": "u",
  2450. "\u0174": "W",
  2451. "\u0175": "w",
  2452. "\u0176": "Y",
  2453. "\u0177": "y",
  2454. "\u0178": "Y",
  2455. "\u0179": "Z",
  2456. "\u017B": "Z",
  2457. "\u017D": "Z",
  2458. "\u017A": "z",
  2459. "\u017C": "z",
  2460. "\u017E": "z",
  2461. "\u0132": "IJ",
  2462. "\u0133": "ij",
  2463. "\u0152": "Oe",
  2464. "\u0153": "oe",
  2465. "\u0149": "'n",
  2466. "\u017F": "s"
  2467. };
  2468. var deburrLetter = basePropertyOf(deburredLetters);
  2469. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  2470. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  2471. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  2472. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  2473. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  2474. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  2475. var reComboMark = RegExp(rsCombo$2, "g");
  2476. function deburr(string) {
  2477. string = toString(string);
  2478. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  2479. }
  2480. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  2481. function asciiWords(string) {
  2482. return string.match(reAsciiWord) || [];
  2483. }
  2484. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  2485. function hasUnicodeWord(string) {
  2486. return reHasUnicodeWord.test(string);
  2487. }
  2488. var rsAstralRange$1 = "\\ud800-\\udfff";
  2489. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  2490. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  2491. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  2492. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  2493. var rsDingbatRange = "\\u2700-\\u27bf";
  2494. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  2495. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  2496. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  2497. var rsPunctuationRange = "\\u2000-\\u206f";
  2498. var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
  2499. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  2500. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  2501. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  2502. var rsApos$1 = "['\u2019]";
  2503. var rsBreak = "[" + rsBreakRange + "]";
  2504. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  2505. var rsDigits = "\\d+";
  2506. var rsDingbat = "[" + rsDingbatRange + "]";
  2507. var rsLower = "[" + rsLowerRange + "]";
  2508. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  2509. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  2510. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  2511. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  2512. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2513. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2514. var rsUpper = "[" + rsUpperRange + "]";
  2515. var rsZWJ$1 = "\\u200d";
  2516. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  2517. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  2518. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  2519. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  2520. var reOptMod$1 = rsModifier$1 + "?";
  2521. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  2522. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  2523. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  2524. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  2525. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  2526. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  2527. var reUnicodeWord = RegExp([
  2528. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  2529. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  2530. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  2531. rsUpper + "+" + rsOptContrUpper,
  2532. rsOrdUpper,
  2533. rsOrdLower,
  2534. rsDigits,
  2535. rsEmoji
  2536. ].join("|"), "g");
  2537. function unicodeWords(string) {
  2538. return string.match(reUnicodeWord) || [];
  2539. }
  2540. function words(string, pattern, guard) {
  2541. string = toString(string);
  2542. pattern = guard ? void 0 : pattern;
  2543. if (pattern === void 0) {
  2544. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  2545. }
  2546. return string.match(pattern) || [];
  2547. }
  2548. var rsApos = "['\u2019]";
  2549. var reApos = RegExp(rsApos, "g");
  2550. function createCompounder(callback) {
  2551. return function(string) {
  2552. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  2553. };
  2554. }
  2555. var camelCase = createCompounder(function(result, word, index) {
  2556. word = word.toLowerCase();
  2557. return result + (index ? capitalize$1(word) : word);
  2558. });
  2559. function castArray$1() {
  2560. if (!arguments.length) {
  2561. return [];
  2562. }
  2563. var value = arguments[0];
  2564. return isArray(value) ? value : [value];
  2565. }
  2566. var nativeIsFinite$1 = root.isFinite;
  2567. var nativeMin$c = Math.min;
  2568. function createRound(methodName) {
  2569. var func = Math[methodName];
  2570. return function(number, precision) {
  2571. number = toNumber(number);
  2572. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  2573. if (precision && nativeIsFinite$1(number)) {
  2574. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  2575. pair = (toString(value) + "e").split("e");
  2576. return +(pair[0] + "e" + (+pair[1] - precision));
  2577. }
  2578. return func(number);
  2579. };
  2580. }
  2581. var ceil = createRound("ceil");
  2582. function chain(value) {
  2583. var result = lodash(value);
  2584. result.__chain__ = true;
  2585. return result;
  2586. }
  2587. var nativeCeil$3 = Math.ceil;
  2588. var nativeMax$c = Math.max;
  2589. function chunk(array, size, guard) {
  2590. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  2591. size = 1;
  2592. } else {
  2593. size = nativeMax$c(toInteger(size), 0);
  2594. }
  2595. var length = array == null ? 0 : array.length;
  2596. if (!length || size < 1) {
  2597. return [];
  2598. }
  2599. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  2600. while (index < length) {
  2601. result[resIndex++] = baseSlice(array, index, index += size);
  2602. }
  2603. return result;
  2604. }
  2605. function baseClamp(number, lower, upper) {
  2606. if (number === number) {
  2607. if (upper !== void 0) {
  2608. number = number <= upper ? number : upper;
  2609. }
  2610. if (lower !== void 0) {
  2611. number = number >= lower ? number : lower;
  2612. }
  2613. }
  2614. return number;
  2615. }
  2616. function clamp(number, lower, upper) {
  2617. if (upper === void 0) {
  2618. upper = lower;
  2619. lower = void 0;
  2620. }
  2621. if (upper !== void 0) {
  2622. upper = toNumber(upper);
  2623. upper = upper === upper ? upper : 0;
  2624. }
  2625. if (lower !== void 0) {
  2626. lower = toNumber(lower);
  2627. lower = lower === lower ? lower : 0;
  2628. }
  2629. return baseClamp(toNumber(number), lower, upper);
  2630. }
  2631. function stackClear() {
  2632. this.__data__ = new ListCache();
  2633. this.size = 0;
  2634. }
  2635. function stackDelete(key) {
  2636. var data = this.__data__, result = data["delete"](key);
  2637. this.size = data.size;
  2638. return result;
  2639. }
  2640. function stackGet(key) {
  2641. return this.__data__.get(key);
  2642. }
  2643. function stackHas(key) {
  2644. return this.__data__.has(key);
  2645. }
  2646. var LARGE_ARRAY_SIZE$2 = 200;
  2647. function stackSet(key, value) {
  2648. var data = this.__data__;
  2649. if (data instanceof ListCache) {
  2650. var pairs = data.__data__;
  2651. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  2652. pairs.push([key, value]);
  2653. this.size = ++data.size;
  2654. return this;
  2655. }
  2656. data = this.__data__ = new MapCache(pairs);
  2657. }
  2658. data.set(key, value);
  2659. this.size = data.size;
  2660. return this;
  2661. }
  2662. function Stack(entries) {
  2663. var data = this.__data__ = new ListCache(entries);
  2664. this.size = data.size;
  2665. }
  2666. Stack.prototype.clear = stackClear;
  2667. Stack.prototype["delete"] = stackDelete;
  2668. Stack.prototype.get = stackGet;
  2669. Stack.prototype.has = stackHas;
  2670. Stack.prototype.set = stackSet;
  2671. function baseAssign(object, source) {
  2672. return object && copyObject(source, keys(source), object);
  2673. }
  2674. function baseAssignIn(object, source) {
  2675. return object && copyObject(source, keysIn(source), object);
  2676. }
  2677. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  2678. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  2679. var moduleExports = freeModule && freeModule.exports === freeExports;
  2680. var Buffer = moduleExports ? root.Buffer : void 0;
  2681. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  2682. function cloneBuffer(buffer, isDeep) {
  2683. if (isDeep) {
  2684. return buffer.slice();
  2685. }
  2686. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  2687. buffer.copy(result);
  2688. return result;
  2689. }
  2690. function arrayFilter(array, predicate) {
  2691. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2692. while (++index < length) {
  2693. var value = array[index];
  2694. if (predicate(value, index, array)) {
  2695. result[resIndex++] = value;
  2696. }
  2697. }
  2698. return result;
  2699. }
  2700. function stubArray() {
  2701. return [];
  2702. }
  2703. var objectProto$d = Object.prototype;
  2704. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  2705. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  2706. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  2707. if (object == null) {
  2708. return [];
  2709. }
  2710. object = Object(object);
  2711. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  2712. return propertyIsEnumerable.call(object, symbol);
  2713. });
  2714. };
  2715. function copySymbols(source, object) {
  2716. return copyObject(source, getSymbols(source), object);
  2717. }
  2718. var nativeGetSymbols = Object.getOwnPropertySymbols;
  2719. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  2720. var result = [];
  2721. while (object) {
  2722. arrayPush(result, getSymbols(object));
  2723. object = getPrototype(object);
  2724. }
  2725. return result;
  2726. };
  2727. function copySymbolsIn(source, object) {
  2728. return copyObject(source, getSymbolsIn(source), object);
  2729. }
  2730. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2731. var result = keysFunc(object);
  2732. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2733. }
  2734. function getAllKeys(object) {
  2735. return baseGetAllKeys(object, keys, getSymbols);
  2736. }
  2737. function getAllKeysIn(object) {
  2738. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  2739. }
  2740. var DataView = getNative(root, "DataView");
  2741. var Promise$1 = getNative(root, "Promise");
  2742. var Set$1 = getNative(root, "Set");
  2743. var mapTag$8 = "[object Map]";
  2744. var objectTag$2 = "[object Object]";
  2745. var promiseTag = "[object Promise]";
  2746. var setTag$8 = "[object Set]";
  2747. var weakMapTag$2 = "[object WeakMap]";
  2748. var dataViewTag$3 = "[object DataView]";
  2749. var dataViewCtorString = toSource(DataView);
  2750. var mapCtorString = toSource(Map$1);
  2751. var promiseCtorString = toSource(Promise$1);
  2752. var setCtorString = toSource(Set$1);
  2753. var weakMapCtorString = toSource(WeakMap);
  2754. var getTag = baseGetTag;
  2755. if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$8 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$8 || WeakMap && getTag(new WeakMap()) != weakMapTag$2) {
  2756. getTag = function(value) {
  2757. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2758. if (ctorString) {
  2759. switch (ctorString) {
  2760. case dataViewCtorString:
  2761. return dataViewTag$3;
  2762. case mapCtorString:
  2763. return mapTag$8;
  2764. case promiseCtorString:
  2765. return promiseTag;
  2766. case setCtorString:
  2767. return setTag$8;
  2768. case weakMapCtorString:
  2769. return weakMapTag$2;
  2770. }
  2771. }
  2772. return result;
  2773. };
  2774. }
  2775. var getTag$1 = getTag;
  2776. var objectProto$c = Object.prototype;
  2777. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  2778. function initCloneArray(array) {
  2779. var length = array.length, result = new array.constructor(length);
  2780. if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) {
  2781. result.index = array.index;
  2782. result.input = array.input;
  2783. }
  2784. return result;
  2785. }
  2786. var Uint8Array = root.Uint8Array;
  2787. function cloneArrayBuffer(arrayBuffer) {
  2788. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2789. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2790. return result;
  2791. }
  2792. function cloneDataView(dataView, isDeep) {
  2793. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2794. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2795. }
  2796. var reFlags$1 = /\w*$/;
  2797. function cloneRegExp(regexp) {
  2798. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  2799. result.lastIndex = regexp.lastIndex;
  2800. return result;
  2801. }
  2802. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  2803. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2804. function cloneSymbol(symbol) {
  2805. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2806. }
  2807. function cloneTypedArray(typedArray, isDeep) {
  2808. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2809. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2810. }
  2811. var boolTag$3 = "[object Boolean]";
  2812. var dateTag$3 = "[object Date]";
  2813. var mapTag$7 = "[object Map]";
  2814. var numberTag$3 = "[object Number]";
  2815. var regexpTag$3 = "[object RegExp]";
  2816. var setTag$7 = "[object Set]";
  2817. var stringTag$3 = "[object String]";
  2818. var symbolTag$2 = "[object Symbol]";
  2819. var arrayBufferTag$3 = "[object ArrayBuffer]";
  2820. var dataViewTag$2 = "[object DataView]";
  2821. var float32Tag$1 = "[object Float32Array]";
  2822. var float64Tag$1 = "[object Float64Array]";
  2823. var int8Tag$1 = "[object Int8Array]";
  2824. var int16Tag$1 = "[object Int16Array]";
  2825. var int32Tag$1 = "[object Int32Array]";
  2826. var uint8Tag$1 = "[object Uint8Array]";
  2827. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  2828. var uint16Tag$1 = "[object Uint16Array]";
  2829. var uint32Tag$1 = "[object Uint32Array]";
  2830. function initCloneByTag(object, tag, isDeep) {
  2831. var Ctor = object.constructor;
  2832. switch (tag) {
  2833. case arrayBufferTag$3:
  2834. return cloneArrayBuffer(object);
  2835. case boolTag$3:
  2836. case dateTag$3:
  2837. return new Ctor(+object);
  2838. case dataViewTag$2:
  2839. return cloneDataView(object, isDeep);
  2840. case float32Tag$1:
  2841. case float64Tag$1:
  2842. case int8Tag$1:
  2843. case int16Tag$1:
  2844. case int32Tag$1:
  2845. case uint8Tag$1:
  2846. case uint8ClampedTag$1:
  2847. case uint16Tag$1:
  2848. case uint32Tag$1:
  2849. return cloneTypedArray(object, isDeep);
  2850. case mapTag$7:
  2851. return new Ctor();
  2852. case numberTag$3:
  2853. case stringTag$3:
  2854. return new Ctor(object);
  2855. case regexpTag$3:
  2856. return cloneRegExp(object);
  2857. case setTag$7:
  2858. return new Ctor();
  2859. case symbolTag$2:
  2860. return cloneSymbol(object);
  2861. }
  2862. }
  2863. function initCloneObject(object) {
  2864. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2865. }
  2866. var mapTag$6 = "[object Map]";
  2867. function baseIsMap(value) {
  2868. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  2869. }
  2870. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2871. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2872. var setTag$6 = "[object Set]";
  2873. function baseIsSet(value) {
  2874. return isObjectLike(value) && getTag$1(value) == setTag$6;
  2875. }
  2876. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2877. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2878. var CLONE_DEEP_FLAG$7 = 1;
  2879. var CLONE_FLAT_FLAG$1 = 2;
  2880. var CLONE_SYMBOLS_FLAG$5 = 4;
  2881. var argsTag$1 = "[object Arguments]";
  2882. var arrayTag$1 = "[object Array]";
  2883. var boolTag$2 = "[object Boolean]";
  2884. var dateTag$2 = "[object Date]";
  2885. var errorTag$1 = "[object Error]";
  2886. var funcTag = "[object Function]";
  2887. var genTag = "[object GeneratorFunction]";
  2888. var mapTag$5 = "[object Map]";
  2889. var numberTag$2 = "[object Number]";
  2890. var objectTag$1 = "[object Object]";
  2891. var regexpTag$2 = "[object RegExp]";
  2892. var setTag$5 = "[object Set]";
  2893. var stringTag$2 = "[object String]";
  2894. var symbolTag$1 = "[object Symbol]";
  2895. var weakMapTag$1 = "[object WeakMap]";
  2896. var arrayBufferTag$2 = "[object ArrayBuffer]";
  2897. var dataViewTag$1 = "[object DataView]";
  2898. var float32Tag = "[object Float32Array]";
  2899. var float64Tag = "[object Float64Array]";
  2900. var int8Tag = "[object Int8Array]";
  2901. var int16Tag = "[object Int16Array]";
  2902. var int32Tag = "[object Int32Array]";
  2903. var uint8Tag = "[object Uint8Array]";
  2904. var uint8ClampedTag = "[object Uint8ClampedArray]";
  2905. var uint16Tag = "[object Uint16Array]";
  2906. var uint32Tag = "[object Uint32Array]";
  2907. var cloneableTags = {};
  2908. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$2] = cloneableTags[dateTag$2] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$5] = cloneableTags[numberTag$2] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$2] = cloneableTags[setTag$5] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  2909. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  2910. function baseClone(value, bitmask, customizer, key, object, stack) {
  2911. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  2912. if (customizer) {
  2913. result = object ? customizer(value, key, object, stack) : customizer(value);
  2914. }
  2915. if (result !== void 0) {
  2916. return result;
  2917. }
  2918. if (!isObject(value)) {
  2919. return value;
  2920. }
  2921. var isArr = isArray(value);
  2922. if (isArr) {
  2923. result = initCloneArray(value);
  2924. if (!isDeep) {
  2925. return copyArray(value, result);
  2926. }
  2927. } else {
  2928. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  2929. if (isBuffer(value)) {
  2930. return cloneBuffer(value, isDeep);
  2931. }
  2932. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2933. result = isFlat || isFunc ? {} : initCloneObject(value);
  2934. if (!isDeep) {
  2935. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2936. }
  2937. } else {
  2938. if (!cloneableTags[tag]) {
  2939. return object ? value : {};
  2940. }
  2941. result = initCloneByTag(value, tag, isDeep);
  2942. }
  2943. }
  2944. stack || (stack = new Stack());
  2945. var stacked = stack.get(value);
  2946. if (stacked) {
  2947. return stacked;
  2948. }
  2949. stack.set(value, result);
  2950. if (isSet(value)) {
  2951. value.forEach(function(subValue) {
  2952. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2953. });
  2954. } else if (isMap(value)) {
  2955. value.forEach(function(subValue, key2) {
  2956. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2957. });
  2958. }
  2959. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  2960. var props = isArr ? void 0 : keysFunc(value);
  2961. arrayEach(props || value, function(subValue, key2) {
  2962. if (props) {
  2963. key2 = subValue;
  2964. subValue = value[key2];
  2965. }
  2966. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2967. });
  2968. return result;
  2969. }
  2970. var CLONE_SYMBOLS_FLAG$4 = 4;
  2971. function clone(value) {
  2972. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  2973. }
  2974. var CLONE_DEEP_FLAG$6 = 1;
  2975. var CLONE_SYMBOLS_FLAG$3 = 4;
  2976. function cloneDeep(value) {
  2977. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  2978. }
  2979. var CLONE_DEEP_FLAG$5 = 1;
  2980. var CLONE_SYMBOLS_FLAG$2 = 4;
  2981. function cloneDeepWith(value, customizer) {
  2982. customizer = typeof customizer == "function" ? customizer : void 0;
  2983. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  2984. }
  2985. var CLONE_SYMBOLS_FLAG$1 = 4;
  2986. function cloneWith(value, customizer) {
  2987. customizer = typeof customizer == "function" ? customizer : void 0;
  2988. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  2989. }
  2990. function wrapperCommit() {
  2991. return new LodashWrapper(this.value(), this.__chain__);
  2992. }
  2993. function compact(array) {
  2994. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2995. while (++index < length) {
  2996. var value = array[index];
  2997. if (value) {
  2998. result[resIndex++] = value;
  2999. }
  3000. }
  3001. return result;
  3002. }
  3003. function concat() {
  3004. var length = arguments.length;
  3005. if (!length) {
  3006. return [];
  3007. }
  3008. var args = Array(length - 1), array = arguments[0], index = length;
  3009. while (index--) {
  3010. args[index - 1] = arguments[index];
  3011. }
  3012. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  3013. }
  3014. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  3015. function setCacheAdd(value) {
  3016. this.__data__.set(value, HASH_UNDEFINED);
  3017. return this;
  3018. }
  3019. function setCacheHas(value) {
  3020. return this.__data__.has(value);
  3021. }
  3022. function SetCache(values) {
  3023. var index = -1, length = values == null ? 0 : values.length;
  3024. this.__data__ = new MapCache();
  3025. while (++index < length) {
  3026. this.add(values[index]);
  3027. }
  3028. }
  3029. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3030. SetCache.prototype.has = setCacheHas;
  3031. function arraySome(array, predicate) {
  3032. var index = -1, length = array == null ? 0 : array.length;
  3033. while (++index < length) {
  3034. if (predicate(array[index], index, array)) {
  3035. return true;
  3036. }
  3037. }
  3038. return false;
  3039. }
  3040. function cacheHas(cache, key) {
  3041. return cache.has(key);
  3042. }
  3043. var COMPARE_PARTIAL_FLAG$5 = 1;
  3044. var COMPARE_UNORDERED_FLAG$3 = 2;
  3045. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  3046. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  3047. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  3048. return false;
  3049. }
  3050. var arrStacked = stack.get(array);
  3051. var othStacked = stack.get(other);
  3052. if (arrStacked && othStacked) {
  3053. return arrStacked == other && othStacked == array;
  3054. }
  3055. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  3056. stack.set(array, other);
  3057. stack.set(other, array);
  3058. while (++index < arrLength) {
  3059. var arrValue = array[index], othValue = other[index];
  3060. if (customizer) {
  3061. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  3062. }
  3063. if (compared !== void 0) {
  3064. if (compared) {
  3065. continue;
  3066. }
  3067. result = false;
  3068. break;
  3069. }
  3070. if (seen) {
  3071. if (!arraySome(other, function(othValue2, othIndex) {
  3072. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  3073. return seen.push(othIndex);
  3074. }
  3075. })) {
  3076. result = false;
  3077. break;
  3078. }
  3079. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  3080. result = false;
  3081. break;
  3082. }
  3083. }
  3084. stack["delete"](array);
  3085. stack["delete"](other);
  3086. return result;
  3087. }
  3088. function mapToArray(map) {
  3089. var index = -1, result = Array(map.size);
  3090. map.forEach(function(value, key) {
  3091. result[++index] = [key, value];
  3092. });
  3093. return result;
  3094. }
  3095. function setToArray(set) {
  3096. var index = -1, result = Array(set.size);
  3097. set.forEach(function(value) {
  3098. result[++index] = value;
  3099. });
  3100. return result;
  3101. }
  3102. var COMPARE_PARTIAL_FLAG$4 = 1;
  3103. var COMPARE_UNORDERED_FLAG$2 = 2;
  3104. var boolTag$1 = "[object Boolean]";
  3105. var dateTag$1 = "[object Date]";
  3106. var errorTag = "[object Error]";
  3107. var mapTag$4 = "[object Map]";
  3108. var numberTag$1 = "[object Number]";
  3109. var regexpTag$1 = "[object RegExp]";
  3110. var setTag$4 = "[object Set]";
  3111. var stringTag$1 = "[object String]";
  3112. var symbolTag = "[object Symbol]";
  3113. var arrayBufferTag$1 = "[object ArrayBuffer]";
  3114. var dataViewTag = "[object DataView]";
  3115. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  3116. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  3117. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  3118. switch (tag) {
  3119. case dataViewTag:
  3120. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  3121. return false;
  3122. }
  3123. object = object.buffer;
  3124. other = other.buffer;
  3125. case arrayBufferTag$1:
  3126. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  3127. return false;
  3128. }
  3129. return true;
  3130. case boolTag$1:
  3131. case dateTag$1:
  3132. case numberTag$1:
  3133. return eq(+object, +other);
  3134. case errorTag:
  3135. return object.name == other.name && object.message == other.message;
  3136. case regexpTag$1:
  3137. case stringTag$1:
  3138. return object == other + "";
  3139. case mapTag$4:
  3140. var convert = mapToArray;
  3141. case setTag$4:
  3142. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  3143. convert || (convert = setToArray);
  3144. if (object.size != other.size && !isPartial) {
  3145. return false;
  3146. }
  3147. var stacked = stack.get(object);
  3148. if (stacked) {
  3149. return stacked == other;
  3150. }
  3151. bitmask |= COMPARE_UNORDERED_FLAG$2;
  3152. stack.set(object, other);
  3153. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  3154. stack["delete"](object);
  3155. return result;
  3156. case symbolTag:
  3157. if (symbolValueOf) {
  3158. return symbolValueOf.call(object) == symbolValueOf.call(other);
  3159. }
  3160. }
  3161. return false;
  3162. }
  3163. var COMPARE_PARTIAL_FLAG$3 = 1;
  3164. var objectProto$b = Object.prototype;
  3165. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  3166. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  3167. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  3168. if (objLength != othLength && !isPartial) {
  3169. return false;
  3170. }
  3171. var index = objLength;
  3172. while (index--) {
  3173. var key = objProps[index];
  3174. if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
  3175. return false;
  3176. }
  3177. }
  3178. var objStacked = stack.get(object);
  3179. var othStacked = stack.get(other);
  3180. if (objStacked && othStacked) {
  3181. return objStacked == other && othStacked == object;
  3182. }
  3183. var result = true;
  3184. stack.set(object, other);
  3185. stack.set(other, object);
  3186. var skipCtor = isPartial;
  3187. while (++index < objLength) {
  3188. key = objProps[index];
  3189. var objValue = object[key], othValue = other[key];
  3190. if (customizer) {
  3191. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  3192. }
  3193. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  3194. result = false;
  3195. break;
  3196. }
  3197. skipCtor || (skipCtor = key == "constructor");
  3198. }
  3199. if (result && !skipCtor) {
  3200. var objCtor = object.constructor, othCtor = other.constructor;
  3201. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  3202. result = false;
  3203. }
  3204. }
  3205. stack["delete"](object);
  3206. stack["delete"](other);
  3207. return result;
  3208. }
  3209. var COMPARE_PARTIAL_FLAG$2 = 1;
  3210. var argsTag = "[object Arguments]";
  3211. var arrayTag = "[object Array]";
  3212. var objectTag = "[object Object]";
  3213. var objectProto$a = Object.prototype;
  3214. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  3215. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3216. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  3217. objTag = objTag == argsTag ? objectTag : objTag;
  3218. othTag = othTag == argsTag ? objectTag : othTag;
  3219. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  3220. if (isSameTag && isBuffer(object)) {
  3221. if (!isBuffer(other)) {
  3222. return false;
  3223. }
  3224. objIsArr = true;
  3225. objIsObj = false;
  3226. }
  3227. if (isSameTag && !objIsObj) {
  3228. stack || (stack = new Stack());
  3229. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3230. }
  3231. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  3232. var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__");
  3233. if (objIsWrapped || othIsWrapped) {
  3234. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  3235. stack || (stack = new Stack());
  3236. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3237. }
  3238. }
  3239. if (!isSameTag) {
  3240. return false;
  3241. }
  3242. stack || (stack = new Stack());
  3243. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3244. }
  3245. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3246. if (value === other) {
  3247. return true;
  3248. }
  3249. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  3250. return value !== value && other !== other;
  3251. }
  3252. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3253. }
  3254. var COMPARE_PARTIAL_FLAG$1 = 1;
  3255. var COMPARE_UNORDERED_FLAG$1 = 2;
  3256. function baseIsMatch(object, source, matchData, customizer) {
  3257. var index = matchData.length, length = index, noCustomizer = !customizer;
  3258. if (object == null) {
  3259. return !length;
  3260. }
  3261. object = Object(object);
  3262. while (index--) {
  3263. var data = matchData[index];
  3264. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  3265. return false;
  3266. }
  3267. }
  3268. while (++index < length) {
  3269. data = matchData[index];
  3270. var key = data[0], objValue = object[key], srcValue = data[1];
  3271. if (noCustomizer && data[2]) {
  3272. if (objValue === void 0 && !(key in object)) {
  3273. return false;
  3274. }
  3275. } else {
  3276. var stack = new Stack();
  3277. if (customizer) {
  3278. var result = customizer(objValue, srcValue, key, object, source, stack);
  3279. }
  3280. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  3281. return false;
  3282. }
  3283. }
  3284. }
  3285. return true;
  3286. }
  3287. function isStrictComparable(value) {
  3288. return value === value && !isObject(value);
  3289. }
  3290. function getMatchData(object) {
  3291. var result = keys(object), length = result.length;
  3292. while (length--) {
  3293. var key = result[length], value = object[key];
  3294. result[length] = [key, value, isStrictComparable(value)];
  3295. }
  3296. return result;
  3297. }
  3298. function matchesStrictComparable(key, srcValue) {
  3299. return function(object) {
  3300. if (object == null) {
  3301. return false;
  3302. }
  3303. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  3304. };
  3305. }
  3306. function baseMatches(source) {
  3307. var matchData = getMatchData(source);
  3308. if (matchData.length == 1 && matchData[0][2]) {
  3309. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3310. }
  3311. return function(object) {
  3312. return object === source || baseIsMatch(object, source, matchData);
  3313. };
  3314. }
  3315. function baseHasIn(object, key) {
  3316. return object != null && key in Object(object);
  3317. }
  3318. function hasPath(object, path, hasFunc) {
  3319. path = castPath(path, object);
  3320. var index = -1, length = path.length, result = false;
  3321. while (++index < length) {
  3322. var key = toKey(path[index]);
  3323. if (!(result = object != null && hasFunc(object, key))) {
  3324. break;
  3325. }
  3326. object = object[key];
  3327. }
  3328. if (result || ++index != length) {
  3329. return result;
  3330. }
  3331. length = object == null ? 0 : object.length;
  3332. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  3333. }
  3334. function hasIn(object, path) {
  3335. return object != null && hasPath(object, path, baseHasIn);
  3336. }
  3337. var COMPARE_PARTIAL_FLAG = 1;
  3338. var COMPARE_UNORDERED_FLAG = 2;
  3339. function baseMatchesProperty(path, srcValue) {
  3340. if (isKey(path) && isStrictComparable(srcValue)) {
  3341. return matchesStrictComparable(toKey(path), srcValue);
  3342. }
  3343. return function(object) {
  3344. var objValue = get(object, path);
  3345. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3346. };
  3347. }
  3348. function baseProperty(key) {
  3349. return function(object) {
  3350. return object == null ? void 0 : object[key];
  3351. };
  3352. }
  3353. function basePropertyDeep(path) {
  3354. return function(object) {
  3355. return baseGet(object, path);
  3356. };
  3357. }
  3358. function property(path) {
  3359. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3360. }
  3361. function baseIteratee(value) {
  3362. if (typeof value == "function") {
  3363. return value;
  3364. }
  3365. if (value == null) {
  3366. return identity;
  3367. }
  3368. if (typeof value == "object") {
  3369. return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  3370. }
  3371. return property(value);
  3372. }
  3373. var FUNC_ERROR_TEXT$7 = "Expected a function";
  3374. function cond(pairs) {
  3375. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  3376. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  3377. if (typeof pair[1] != "function") {
  3378. throw new TypeError(FUNC_ERROR_TEXT$7);
  3379. }
  3380. return [toIteratee(pair[0]), pair[1]];
  3381. });
  3382. return baseRest(function(args) {
  3383. var index = -1;
  3384. while (++index < length) {
  3385. var pair = pairs[index];
  3386. if (apply(pair[0], this, args)) {
  3387. return apply(pair[1], this, args);
  3388. }
  3389. }
  3390. });
  3391. }
  3392. function baseConformsTo(object, source, props) {
  3393. var length = props.length;
  3394. if (object == null) {
  3395. return !length;
  3396. }
  3397. object = Object(object);
  3398. while (length--) {
  3399. var key = props[length], predicate = source[key], value = object[key];
  3400. if (value === void 0 && !(key in object) || !predicate(value)) {
  3401. return false;
  3402. }
  3403. }
  3404. return true;
  3405. }
  3406. function baseConforms(source) {
  3407. var props = keys(source);
  3408. return function(object) {
  3409. return baseConformsTo(object, source, props);
  3410. };
  3411. }
  3412. var CLONE_DEEP_FLAG$4 = 1;
  3413. function conforms(source) {
  3414. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  3415. }
  3416. function conformsTo(object, source) {
  3417. return source == null || baseConformsTo(object, source, keys(source));
  3418. }
  3419. function arrayAggregator(array, setter, iteratee, accumulator) {
  3420. var index = -1, length = array == null ? 0 : array.length;
  3421. while (++index < length) {
  3422. var value = array[index];
  3423. setter(accumulator, value, iteratee(value), array);
  3424. }
  3425. return accumulator;
  3426. }
  3427. function createBaseFor(fromRight) {
  3428. return function(object, iteratee, keysFunc) {
  3429. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  3430. while (length--) {
  3431. var key = props[fromRight ? length : ++index];
  3432. if (iteratee(iterable[key], key, iterable) === false) {
  3433. break;
  3434. }
  3435. }
  3436. return object;
  3437. };
  3438. }
  3439. var baseFor = createBaseFor();
  3440. function baseForOwn(object, iteratee) {
  3441. return object && baseFor(object, iteratee, keys);
  3442. }
  3443. function createBaseEach(eachFunc, fromRight) {
  3444. return function(collection, iteratee) {
  3445. if (collection == null) {
  3446. return collection;
  3447. }
  3448. if (!isArrayLike(collection)) {
  3449. return eachFunc(collection, iteratee);
  3450. }
  3451. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  3452. while (fromRight ? index-- : ++index < length) {
  3453. if (iteratee(iterable[index], index, iterable) === false) {
  3454. break;
  3455. }
  3456. }
  3457. return collection;
  3458. };
  3459. }
  3460. var baseEach = createBaseEach(baseForOwn);
  3461. function baseAggregator(collection, setter, iteratee, accumulator) {
  3462. baseEach(collection, function(value, key, collection2) {
  3463. setter(accumulator, value, iteratee(value), collection2);
  3464. });
  3465. return accumulator;
  3466. }
  3467. function createAggregator(setter, initializer) {
  3468. return function(collection, iteratee) {
  3469. var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  3470. return func(collection, setter, baseIteratee(iteratee), accumulator);
  3471. };
  3472. }
  3473. var objectProto$9 = Object.prototype;
  3474. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  3475. var countBy = createAggregator(function(result, value, key) {
  3476. if (hasOwnProperty$8.call(result, key)) {
  3477. ++result[key];
  3478. } else {
  3479. baseAssignValue(result, key, 1);
  3480. }
  3481. });
  3482. function create(prototype, properties) {
  3483. var result = baseCreate(prototype);
  3484. return properties == null ? result : baseAssign(result, properties);
  3485. }
  3486. var WRAP_CURRY_FLAG$1 = 8;
  3487. function curry(func, arity, guard) {
  3488. arity = guard ? void 0 : arity;
  3489. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  3490. result.placeholder = curry.placeholder;
  3491. return result;
  3492. }
  3493. curry.placeholder = {};
  3494. var WRAP_CURRY_RIGHT_FLAG = 16;
  3495. function curryRight(func, arity, guard) {
  3496. arity = guard ? void 0 : arity;
  3497. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  3498. result.placeholder = curryRight.placeholder;
  3499. return result;
  3500. }
  3501. curryRight.placeholder = {};
  3502. var now = function() {
  3503. return root.Date.now();
  3504. };
  3505. var FUNC_ERROR_TEXT$6 = "Expected a function";
  3506. var nativeMax$b = Math.max;
  3507. var nativeMin$b = Math.min;
  3508. function debounce(func, wait, options) {
  3509. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  3510. if (typeof func != "function") {
  3511. throw new TypeError(FUNC_ERROR_TEXT$6);
  3512. }
  3513. wait = toNumber(wait) || 0;
  3514. if (isObject(options)) {
  3515. leading = !!options.leading;
  3516. maxing = "maxWait" in options;
  3517. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  3518. trailing = "trailing" in options ? !!options.trailing : trailing;
  3519. }
  3520. function invokeFunc(time) {
  3521. var args = lastArgs, thisArg = lastThis;
  3522. lastArgs = lastThis = void 0;
  3523. lastInvokeTime = time;
  3524. result = func.apply(thisArg, args);
  3525. return result;
  3526. }
  3527. function leadingEdge(time) {
  3528. lastInvokeTime = time;
  3529. timerId = setTimeout(timerExpired, wait);
  3530. return leading ? invokeFunc(time) : result;
  3531. }
  3532. function remainingWait(time) {
  3533. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  3534. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  3535. }
  3536. function shouldInvoke(time) {
  3537. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  3538. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  3539. }
  3540. function timerExpired() {
  3541. var time = now();
  3542. if (shouldInvoke(time)) {
  3543. return trailingEdge(time);
  3544. }
  3545. timerId = setTimeout(timerExpired, remainingWait(time));
  3546. }
  3547. function trailingEdge(time) {
  3548. timerId = void 0;
  3549. if (trailing && lastArgs) {
  3550. return invokeFunc(time);
  3551. }
  3552. lastArgs = lastThis = void 0;
  3553. return result;
  3554. }
  3555. function cancel() {
  3556. if (timerId !== void 0) {
  3557. clearTimeout(timerId);
  3558. }
  3559. lastInvokeTime = 0;
  3560. lastArgs = lastCallTime = lastThis = timerId = void 0;
  3561. }
  3562. function flush() {
  3563. return timerId === void 0 ? result : trailingEdge(now());
  3564. }
  3565. function debounced() {
  3566. var time = now(), isInvoking = shouldInvoke(time);
  3567. lastArgs = arguments;
  3568. lastThis = this;
  3569. lastCallTime = time;
  3570. if (isInvoking) {
  3571. if (timerId === void 0) {
  3572. return leadingEdge(lastCallTime);
  3573. }
  3574. if (maxing) {
  3575. clearTimeout(timerId);
  3576. timerId = setTimeout(timerExpired, wait);
  3577. return invokeFunc(lastCallTime);
  3578. }
  3579. }
  3580. if (timerId === void 0) {
  3581. timerId = setTimeout(timerExpired, wait);
  3582. }
  3583. return result;
  3584. }
  3585. debounced.cancel = cancel;
  3586. debounced.flush = flush;
  3587. return debounced;
  3588. }
  3589. function defaultTo(value, defaultValue) {
  3590. return value == null || value !== value ? defaultValue : value;
  3591. }
  3592. var objectProto$8 = Object.prototype;
  3593. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  3594. var defaults = baseRest(function(object, sources) {
  3595. object = Object(object);
  3596. var index = -1;
  3597. var length = sources.length;
  3598. var guard = length > 2 ? sources[2] : void 0;
  3599. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  3600. length = 1;
  3601. }
  3602. while (++index < length) {
  3603. var source = sources[index];
  3604. var props = keysIn(source);
  3605. var propsIndex = -1;
  3606. var propsLength = props.length;
  3607. while (++propsIndex < propsLength) {
  3608. var key = props[propsIndex];
  3609. var value = object[key];
  3610. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) {
  3611. object[key] = source[key];
  3612. }
  3613. }
  3614. }
  3615. return object;
  3616. });
  3617. function assignMergeValue(object, key, value) {
  3618. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  3619. baseAssignValue(object, key, value);
  3620. }
  3621. }
  3622. function isArrayLikeObject(value) {
  3623. return isObjectLike(value) && isArrayLike(value);
  3624. }
  3625. function safeGet(object, key) {
  3626. if (key === "constructor" && typeof object[key] === "function") {
  3627. return;
  3628. }
  3629. if (key == "__proto__") {
  3630. return;
  3631. }
  3632. return object[key];
  3633. }
  3634. function toPlainObject(value) {
  3635. return copyObject(value, keysIn(value));
  3636. }
  3637. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  3638. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  3639. if (stacked) {
  3640. assignMergeValue(object, key, stacked);
  3641. return;
  3642. }
  3643. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  3644. var isCommon = newValue === void 0;
  3645. if (isCommon) {
  3646. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  3647. newValue = srcValue;
  3648. if (isArr || isBuff || isTyped) {
  3649. if (isArray(objValue)) {
  3650. newValue = objValue;
  3651. } else if (isArrayLikeObject(objValue)) {
  3652. newValue = copyArray(objValue);
  3653. } else if (isBuff) {
  3654. isCommon = false;
  3655. newValue = cloneBuffer(srcValue, true);
  3656. } else if (isTyped) {
  3657. isCommon = false;
  3658. newValue = cloneTypedArray(srcValue, true);
  3659. } else {
  3660. newValue = [];
  3661. }
  3662. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  3663. newValue = objValue;
  3664. if (isArguments(objValue)) {
  3665. newValue = toPlainObject(objValue);
  3666. } else if (!isObject(objValue) || isFunction(objValue)) {
  3667. newValue = initCloneObject(srcValue);
  3668. }
  3669. } else {
  3670. isCommon = false;
  3671. }
  3672. }
  3673. if (isCommon) {
  3674. stack.set(srcValue, newValue);
  3675. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  3676. stack["delete"](srcValue);
  3677. }
  3678. assignMergeValue(object, key, newValue);
  3679. }
  3680. function baseMerge(object, source, srcIndex, customizer, stack) {
  3681. if (object === source) {
  3682. return;
  3683. }
  3684. baseFor(source, function(srcValue, key) {
  3685. stack || (stack = new Stack());
  3686. if (isObject(srcValue)) {
  3687. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  3688. } else {
  3689. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  3690. if (newValue === void 0) {
  3691. newValue = srcValue;
  3692. }
  3693. assignMergeValue(object, key, newValue);
  3694. }
  3695. }, keysIn);
  3696. }
  3697. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  3698. if (isObject(objValue) && isObject(srcValue)) {
  3699. stack.set(srcValue, objValue);
  3700. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  3701. stack["delete"](srcValue);
  3702. }
  3703. return objValue;
  3704. }
  3705. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  3706. baseMerge(object, source, srcIndex, customizer);
  3707. });
  3708. var defaultsDeep = baseRest(function(args) {
  3709. args.push(void 0, customDefaultsMerge);
  3710. return apply(mergeWith, void 0, args);
  3711. });
  3712. var FUNC_ERROR_TEXT$5 = "Expected a function";
  3713. function baseDelay(func, wait, args) {
  3714. if (typeof func != "function") {
  3715. throw new TypeError(FUNC_ERROR_TEXT$5);
  3716. }
  3717. return setTimeout(function() {
  3718. func.apply(void 0, args);
  3719. }, wait);
  3720. }
  3721. var defer = baseRest(function(func, args) {
  3722. return baseDelay(func, 1, args);
  3723. });
  3724. var delay = baseRest(function(func, wait, args) {
  3725. return baseDelay(func, toNumber(wait) || 0, args);
  3726. });
  3727. function arrayIncludesWith(array, value, comparator) {
  3728. var index = -1, length = array == null ? 0 : array.length;
  3729. while (++index < length) {
  3730. if (comparator(value, array[index])) {
  3731. return true;
  3732. }
  3733. }
  3734. return false;
  3735. }
  3736. var LARGE_ARRAY_SIZE$1 = 200;
  3737. function baseDifference(array, values, iteratee, comparator) {
  3738. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  3739. if (!length) {
  3740. return result;
  3741. }
  3742. if (iteratee) {
  3743. values = arrayMap(values, baseUnary(iteratee));
  3744. }
  3745. if (comparator) {
  3746. includes = arrayIncludesWith;
  3747. isCommon = false;
  3748. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  3749. includes = cacheHas;
  3750. isCommon = false;
  3751. values = new SetCache(values);
  3752. }
  3753. outer:
  3754. while (++index < length) {
  3755. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  3756. value = comparator || value !== 0 ? value : 0;
  3757. if (isCommon && computed === computed) {
  3758. var valuesIndex = valuesLength;
  3759. while (valuesIndex--) {
  3760. if (values[valuesIndex] === computed) {
  3761. continue outer;
  3762. }
  3763. }
  3764. result.push(value);
  3765. } else if (!includes(values, computed, comparator)) {
  3766. result.push(value);
  3767. }
  3768. }
  3769. return result;
  3770. }
  3771. var difference = baseRest(function(array, values) {
  3772. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  3773. });
  3774. function last(array) {
  3775. var length = array == null ? 0 : array.length;
  3776. return length ? array[length - 1] : void 0;
  3777. }
  3778. var differenceBy = baseRest(function(array, values) {
  3779. var iteratee = last(values);
  3780. if (isArrayLikeObject(iteratee)) {
  3781. iteratee = void 0;
  3782. }
  3783. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  3784. });
  3785. var differenceWith = baseRest(function(array, values) {
  3786. var comparator = last(values);
  3787. if (isArrayLikeObject(comparator)) {
  3788. comparator = void 0;
  3789. }
  3790. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  3791. });
  3792. var divide = createMathOperation(function(dividend, divisor) {
  3793. return dividend / divisor;
  3794. }, 1);
  3795. function drop(array, n, guard) {
  3796. var length = array == null ? 0 : array.length;
  3797. if (!length) {
  3798. return [];
  3799. }
  3800. n = guard || n === void 0 ? 1 : toInteger(n);
  3801. return baseSlice(array, n < 0 ? 0 : n, length);
  3802. }
  3803. function dropRight(array, n, guard) {
  3804. var length = array == null ? 0 : array.length;
  3805. if (!length) {
  3806. return [];
  3807. }
  3808. n = guard || n === void 0 ? 1 : toInteger(n);
  3809. n = length - n;
  3810. return baseSlice(array, 0, n < 0 ? 0 : n);
  3811. }
  3812. function baseWhile(array, predicate, isDrop, fromRight) {
  3813. var length = array.length, index = fromRight ? length : -1;
  3814. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  3815. }
  3816. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  3817. }
  3818. function dropRightWhile(array, predicate) {
  3819. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  3820. }
  3821. function dropWhile(array, predicate) {
  3822. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  3823. }
  3824. function castFunction(value) {
  3825. return typeof value == "function" ? value : identity;
  3826. }
  3827. function forEach(collection, iteratee) {
  3828. var func = isArray(collection) ? arrayEach : baseEach;
  3829. return func(collection, castFunction(iteratee));
  3830. }
  3831. function arrayEachRight(array, iteratee) {
  3832. var length = array == null ? 0 : array.length;
  3833. while (length--) {
  3834. if (iteratee(array[length], length, array) === false) {
  3835. break;
  3836. }
  3837. }
  3838. return array;
  3839. }
  3840. var baseForRight = createBaseFor(true);
  3841. function baseForOwnRight(object, iteratee) {
  3842. return object && baseForRight(object, iteratee, keys);
  3843. }
  3844. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3845. function forEachRight(collection, iteratee) {
  3846. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  3847. return func(collection, castFunction(iteratee));
  3848. }
  3849. function endsWith(string, target, position) {
  3850. string = toString(string);
  3851. target = baseToString(target);
  3852. var length = string.length;
  3853. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  3854. var end = position;
  3855. position -= target.length;
  3856. return position >= 0 && string.slice(position, end) == target;
  3857. }
  3858. function baseToPairs(object, props) {
  3859. return arrayMap(props, function(key) {
  3860. return [key, object[key]];
  3861. });
  3862. }
  3863. function setToPairs(set) {
  3864. var index = -1, result = Array(set.size);
  3865. set.forEach(function(value) {
  3866. result[++index] = [value, value];
  3867. });
  3868. return result;
  3869. }
  3870. var mapTag$3 = "[object Map]";
  3871. var setTag$3 = "[object Set]";
  3872. function createToPairs(keysFunc) {
  3873. return function(object) {
  3874. var tag = getTag$1(object);
  3875. if (tag == mapTag$3) {
  3876. return mapToArray(object);
  3877. }
  3878. if (tag == setTag$3) {
  3879. return setToPairs(object);
  3880. }
  3881. return baseToPairs(object, keysFunc(object));
  3882. };
  3883. }
  3884. var toPairs = createToPairs(keys);
  3885. var toPairsIn = createToPairs(keysIn);
  3886. var htmlEscapes = {
  3887. "&": "&amp;",
  3888. "<": "&lt;",
  3889. ">": "&gt;",
  3890. '"': "&quot;",
  3891. "'": "&#39;"
  3892. };
  3893. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  3894. var reUnescapedHtml = /[&<>"']/g;
  3895. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  3896. function escape(string) {
  3897. string = toString(string);
  3898. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  3899. }
  3900. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3901. var reHasRegExpChar = RegExp(reRegExpChar.source);
  3902. function escapeRegExp(string) {
  3903. string = toString(string);
  3904. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  3905. }
  3906. function arrayEvery(array, predicate) {
  3907. var index = -1, length = array == null ? 0 : array.length;
  3908. while (++index < length) {
  3909. if (!predicate(array[index], index, array)) {
  3910. return false;
  3911. }
  3912. }
  3913. return true;
  3914. }
  3915. function baseEvery(collection, predicate) {
  3916. var result = true;
  3917. baseEach(collection, function(value, index, collection2) {
  3918. result = !!predicate(value, index, collection2);
  3919. return result;
  3920. });
  3921. return result;
  3922. }
  3923. function every(collection, predicate, guard) {
  3924. var func = isArray(collection) ? arrayEvery : baseEvery;
  3925. if (guard && isIterateeCall(collection, predicate, guard)) {
  3926. predicate = void 0;
  3927. }
  3928. return func(collection, baseIteratee(predicate));
  3929. }
  3930. var MAX_ARRAY_LENGTH$5 = 4294967295;
  3931. function toLength(value) {
  3932. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  3933. }
  3934. function baseFill(array, value, start, end) {
  3935. var length = array.length;
  3936. start = toInteger(start);
  3937. if (start < 0) {
  3938. start = -start > length ? 0 : length + start;
  3939. }
  3940. end = end === void 0 || end > length ? length : toInteger(end);
  3941. if (end < 0) {
  3942. end += length;
  3943. }
  3944. end = start > end ? 0 : toLength(end);
  3945. while (start < end) {
  3946. array[start++] = value;
  3947. }
  3948. return array;
  3949. }
  3950. function fill(array, value, start, end) {
  3951. var length = array == null ? 0 : array.length;
  3952. if (!length) {
  3953. return [];
  3954. }
  3955. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  3956. start = 0;
  3957. end = length;
  3958. }
  3959. return baseFill(array, value, start, end);
  3960. }
  3961. function baseFilter(collection, predicate) {
  3962. var result = [];
  3963. baseEach(collection, function(value, index, collection2) {
  3964. if (predicate(value, index, collection2)) {
  3965. result.push(value);
  3966. }
  3967. });
  3968. return result;
  3969. }
  3970. function filter(collection, predicate) {
  3971. var func = isArray(collection) ? arrayFilter : baseFilter;
  3972. return func(collection, baseIteratee(predicate));
  3973. }
  3974. function createFind(findIndexFunc) {
  3975. return function(collection, predicate, fromIndex) {
  3976. var iterable = Object(collection);
  3977. if (!isArrayLike(collection)) {
  3978. var iteratee = baseIteratee(predicate);
  3979. collection = keys(collection);
  3980. predicate = function(key) {
  3981. return iteratee(iterable[key], key, iterable);
  3982. };
  3983. }
  3984. var index = findIndexFunc(collection, predicate, fromIndex);
  3985. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  3986. };
  3987. }
  3988. var nativeMax$a = Math.max;
  3989. function findIndex(array, predicate, fromIndex) {
  3990. var length = array == null ? 0 : array.length;
  3991. if (!length) {
  3992. return -1;
  3993. }
  3994. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3995. if (index < 0) {
  3996. index = nativeMax$a(length + index, 0);
  3997. }
  3998. return baseFindIndex(array, baseIteratee(predicate), index);
  3999. }
  4000. var find = createFind(findIndex);
  4001. function baseFindKey(collection, predicate, eachFunc) {
  4002. var result;
  4003. eachFunc(collection, function(value, key, collection2) {
  4004. if (predicate(value, key, collection2)) {
  4005. result = key;
  4006. return false;
  4007. }
  4008. });
  4009. return result;
  4010. }
  4011. function findKey(object, predicate) {
  4012. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  4013. }
  4014. var nativeMax$9 = Math.max;
  4015. var nativeMin$a = Math.min;
  4016. function findLastIndex(array, predicate, fromIndex) {
  4017. var length = array == null ? 0 : array.length;
  4018. if (!length) {
  4019. return -1;
  4020. }
  4021. var index = length - 1;
  4022. if (fromIndex !== void 0) {
  4023. index = toInteger(fromIndex);
  4024. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  4025. }
  4026. return baseFindIndex(array, baseIteratee(predicate), index, true);
  4027. }
  4028. var findLast = createFind(findLastIndex);
  4029. function findLastKey(object, predicate) {
  4030. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  4031. }
  4032. function head(array) {
  4033. return array && array.length ? array[0] : void 0;
  4034. }
  4035. function baseMap(collection, iteratee) {
  4036. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  4037. baseEach(collection, function(value, key, collection2) {
  4038. result[++index] = iteratee(value, key, collection2);
  4039. });
  4040. return result;
  4041. }
  4042. function map(collection, iteratee) {
  4043. var func = isArray(collection) ? arrayMap : baseMap;
  4044. return func(collection, baseIteratee(iteratee));
  4045. }
  4046. function flatMap(collection, iteratee) {
  4047. return baseFlatten(map(collection, iteratee), 1);
  4048. }
  4049. var INFINITY$2 = 1 / 0;
  4050. function flatMapDeep(collection, iteratee) {
  4051. return baseFlatten(map(collection, iteratee), INFINITY$2);
  4052. }
  4053. function flatMapDepth(collection, iteratee, depth) {
  4054. depth = depth === void 0 ? 1 : toInteger(depth);
  4055. return baseFlatten(map(collection, iteratee), depth);
  4056. }
  4057. var INFINITY$1 = 1 / 0;
  4058. function flattenDeep(array) {
  4059. var length = array == null ? 0 : array.length;
  4060. return length ? baseFlatten(array, INFINITY$1) : [];
  4061. }
  4062. function flattenDepth(array, depth) {
  4063. var length = array == null ? 0 : array.length;
  4064. if (!length) {
  4065. return [];
  4066. }
  4067. depth = depth === void 0 ? 1 : toInteger(depth);
  4068. return baseFlatten(array, depth);
  4069. }
  4070. var WRAP_FLIP_FLAG = 512;
  4071. function flip$1(func) {
  4072. return createWrap(func, WRAP_FLIP_FLAG);
  4073. }
  4074. var floor$1 = createRound("floor");
  4075. var FUNC_ERROR_TEXT$4 = "Expected a function";
  4076. var WRAP_CURRY_FLAG = 8;
  4077. var WRAP_PARTIAL_FLAG$1 = 32;
  4078. var WRAP_ARY_FLAG = 128;
  4079. var WRAP_REARG_FLAG$1 = 256;
  4080. function createFlow(fromRight) {
  4081. return flatRest(function(funcs) {
  4082. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  4083. if (fromRight) {
  4084. funcs.reverse();
  4085. }
  4086. while (index--) {
  4087. var func = funcs[index];
  4088. if (typeof func != "function") {
  4089. throw new TypeError(FUNC_ERROR_TEXT$4);
  4090. }
  4091. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  4092. var wrapper = new LodashWrapper([], true);
  4093. }
  4094. }
  4095. index = wrapper ? index : length;
  4096. while (++index < length) {
  4097. func = funcs[index];
  4098. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  4099. if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG$1 | WRAP_REARG_FLAG$1) && !data[4].length && data[9] == 1) {
  4100. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  4101. } else {
  4102. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  4103. }
  4104. }
  4105. return function() {
  4106. var args = arguments, value = args[0];
  4107. if (wrapper && args.length == 1 && isArray(value)) {
  4108. return wrapper.plant(value).value();
  4109. }
  4110. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  4111. while (++index2 < length) {
  4112. result = funcs[index2].call(this, result);
  4113. }
  4114. return result;
  4115. };
  4116. });
  4117. }
  4118. var flow = createFlow();
  4119. var flowRight = createFlow(true);
  4120. function forIn(object, iteratee) {
  4121. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  4122. }
  4123. function forInRight(object, iteratee) {
  4124. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  4125. }
  4126. function forOwn(object, iteratee) {
  4127. return object && baseForOwn(object, castFunction(iteratee));
  4128. }
  4129. function forOwnRight(object, iteratee) {
  4130. return object && baseForOwnRight(object, castFunction(iteratee));
  4131. }
  4132. function fromPairs(pairs) {
  4133. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  4134. while (++index < length) {
  4135. var pair = pairs[index];
  4136. result[pair[0]] = pair[1];
  4137. }
  4138. return result;
  4139. }
  4140. function baseFunctions(object, props) {
  4141. return arrayFilter(props, function(key) {
  4142. return isFunction(object[key]);
  4143. });
  4144. }
  4145. function functions(object) {
  4146. return object == null ? [] : baseFunctions(object, keys(object));
  4147. }
  4148. function functionsIn(object) {
  4149. return object == null ? [] : baseFunctions(object, keysIn(object));
  4150. }
  4151. var objectProto$7 = Object.prototype;
  4152. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  4153. var groupBy = createAggregator(function(result, value, key) {
  4154. if (hasOwnProperty$6.call(result, key)) {
  4155. result[key].push(value);
  4156. } else {
  4157. baseAssignValue(result, key, [value]);
  4158. }
  4159. });
  4160. function baseGt(value, other) {
  4161. return value > other;
  4162. }
  4163. function createRelationalOperation(operator) {
  4164. return function(value, other) {
  4165. if (!(typeof value == "string" && typeof other == "string")) {
  4166. value = toNumber(value);
  4167. other = toNumber(other);
  4168. }
  4169. return operator(value, other);
  4170. };
  4171. }
  4172. var gt$1 = createRelationalOperation(baseGt);
  4173. var gte = createRelationalOperation(function(value, other) {
  4174. return value >= other;
  4175. });
  4176. var objectProto$6 = Object.prototype;
  4177. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  4178. function baseHas(object, key) {
  4179. return object != null && hasOwnProperty$5.call(object, key);
  4180. }
  4181. function has(object, path) {
  4182. return object != null && hasPath(object, path, baseHas);
  4183. }
  4184. var nativeMax$8 = Math.max;
  4185. var nativeMin$9 = Math.min;
  4186. function baseInRange(number, start, end) {
  4187. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  4188. }
  4189. function inRange(number, start, end) {
  4190. start = toFinite(start);
  4191. if (end === void 0) {
  4192. end = start;
  4193. start = 0;
  4194. } else {
  4195. end = toFinite(end);
  4196. }
  4197. number = toNumber(number);
  4198. return baseInRange(number, start, end);
  4199. }
  4200. var stringTag = "[object String]";
  4201. function isString(value) {
  4202. return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  4203. }
  4204. function baseValues(object, props) {
  4205. return arrayMap(props, function(key) {
  4206. return object[key];
  4207. });
  4208. }
  4209. function values(object) {
  4210. return object == null ? [] : baseValues(object, keys(object));
  4211. }
  4212. var nativeMax$7 = Math.max;
  4213. function includes(collection, value, fromIndex, guard) {
  4214. collection = isArrayLike(collection) ? collection : values(collection);
  4215. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  4216. var length = collection.length;
  4217. if (fromIndex < 0) {
  4218. fromIndex = nativeMax$7(length + fromIndex, 0);
  4219. }
  4220. return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  4221. }
  4222. var nativeMax$6 = Math.max;
  4223. function indexOf(array, value, fromIndex) {
  4224. var length = array == null ? 0 : array.length;
  4225. if (!length) {
  4226. return -1;
  4227. }
  4228. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4229. if (index < 0) {
  4230. index = nativeMax$6(length + index, 0);
  4231. }
  4232. return baseIndexOf(array, value, index);
  4233. }
  4234. function initial$1(array) {
  4235. var length = array == null ? 0 : array.length;
  4236. return length ? baseSlice(array, 0, -1) : [];
  4237. }
  4238. var nativeMin$8 = Math.min;
  4239. function baseIntersection(arrays, iteratee, comparator) {
  4240. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  4241. while (othIndex--) {
  4242. var array = arrays[othIndex];
  4243. if (othIndex && iteratee) {
  4244. array = arrayMap(array, baseUnary(iteratee));
  4245. }
  4246. maxLength = nativeMin$8(array.length, maxLength);
  4247. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  4248. }
  4249. array = arrays[0];
  4250. var index = -1, seen = caches[0];
  4251. outer:
  4252. while (++index < length && result.length < maxLength) {
  4253. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4254. value = comparator || value !== 0 ? value : 0;
  4255. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  4256. othIndex = othLength;
  4257. while (--othIndex) {
  4258. var cache = caches[othIndex];
  4259. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  4260. continue outer;
  4261. }
  4262. }
  4263. if (seen) {
  4264. seen.push(computed);
  4265. }
  4266. result.push(value);
  4267. }
  4268. }
  4269. return result;
  4270. }
  4271. function castArrayLikeObject(value) {
  4272. return isArrayLikeObject(value) ? value : [];
  4273. }
  4274. var intersection = baseRest(function(arrays) {
  4275. var mapped = arrayMap(arrays, castArrayLikeObject);
  4276. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  4277. });
  4278. var intersectionBy = baseRest(function(arrays) {
  4279. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4280. if (iteratee === last(mapped)) {
  4281. iteratee = void 0;
  4282. } else {
  4283. mapped.pop();
  4284. }
  4285. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  4286. });
  4287. var intersectionWith = baseRest(function(arrays) {
  4288. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4289. comparator = typeof comparator == "function" ? comparator : void 0;
  4290. if (comparator) {
  4291. mapped.pop();
  4292. }
  4293. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  4294. });
  4295. function baseInverter(object, setter, iteratee, accumulator) {
  4296. baseForOwn(object, function(value, key, object2) {
  4297. setter(accumulator, iteratee(value), key, object2);
  4298. });
  4299. return accumulator;
  4300. }
  4301. function createInverter(setter, toIteratee) {
  4302. return function(object, iteratee) {
  4303. return baseInverter(object, setter, toIteratee(iteratee), {});
  4304. };
  4305. }
  4306. var objectProto$5 = Object.prototype;
  4307. var nativeObjectToString$1 = objectProto$5.toString;
  4308. var invert = createInverter(function(result, value, key) {
  4309. if (value != null && typeof value.toString != "function") {
  4310. value = nativeObjectToString$1.call(value);
  4311. }
  4312. result[value] = key;
  4313. }, constant(identity));
  4314. var objectProto$4 = Object.prototype;
  4315. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4316. var nativeObjectToString = objectProto$4.toString;
  4317. var invertBy = createInverter(function(result, value, key) {
  4318. if (value != null && typeof value.toString != "function") {
  4319. value = nativeObjectToString.call(value);
  4320. }
  4321. if (hasOwnProperty$4.call(result, value)) {
  4322. result[value].push(key);
  4323. } else {
  4324. result[value] = [key];
  4325. }
  4326. }, baseIteratee);
  4327. function parent(object, path) {
  4328. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  4329. }
  4330. function baseInvoke(object, path, args) {
  4331. path = castPath(path, object);
  4332. object = parent(object, path);
  4333. var func = object == null ? object : object[toKey(last(path))];
  4334. return func == null ? void 0 : apply(func, object, args);
  4335. }
  4336. var invoke = baseRest(baseInvoke);
  4337. var invokeMap = baseRest(function(collection, path, args) {
  4338. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  4339. baseEach(collection, function(value) {
  4340. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  4341. });
  4342. return result;
  4343. });
  4344. var arrayBufferTag = "[object ArrayBuffer]";
  4345. function baseIsArrayBuffer(value) {
  4346. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4347. }
  4348. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  4349. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  4350. var boolTag = "[object Boolean]";
  4351. function isBoolean$1(value) {
  4352. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  4353. }
  4354. var dateTag = "[object Date]";
  4355. function baseIsDate(value) {
  4356. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4357. }
  4358. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  4359. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  4360. function isElement$2(value) {
  4361. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  4362. }
  4363. var mapTag$2 = "[object Map]";
  4364. var setTag$2 = "[object Set]";
  4365. var objectProto$3 = Object.prototype;
  4366. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4367. function isEmpty$1(value) {
  4368. if (value == null) {
  4369. return true;
  4370. }
  4371. if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  4372. return !value.length;
  4373. }
  4374. var tag = getTag$1(value);
  4375. if (tag == mapTag$2 || tag == setTag$2) {
  4376. return !value.size;
  4377. }
  4378. if (isPrototype(value)) {
  4379. return !baseKeys(value).length;
  4380. }
  4381. for (var key in value) {
  4382. if (hasOwnProperty$3.call(value, key)) {
  4383. return false;
  4384. }
  4385. }
  4386. return true;
  4387. }
  4388. function isEqual$1(value, other) {
  4389. return baseIsEqual(value, other);
  4390. }
  4391. function isEqualWith(value, other, customizer) {
  4392. customizer = typeof customizer == "function" ? customizer : void 0;
  4393. var result = customizer ? customizer(value, other) : void 0;
  4394. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  4395. }
  4396. var nativeIsFinite = root.isFinite;
  4397. function isFinite(value) {
  4398. return typeof value == "number" && nativeIsFinite(value);
  4399. }
  4400. function isInteger(value) {
  4401. return typeof value == "number" && value == toInteger(value);
  4402. }
  4403. function isMatch(object, source) {
  4404. return object === source || baseIsMatch(object, source, getMatchData(source));
  4405. }
  4406. function isMatchWith(object, source, customizer) {
  4407. customizer = typeof customizer == "function" ? customizer : void 0;
  4408. return baseIsMatch(object, source, getMatchData(source), customizer);
  4409. }
  4410. var numberTag = "[object Number]";
  4411. function isNumber$1(value) {
  4412. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  4413. }
  4414. function isNaN$1(value) {
  4415. return isNumber$1(value) && value != +value;
  4416. }
  4417. var isMaskable = coreJsData ? isFunction : stubFalse;
  4418. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  4419. function isNative(value) {
  4420. if (isMaskable(value)) {
  4421. throw new Error(CORE_ERROR_TEXT);
  4422. }
  4423. return baseIsNative(value);
  4424. }
  4425. function isNil(value) {
  4426. return value == null;
  4427. }
  4428. function isNull(value) {
  4429. return value === null;
  4430. }
  4431. var regexpTag = "[object RegExp]";
  4432. function baseIsRegExp(value) {
  4433. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4434. }
  4435. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  4436. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  4437. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  4438. function isSafeInteger(value) {
  4439. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  4440. }
  4441. function isUndefined$1(value) {
  4442. return value === void 0;
  4443. }
  4444. var weakMapTag = "[object WeakMap]";
  4445. function isWeakMap(value) {
  4446. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  4447. }
  4448. var weakSetTag = "[object WeakSet]";
  4449. function isWeakSet(value) {
  4450. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  4451. }
  4452. var CLONE_DEEP_FLAG$3 = 1;
  4453. function iteratee(func) {
  4454. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  4455. }
  4456. var arrayProto$4 = Array.prototype;
  4457. var nativeJoin = arrayProto$4.join;
  4458. function join(array, separator) {
  4459. return array == null ? "" : nativeJoin.call(array, separator);
  4460. }
  4461. var kebabCase = createCompounder(function(result, word, index) {
  4462. return result + (index ? "-" : "") + word.toLowerCase();
  4463. });
  4464. var keyBy = createAggregator(function(result, value, key) {
  4465. baseAssignValue(result, key, value);
  4466. });
  4467. function strictLastIndexOf(array, value, fromIndex) {
  4468. var index = fromIndex + 1;
  4469. while (index--) {
  4470. if (array[index] === value) {
  4471. return index;
  4472. }
  4473. }
  4474. return index;
  4475. }
  4476. var nativeMax$5 = Math.max;
  4477. var nativeMin$7 = Math.min;
  4478. function lastIndexOf(array, value, fromIndex) {
  4479. var length = array == null ? 0 : array.length;
  4480. if (!length) {
  4481. return -1;
  4482. }
  4483. var index = length;
  4484. if (fromIndex !== void 0) {
  4485. index = toInteger(fromIndex);
  4486. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  4487. }
  4488. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  4489. }
  4490. var lowerCase = createCompounder(function(result, word, index) {
  4491. return result + (index ? " " : "") + word.toLowerCase();
  4492. });
  4493. var lowerFirst = createCaseFirst("toLowerCase");
  4494. function baseLt(value, other) {
  4495. return value < other;
  4496. }
  4497. var lt$1 = createRelationalOperation(baseLt);
  4498. var lte = createRelationalOperation(function(value, other) {
  4499. return value <= other;
  4500. });
  4501. function mapKeys(object, iteratee) {
  4502. var result = {};
  4503. iteratee = baseIteratee(iteratee);
  4504. baseForOwn(object, function(value, key, object2) {
  4505. baseAssignValue(result, iteratee(value, key, object2), value);
  4506. });
  4507. return result;
  4508. }
  4509. function mapValues(object, iteratee) {
  4510. var result = {};
  4511. iteratee = baseIteratee(iteratee);
  4512. baseForOwn(object, function(value, key, object2) {
  4513. baseAssignValue(result, key, iteratee(value, key, object2));
  4514. });
  4515. return result;
  4516. }
  4517. var CLONE_DEEP_FLAG$2 = 1;
  4518. function matches(source) {
  4519. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  4520. }
  4521. var CLONE_DEEP_FLAG$1 = 1;
  4522. function matchesProperty(path, srcValue) {
  4523. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  4524. }
  4525. function baseExtremum(array, iteratee, comparator) {
  4526. var index = -1, length = array.length;
  4527. while (++index < length) {
  4528. var value = array[index], current = iteratee(value);
  4529. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  4530. var computed = current, result = value;
  4531. }
  4532. }
  4533. return result;
  4534. }
  4535. function max$3(array) {
  4536. return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
  4537. }
  4538. function maxBy(array, iteratee) {
  4539. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  4540. }
  4541. function baseSum(array, iteratee) {
  4542. var result, index = -1, length = array.length;
  4543. while (++index < length) {
  4544. var current = iteratee(array[index]);
  4545. if (current !== void 0) {
  4546. result = result === void 0 ? current : result + current;
  4547. }
  4548. }
  4549. return result;
  4550. }
  4551. var NAN = 0 / 0;
  4552. function baseMean(array, iteratee) {
  4553. var length = array == null ? 0 : array.length;
  4554. return length ? baseSum(array, iteratee) / length : NAN;
  4555. }
  4556. function mean(array) {
  4557. return baseMean(array, identity);
  4558. }
  4559. function meanBy(array, iteratee) {
  4560. return baseMean(array, baseIteratee(iteratee));
  4561. }
  4562. var merge = createAssigner(function(object, source, srcIndex) {
  4563. baseMerge(object, source, srcIndex);
  4564. });
  4565. var method = baseRest(function(path, args) {
  4566. return function(object) {
  4567. return baseInvoke(object, path, args);
  4568. };
  4569. });
  4570. var methodOf = baseRest(function(object, args) {
  4571. return function(path) {
  4572. return baseInvoke(object, path, args);
  4573. };
  4574. });
  4575. function min$3(array) {
  4576. return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
  4577. }
  4578. function minBy(array, iteratee) {
  4579. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  4580. }
  4581. function mixin$1(object, source, options) {
  4582. var props = keys(source), methodNames = baseFunctions(source, props);
  4583. var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
  4584. arrayEach(methodNames, function(methodName) {
  4585. var func = source[methodName];
  4586. object[methodName] = func;
  4587. if (isFunc) {
  4588. object.prototype[methodName] = function() {
  4589. var chainAll = this.__chain__;
  4590. if (chain || chainAll) {
  4591. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  4592. actions.push({ "func": func, "args": arguments, "thisArg": object });
  4593. result.__chain__ = chainAll;
  4594. return result;
  4595. }
  4596. return func.apply(object, arrayPush([this.value()], arguments));
  4597. };
  4598. }
  4599. });
  4600. return object;
  4601. }
  4602. var multiply = createMathOperation(function(multiplier, multiplicand) {
  4603. return multiplier * multiplicand;
  4604. }, 1);
  4605. var FUNC_ERROR_TEXT$3 = "Expected a function";
  4606. function negate(predicate) {
  4607. if (typeof predicate != "function") {
  4608. throw new TypeError(FUNC_ERROR_TEXT$3);
  4609. }
  4610. return function() {
  4611. var args = arguments;
  4612. switch (args.length) {
  4613. case 0:
  4614. return !predicate.call(this);
  4615. case 1:
  4616. return !predicate.call(this, args[0]);
  4617. case 2:
  4618. return !predicate.call(this, args[0], args[1]);
  4619. case 3:
  4620. return !predicate.call(this, args[0], args[1], args[2]);
  4621. }
  4622. return !predicate.apply(this, args);
  4623. };
  4624. }
  4625. function iteratorToArray(iterator) {
  4626. var data, result = [];
  4627. while (!(data = iterator.next()).done) {
  4628. result.push(data.value);
  4629. }
  4630. return result;
  4631. }
  4632. var mapTag$1 = "[object Map]";
  4633. var setTag$1 = "[object Set]";
  4634. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  4635. function toArray(value) {
  4636. if (!value) {
  4637. return [];
  4638. }
  4639. if (isArrayLike(value)) {
  4640. return isString(value) ? stringToArray(value) : copyArray(value);
  4641. }
  4642. if (symIterator$1 && value[symIterator$1]) {
  4643. return iteratorToArray(value[symIterator$1]());
  4644. }
  4645. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  4646. return func(value);
  4647. }
  4648. function wrapperNext() {
  4649. if (this.__values__ === void 0) {
  4650. this.__values__ = toArray(this.value());
  4651. }
  4652. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  4653. return { "done": done, "value": value };
  4654. }
  4655. function baseNth(array, n) {
  4656. var length = array.length;
  4657. if (!length) {
  4658. return;
  4659. }
  4660. n += n < 0 ? length : 0;
  4661. return isIndex(n, length) ? array[n] : void 0;
  4662. }
  4663. function nth(array, n) {
  4664. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  4665. }
  4666. function nthArg(n) {
  4667. n = toInteger(n);
  4668. return baseRest(function(args) {
  4669. return baseNth(args, n);
  4670. });
  4671. }
  4672. function baseUnset(object, path) {
  4673. path = castPath(path, object);
  4674. object = parent(object, path);
  4675. return object == null || delete object[toKey(last(path))];
  4676. }
  4677. function customOmitClone(value) {
  4678. return isPlainObject(value) ? void 0 : value;
  4679. }
  4680. var CLONE_DEEP_FLAG = 1;
  4681. var CLONE_FLAT_FLAG = 2;
  4682. var CLONE_SYMBOLS_FLAG = 4;
  4683. var omit = flatRest(function(object, paths) {
  4684. var result = {};
  4685. if (object == null) {
  4686. return result;
  4687. }
  4688. var isDeep = false;
  4689. paths = arrayMap(paths, function(path) {
  4690. path = castPath(path, object);
  4691. isDeep || (isDeep = path.length > 1);
  4692. return path;
  4693. });
  4694. copyObject(object, getAllKeysIn(object), result);
  4695. if (isDeep) {
  4696. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  4697. }
  4698. var length = paths.length;
  4699. while (length--) {
  4700. baseUnset(result, paths[length]);
  4701. }
  4702. return result;
  4703. });
  4704. function baseSet(object, path, value, customizer) {
  4705. if (!isObject(object)) {
  4706. return object;
  4707. }
  4708. path = castPath(path, object);
  4709. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  4710. while (nested != null && ++index < length) {
  4711. var key = toKey(path[index]), newValue = value;
  4712. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  4713. return object;
  4714. }
  4715. if (index != lastIndex) {
  4716. var objValue = nested[key];
  4717. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  4718. if (newValue === void 0) {
  4719. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  4720. }
  4721. }
  4722. assignValue(nested, key, newValue);
  4723. nested = nested[key];
  4724. }
  4725. return object;
  4726. }
  4727. function basePickBy(object, paths, predicate) {
  4728. var index = -1, length = paths.length, result = {};
  4729. while (++index < length) {
  4730. var path = paths[index], value = baseGet(object, path);
  4731. if (predicate(value, path)) {
  4732. baseSet(result, castPath(path, object), value);
  4733. }
  4734. }
  4735. return result;
  4736. }
  4737. function pickBy(object, predicate) {
  4738. if (object == null) {
  4739. return {};
  4740. }
  4741. var props = arrayMap(getAllKeysIn(object), function(prop) {
  4742. return [prop];
  4743. });
  4744. predicate = baseIteratee(predicate);
  4745. return basePickBy(object, props, function(value, path) {
  4746. return predicate(value, path[0]);
  4747. });
  4748. }
  4749. function omitBy(object, predicate) {
  4750. return pickBy(object, negate(baseIteratee(predicate)));
  4751. }
  4752. function once(func) {
  4753. return before(2, func);
  4754. }
  4755. function baseSortBy(array, comparer) {
  4756. var length = array.length;
  4757. array.sort(comparer);
  4758. while (length--) {
  4759. array[length] = array[length].value;
  4760. }
  4761. return array;
  4762. }
  4763. function compareAscending(value, other) {
  4764. if (value !== other) {
  4765. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  4766. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  4767. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  4768. return 1;
  4769. }
  4770. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  4771. return -1;
  4772. }
  4773. }
  4774. return 0;
  4775. }
  4776. function compareMultiple(object, other, orders) {
  4777. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  4778. while (++index < length) {
  4779. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4780. if (result) {
  4781. if (index >= ordersLength) {
  4782. return result;
  4783. }
  4784. var order = orders[index];
  4785. return result * (order == "desc" ? -1 : 1);
  4786. }
  4787. }
  4788. return object.index - other.index;
  4789. }
  4790. function baseOrderBy(collection, iteratees, orders) {
  4791. if (iteratees.length) {
  4792. iteratees = arrayMap(iteratees, function(iteratee) {
  4793. if (isArray(iteratee)) {
  4794. return function(value) {
  4795. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4796. };
  4797. }
  4798. return iteratee;
  4799. });
  4800. } else {
  4801. iteratees = [identity];
  4802. }
  4803. var index = -1;
  4804. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4805. var result = baseMap(collection, function(value, key, collection2) {
  4806. var criteria = arrayMap(iteratees, function(iteratee) {
  4807. return iteratee(value);
  4808. });
  4809. return { "criteria": criteria, "index": ++index, "value": value };
  4810. });
  4811. return baseSortBy(result, function(object, other) {
  4812. return compareMultiple(object, other, orders);
  4813. });
  4814. }
  4815. function orderBy$1(collection, iteratees, orders, guard) {
  4816. if (collection == null) {
  4817. return [];
  4818. }
  4819. if (!isArray(iteratees)) {
  4820. iteratees = iteratees == null ? [] : [iteratees];
  4821. }
  4822. orders = guard ? void 0 : orders;
  4823. if (!isArray(orders)) {
  4824. orders = orders == null ? [] : [orders];
  4825. }
  4826. return baseOrderBy(collection, iteratees, orders);
  4827. }
  4828. function createOver(arrayFunc) {
  4829. return flatRest(function(iteratees) {
  4830. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4831. return baseRest(function(args) {
  4832. var thisArg = this;
  4833. return arrayFunc(iteratees, function(iteratee) {
  4834. return apply(iteratee, thisArg, args);
  4835. });
  4836. });
  4837. });
  4838. }
  4839. var over = createOver(arrayMap);
  4840. var castRest = baseRest;
  4841. var nativeMin$6 = Math.min;
  4842. var overArgs = castRest(function(func, transforms) {
  4843. transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  4844. var funcsLength = transforms.length;
  4845. return baseRest(function(args) {
  4846. var index = -1, length = nativeMin$6(args.length, funcsLength);
  4847. while (++index < length) {
  4848. args[index] = transforms[index].call(this, args[index]);
  4849. }
  4850. return apply(func, this, args);
  4851. });
  4852. });
  4853. var overEvery = createOver(arrayEvery);
  4854. var overSome = createOver(arraySome);
  4855. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  4856. var nativeFloor$3 = Math.floor;
  4857. function baseRepeat(string, n) {
  4858. var result = "";
  4859. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  4860. return result;
  4861. }
  4862. do {
  4863. if (n % 2) {
  4864. result += string;
  4865. }
  4866. n = nativeFloor$3(n / 2);
  4867. if (n) {
  4868. string += string;
  4869. }
  4870. } while (n);
  4871. return result;
  4872. }
  4873. var asciiSize = baseProperty("length");
  4874. var rsAstralRange = "\\ud800-\\udfff";
  4875. var rsComboMarksRange = "\\u0300-\\u036f";
  4876. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  4877. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  4878. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  4879. var rsVarRange = "\\ufe0e\\ufe0f";
  4880. var rsAstral = "[" + rsAstralRange + "]";
  4881. var rsCombo = "[" + rsComboRange + "]";
  4882. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  4883. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  4884. var rsNonAstral = "[^" + rsAstralRange + "]";
  4885. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  4886. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  4887. var rsZWJ = "\\u200d";
  4888. var reOptMod = rsModifier + "?";
  4889. var rsOptVar = "[" + rsVarRange + "]?";
  4890. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  4891. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  4892. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  4893. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  4894. function unicodeSize(string) {
  4895. var result = reUnicode.lastIndex = 0;
  4896. while (reUnicode.test(string)) {
  4897. ++result;
  4898. }
  4899. return result;
  4900. }
  4901. function stringSize(string) {
  4902. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  4903. }
  4904. var nativeCeil$2 = Math.ceil;
  4905. function createPadding(length, chars) {
  4906. chars = chars === void 0 ? " " : baseToString(chars);
  4907. var charsLength = chars.length;
  4908. if (charsLength < 2) {
  4909. return charsLength ? baseRepeat(chars, length) : chars;
  4910. }
  4911. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  4912. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  4913. }
  4914. var nativeCeil$1 = Math.ceil;
  4915. var nativeFloor$2 = Math.floor;
  4916. function pad(string, length, chars) {
  4917. string = toString(string);
  4918. length = toInteger(length);
  4919. var strLength = length ? stringSize(string) : 0;
  4920. if (!length || strLength >= length) {
  4921. return string;
  4922. }
  4923. var mid = (length - strLength) / 2;
  4924. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  4925. }
  4926. function padEnd(string, length, chars) {
  4927. string = toString(string);
  4928. length = toInteger(length);
  4929. var strLength = length ? stringSize(string) : 0;
  4930. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  4931. }
  4932. function padStart(string, length, chars) {
  4933. string = toString(string);
  4934. length = toInteger(length);
  4935. var strLength = length ? stringSize(string) : 0;
  4936. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  4937. }
  4938. var reTrimStart$1 = /^\s+/;
  4939. var nativeParseInt = root.parseInt;
  4940. function parseInt$1(string, radix, guard) {
  4941. if (guard || radix == null) {
  4942. radix = 0;
  4943. } else if (radix) {
  4944. radix = +radix;
  4945. }
  4946. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  4947. }
  4948. var WRAP_PARTIAL_FLAG = 32;
  4949. var partial = baseRest(function(func, partials) {
  4950. var holders = replaceHolders(partials, getHolder(partial));
  4951. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  4952. });
  4953. partial.placeholder = {};
  4954. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  4955. var partialRight = baseRest(function(func, partials) {
  4956. var holders = replaceHolders(partials, getHolder(partialRight));
  4957. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  4958. });
  4959. partialRight.placeholder = {};
  4960. var partition = createAggregator(function(result, value, key) {
  4961. result[key ? 0 : 1].push(value);
  4962. }, function() {
  4963. return [[], []];
  4964. });
  4965. function basePick(object, paths) {
  4966. return basePickBy(object, paths, function(value, path) {
  4967. return hasIn(object, path);
  4968. });
  4969. }
  4970. var pick = flatRest(function(object, paths) {
  4971. return object == null ? {} : basePick(object, paths);
  4972. });
  4973. function wrapperPlant(value) {
  4974. var result, parent = this;
  4975. while (parent instanceof baseLodash) {
  4976. var clone = wrapperClone(parent);
  4977. clone.__index__ = 0;
  4978. clone.__values__ = void 0;
  4979. if (result) {
  4980. previous.__wrapped__ = clone;
  4981. } else {
  4982. result = clone;
  4983. }
  4984. var previous = clone;
  4985. parent = parent.__wrapped__;
  4986. }
  4987. previous.__wrapped__ = value;
  4988. return result;
  4989. }
  4990. function propertyOf(object) {
  4991. return function(path) {
  4992. return object == null ? void 0 : baseGet(object, path);
  4993. };
  4994. }
  4995. function baseIndexOfWith(array, value, fromIndex, comparator) {
  4996. var index = fromIndex - 1, length = array.length;
  4997. while (++index < length) {
  4998. if (comparator(array[index], value)) {
  4999. return index;
  5000. }
  5001. }
  5002. return -1;
  5003. }
  5004. var arrayProto$3 = Array.prototype;
  5005. var splice$1 = arrayProto$3.splice;
  5006. function basePullAll(array, values, iteratee, comparator) {
  5007. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  5008. if (array === values) {
  5009. values = copyArray(values);
  5010. }
  5011. if (iteratee) {
  5012. seen = arrayMap(array, baseUnary(iteratee));
  5013. }
  5014. while (++index < length) {
  5015. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  5016. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5017. if (seen !== array) {
  5018. splice$1.call(seen, fromIndex, 1);
  5019. }
  5020. splice$1.call(array, fromIndex, 1);
  5021. }
  5022. }
  5023. return array;
  5024. }
  5025. function pullAll(array, values) {
  5026. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  5027. }
  5028. var pull = baseRest(pullAll);
  5029. function pullAllBy(array, values, iteratee) {
  5030. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  5031. }
  5032. function pullAllWith(array, values, comparator) {
  5033. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  5034. }
  5035. var arrayProto$2 = Array.prototype;
  5036. var splice = arrayProto$2.splice;
  5037. function basePullAt(array, indexes) {
  5038. var length = array ? indexes.length : 0, lastIndex = length - 1;
  5039. while (length--) {
  5040. var index = indexes[length];
  5041. if (length == lastIndex || index !== previous) {
  5042. var previous = index;
  5043. if (isIndex(index)) {
  5044. splice.call(array, index, 1);
  5045. } else {
  5046. baseUnset(array, index);
  5047. }
  5048. }
  5049. }
  5050. return array;
  5051. }
  5052. var pullAt = flatRest(function(array, indexes) {
  5053. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  5054. basePullAt(array, arrayMap(indexes, function(index) {
  5055. return isIndex(index, length) ? +index : index;
  5056. }).sort(compareAscending));
  5057. return result;
  5058. });
  5059. var nativeFloor$1 = Math.floor;
  5060. var nativeRandom$1 = Math.random;
  5061. function baseRandom(lower, upper) {
  5062. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  5063. }
  5064. var freeParseFloat = parseFloat;
  5065. var nativeMin$5 = Math.min;
  5066. var nativeRandom = Math.random;
  5067. function random(lower, upper, floating) {
  5068. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  5069. upper = floating = void 0;
  5070. }
  5071. if (floating === void 0) {
  5072. if (typeof upper == "boolean") {
  5073. floating = upper;
  5074. upper = void 0;
  5075. } else if (typeof lower == "boolean") {
  5076. floating = lower;
  5077. lower = void 0;
  5078. }
  5079. }
  5080. if (lower === void 0 && upper === void 0) {
  5081. lower = 0;
  5082. upper = 1;
  5083. } else {
  5084. lower = toFinite(lower);
  5085. if (upper === void 0) {
  5086. upper = lower;
  5087. lower = 0;
  5088. } else {
  5089. upper = toFinite(upper);
  5090. }
  5091. }
  5092. if (lower > upper) {
  5093. var temp = lower;
  5094. lower = upper;
  5095. upper = temp;
  5096. }
  5097. if (floating || lower % 1 || upper % 1) {
  5098. var rand = nativeRandom();
  5099. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  5100. }
  5101. return baseRandom(lower, upper);
  5102. }
  5103. var nativeCeil = Math.ceil;
  5104. var nativeMax$4 = Math.max;
  5105. function baseRange(start, end, step, fromRight) {
  5106. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  5107. while (length--) {
  5108. result[fromRight ? length : ++index] = start;
  5109. start += step;
  5110. }
  5111. return result;
  5112. }
  5113. function createRange(fromRight) {
  5114. return function(start, end, step) {
  5115. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  5116. end = step = void 0;
  5117. }
  5118. start = toFinite(start);
  5119. if (end === void 0) {
  5120. end = start;
  5121. start = 0;
  5122. } else {
  5123. end = toFinite(end);
  5124. }
  5125. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  5126. return baseRange(start, end, step, fromRight);
  5127. };
  5128. }
  5129. var range$1 = createRange();
  5130. var rangeRight = createRange(true);
  5131. var WRAP_REARG_FLAG = 256;
  5132. var rearg = flatRest(function(func, indexes) {
  5133. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  5134. });
  5135. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  5136. eachFunc(collection, function(value, index, collection2) {
  5137. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  5138. });
  5139. return accumulator;
  5140. }
  5141. function reduce(collection, iteratee, accumulator) {
  5142. var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  5143. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  5144. }
  5145. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  5146. var length = array == null ? 0 : array.length;
  5147. if (initAccum && length) {
  5148. accumulator = array[--length];
  5149. }
  5150. while (length--) {
  5151. accumulator = iteratee(accumulator, array[length], length, array);
  5152. }
  5153. return accumulator;
  5154. }
  5155. function reduceRight(collection, iteratee, accumulator) {
  5156. var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  5157. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  5158. }
  5159. function reject(collection, predicate) {
  5160. var func = isArray(collection) ? arrayFilter : baseFilter;
  5161. return func(collection, negate(baseIteratee(predicate)));
  5162. }
  5163. function remove(array, predicate) {
  5164. var result = [];
  5165. if (!(array && array.length)) {
  5166. return result;
  5167. }
  5168. var index = -1, indexes = [], length = array.length;
  5169. predicate = baseIteratee(predicate);
  5170. while (++index < length) {
  5171. var value = array[index];
  5172. if (predicate(value, index, array)) {
  5173. result.push(value);
  5174. indexes.push(index);
  5175. }
  5176. }
  5177. basePullAt(array, indexes);
  5178. return result;
  5179. }
  5180. function repeat(string, n, guard) {
  5181. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  5182. n = 1;
  5183. } else {
  5184. n = toInteger(n);
  5185. }
  5186. return baseRepeat(toString(string), n);
  5187. }
  5188. function replace() {
  5189. var args = arguments, string = toString(args[0]);
  5190. return args.length < 3 ? string : string.replace(args[1], args[2]);
  5191. }
  5192. var FUNC_ERROR_TEXT$2 = "Expected a function";
  5193. function rest(func, start) {
  5194. if (typeof func != "function") {
  5195. throw new TypeError(FUNC_ERROR_TEXT$2);
  5196. }
  5197. start = start === void 0 ? start : toInteger(start);
  5198. return baseRest(func, start);
  5199. }
  5200. function result(object, path, defaultValue) {
  5201. path = castPath(path, object);
  5202. var index = -1, length = path.length;
  5203. if (!length) {
  5204. length = 1;
  5205. object = void 0;
  5206. }
  5207. while (++index < length) {
  5208. var value = object == null ? void 0 : object[toKey(path[index])];
  5209. if (value === void 0) {
  5210. index = length;
  5211. value = defaultValue;
  5212. }
  5213. object = isFunction(value) ? value.call(object) : value;
  5214. }
  5215. return object;
  5216. }
  5217. var arrayProto$1 = Array.prototype;
  5218. var nativeReverse = arrayProto$1.reverse;
  5219. function reverse(array) {
  5220. return array == null ? array : nativeReverse.call(array);
  5221. }
  5222. var round$1 = createRound("round");
  5223. function arraySample(array) {
  5224. var length = array.length;
  5225. return length ? array[baseRandom(0, length - 1)] : void 0;
  5226. }
  5227. function baseSample(collection) {
  5228. return arraySample(values(collection));
  5229. }
  5230. function sample(collection) {
  5231. var func = isArray(collection) ? arraySample : baseSample;
  5232. return func(collection);
  5233. }
  5234. function shuffleSelf(array, size) {
  5235. var index = -1, length = array.length, lastIndex = length - 1;
  5236. size = size === void 0 ? length : size;
  5237. while (++index < size) {
  5238. var rand = baseRandom(index, lastIndex), value = array[rand];
  5239. array[rand] = array[index];
  5240. array[index] = value;
  5241. }
  5242. array.length = size;
  5243. return array;
  5244. }
  5245. function arraySampleSize(array, n) {
  5246. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  5247. }
  5248. function baseSampleSize(collection, n) {
  5249. var array = values(collection);
  5250. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5251. }
  5252. function sampleSize(collection, n, guard) {
  5253. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  5254. n = 1;
  5255. } else {
  5256. n = toInteger(n);
  5257. }
  5258. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  5259. return func(collection, n);
  5260. }
  5261. function set(object, path, value) {
  5262. return object == null ? object : baseSet(object, path, value);
  5263. }
  5264. function setWith(object, path, value, customizer) {
  5265. customizer = typeof customizer == "function" ? customizer : void 0;
  5266. return object == null ? object : baseSet(object, path, value, customizer);
  5267. }
  5268. function arrayShuffle(array) {
  5269. return shuffleSelf(copyArray(array));
  5270. }
  5271. function baseShuffle(collection) {
  5272. return shuffleSelf(values(collection));
  5273. }
  5274. function shuffle(collection) {
  5275. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  5276. return func(collection);
  5277. }
  5278. var mapTag = "[object Map]";
  5279. var setTag = "[object Set]";
  5280. function size(collection) {
  5281. if (collection == null) {
  5282. return 0;
  5283. }
  5284. if (isArrayLike(collection)) {
  5285. return isString(collection) ? stringSize(collection) : collection.length;
  5286. }
  5287. var tag = getTag$1(collection);
  5288. if (tag == mapTag || tag == setTag) {
  5289. return collection.size;
  5290. }
  5291. return baseKeys(collection).length;
  5292. }
  5293. function slice(array, start, end) {
  5294. var length = array == null ? 0 : array.length;
  5295. if (!length) {
  5296. return [];
  5297. }
  5298. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  5299. start = 0;
  5300. end = length;
  5301. } else {
  5302. start = start == null ? 0 : toInteger(start);
  5303. end = end === void 0 ? length : toInteger(end);
  5304. }
  5305. return baseSlice(array, start, end);
  5306. }
  5307. var snakeCase = createCompounder(function(result, word, index) {
  5308. return result + (index ? "_" : "") + word.toLowerCase();
  5309. });
  5310. function baseSome(collection, predicate) {
  5311. var result;
  5312. baseEach(collection, function(value, index, collection2) {
  5313. result = predicate(value, index, collection2);
  5314. return !result;
  5315. });
  5316. return !!result;
  5317. }
  5318. function some(collection, predicate, guard) {
  5319. var func = isArray(collection) ? arraySome : baseSome;
  5320. if (guard && isIterateeCall(collection, predicate, guard)) {
  5321. predicate = void 0;
  5322. }
  5323. return func(collection, baseIteratee(predicate));
  5324. }
  5325. var sortBy = baseRest(function(collection, iteratees) {
  5326. if (collection == null) {
  5327. return [];
  5328. }
  5329. var length = iteratees.length;
  5330. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  5331. iteratees = [];
  5332. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  5333. iteratees = [iteratees[0]];
  5334. }
  5335. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  5336. });
  5337. var MAX_ARRAY_LENGTH$4 = 4294967295;
  5338. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  5339. var nativeFloor = Math.floor;
  5340. var nativeMin$4 = Math.min;
  5341. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5342. var low = 0, high = array == null ? 0 : array.length;
  5343. if (high === 0) {
  5344. return 0;
  5345. }
  5346. value = iteratee(value);
  5347. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  5348. while (low < high) {
  5349. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  5350. if (valIsNaN) {
  5351. var setLow = retHighest || othIsReflexive;
  5352. } else if (valIsUndefined) {
  5353. setLow = othIsReflexive && (retHighest || othIsDefined);
  5354. } else if (valIsNull) {
  5355. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5356. } else if (valIsSymbol) {
  5357. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5358. } else if (othIsNull || othIsSymbol) {
  5359. setLow = false;
  5360. } else {
  5361. setLow = retHighest ? computed <= value : computed < value;
  5362. }
  5363. if (setLow) {
  5364. low = mid + 1;
  5365. } else {
  5366. high = mid;
  5367. }
  5368. }
  5369. return nativeMin$4(high, MAX_ARRAY_INDEX);
  5370. }
  5371. var MAX_ARRAY_LENGTH$3 = 4294967295;
  5372. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  5373. function baseSortedIndex(array, value, retHighest) {
  5374. var low = 0, high = array == null ? low : array.length;
  5375. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5376. while (low < high) {
  5377. var mid = low + high >>> 1, computed = array[mid];
  5378. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  5379. low = mid + 1;
  5380. } else {
  5381. high = mid;
  5382. }
  5383. }
  5384. return high;
  5385. }
  5386. return baseSortedIndexBy(array, value, identity, retHighest);
  5387. }
  5388. function sortedIndex(array, value) {
  5389. return baseSortedIndex(array, value);
  5390. }
  5391. function sortedIndexBy(array, value, iteratee) {
  5392. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  5393. }
  5394. function sortedIndexOf(array, value) {
  5395. var length = array == null ? 0 : array.length;
  5396. if (length) {
  5397. var index = baseSortedIndex(array, value);
  5398. if (index < length && eq(array[index], value)) {
  5399. return index;
  5400. }
  5401. }
  5402. return -1;
  5403. }
  5404. function sortedLastIndex(array, value) {
  5405. return baseSortedIndex(array, value, true);
  5406. }
  5407. function sortedLastIndexBy(array, value, iteratee) {
  5408. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  5409. }
  5410. function sortedLastIndexOf(array, value) {
  5411. var length = array == null ? 0 : array.length;
  5412. if (length) {
  5413. var index = baseSortedIndex(array, value, true) - 1;
  5414. if (eq(array[index], value)) {
  5415. return index;
  5416. }
  5417. }
  5418. return -1;
  5419. }
  5420. function baseSortedUniq(array, iteratee) {
  5421. var index = -1, length = array.length, resIndex = 0, result = [];
  5422. while (++index < length) {
  5423. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5424. if (!index || !eq(computed, seen)) {
  5425. var seen = computed;
  5426. result[resIndex++] = value === 0 ? 0 : value;
  5427. }
  5428. }
  5429. return result;
  5430. }
  5431. function sortedUniq(array) {
  5432. return array && array.length ? baseSortedUniq(array) : [];
  5433. }
  5434. function sortedUniqBy(array, iteratee) {
  5435. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  5436. }
  5437. var MAX_ARRAY_LENGTH$2 = 4294967295;
  5438. function split(string, separator, limit) {
  5439. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  5440. separator = limit = void 0;
  5441. }
  5442. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  5443. if (!limit) {
  5444. return [];
  5445. }
  5446. string = toString(string);
  5447. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  5448. separator = baseToString(separator);
  5449. if (!separator && hasUnicode(string)) {
  5450. return castSlice(stringToArray(string), 0, limit);
  5451. }
  5452. }
  5453. return string.split(separator, limit);
  5454. }
  5455. var FUNC_ERROR_TEXT$1 = "Expected a function";
  5456. var nativeMax$3 = Math.max;
  5457. function spread(func, start) {
  5458. if (typeof func != "function") {
  5459. throw new TypeError(FUNC_ERROR_TEXT$1);
  5460. }
  5461. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  5462. return baseRest(function(args) {
  5463. var array = args[start], otherArgs = castSlice(args, 0, start);
  5464. if (array) {
  5465. arrayPush(otherArgs, array);
  5466. }
  5467. return apply(func, this, otherArgs);
  5468. });
  5469. }
  5470. var startCase = createCompounder(function(result, word, index) {
  5471. return result + (index ? " " : "") + upperFirst(word);
  5472. });
  5473. function startsWith(string, target, position) {
  5474. string = toString(string);
  5475. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  5476. target = baseToString(target);
  5477. return string.slice(position, position + target.length) == target;
  5478. }
  5479. function stubObject() {
  5480. return {};
  5481. }
  5482. function stubString() {
  5483. return "";
  5484. }
  5485. function stubTrue() {
  5486. return true;
  5487. }
  5488. var subtract = createMathOperation(function(minuend, subtrahend) {
  5489. return minuend - subtrahend;
  5490. }, 0);
  5491. function sum$1(array) {
  5492. return array && array.length ? baseSum(array, identity) : 0;
  5493. }
  5494. function sumBy(array, iteratee) {
  5495. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  5496. }
  5497. function tail(array) {
  5498. var length = array == null ? 0 : array.length;
  5499. return length ? baseSlice(array, 1, length) : [];
  5500. }
  5501. function take(array, n, guard) {
  5502. if (!(array && array.length)) {
  5503. return [];
  5504. }
  5505. n = guard || n === void 0 ? 1 : toInteger(n);
  5506. return baseSlice(array, 0, n < 0 ? 0 : n);
  5507. }
  5508. function takeRight(array, n, guard) {
  5509. var length = array == null ? 0 : array.length;
  5510. if (!length) {
  5511. return [];
  5512. }
  5513. n = guard || n === void 0 ? 1 : toInteger(n);
  5514. n = length - n;
  5515. return baseSlice(array, n < 0 ? 0 : n, length);
  5516. }
  5517. function takeRightWhile(array, predicate) {
  5518. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  5519. }
  5520. function takeWhile(array, predicate) {
  5521. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  5522. }
  5523. function tap(value, interceptor) {
  5524. interceptor(value);
  5525. return value;
  5526. }
  5527. var objectProto$2 = Object.prototype;
  5528. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  5529. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5530. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) {
  5531. return srcValue;
  5532. }
  5533. return objValue;
  5534. }
  5535. var stringEscapes = {
  5536. "\\": "\\",
  5537. "'": "'",
  5538. "\n": "n",
  5539. "\r": "r",
  5540. "\u2028": "u2028",
  5541. "\u2029": "u2029"
  5542. };
  5543. function escapeStringChar(chr) {
  5544. return "\\" + stringEscapes[chr];
  5545. }
  5546. var reInterpolate = /<%=([\s\S]+?)%>/g;
  5547. var reEscape = /<%-([\s\S]+?)%>/g;
  5548. var reEvaluate = /<%([\s\S]+?)%>/g;
  5549. var templateSettings = {
  5550. "escape": reEscape,
  5551. "evaluate": reEvaluate,
  5552. "interpolate": reInterpolate,
  5553. "variable": "",
  5554. "imports": {
  5555. "_": { "escape": escape }
  5556. }
  5557. };
  5558. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  5559. var reEmptyStringLeading = /\b__p \+= '';/g;
  5560. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  5561. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  5562. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  5563. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  5564. var reNoMatch = /($^)/;
  5565. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  5566. var objectProto$1 = Object.prototype;
  5567. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  5568. function template(string, options, guard) {
  5569. var settings = templateSettings.imports._.templateSettings || templateSettings;
  5570. if (guard && isIterateeCall(string, options, guard)) {
  5571. options = void 0;
  5572. }
  5573. string = toString(string);
  5574. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  5575. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  5576. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  5577. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  5578. var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  5579. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  5580. interpolateValue || (interpolateValue = esTemplateValue);
  5581. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  5582. if (escapeValue) {
  5583. isEscaping = true;
  5584. source += "' +\n__e(" + escapeValue + ") +\n'";
  5585. }
  5586. if (evaluateValue) {
  5587. isEvaluating = true;
  5588. source += "';\n" + evaluateValue + ";\n__p += '";
  5589. }
  5590. if (interpolateValue) {
  5591. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  5592. }
  5593. index = offset + match.length;
  5594. return match;
  5595. });
  5596. source += "';\n";
  5597. var variable = hasOwnProperty$1.call(options, "variable") && options.variable;
  5598. if (!variable) {
  5599. source = "with (obj) {\n" + source + "\n}\n";
  5600. } else if (reForbiddenIdentifierChars.test(variable)) {
  5601. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  5602. }
  5603. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  5604. source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
  5605. var result = attempt(function() {
  5606. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  5607. });
  5608. result.source = source;
  5609. if (isError(result)) {
  5610. throw result;
  5611. }
  5612. return result;
  5613. }
  5614. var FUNC_ERROR_TEXT = "Expected a function";
  5615. function throttle(func, wait, options) {
  5616. var leading = true, trailing = true;
  5617. if (typeof func != "function") {
  5618. throw new TypeError(FUNC_ERROR_TEXT);
  5619. }
  5620. if (isObject(options)) {
  5621. leading = "leading" in options ? !!options.leading : leading;
  5622. trailing = "trailing" in options ? !!options.trailing : trailing;
  5623. }
  5624. return debounce(func, wait, {
  5625. "leading": leading,
  5626. "maxWait": wait,
  5627. "trailing": trailing
  5628. });
  5629. }
  5630. function thru(value, interceptor) {
  5631. return interceptor(value);
  5632. }
  5633. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  5634. var MAX_ARRAY_LENGTH$1 = 4294967295;
  5635. var nativeMin$3 = Math.min;
  5636. function times(n, iteratee) {
  5637. n = toInteger(n);
  5638. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  5639. return [];
  5640. }
  5641. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  5642. iteratee = castFunction(iteratee);
  5643. n -= MAX_ARRAY_LENGTH$1;
  5644. var result = baseTimes(length, iteratee);
  5645. while (++index < n) {
  5646. iteratee(index);
  5647. }
  5648. return result;
  5649. }
  5650. function wrapperToIterator() {
  5651. return this;
  5652. }
  5653. function baseWrapperValue(value, actions) {
  5654. var result = value;
  5655. if (result instanceof LazyWrapper) {
  5656. result = result.value();
  5657. }
  5658. return arrayReduce(actions, function(result2, action) {
  5659. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  5660. }, result);
  5661. }
  5662. function wrapperValue() {
  5663. return baseWrapperValue(this.__wrapped__, this.__actions__);
  5664. }
  5665. function toLower(value) {
  5666. return toString(value).toLowerCase();
  5667. }
  5668. function toPath(value) {
  5669. if (isArray(value)) {
  5670. return arrayMap(value, toKey);
  5671. }
  5672. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  5673. }
  5674. var MAX_SAFE_INTEGER = 9007199254740991;
  5675. function toSafeInteger(value) {
  5676. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  5677. }
  5678. function toUpper(value) {
  5679. return toString(value).toUpperCase();
  5680. }
  5681. function transform(object, iteratee, accumulator) {
  5682. var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  5683. iteratee = baseIteratee(iteratee);
  5684. if (accumulator == null) {
  5685. var Ctor = object && object.constructor;
  5686. if (isArrLike) {
  5687. accumulator = isArr ? new Ctor() : [];
  5688. } else if (isObject(object)) {
  5689. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  5690. } else {
  5691. accumulator = {};
  5692. }
  5693. }
  5694. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  5695. return iteratee(accumulator, value, index, object2);
  5696. });
  5697. return accumulator;
  5698. }
  5699. function charsEndIndex(strSymbols, chrSymbols) {
  5700. var index = strSymbols.length;
  5701. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5702. }
  5703. return index;
  5704. }
  5705. function charsStartIndex(strSymbols, chrSymbols) {
  5706. var index = -1, length = strSymbols.length;
  5707. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5708. }
  5709. return index;
  5710. }
  5711. function trim(string, chars, guard) {
  5712. string = toString(string);
  5713. if (string && (guard || chars === void 0)) {
  5714. return baseTrim(string);
  5715. }
  5716. if (!string || !(chars = baseToString(chars))) {
  5717. return string;
  5718. }
  5719. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  5720. return castSlice(strSymbols, start, end).join("");
  5721. }
  5722. function trimEnd(string, chars, guard) {
  5723. string = toString(string);
  5724. if (string && (guard || chars === void 0)) {
  5725. return string.slice(0, trimmedEndIndex(string) + 1);
  5726. }
  5727. if (!string || !(chars = baseToString(chars))) {
  5728. return string;
  5729. }
  5730. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  5731. return castSlice(strSymbols, 0, end).join("");
  5732. }
  5733. var reTrimStart = /^\s+/;
  5734. function trimStart(string, chars, guard) {
  5735. string = toString(string);
  5736. if (string && (guard || chars === void 0)) {
  5737. return string.replace(reTrimStart, "");
  5738. }
  5739. if (!string || !(chars = baseToString(chars))) {
  5740. return string;
  5741. }
  5742. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  5743. return castSlice(strSymbols, start).join("");
  5744. }
  5745. var DEFAULT_TRUNC_LENGTH = 30;
  5746. var DEFAULT_TRUNC_OMISSION = "...";
  5747. var reFlags = /\w*$/;
  5748. function truncate(string, options) {
  5749. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  5750. if (isObject(options)) {
  5751. var separator = "separator" in options ? options.separator : separator;
  5752. length = "length" in options ? toInteger(options.length) : length;
  5753. omission = "omission" in options ? baseToString(options.omission) : omission;
  5754. }
  5755. string = toString(string);
  5756. var strLength = string.length;
  5757. if (hasUnicode(string)) {
  5758. var strSymbols = stringToArray(string);
  5759. strLength = strSymbols.length;
  5760. }
  5761. if (length >= strLength) {
  5762. return string;
  5763. }
  5764. var end = length - stringSize(omission);
  5765. if (end < 1) {
  5766. return omission;
  5767. }
  5768. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  5769. if (separator === void 0) {
  5770. return result + omission;
  5771. }
  5772. if (strSymbols) {
  5773. end += result.length - end;
  5774. }
  5775. if (isRegExp(separator)) {
  5776. if (string.slice(end).search(separator)) {
  5777. var match, substring = result;
  5778. if (!separator.global) {
  5779. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  5780. }
  5781. separator.lastIndex = 0;
  5782. while (match = separator.exec(substring)) {
  5783. var newEnd = match.index;
  5784. }
  5785. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  5786. }
  5787. } else if (string.indexOf(baseToString(separator), end) != end) {
  5788. var index = result.lastIndexOf(separator);
  5789. if (index > -1) {
  5790. result = result.slice(0, index);
  5791. }
  5792. }
  5793. return result + omission;
  5794. }
  5795. function unary(func) {
  5796. return ary(func, 1);
  5797. }
  5798. var htmlUnescapes = {
  5799. "&amp;": "&",
  5800. "&lt;": "<",
  5801. "&gt;": ">",
  5802. "&quot;": '"',
  5803. "&#39;": "'"
  5804. };
  5805. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  5806. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  5807. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  5808. function unescape(string) {
  5809. string = toString(string);
  5810. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  5811. }
  5812. var INFINITY = 1 / 0;
  5813. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
  5814. return new Set$1(values);
  5815. };
  5816. var LARGE_ARRAY_SIZE = 200;
  5817. function baseUniq(array, iteratee, comparator) {
  5818. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5819. if (comparator) {
  5820. isCommon = false;
  5821. includes = arrayIncludesWith;
  5822. } else if (length >= LARGE_ARRAY_SIZE) {
  5823. var set = iteratee ? null : createSet(array);
  5824. if (set) {
  5825. return setToArray(set);
  5826. }
  5827. isCommon = false;
  5828. includes = cacheHas;
  5829. seen = new SetCache();
  5830. } else {
  5831. seen = iteratee ? [] : result;
  5832. }
  5833. outer:
  5834. while (++index < length) {
  5835. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5836. value = comparator || value !== 0 ? value : 0;
  5837. if (isCommon && computed === computed) {
  5838. var seenIndex = seen.length;
  5839. while (seenIndex--) {
  5840. if (seen[seenIndex] === computed) {
  5841. continue outer;
  5842. }
  5843. }
  5844. if (iteratee) {
  5845. seen.push(computed);
  5846. }
  5847. result.push(value);
  5848. } else if (!includes(seen, computed, comparator)) {
  5849. if (seen !== result) {
  5850. seen.push(computed);
  5851. }
  5852. result.push(value);
  5853. }
  5854. }
  5855. return result;
  5856. }
  5857. var union = baseRest(function(arrays) {
  5858. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5859. });
  5860. var unionBy = baseRest(function(arrays) {
  5861. var iteratee = last(arrays);
  5862. if (isArrayLikeObject(iteratee)) {
  5863. iteratee = void 0;
  5864. }
  5865. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  5866. });
  5867. var unionWith = baseRest(function(arrays) {
  5868. var comparator = last(arrays);
  5869. comparator = typeof comparator == "function" ? comparator : void 0;
  5870. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  5871. });
  5872. function uniq(array) {
  5873. return array && array.length ? baseUniq(array) : [];
  5874. }
  5875. function uniqBy(array, iteratee) {
  5876. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  5877. }
  5878. function uniqWith(array, comparator) {
  5879. comparator = typeof comparator == "function" ? comparator : void 0;
  5880. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  5881. }
  5882. var idCounter = 0;
  5883. function uniqueId(prefix) {
  5884. var id = ++idCounter;
  5885. return toString(prefix) + id;
  5886. }
  5887. function unset(object, path) {
  5888. return object == null ? true : baseUnset(object, path);
  5889. }
  5890. var nativeMax$2 = Math.max;
  5891. function unzip(array) {
  5892. if (!(array && array.length)) {
  5893. return [];
  5894. }
  5895. var length = 0;
  5896. array = arrayFilter(array, function(group) {
  5897. if (isArrayLikeObject(group)) {
  5898. length = nativeMax$2(group.length, length);
  5899. return true;
  5900. }
  5901. });
  5902. return baseTimes(length, function(index) {
  5903. return arrayMap(array, baseProperty(index));
  5904. });
  5905. }
  5906. function unzipWith(array, iteratee) {
  5907. if (!(array && array.length)) {
  5908. return [];
  5909. }
  5910. var result = unzip(array);
  5911. if (iteratee == null) {
  5912. return result;
  5913. }
  5914. return arrayMap(result, function(group) {
  5915. return apply(iteratee, void 0, group);
  5916. });
  5917. }
  5918. function baseUpdate(object, path, updater, customizer) {
  5919. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5920. }
  5921. function update(object, path, updater) {
  5922. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  5923. }
  5924. function updateWith(object, path, updater, customizer) {
  5925. customizer = typeof customizer == "function" ? customizer : void 0;
  5926. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  5927. }
  5928. var upperCase = createCompounder(function(result, word, index) {
  5929. return result + (index ? " " : "") + word.toUpperCase();
  5930. });
  5931. function valuesIn(object) {
  5932. return object == null ? [] : baseValues(object, keysIn(object));
  5933. }
  5934. var without = baseRest(function(array, values) {
  5935. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  5936. });
  5937. function wrap(value, wrapper) {
  5938. return partial(castFunction(wrapper), value);
  5939. }
  5940. var wrapperAt = flatRest(function(paths) {
  5941. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  5942. return baseAt(object, paths);
  5943. };
  5944. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  5945. return this.thru(interceptor);
  5946. }
  5947. value = value.slice(start, +start + (length ? 1 : 0));
  5948. value.__actions__.push({
  5949. "func": thru,
  5950. "args": [interceptor],
  5951. "thisArg": void 0
  5952. });
  5953. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  5954. if (length && !array.length) {
  5955. array.push(void 0);
  5956. }
  5957. return array;
  5958. });
  5959. });
  5960. function wrapperChain() {
  5961. return chain(this);
  5962. }
  5963. function wrapperReverse() {
  5964. var value = this.__wrapped__;
  5965. if (value instanceof LazyWrapper) {
  5966. var wrapped = value;
  5967. if (this.__actions__.length) {
  5968. wrapped = new LazyWrapper(this);
  5969. }
  5970. wrapped = wrapped.reverse();
  5971. wrapped.__actions__.push({
  5972. "func": thru,
  5973. "args": [reverse],
  5974. "thisArg": void 0
  5975. });
  5976. return new LodashWrapper(wrapped, this.__chain__);
  5977. }
  5978. return this.thru(reverse);
  5979. }
  5980. function baseXor(arrays, iteratee, comparator) {
  5981. var length = arrays.length;
  5982. if (length < 2) {
  5983. return length ? baseUniq(arrays[0]) : [];
  5984. }
  5985. var index = -1, result = Array(length);
  5986. while (++index < length) {
  5987. var array = arrays[index], othIndex = -1;
  5988. while (++othIndex < length) {
  5989. if (othIndex != index) {
  5990. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5991. }
  5992. }
  5993. }
  5994. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5995. }
  5996. var xor = baseRest(function(arrays) {
  5997. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  5998. });
  5999. var xorBy = baseRest(function(arrays) {
  6000. var iteratee = last(arrays);
  6001. if (isArrayLikeObject(iteratee)) {
  6002. iteratee = void 0;
  6003. }
  6004. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  6005. });
  6006. var xorWith = baseRest(function(arrays) {
  6007. var comparator = last(arrays);
  6008. comparator = typeof comparator == "function" ? comparator : void 0;
  6009. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  6010. });
  6011. var zip = baseRest(unzip);
  6012. function baseZipObject(props, values, assignFunc) {
  6013. var index = -1, length = props.length, valsLength = values.length, result = {};
  6014. while (++index < length) {
  6015. var value = index < valsLength ? values[index] : void 0;
  6016. assignFunc(result, props[index], value);
  6017. }
  6018. return result;
  6019. }
  6020. function zipObject(props, values) {
  6021. return baseZipObject(props || [], values || [], assignValue);
  6022. }
  6023. function zipObjectDeep(props, values) {
  6024. return baseZipObject(props || [], values || [], baseSet);
  6025. }
  6026. var zipWith = baseRest(function(arrays) {
  6027. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  6028. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  6029. return unzipWith(arrays, iteratee);
  6030. });
  6031. var array = {
  6032. chunk,
  6033. compact,
  6034. concat,
  6035. difference,
  6036. differenceBy,
  6037. differenceWith,
  6038. drop,
  6039. dropRight,
  6040. dropRightWhile,
  6041. dropWhile,
  6042. fill,
  6043. findIndex,
  6044. findLastIndex,
  6045. first: head,
  6046. flatten,
  6047. flattenDeep,
  6048. flattenDepth,
  6049. fromPairs,
  6050. head,
  6051. indexOf,
  6052. initial: initial$1,
  6053. intersection,
  6054. intersectionBy,
  6055. intersectionWith,
  6056. join,
  6057. last,
  6058. lastIndexOf,
  6059. nth,
  6060. pull,
  6061. pullAll,
  6062. pullAllBy,
  6063. pullAllWith,
  6064. pullAt,
  6065. remove,
  6066. reverse,
  6067. slice,
  6068. sortedIndex,
  6069. sortedIndexBy,
  6070. sortedIndexOf,
  6071. sortedLastIndex,
  6072. sortedLastIndexBy,
  6073. sortedLastIndexOf,
  6074. sortedUniq,
  6075. sortedUniqBy,
  6076. tail,
  6077. take,
  6078. takeRight,
  6079. takeRightWhile,
  6080. takeWhile,
  6081. union,
  6082. unionBy,
  6083. unionWith,
  6084. uniq,
  6085. uniqBy,
  6086. uniqWith,
  6087. unzip,
  6088. unzipWith,
  6089. without,
  6090. xor,
  6091. xorBy,
  6092. xorWith,
  6093. zip,
  6094. zipObject,
  6095. zipObjectDeep,
  6096. zipWith
  6097. };
  6098. var collection = {
  6099. countBy,
  6100. each: forEach,
  6101. eachRight: forEachRight,
  6102. every,
  6103. filter,
  6104. find,
  6105. findLast,
  6106. flatMap,
  6107. flatMapDeep,
  6108. flatMapDepth,
  6109. forEach,
  6110. forEachRight,
  6111. groupBy,
  6112. includes,
  6113. invokeMap,
  6114. keyBy,
  6115. map,
  6116. orderBy: orderBy$1,
  6117. partition,
  6118. reduce,
  6119. reduceRight,
  6120. reject,
  6121. sample,
  6122. sampleSize,
  6123. shuffle,
  6124. size,
  6125. some,
  6126. sortBy
  6127. };
  6128. var date = {
  6129. now
  6130. };
  6131. var func = {
  6132. after,
  6133. ary,
  6134. before,
  6135. bind,
  6136. bindKey,
  6137. curry,
  6138. curryRight,
  6139. debounce,
  6140. defer,
  6141. delay,
  6142. flip: flip$1,
  6143. memoize,
  6144. negate,
  6145. once,
  6146. overArgs,
  6147. partial,
  6148. partialRight,
  6149. rearg,
  6150. rest,
  6151. spread,
  6152. throttle,
  6153. unary,
  6154. wrap
  6155. };
  6156. var lang = {
  6157. castArray: castArray$1,
  6158. clone,
  6159. cloneDeep,
  6160. cloneDeepWith,
  6161. cloneWith,
  6162. conformsTo,
  6163. eq,
  6164. gt: gt$1,
  6165. gte,
  6166. isArguments,
  6167. isArray,
  6168. isArrayBuffer,
  6169. isArrayLike,
  6170. isArrayLikeObject,
  6171. isBoolean: isBoolean$1,
  6172. isBuffer,
  6173. isDate,
  6174. isElement: isElement$2,
  6175. isEmpty: isEmpty$1,
  6176. isEqual: isEqual$1,
  6177. isEqualWith,
  6178. isError,
  6179. isFinite,
  6180. isFunction,
  6181. isInteger,
  6182. isLength,
  6183. isMap,
  6184. isMatch,
  6185. isMatchWith,
  6186. isNaN: isNaN$1,
  6187. isNative,
  6188. isNil,
  6189. isNull,
  6190. isNumber: isNumber$1,
  6191. isObject,
  6192. isObjectLike,
  6193. isPlainObject,
  6194. isRegExp,
  6195. isSafeInteger,
  6196. isSet,
  6197. isString,
  6198. isSymbol,
  6199. isTypedArray,
  6200. isUndefined: isUndefined$1,
  6201. isWeakMap,
  6202. isWeakSet,
  6203. lt: lt$1,
  6204. lte,
  6205. toArray,
  6206. toFinite,
  6207. toInteger,
  6208. toLength,
  6209. toNumber,
  6210. toPlainObject,
  6211. toSafeInteger,
  6212. toString
  6213. };
  6214. var math = {
  6215. add,
  6216. ceil,
  6217. divide,
  6218. floor: floor$1,
  6219. max: max$3,
  6220. maxBy,
  6221. mean,
  6222. meanBy,
  6223. min: min$3,
  6224. minBy,
  6225. multiply,
  6226. round: round$1,
  6227. subtract,
  6228. sum: sum$1,
  6229. sumBy
  6230. };
  6231. var number = {
  6232. clamp,
  6233. inRange,
  6234. random
  6235. };
  6236. var object = {
  6237. assign,
  6238. assignIn,
  6239. assignInWith,
  6240. assignWith,
  6241. at: at$1,
  6242. create,
  6243. defaults,
  6244. defaultsDeep,
  6245. entries: toPairs,
  6246. entriesIn: toPairsIn,
  6247. extend: assignIn,
  6248. extendWith: assignInWith,
  6249. findKey,
  6250. findLastKey,
  6251. forIn,
  6252. forInRight,
  6253. forOwn,
  6254. forOwnRight,
  6255. functions,
  6256. functionsIn,
  6257. get,
  6258. has,
  6259. hasIn,
  6260. invert,
  6261. invertBy,
  6262. invoke,
  6263. keys,
  6264. keysIn,
  6265. mapKeys,
  6266. mapValues,
  6267. merge,
  6268. mergeWith,
  6269. omit,
  6270. omitBy,
  6271. pick,
  6272. pickBy,
  6273. result,
  6274. set,
  6275. setWith,
  6276. toPairs,
  6277. toPairsIn,
  6278. transform,
  6279. unset,
  6280. update,
  6281. updateWith,
  6282. values,
  6283. valuesIn
  6284. };
  6285. var seq = {
  6286. at: wrapperAt,
  6287. chain,
  6288. commit: wrapperCommit,
  6289. lodash,
  6290. next: wrapperNext,
  6291. plant: wrapperPlant,
  6292. reverse: wrapperReverse,
  6293. tap,
  6294. thru,
  6295. toIterator: wrapperToIterator,
  6296. toJSON: wrapperValue,
  6297. value: wrapperValue,
  6298. valueOf: wrapperValue,
  6299. wrapperChain
  6300. };
  6301. var string$1 = {
  6302. camelCase,
  6303. capitalize: capitalize$1,
  6304. deburr,
  6305. endsWith,
  6306. escape,
  6307. escapeRegExp,
  6308. kebabCase,
  6309. lowerCase,
  6310. lowerFirst,
  6311. pad,
  6312. padEnd,
  6313. padStart,
  6314. parseInt: parseInt$1,
  6315. repeat,
  6316. replace,
  6317. snakeCase,
  6318. split,
  6319. startCase,
  6320. startsWith,
  6321. template,
  6322. templateSettings,
  6323. toLower,
  6324. toUpper,
  6325. trim,
  6326. trimEnd,
  6327. trimStart,
  6328. truncate,
  6329. unescape,
  6330. upperCase,
  6331. upperFirst,
  6332. words
  6333. };
  6334. var util = {
  6335. attempt,
  6336. bindAll,
  6337. cond,
  6338. conforms,
  6339. constant,
  6340. defaultTo,
  6341. flow,
  6342. flowRight,
  6343. identity,
  6344. iteratee,
  6345. matches,
  6346. matchesProperty,
  6347. method,
  6348. methodOf,
  6349. mixin: mixin$1,
  6350. noop,
  6351. nthArg,
  6352. over,
  6353. overEvery,
  6354. overSome,
  6355. property,
  6356. propertyOf,
  6357. range: range$1,
  6358. rangeRight,
  6359. stubArray,
  6360. stubFalse,
  6361. stubObject,
  6362. stubString,
  6363. stubTrue,
  6364. times,
  6365. toPath,
  6366. uniqueId
  6367. };
  6368. function lazyClone() {
  6369. var result = new LazyWrapper(this.__wrapped__);
  6370. result.__actions__ = copyArray(this.__actions__);
  6371. result.__dir__ = this.__dir__;
  6372. result.__filtered__ = this.__filtered__;
  6373. result.__iteratees__ = copyArray(this.__iteratees__);
  6374. result.__takeCount__ = this.__takeCount__;
  6375. result.__views__ = copyArray(this.__views__);
  6376. return result;
  6377. }
  6378. function lazyReverse() {
  6379. if (this.__filtered__) {
  6380. var result = new LazyWrapper(this);
  6381. result.__dir__ = -1;
  6382. result.__filtered__ = true;
  6383. } else {
  6384. result = this.clone();
  6385. result.__dir__ *= -1;
  6386. }
  6387. return result;
  6388. }
  6389. var nativeMax$1 = Math.max;
  6390. var nativeMin$2 = Math.min;
  6391. function getView(start, end, transforms) {
  6392. var index = -1, length = transforms.length;
  6393. while (++index < length) {
  6394. var data = transforms[index], size = data.size;
  6395. switch (data.type) {
  6396. case "drop":
  6397. start += size;
  6398. break;
  6399. case "dropRight":
  6400. end -= size;
  6401. break;
  6402. case "take":
  6403. end = nativeMin$2(end, start + size);
  6404. break;
  6405. case "takeRight":
  6406. start = nativeMax$1(start, end - size);
  6407. break;
  6408. }
  6409. }
  6410. return { "start": start, "end": end };
  6411. }
  6412. var LAZY_FILTER_FLAG$1 = 1;
  6413. var LAZY_MAP_FLAG = 2;
  6414. var nativeMin$1 = Math.min;
  6415. function lazyValue() {
  6416. var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin$1(length, this.__takeCount__);
  6417. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  6418. return baseWrapperValue(array, this.__actions__);
  6419. }
  6420. var result = [];
  6421. outer:
  6422. while (length-- && resIndex < takeCount) {
  6423. index += dir;
  6424. var iterIndex = -1, value = array[index];
  6425. while (++iterIndex < iterLength) {
  6426. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  6427. if (type == LAZY_MAP_FLAG) {
  6428. value = computed;
  6429. } else if (!computed) {
  6430. if (type == LAZY_FILTER_FLAG$1) {
  6431. continue outer;
  6432. } else {
  6433. break outer;
  6434. }
  6435. }
  6436. }
  6437. result[resIndex++] = value;
  6438. }
  6439. return result;
  6440. }
  6441. var VERSION = "4.17.21";
  6442. var WRAP_BIND_KEY_FLAG = 2;
  6443. var LAZY_FILTER_FLAG = 1;
  6444. var LAZY_WHILE_FLAG = 3;
  6445. var MAX_ARRAY_LENGTH = 4294967295;
  6446. var arrayProto = Array.prototype;
  6447. var objectProto = Object.prototype;
  6448. var hasOwnProperty = objectProto.hasOwnProperty;
  6449. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  6450. var nativeMax = Math.max;
  6451. var nativeMin = Math.min;
  6452. var mixin = function(func2) {
  6453. return function(object2, source, options) {
  6454. if (options == null) {
  6455. var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  6456. if (!(methodNames ? methodNames.length : isObj)) {
  6457. options = source;
  6458. source = object2;
  6459. object2 = this;
  6460. }
  6461. }
  6462. return func2(object2, source, options);
  6463. };
  6464. }(mixin$1);
  6465. lodash.after = func.after;
  6466. lodash.ary = func.ary;
  6467. lodash.assign = object.assign;
  6468. lodash.assignIn = object.assignIn;
  6469. lodash.assignInWith = object.assignInWith;
  6470. lodash.assignWith = object.assignWith;
  6471. lodash.at = object.at;
  6472. lodash.before = func.before;
  6473. lodash.bind = func.bind;
  6474. lodash.bindAll = util.bindAll;
  6475. lodash.bindKey = func.bindKey;
  6476. lodash.castArray = lang.castArray;
  6477. lodash.chain = seq.chain;
  6478. lodash.chunk = array.chunk;
  6479. lodash.compact = array.compact;
  6480. lodash.concat = array.concat;
  6481. lodash.cond = util.cond;
  6482. lodash.conforms = util.conforms;
  6483. lodash.constant = util.constant;
  6484. lodash.countBy = collection.countBy;
  6485. lodash.create = object.create;
  6486. lodash.curry = func.curry;
  6487. lodash.curryRight = func.curryRight;
  6488. lodash.debounce = func.debounce;
  6489. lodash.defaults = object.defaults;
  6490. lodash.defaultsDeep = object.defaultsDeep;
  6491. lodash.defer = func.defer;
  6492. lodash.delay = func.delay;
  6493. lodash.difference = array.difference;
  6494. lodash.differenceBy = array.differenceBy;
  6495. lodash.differenceWith = array.differenceWith;
  6496. lodash.drop = array.drop;
  6497. lodash.dropRight = array.dropRight;
  6498. lodash.dropRightWhile = array.dropRightWhile;
  6499. lodash.dropWhile = array.dropWhile;
  6500. lodash.fill = array.fill;
  6501. lodash.filter = collection.filter;
  6502. lodash.flatMap = collection.flatMap;
  6503. lodash.flatMapDeep = collection.flatMapDeep;
  6504. lodash.flatMapDepth = collection.flatMapDepth;
  6505. lodash.flatten = array.flatten;
  6506. lodash.flattenDeep = array.flattenDeep;
  6507. lodash.flattenDepth = array.flattenDepth;
  6508. lodash.flip = func.flip;
  6509. lodash.flow = util.flow;
  6510. lodash.flowRight = util.flowRight;
  6511. lodash.fromPairs = array.fromPairs;
  6512. lodash.functions = object.functions;
  6513. lodash.functionsIn = object.functionsIn;
  6514. lodash.groupBy = collection.groupBy;
  6515. lodash.initial = array.initial;
  6516. lodash.intersection = array.intersection;
  6517. lodash.intersectionBy = array.intersectionBy;
  6518. lodash.intersectionWith = array.intersectionWith;
  6519. lodash.invert = object.invert;
  6520. lodash.invertBy = object.invertBy;
  6521. lodash.invokeMap = collection.invokeMap;
  6522. lodash.iteratee = util.iteratee;
  6523. lodash.keyBy = collection.keyBy;
  6524. lodash.keys = keys;
  6525. lodash.keysIn = object.keysIn;
  6526. lodash.map = collection.map;
  6527. lodash.mapKeys = object.mapKeys;
  6528. lodash.mapValues = object.mapValues;
  6529. lodash.matches = util.matches;
  6530. lodash.matchesProperty = util.matchesProperty;
  6531. lodash.memoize = func.memoize;
  6532. lodash.merge = object.merge;
  6533. lodash.mergeWith = object.mergeWith;
  6534. lodash.method = util.method;
  6535. lodash.methodOf = util.methodOf;
  6536. lodash.mixin = mixin;
  6537. lodash.negate = negate;
  6538. lodash.nthArg = util.nthArg;
  6539. lodash.omit = object.omit;
  6540. lodash.omitBy = object.omitBy;
  6541. lodash.once = func.once;
  6542. lodash.orderBy = collection.orderBy;
  6543. lodash.over = util.over;
  6544. lodash.overArgs = func.overArgs;
  6545. lodash.overEvery = util.overEvery;
  6546. lodash.overSome = util.overSome;
  6547. lodash.partial = func.partial;
  6548. lodash.partialRight = func.partialRight;
  6549. lodash.partition = collection.partition;
  6550. lodash.pick = object.pick;
  6551. lodash.pickBy = object.pickBy;
  6552. lodash.property = util.property;
  6553. lodash.propertyOf = util.propertyOf;
  6554. lodash.pull = array.pull;
  6555. lodash.pullAll = array.pullAll;
  6556. lodash.pullAllBy = array.pullAllBy;
  6557. lodash.pullAllWith = array.pullAllWith;
  6558. lodash.pullAt = array.pullAt;
  6559. lodash.range = util.range;
  6560. lodash.rangeRight = util.rangeRight;
  6561. lodash.rearg = func.rearg;
  6562. lodash.reject = collection.reject;
  6563. lodash.remove = array.remove;
  6564. lodash.rest = func.rest;
  6565. lodash.reverse = array.reverse;
  6566. lodash.sampleSize = collection.sampleSize;
  6567. lodash.set = object.set;
  6568. lodash.setWith = object.setWith;
  6569. lodash.shuffle = collection.shuffle;
  6570. lodash.slice = array.slice;
  6571. lodash.sortBy = collection.sortBy;
  6572. lodash.sortedUniq = array.sortedUniq;
  6573. lodash.sortedUniqBy = array.sortedUniqBy;
  6574. lodash.split = string$1.split;
  6575. lodash.spread = func.spread;
  6576. lodash.tail = array.tail;
  6577. lodash.take = array.take;
  6578. lodash.takeRight = array.takeRight;
  6579. lodash.takeRightWhile = array.takeRightWhile;
  6580. lodash.takeWhile = array.takeWhile;
  6581. lodash.tap = seq.tap;
  6582. lodash.throttle = func.throttle;
  6583. lodash.thru = thru;
  6584. lodash.toArray = lang.toArray;
  6585. lodash.toPairs = object.toPairs;
  6586. lodash.toPairsIn = object.toPairsIn;
  6587. lodash.toPath = util.toPath;
  6588. lodash.toPlainObject = lang.toPlainObject;
  6589. lodash.transform = object.transform;
  6590. lodash.unary = func.unary;
  6591. lodash.union = array.union;
  6592. lodash.unionBy = array.unionBy;
  6593. lodash.unionWith = array.unionWith;
  6594. lodash.uniq = array.uniq;
  6595. lodash.uniqBy = array.uniqBy;
  6596. lodash.uniqWith = array.uniqWith;
  6597. lodash.unset = object.unset;
  6598. lodash.unzip = array.unzip;
  6599. lodash.unzipWith = array.unzipWith;
  6600. lodash.update = object.update;
  6601. lodash.updateWith = object.updateWith;
  6602. lodash.values = object.values;
  6603. lodash.valuesIn = object.valuesIn;
  6604. lodash.without = array.without;
  6605. lodash.words = string$1.words;
  6606. lodash.wrap = func.wrap;
  6607. lodash.xor = array.xor;
  6608. lodash.xorBy = array.xorBy;
  6609. lodash.xorWith = array.xorWith;
  6610. lodash.zip = array.zip;
  6611. lodash.zipObject = array.zipObject;
  6612. lodash.zipObjectDeep = array.zipObjectDeep;
  6613. lodash.zipWith = array.zipWith;
  6614. lodash.entries = object.toPairs;
  6615. lodash.entriesIn = object.toPairsIn;
  6616. lodash.extend = object.assignIn;
  6617. lodash.extendWith = object.assignInWith;
  6618. mixin(lodash, lodash);
  6619. lodash.add = math.add;
  6620. lodash.attempt = util.attempt;
  6621. lodash.camelCase = string$1.camelCase;
  6622. lodash.capitalize = string$1.capitalize;
  6623. lodash.ceil = math.ceil;
  6624. lodash.clamp = number.clamp;
  6625. lodash.clone = lang.clone;
  6626. lodash.cloneDeep = lang.cloneDeep;
  6627. lodash.cloneDeepWith = lang.cloneDeepWith;
  6628. lodash.cloneWith = lang.cloneWith;
  6629. lodash.conformsTo = lang.conformsTo;
  6630. lodash.deburr = string$1.deburr;
  6631. lodash.defaultTo = util.defaultTo;
  6632. lodash.divide = math.divide;
  6633. lodash.endsWith = string$1.endsWith;
  6634. lodash.eq = lang.eq;
  6635. lodash.escape = string$1.escape;
  6636. lodash.escapeRegExp = string$1.escapeRegExp;
  6637. lodash.every = collection.every;
  6638. lodash.find = collection.find;
  6639. lodash.findIndex = array.findIndex;
  6640. lodash.findKey = object.findKey;
  6641. lodash.findLast = collection.findLast;
  6642. lodash.findLastIndex = array.findLastIndex;
  6643. lodash.findLastKey = object.findLastKey;
  6644. lodash.floor = math.floor;
  6645. lodash.forEach = collection.forEach;
  6646. lodash.forEachRight = collection.forEachRight;
  6647. lodash.forIn = object.forIn;
  6648. lodash.forInRight = object.forInRight;
  6649. lodash.forOwn = object.forOwn;
  6650. lodash.forOwnRight = object.forOwnRight;
  6651. lodash.get = object.get;
  6652. lodash.gt = lang.gt;
  6653. lodash.gte = lang.gte;
  6654. lodash.has = object.has;
  6655. lodash.hasIn = object.hasIn;
  6656. lodash.head = array.head;
  6657. lodash.identity = identity;
  6658. lodash.includes = collection.includes;
  6659. lodash.indexOf = array.indexOf;
  6660. lodash.inRange = number.inRange;
  6661. lodash.invoke = object.invoke;
  6662. lodash.isArguments = lang.isArguments;
  6663. lodash.isArray = isArray;
  6664. lodash.isArrayBuffer = lang.isArrayBuffer;
  6665. lodash.isArrayLike = lang.isArrayLike;
  6666. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  6667. lodash.isBoolean = lang.isBoolean;
  6668. lodash.isBuffer = lang.isBuffer;
  6669. lodash.isDate = lang.isDate;
  6670. lodash.isElement = lang.isElement;
  6671. lodash.isEmpty = lang.isEmpty;
  6672. lodash.isEqual = lang.isEqual;
  6673. lodash.isEqualWith = lang.isEqualWith;
  6674. lodash.isError = lang.isError;
  6675. lodash.isFinite = lang.isFinite;
  6676. lodash.isFunction = lang.isFunction;
  6677. lodash.isInteger = lang.isInteger;
  6678. lodash.isLength = lang.isLength;
  6679. lodash.isMap = lang.isMap;
  6680. lodash.isMatch = lang.isMatch;
  6681. lodash.isMatchWith = lang.isMatchWith;
  6682. lodash.isNaN = lang.isNaN;
  6683. lodash.isNative = lang.isNative;
  6684. lodash.isNil = lang.isNil;
  6685. lodash.isNull = lang.isNull;
  6686. lodash.isNumber = lang.isNumber;
  6687. lodash.isObject = isObject;
  6688. lodash.isObjectLike = lang.isObjectLike;
  6689. lodash.isPlainObject = lang.isPlainObject;
  6690. lodash.isRegExp = lang.isRegExp;
  6691. lodash.isSafeInteger = lang.isSafeInteger;
  6692. lodash.isSet = lang.isSet;
  6693. lodash.isString = lang.isString;
  6694. lodash.isSymbol = lang.isSymbol;
  6695. lodash.isTypedArray = lang.isTypedArray;
  6696. lodash.isUndefined = lang.isUndefined;
  6697. lodash.isWeakMap = lang.isWeakMap;
  6698. lodash.isWeakSet = lang.isWeakSet;
  6699. lodash.join = array.join;
  6700. lodash.kebabCase = string$1.kebabCase;
  6701. lodash.last = last;
  6702. lodash.lastIndexOf = array.lastIndexOf;
  6703. lodash.lowerCase = string$1.lowerCase;
  6704. lodash.lowerFirst = string$1.lowerFirst;
  6705. lodash.lt = lang.lt;
  6706. lodash.lte = lang.lte;
  6707. lodash.max = math.max;
  6708. lodash.maxBy = math.maxBy;
  6709. lodash.mean = math.mean;
  6710. lodash.meanBy = math.meanBy;
  6711. lodash.min = math.min;
  6712. lodash.minBy = math.minBy;
  6713. lodash.stubArray = util.stubArray;
  6714. lodash.stubFalse = util.stubFalse;
  6715. lodash.stubObject = util.stubObject;
  6716. lodash.stubString = util.stubString;
  6717. lodash.stubTrue = util.stubTrue;
  6718. lodash.multiply = math.multiply;
  6719. lodash.nth = array.nth;
  6720. lodash.noop = util.noop;
  6721. lodash.now = date.now;
  6722. lodash.pad = string$1.pad;
  6723. lodash.padEnd = string$1.padEnd;
  6724. lodash.padStart = string$1.padStart;
  6725. lodash.parseInt = string$1.parseInt;
  6726. lodash.random = number.random;
  6727. lodash.reduce = collection.reduce;
  6728. lodash.reduceRight = collection.reduceRight;
  6729. lodash.repeat = string$1.repeat;
  6730. lodash.replace = string$1.replace;
  6731. lodash.result = object.result;
  6732. lodash.round = math.round;
  6733. lodash.sample = collection.sample;
  6734. lodash.size = collection.size;
  6735. lodash.snakeCase = string$1.snakeCase;
  6736. lodash.some = collection.some;
  6737. lodash.sortedIndex = array.sortedIndex;
  6738. lodash.sortedIndexBy = array.sortedIndexBy;
  6739. lodash.sortedIndexOf = array.sortedIndexOf;
  6740. lodash.sortedLastIndex = array.sortedLastIndex;
  6741. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  6742. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  6743. lodash.startCase = string$1.startCase;
  6744. lodash.startsWith = string$1.startsWith;
  6745. lodash.subtract = math.subtract;
  6746. lodash.sum = math.sum;
  6747. lodash.sumBy = math.sumBy;
  6748. lodash.template = string$1.template;
  6749. lodash.times = util.times;
  6750. lodash.toFinite = lang.toFinite;
  6751. lodash.toInteger = toInteger;
  6752. lodash.toLength = lang.toLength;
  6753. lodash.toLower = string$1.toLower;
  6754. lodash.toNumber = lang.toNumber;
  6755. lodash.toSafeInteger = lang.toSafeInteger;
  6756. lodash.toString = lang.toString;
  6757. lodash.toUpper = string$1.toUpper;
  6758. lodash.trim = string$1.trim;
  6759. lodash.trimEnd = string$1.trimEnd;
  6760. lodash.trimStart = string$1.trimStart;
  6761. lodash.truncate = string$1.truncate;
  6762. lodash.unescape = string$1.unescape;
  6763. lodash.uniqueId = util.uniqueId;
  6764. lodash.upperCase = string$1.upperCase;
  6765. lodash.upperFirst = string$1.upperFirst;
  6766. lodash.each = collection.forEach;
  6767. lodash.eachRight = collection.forEachRight;
  6768. lodash.first = array.head;
  6769. mixin(lodash, function() {
  6770. var source = {};
  6771. baseForOwn(lodash, function(func2, methodName) {
  6772. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  6773. source[methodName] = func2;
  6774. }
  6775. });
  6776. return source;
  6777. }(), { "chain": false });
  6778. lodash.VERSION = VERSION;
  6779. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  6780. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  6781. lodash[methodName].placeholder = lodash;
  6782. });
  6783. arrayEach(["drop", "take"], function(methodName, index) {
  6784. LazyWrapper.prototype[methodName] = function(n) {
  6785. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  6786. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  6787. if (result.__filtered__) {
  6788. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  6789. } else {
  6790. result.__views__.push({
  6791. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  6792. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  6793. });
  6794. }
  6795. return result;
  6796. };
  6797. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  6798. return this.reverse()[methodName](n).reverse();
  6799. };
  6800. });
  6801. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  6802. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  6803. LazyWrapper.prototype[methodName] = function(iteratee) {
  6804. var result = this.clone();
  6805. result.__iteratees__.push({
  6806. "iteratee": baseIteratee(iteratee),
  6807. "type": type
  6808. });
  6809. result.__filtered__ = result.__filtered__ || isFilter;
  6810. return result;
  6811. };
  6812. });
  6813. arrayEach(["head", "last"], function(methodName, index) {
  6814. var takeName = "take" + (index ? "Right" : "");
  6815. LazyWrapper.prototype[methodName] = function() {
  6816. return this[takeName](1).value()[0];
  6817. };
  6818. });
  6819. arrayEach(["initial", "tail"], function(methodName, index) {
  6820. var dropName = "drop" + (index ? "" : "Right");
  6821. LazyWrapper.prototype[methodName] = function() {
  6822. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  6823. };
  6824. });
  6825. LazyWrapper.prototype.compact = function() {
  6826. return this.filter(identity);
  6827. };
  6828. LazyWrapper.prototype.find = function(predicate) {
  6829. return this.filter(predicate).head();
  6830. };
  6831. LazyWrapper.prototype.findLast = function(predicate) {
  6832. return this.reverse().find(predicate);
  6833. };
  6834. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  6835. if (typeof path == "function") {
  6836. return new LazyWrapper(this);
  6837. }
  6838. return this.map(function(value) {
  6839. return baseInvoke(value, path, args);
  6840. });
  6841. });
  6842. LazyWrapper.prototype.reject = function(predicate) {
  6843. return this.filter(negate(baseIteratee(predicate)));
  6844. };
  6845. LazyWrapper.prototype.slice = function(start, end) {
  6846. start = toInteger(start);
  6847. var result = this;
  6848. if (result.__filtered__ && (start > 0 || end < 0)) {
  6849. return new LazyWrapper(result);
  6850. }
  6851. if (start < 0) {
  6852. result = result.takeRight(-start);
  6853. } else if (start) {
  6854. result = result.drop(start);
  6855. }
  6856. if (end !== void 0) {
  6857. end = toInteger(end);
  6858. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  6859. }
  6860. return result;
  6861. };
  6862. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  6863. return this.reverse().takeWhile(predicate).reverse();
  6864. };
  6865. LazyWrapper.prototype.toArray = function() {
  6866. return this.take(MAX_ARRAY_LENGTH);
  6867. };
  6868. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6869. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
  6870. if (!lodashFunc) {
  6871. return;
  6872. }
  6873. lodash.prototype[methodName] = function() {
  6874. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value);
  6875. var interceptor = function(value2) {
  6876. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  6877. return isTaker && chainAll ? result2[0] : result2;
  6878. };
  6879. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  6880. isLazy = useLazy = false;
  6881. }
  6882. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  6883. if (!retUnwrapped && useLazy) {
  6884. value = onlyLazy ? value : new LazyWrapper(this);
  6885. var result = func2.apply(value, args);
  6886. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  6887. return new LodashWrapper(result, chainAll);
  6888. }
  6889. if (isUnwrapped && onlyLazy) {
  6890. return func2.apply(this, args);
  6891. }
  6892. result = this.thru(interceptor);
  6893. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  6894. };
  6895. });
  6896. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  6897. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  6898. lodash.prototype[methodName] = function() {
  6899. var args = arguments;
  6900. if (retUnwrapped && !this.__chain__) {
  6901. var value = this.value();
  6902. return func2.apply(isArray(value) ? value : [], args);
  6903. }
  6904. return this[chainName](function(value2) {
  6905. return func2.apply(isArray(value2) ? value2 : [], args);
  6906. });
  6907. };
  6908. });
  6909. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6910. var lodashFunc = lodash[methodName];
  6911. if (lodashFunc) {
  6912. var key = lodashFunc.name + "";
  6913. if (!hasOwnProperty.call(realNames, key)) {
  6914. realNames[key] = [];
  6915. }
  6916. realNames[key].push({ "name": methodName, "func": lodashFunc });
  6917. }
  6918. });
  6919. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  6920. "name": "wrapper",
  6921. "func": void 0
  6922. }];
  6923. LazyWrapper.prototype.clone = lazyClone;
  6924. LazyWrapper.prototype.reverse = lazyReverse;
  6925. LazyWrapper.prototype.value = lazyValue;
  6926. lodash.prototype.at = seq.at;
  6927. lodash.prototype.chain = seq.wrapperChain;
  6928. lodash.prototype.commit = seq.commit;
  6929. lodash.prototype.next = seq.next;
  6930. lodash.prototype.plant = seq.plant;
  6931. lodash.prototype.reverse = seq.reverse;
  6932. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  6933. lodash.prototype.first = lodash.prototype.head;
  6934. if (symIterator) {
  6935. lodash.prototype[symIterator] = seq.toIterator;
  6936. }
  6937. /**
  6938. * @license
  6939. * Lodash (Custom Build) <https://lodash.com/>
  6940. * Build: `lodash modularize exports="es" -o ./`
  6941. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  6942. * Released under MIT license <https://lodash.com/license>
  6943. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6944. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6945. */
  6946. const isUndefined = (val) => val === void 0;
  6947. const isBoolean = (val) => typeof val === "boolean";
  6948. const isNumber = (val) => typeof val === "number";
  6949. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  6950. const isElement$1 = (e) => {
  6951. if (typeof Element === "undefined")
  6952. return false;
  6953. return e instanceof Element;
  6954. };
  6955. const isPropAbsent = (prop) => isNil(prop);
  6956. const isStringNumber = (val) => {
  6957. if (!isString$1(val)) {
  6958. return false;
  6959. }
  6960. return !Number.isNaN(Number(val));
  6961. };
  6962. const isWindow$1 = (val) => val === window;
  6963. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  6964. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  6965. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  6966. const capitalize = (str) => capitalize$2(str);
  6967. const keysOf = (arr) => Object.keys(arr);
  6968. const entriesOf = (arr) => Object.entries(arr);
  6969. const getProp = (obj, path, defaultValue) => {
  6970. return {
  6971. get value() {
  6972. return get(obj, path, defaultValue);
  6973. },
  6974. set value(val) {
  6975. set(obj, path, val);
  6976. }
  6977. };
  6978. };
  6979. class ElementPlusError extends Error {
  6980. constructor(m) {
  6981. super(m);
  6982. this.name = "ElementPlusError";
  6983. }
  6984. }
  6985. function throwError(scope, m) {
  6986. throw new ElementPlusError(`[${scope}] ${m}`);
  6987. }
  6988. function debugWarn(scope, message) {
  6989. }
  6990. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  6991. const hasClass = (el, cls) => {
  6992. if (!el || !cls)
  6993. return false;
  6994. if (cls.includes(" "))
  6995. throw new Error("className should not contain space.");
  6996. return el.classList.contains(cls);
  6997. };
  6998. const addClass = (el, cls) => {
  6999. if (!el || !cls.trim())
  7000. return;
  7001. el.classList.add(...classNameToArray(cls));
  7002. };
  7003. const removeClass = (el, cls) => {
  7004. if (!el || !cls.trim())
  7005. return;
  7006. el.classList.remove(...classNameToArray(cls));
  7007. };
  7008. const getStyle = (element, styleName) => {
  7009. var _a;
  7010. if (!isClient || !element || !styleName)
  7011. return "";
  7012. let key = camelize(styleName);
  7013. if (key === "float")
  7014. key = "cssFloat";
  7015. try {
  7016. const style = element.style[key];
  7017. if (style)
  7018. return style;
  7019. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  7020. return computed ? computed[key] : "";
  7021. } catch (e) {
  7022. return element.style[key];
  7023. }
  7024. };
  7025. const setStyle = (element, styleName, value) => {
  7026. if (!element || !styleName)
  7027. return;
  7028. if (isObject$1(styleName)) {
  7029. entriesOf(styleName).forEach(([prop, value2]) => setStyle(element, prop, value2));
  7030. } else {
  7031. const key = camelize(styleName);
  7032. element.style[key] = value;
  7033. }
  7034. };
  7035. function addUnit(value, defaultUnit = "px") {
  7036. if (!value)
  7037. return "";
  7038. if (isNumber(value) || isStringNumber(value)) {
  7039. return `${value}${defaultUnit}`;
  7040. } else if (isString$1(value)) {
  7041. return value;
  7042. }
  7043. }
  7044. const isScroll = (el, isVertical) => {
  7045. if (!isClient)
  7046. return false;
  7047. const key = {
  7048. undefined: "overflow",
  7049. true: "overflow-y",
  7050. false: "overflow-x"
  7051. }[String(isVertical)];
  7052. const overflow = getStyle(el, key);
  7053. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  7054. };
  7055. const getScrollContainer = (el, isVertical) => {
  7056. if (!isClient)
  7057. return;
  7058. let parent = el;
  7059. while (parent) {
  7060. if ([window, document, document.documentElement].includes(parent))
  7061. return window;
  7062. if (isScroll(parent, isVertical))
  7063. return parent;
  7064. parent = parent.parentNode;
  7065. }
  7066. return parent;
  7067. };
  7068. let scrollBarWidth;
  7069. const getScrollBarWidth = (namespace) => {
  7070. var _a;
  7071. if (!isClient)
  7072. return 0;
  7073. if (scrollBarWidth !== void 0)
  7074. return scrollBarWidth;
  7075. const outer = document.createElement("div");
  7076. outer.className = `${namespace}-scrollbar__wrap`;
  7077. outer.style.visibility = "hidden";
  7078. outer.style.width = "100px";
  7079. outer.style.position = "absolute";
  7080. outer.style.top = "-9999px";
  7081. document.body.appendChild(outer);
  7082. const widthNoScroll = outer.offsetWidth;
  7083. outer.style.overflow = "scroll";
  7084. const inner = document.createElement("div");
  7085. inner.style.width = "100%";
  7086. outer.appendChild(inner);
  7087. const widthWithScroll = inner.offsetWidth;
  7088. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7089. scrollBarWidth = widthNoScroll - widthWithScroll;
  7090. return scrollBarWidth;
  7091. };
  7092. function scrollIntoView(container, selected) {
  7093. if (!isClient)
  7094. return;
  7095. if (!selected) {
  7096. container.scrollTop = 0;
  7097. return;
  7098. }
  7099. const offsetParents = [];
  7100. let pointer = selected.offsetParent;
  7101. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7102. offsetParents.push(pointer);
  7103. pointer = pointer.offsetParent;
  7104. }
  7105. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7106. const bottom = top + selected.offsetHeight;
  7107. const viewRectTop = container.scrollTop;
  7108. const viewRectBottom = viewRectTop + container.clientHeight;
  7109. if (top < viewRectTop) {
  7110. container.scrollTop = top;
  7111. } else if (bottom > viewRectBottom) {
  7112. container.scrollTop = bottom - container.clientHeight;
  7113. }
  7114. }
  7115. function animateScrollTo(container, from, to, duration, callback) {
  7116. const startTime = Date.now();
  7117. let handle;
  7118. const scroll = () => {
  7119. const timestamp = Date.now();
  7120. const time = timestamp - startTime;
  7121. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  7122. if (isWindow$1(container)) {
  7123. container.scrollTo(window.pageXOffset, nextScrollTop);
  7124. } else {
  7125. container.scrollTop = nextScrollTop;
  7126. }
  7127. if (time < duration) {
  7128. handle = rAF(scroll);
  7129. } else if (isFunction$1(callback)) {
  7130. callback();
  7131. }
  7132. };
  7133. scroll();
  7134. return () => {
  7135. handle && cAF(handle);
  7136. };
  7137. }
  7138. const getScrollElement = (target, container) => {
  7139. if (isWindow$1(container)) {
  7140. return target.ownerDocument.documentElement;
  7141. }
  7142. return container;
  7143. };
  7144. const getScrollTop = (container) => {
  7145. if (isWindow$1(container)) {
  7146. return window.scrollY;
  7147. }
  7148. return container.scrollTop;
  7149. };
  7150. const getElement = (target) => {
  7151. if (!isClient || target === "")
  7152. return null;
  7153. if (isString$1(target)) {
  7154. try {
  7155. return document.querySelector(target);
  7156. } catch (e) {
  7157. return null;
  7158. }
  7159. }
  7160. return target;
  7161. };
  7162. let target = !isClient ? void 0 : document.body;
  7163. function createGlobalNode(id) {
  7164. const el = document.createElement("div");
  7165. if (id !== void 0) {
  7166. el.setAttribute("id", id);
  7167. }
  7168. if (target) {
  7169. target.appendChild(el);
  7170. }
  7171. return el;
  7172. }
  7173. function removeGlobalNode(el) {
  7174. el.remove();
  7175. }
  7176. var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7177. name: "ArrowDown",
  7178. __name: "arrow-down",
  7179. setup(__props) {
  7180. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7181. xmlns: "http://www.w3.org/2000/svg",
  7182. viewBox: "0 0 1024 1024"
  7183. }, [
  7184. vue.createElementVNode("path", {
  7185. fill: "currentColor",
  7186. 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"
  7187. })
  7188. ]));
  7189. }
  7190. });
  7191. var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
  7192. var arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7193. name: "ArrowLeft",
  7194. __name: "arrow-left",
  7195. setup(__props) {
  7196. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7197. xmlns: "http://www.w3.org/2000/svg",
  7198. viewBox: "0 0 1024 1024"
  7199. }, [
  7200. vue.createElementVNode("path", {
  7201. fill: "currentColor",
  7202. 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"
  7203. })
  7204. ]));
  7205. }
  7206. });
  7207. var arrow_left_default = arrow_left_vue_vue_type_script_setup_true_lang_default;
  7208. var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7209. name: "ArrowRight",
  7210. __name: "arrow-right",
  7211. setup(__props) {
  7212. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7213. xmlns: "http://www.w3.org/2000/svg",
  7214. viewBox: "0 0 1024 1024"
  7215. }, [
  7216. vue.createElementVNode("path", {
  7217. fill: "currentColor",
  7218. 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"
  7219. })
  7220. ]));
  7221. }
  7222. });
  7223. var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
  7224. var arrow_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7225. name: "ArrowUp",
  7226. __name: "arrow-up",
  7227. setup(__props) {
  7228. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7229. xmlns: "http://www.w3.org/2000/svg",
  7230. viewBox: "0 0 1024 1024"
  7231. }, [
  7232. vue.createElementVNode("path", {
  7233. fill: "currentColor",
  7234. 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"
  7235. })
  7236. ]));
  7237. }
  7238. });
  7239. var arrow_up_default = arrow_up_vue_vue_type_script_setup_true_lang_default;
  7240. var back_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7241. name: "Back",
  7242. __name: "back",
  7243. setup(__props) {
  7244. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7245. xmlns: "http://www.w3.org/2000/svg",
  7246. viewBox: "0 0 1024 1024"
  7247. }, [
  7248. vue.createElementVNode("path", {
  7249. fill: "currentColor",
  7250. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  7251. }),
  7252. vue.createElementVNode("path", {
  7253. fill: "currentColor",
  7254. 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"
  7255. })
  7256. ]));
  7257. }
  7258. });
  7259. var back_default = back_vue_vue_type_script_setup_true_lang_default;
  7260. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7261. name: "Calendar",
  7262. __name: "calendar",
  7263. setup(__props) {
  7264. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7265. xmlns: "http://www.w3.org/2000/svg",
  7266. viewBox: "0 0 1024 1024"
  7267. }, [
  7268. vue.createElementVNode("path", {
  7269. fill: "currentColor",
  7270. 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"
  7271. })
  7272. ]));
  7273. }
  7274. });
  7275. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  7276. var caret_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7277. name: "CaretRight",
  7278. __name: "caret-right",
  7279. setup(__props) {
  7280. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7281. xmlns: "http://www.w3.org/2000/svg",
  7282. viewBox: "0 0 1024 1024"
  7283. }, [
  7284. vue.createElementVNode("path", {
  7285. fill: "currentColor",
  7286. d: "M384 192v640l384-320.064z"
  7287. })
  7288. ]));
  7289. }
  7290. });
  7291. var caret_right_default = caret_right_vue_vue_type_script_setup_true_lang_default;
  7292. var caret_top_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7293. name: "CaretTop",
  7294. __name: "caret-top",
  7295. setup(__props) {
  7296. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7297. xmlns: "http://www.w3.org/2000/svg",
  7298. viewBox: "0 0 1024 1024"
  7299. }, [
  7300. vue.createElementVNode("path", {
  7301. fill: "currentColor",
  7302. d: "M512 320 192 704h639.936z"
  7303. })
  7304. ]));
  7305. }
  7306. });
  7307. var caret_top_default = caret_top_vue_vue_type_script_setup_true_lang_default;
  7308. var check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7309. name: "Check",
  7310. __name: "check",
  7311. setup(__props) {
  7312. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7313. xmlns: "http://www.w3.org/2000/svg",
  7314. viewBox: "0 0 1024 1024"
  7315. }, [
  7316. vue.createElementVNode("path", {
  7317. fill: "currentColor",
  7318. 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"
  7319. })
  7320. ]));
  7321. }
  7322. });
  7323. var check_default = check_vue_vue_type_script_setup_true_lang_default;
  7324. var circle_check_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7325. name: "CircleCheckFilled",
  7326. __name: "circle-check-filled",
  7327. setup(__props) {
  7328. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7329. xmlns: "http://www.w3.org/2000/svg",
  7330. viewBox: "0 0 1024 1024"
  7331. }, [
  7332. vue.createElementVNode("path", {
  7333. fill: "currentColor",
  7334. 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"
  7335. })
  7336. ]));
  7337. }
  7338. });
  7339. var circle_check_filled_default = circle_check_filled_vue_vue_type_script_setup_true_lang_default;
  7340. var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7341. name: "CircleCheck",
  7342. __name: "circle-check",
  7343. setup(__props) {
  7344. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7345. xmlns: "http://www.w3.org/2000/svg",
  7346. viewBox: "0 0 1024 1024"
  7347. }, [
  7348. vue.createElementVNode("path", {
  7349. fill: "currentColor",
  7350. 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"
  7351. }),
  7352. vue.createElementVNode("path", {
  7353. fill: "currentColor",
  7354. 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"
  7355. })
  7356. ]));
  7357. }
  7358. });
  7359. var circle_check_default = circle_check_vue_vue_type_script_setup_true_lang_default;
  7360. var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7361. name: "CircleCloseFilled",
  7362. __name: "circle-close-filled",
  7363. setup(__props) {
  7364. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7365. xmlns: "http://www.w3.org/2000/svg",
  7366. viewBox: "0 0 1024 1024"
  7367. }, [
  7368. vue.createElementVNode("path", {
  7369. fill: "currentColor",
  7370. 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"
  7371. })
  7372. ]));
  7373. }
  7374. });
  7375. var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
  7376. var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7377. name: "CircleClose",
  7378. __name: "circle-close",
  7379. setup(__props) {
  7380. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7381. xmlns: "http://www.w3.org/2000/svg",
  7382. viewBox: "0 0 1024 1024"
  7383. }, [
  7384. vue.createElementVNode("path", {
  7385. fill: "currentColor",
  7386. 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"
  7387. }),
  7388. vue.createElementVNode("path", {
  7389. fill: "currentColor",
  7390. 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"
  7391. })
  7392. ]));
  7393. }
  7394. });
  7395. var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
  7396. var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7397. name: "Clock",
  7398. __name: "clock",
  7399. setup(__props) {
  7400. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7401. xmlns: "http://www.w3.org/2000/svg",
  7402. viewBox: "0 0 1024 1024"
  7403. }, [
  7404. vue.createElementVNode("path", {
  7405. fill: "currentColor",
  7406. 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"
  7407. }),
  7408. vue.createElementVNode("path", {
  7409. fill: "currentColor",
  7410. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  7411. }),
  7412. vue.createElementVNode("path", {
  7413. fill: "currentColor",
  7414. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  7415. })
  7416. ]));
  7417. }
  7418. });
  7419. var clock_default = clock_vue_vue_type_script_setup_true_lang_default;
  7420. var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7421. name: "Close",
  7422. __name: "close",
  7423. setup(__props) {
  7424. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7425. xmlns: "http://www.w3.org/2000/svg",
  7426. viewBox: "0 0 1024 1024"
  7427. }, [
  7428. vue.createElementVNode("path", {
  7429. fill: "currentColor",
  7430. 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"
  7431. })
  7432. ]));
  7433. }
  7434. });
  7435. var close_default = close_vue_vue_type_script_setup_true_lang_default;
  7436. var d_arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7437. name: "DArrowLeft",
  7438. __name: "d-arrow-left",
  7439. setup(__props) {
  7440. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7441. xmlns: "http://www.w3.org/2000/svg",
  7442. viewBox: "0 0 1024 1024"
  7443. }, [
  7444. vue.createElementVNode("path", {
  7445. fill: "currentColor",
  7446. 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"
  7447. })
  7448. ]));
  7449. }
  7450. });
  7451. var d_arrow_left_default = d_arrow_left_vue_vue_type_script_setup_true_lang_default;
  7452. var d_arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7453. name: "DArrowRight",
  7454. __name: "d-arrow-right",
  7455. setup(__props) {
  7456. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7457. xmlns: "http://www.w3.org/2000/svg",
  7458. viewBox: "0 0 1024 1024"
  7459. }, [
  7460. vue.createElementVNode("path", {
  7461. fill: "currentColor",
  7462. 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"
  7463. })
  7464. ]));
  7465. }
  7466. });
  7467. var d_arrow_right_default = d_arrow_right_vue_vue_type_script_setup_true_lang_default;
  7468. var delete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7469. name: "Delete",
  7470. __name: "delete",
  7471. setup(__props) {
  7472. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7473. xmlns: "http://www.w3.org/2000/svg",
  7474. viewBox: "0 0 1024 1024"
  7475. }, [
  7476. vue.createElementVNode("path", {
  7477. fill: "currentColor",
  7478. 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"
  7479. })
  7480. ]));
  7481. }
  7482. });
  7483. var delete_default = delete_vue_vue_type_script_setup_true_lang_default;
  7484. var document_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7485. name: "Document",
  7486. __name: "document",
  7487. setup(__props) {
  7488. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7489. xmlns: "http://www.w3.org/2000/svg",
  7490. viewBox: "0 0 1024 1024"
  7491. }, [
  7492. vue.createElementVNode("path", {
  7493. fill: "currentColor",
  7494. 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"
  7495. })
  7496. ]));
  7497. }
  7498. });
  7499. var document_default = document_vue_vue_type_script_setup_true_lang_default;
  7500. var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7501. name: "FullScreen",
  7502. __name: "full-screen",
  7503. setup(__props) {
  7504. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7505. xmlns: "http://www.w3.org/2000/svg",
  7506. viewBox: "0 0 1024 1024"
  7507. }, [
  7508. vue.createElementVNode("path", {
  7509. fill: "currentColor",
  7510. 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"
  7511. })
  7512. ]));
  7513. }
  7514. });
  7515. var full_screen_default = full_screen_vue_vue_type_script_setup_true_lang_default;
  7516. var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7517. name: "Hide",
  7518. __name: "hide",
  7519. setup(__props) {
  7520. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7521. xmlns: "http://www.w3.org/2000/svg",
  7522. viewBox: "0 0 1024 1024"
  7523. }, [
  7524. vue.createElementVNode("path", {
  7525. fill: "currentColor",
  7526. 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"
  7527. }),
  7528. vue.createElementVNode("path", {
  7529. fill: "currentColor",
  7530. 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"
  7531. })
  7532. ]));
  7533. }
  7534. });
  7535. var hide_default = hide_vue_vue_type_script_setup_true_lang_default;
  7536. var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7537. name: "InfoFilled",
  7538. __name: "info-filled",
  7539. setup(__props) {
  7540. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7541. xmlns: "http://www.w3.org/2000/svg",
  7542. viewBox: "0 0 1024 1024"
  7543. }, [
  7544. vue.createElementVNode("path", {
  7545. fill: "currentColor",
  7546. 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"
  7547. })
  7548. ]));
  7549. }
  7550. });
  7551. var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
  7552. var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7553. name: "Loading",
  7554. __name: "loading",
  7555. setup(__props) {
  7556. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7557. xmlns: "http://www.w3.org/2000/svg",
  7558. viewBox: "0 0 1024 1024"
  7559. }, [
  7560. vue.createElementVNode("path", {
  7561. fill: "currentColor",
  7562. 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"
  7563. })
  7564. ]));
  7565. }
  7566. });
  7567. var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
  7568. var minus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7569. name: "Minus",
  7570. __name: "minus",
  7571. setup(__props) {
  7572. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7573. xmlns: "http://www.w3.org/2000/svg",
  7574. viewBox: "0 0 1024 1024"
  7575. }, [
  7576. vue.createElementVNode("path", {
  7577. fill: "currentColor",
  7578. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  7579. })
  7580. ]));
  7581. }
  7582. });
  7583. var minus_default = minus_vue_vue_type_script_setup_true_lang_default;
  7584. var more_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7585. name: "MoreFilled",
  7586. __name: "more-filled",
  7587. setup(__props) {
  7588. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7589. xmlns: "http://www.w3.org/2000/svg",
  7590. viewBox: "0 0 1024 1024"
  7591. }, [
  7592. vue.createElementVNode("path", {
  7593. fill: "currentColor",
  7594. 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"
  7595. })
  7596. ]));
  7597. }
  7598. });
  7599. var more_filled_default = more_filled_vue_vue_type_script_setup_true_lang_default;
  7600. var more_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7601. name: "More",
  7602. __name: "more",
  7603. setup(__props) {
  7604. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7605. xmlns: "http://www.w3.org/2000/svg",
  7606. viewBox: "0 0 1024 1024"
  7607. }, [
  7608. vue.createElementVNode("path", {
  7609. fill: "currentColor",
  7610. 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"
  7611. })
  7612. ]));
  7613. }
  7614. });
  7615. var more_default = more_vue_vue_type_script_setup_true_lang_default;
  7616. var picture_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7617. name: "PictureFilled",
  7618. __name: "picture-filled",
  7619. setup(__props) {
  7620. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7621. xmlns: "http://www.w3.org/2000/svg",
  7622. viewBox: "0 0 1024 1024"
  7623. }, [
  7624. vue.createElementVNode("path", {
  7625. fill: "currentColor",
  7626. 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"
  7627. })
  7628. ]));
  7629. }
  7630. });
  7631. var picture_filled_default = picture_filled_vue_vue_type_script_setup_true_lang_default;
  7632. var plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7633. name: "Plus",
  7634. __name: "plus",
  7635. setup(__props) {
  7636. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7637. xmlns: "http://www.w3.org/2000/svg",
  7638. viewBox: "0 0 1024 1024"
  7639. }, [
  7640. vue.createElementVNode("path", {
  7641. fill: "currentColor",
  7642. 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"
  7643. })
  7644. ]));
  7645. }
  7646. });
  7647. var plus_default = plus_vue_vue_type_script_setup_true_lang_default;
  7648. var question_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7649. name: "QuestionFilled",
  7650. __name: "question-filled",
  7651. setup(__props) {
  7652. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7653. xmlns: "http://www.w3.org/2000/svg",
  7654. viewBox: "0 0 1024 1024"
  7655. }, [
  7656. vue.createElementVNode("path", {
  7657. fill: "currentColor",
  7658. 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"
  7659. })
  7660. ]));
  7661. }
  7662. });
  7663. var question_filled_default = question_filled_vue_vue_type_script_setup_true_lang_default;
  7664. var refresh_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7665. name: "RefreshLeft",
  7666. __name: "refresh-left",
  7667. setup(__props) {
  7668. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7669. xmlns: "http://www.w3.org/2000/svg",
  7670. viewBox: "0 0 1024 1024"
  7671. }, [
  7672. vue.createElementVNode("path", {
  7673. fill: "currentColor",
  7674. 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"
  7675. })
  7676. ]));
  7677. }
  7678. });
  7679. var refresh_left_default = refresh_left_vue_vue_type_script_setup_true_lang_default;
  7680. var refresh_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7681. name: "RefreshRight",
  7682. __name: "refresh-right",
  7683. setup(__props) {
  7684. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7685. xmlns: "http://www.w3.org/2000/svg",
  7686. viewBox: "0 0 1024 1024"
  7687. }, [
  7688. vue.createElementVNode("path", {
  7689. fill: "currentColor",
  7690. 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"
  7691. })
  7692. ]));
  7693. }
  7694. });
  7695. var refresh_right_default = refresh_right_vue_vue_type_script_setup_true_lang_default;
  7696. var scale_to_original_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7697. name: "ScaleToOriginal",
  7698. __name: "scale-to-original",
  7699. setup(__props) {
  7700. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7701. xmlns: "http://www.w3.org/2000/svg",
  7702. viewBox: "0 0 1024 1024"
  7703. }, [
  7704. vue.createElementVNode("path", {
  7705. fill: "currentColor",
  7706. 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"
  7707. })
  7708. ]));
  7709. }
  7710. });
  7711. var scale_to_original_default = scale_to_original_vue_vue_type_script_setup_true_lang_default;
  7712. var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7713. name: "Search",
  7714. __name: "search",
  7715. setup(__props) {
  7716. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7717. xmlns: "http://www.w3.org/2000/svg",
  7718. viewBox: "0 0 1024 1024"
  7719. }, [
  7720. vue.createElementVNode("path", {
  7721. fill: "currentColor",
  7722. 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"
  7723. })
  7724. ]));
  7725. }
  7726. });
  7727. var search_default = search_vue_vue_type_script_setup_true_lang_default;
  7728. var sort_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7729. name: "SortDown",
  7730. __name: "sort-down",
  7731. setup(__props) {
  7732. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7733. xmlns: "http://www.w3.org/2000/svg",
  7734. viewBox: "0 0 1024 1024"
  7735. }, [
  7736. vue.createElementVNode("path", {
  7737. fill: "currentColor",
  7738. 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"
  7739. })
  7740. ]));
  7741. }
  7742. });
  7743. var sort_down_default = sort_down_vue_vue_type_script_setup_true_lang_default;
  7744. var sort_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7745. name: "SortUp",
  7746. __name: "sort-up",
  7747. setup(__props) {
  7748. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7749. xmlns: "http://www.w3.org/2000/svg",
  7750. viewBox: "0 0 1024 1024"
  7751. }, [
  7752. vue.createElementVNode("path", {
  7753. fill: "currentColor",
  7754. 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"
  7755. })
  7756. ]));
  7757. }
  7758. });
  7759. var sort_up_default = sort_up_vue_vue_type_script_setup_true_lang_default;
  7760. var star_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7761. name: "StarFilled",
  7762. __name: "star-filled",
  7763. setup(__props) {
  7764. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7765. xmlns: "http://www.w3.org/2000/svg",
  7766. viewBox: "0 0 1024 1024"
  7767. }, [
  7768. vue.createElementVNode("path", {
  7769. fill: "currentColor",
  7770. 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"
  7771. })
  7772. ]));
  7773. }
  7774. });
  7775. var star_filled_default = star_filled_vue_vue_type_script_setup_true_lang_default;
  7776. var star_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7777. name: "Star",
  7778. __name: "star",
  7779. setup(__props) {
  7780. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7781. xmlns: "http://www.w3.org/2000/svg",
  7782. viewBox: "0 0 1024 1024"
  7783. }, [
  7784. vue.createElementVNode("path", {
  7785. fill: "currentColor",
  7786. 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"
  7787. })
  7788. ]));
  7789. }
  7790. });
  7791. var star_default = star_vue_vue_type_script_setup_true_lang_default;
  7792. var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7793. name: "SuccessFilled",
  7794. __name: "success-filled",
  7795. setup(__props) {
  7796. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7797. xmlns: "http://www.w3.org/2000/svg",
  7798. viewBox: "0 0 1024 1024"
  7799. }, [
  7800. vue.createElementVNode("path", {
  7801. fill: "currentColor",
  7802. 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"
  7803. })
  7804. ]));
  7805. }
  7806. });
  7807. var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
  7808. var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7809. name: "View",
  7810. __name: "view",
  7811. setup(__props) {
  7812. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7813. xmlns: "http://www.w3.org/2000/svg",
  7814. viewBox: "0 0 1024 1024"
  7815. }, [
  7816. vue.createElementVNode("path", {
  7817. fill: "currentColor",
  7818. 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"
  7819. })
  7820. ]));
  7821. }
  7822. });
  7823. var view_default = view_vue_vue_type_script_setup_true_lang_default;
  7824. var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7825. name: "WarningFilled",
  7826. __name: "warning-filled",
  7827. setup(__props) {
  7828. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7829. xmlns: "http://www.w3.org/2000/svg",
  7830. viewBox: "0 0 1024 1024"
  7831. }, [
  7832. vue.createElementVNode("path", {
  7833. fill: "currentColor",
  7834. 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"
  7835. })
  7836. ]));
  7837. }
  7838. });
  7839. var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
  7840. var zoom_in_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7841. name: "ZoomIn",
  7842. __name: "zoom-in",
  7843. setup(__props) {
  7844. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7845. xmlns: "http://www.w3.org/2000/svg",
  7846. viewBox: "0 0 1024 1024"
  7847. }, [
  7848. vue.createElementVNode("path", {
  7849. fill: "currentColor",
  7850. 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"
  7851. })
  7852. ]));
  7853. }
  7854. });
  7855. var zoom_in_default = zoom_in_vue_vue_type_script_setup_true_lang_default;
  7856. var zoom_out_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7857. name: "ZoomOut",
  7858. __name: "zoom-out",
  7859. setup(__props) {
  7860. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7861. xmlns: "http://www.w3.org/2000/svg",
  7862. viewBox: "0 0 1024 1024"
  7863. }, [
  7864. vue.createElementVNode("path", {
  7865. fill: "currentColor",
  7866. 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"
  7867. })
  7868. ]));
  7869. }
  7870. });
  7871. var zoom_out_default = zoom_out_vue_vue_type_script_setup_true_lang_default;
  7872. /*! Element Plus Icons Vue v2.3.1 */
  7873. const epPropKey = "__epPropKey";
  7874. const definePropType = (val) => val;
  7875. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7876. const buildProp = (prop, key) => {
  7877. if (!isObject$1(prop) || isEpProp(prop))
  7878. return prop;
  7879. const { values, required, default: defaultValue, type, validator } = prop;
  7880. const _validator = values || validator ? (val) => {
  7881. let valid = false;
  7882. let allowedValues = [];
  7883. if (values) {
  7884. allowedValues = Array.from(values);
  7885. if (hasOwn(prop, "default")) {
  7886. allowedValues.push(defaultValue);
  7887. }
  7888. valid || (valid = allowedValues.includes(val));
  7889. }
  7890. if (validator)
  7891. valid || (valid = validator(val));
  7892. if (!valid && allowedValues.length > 0) {
  7893. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7894. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7895. }
  7896. return valid;
  7897. } : void 0;
  7898. const epProp = {
  7899. type,
  7900. required: !!required,
  7901. validator: _validator,
  7902. [epPropKey]: true
  7903. };
  7904. if (hasOwn(prop, "default"))
  7905. epProp.default = defaultValue;
  7906. return epProp;
  7907. };
  7908. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7909. key,
  7910. buildProp(option, key)
  7911. ]));
  7912. const iconPropType = definePropType([
  7913. String,
  7914. Object,
  7915. Function
  7916. ]);
  7917. const CloseComponents = {
  7918. Close: close_default
  7919. };
  7920. const TypeComponents = {
  7921. Close: close_default,
  7922. SuccessFilled: success_filled_default,
  7923. InfoFilled: info_filled_default,
  7924. WarningFilled: warning_filled_default,
  7925. CircleCloseFilled: circle_close_filled_default
  7926. };
  7927. const TypeComponentsMap = {
  7928. success: success_filled_default,
  7929. warning: warning_filled_default,
  7930. error: circle_close_filled_default,
  7931. info: info_filled_default
  7932. };
  7933. const ValidateComponentsMap = {
  7934. validating: loading_default,
  7935. success: circle_check_default,
  7936. error: circle_close_default
  7937. };
  7938. const withInstall = (main, extra) => {
  7939. main.install = (app) => {
  7940. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7941. app.component(comp.name, comp);
  7942. }
  7943. };
  7944. if (extra) {
  7945. for (const [key, comp] of Object.entries(extra)) {
  7946. main[key] = comp;
  7947. }
  7948. }
  7949. return main;
  7950. };
  7951. const withInstallFunction = (fn, name) => {
  7952. fn.install = (app) => {
  7953. fn._context = app._context;
  7954. app.config.globalProperties[name] = fn;
  7955. };
  7956. return fn;
  7957. };
  7958. const withInstallDirective = (directive, name) => {
  7959. directive.install = (app) => {
  7960. app.directive(name, directive);
  7961. };
  7962. return directive;
  7963. };
  7964. const withNoopInstall = (component) => {
  7965. component.install = NOOP;
  7966. return component;
  7967. };
  7968. const composeRefs = (...refs) => {
  7969. return (el) => {
  7970. refs.forEach((ref) => {
  7971. if (isFunction$1(ref)) {
  7972. ref(el);
  7973. } else {
  7974. ref.value = el;
  7975. }
  7976. });
  7977. };
  7978. };
  7979. const EVENT_CODE = {
  7980. tab: "Tab",
  7981. enter: "Enter",
  7982. space: "Space",
  7983. left: "ArrowLeft",
  7984. up: "ArrowUp",
  7985. right: "ArrowRight",
  7986. down: "ArrowDown",
  7987. esc: "Escape",
  7988. delete: "Delete",
  7989. backspace: "Backspace",
  7990. numpadEnter: "NumpadEnter",
  7991. pageUp: "PageUp",
  7992. pageDown: "PageDown",
  7993. home: "Home",
  7994. end: "End"
  7995. };
  7996. const datePickTypes = [
  7997. "year",
  7998. "years",
  7999. "month",
  8000. "months",
  8001. "date",
  8002. "dates",
  8003. "week",
  8004. "datetime",
  8005. "datetimerange",
  8006. "daterange",
  8007. "monthrange",
  8008. "yearrange"
  8009. ];
  8010. const WEEK_DAYS = [
  8011. "sun",
  8012. "mon",
  8013. "tue",
  8014. "wed",
  8015. "thu",
  8016. "fri",
  8017. "sat"
  8018. ];
  8019. const UPDATE_MODEL_EVENT = "update:modelValue";
  8020. const CHANGE_EVENT = "change";
  8021. const INPUT_EVENT = "input";
  8022. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  8023. const componentSizes = ["", "default", "small", "large"];
  8024. const componentSizeMap = {
  8025. large: 40,
  8026. default: 32,
  8027. small: 24
  8028. };
  8029. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8030. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8031. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8032. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8033. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8034. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8035. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8036. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8037. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8038. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8039. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8040. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8041. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8042. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8043. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8044. return PatchFlags2;
  8045. })(PatchFlags || {});
  8046. function isFragment(node) {
  8047. return vue.isVNode(node) && node.type === vue.Fragment;
  8048. }
  8049. function isComment(node) {
  8050. return vue.isVNode(node) && node.type === vue.Comment;
  8051. }
  8052. function isValidElementNode(node) {
  8053. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8054. }
  8055. const getNormalizedProps = (node) => {
  8056. if (!vue.isVNode(node)) {
  8057. return {};
  8058. }
  8059. const raw = node.props || {};
  8060. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8061. const props = {};
  8062. Object.keys(type).forEach((key) => {
  8063. if (hasOwn(type[key], "default")) {
  8064. props[key] = type[key].default;
  8065. }
  8066. });
  8067. Object.keys(raw).forEach((key) => {
  8068. props[camelize(key)] = raw[key];
  8069. });
  8070. return props;
  8071. };
  8072. const ensureOnlyChild = (children) => {
  8073. if (!isArray$1(children) || children.length > 1) {
  8074. throw new Error("expect to receive a single Vue element child");
  8075. }
  8076. return children[0];
  8077. };
  8078. const flattedChildren = (children) => {
  8079. const vNodes = isArray$1(children) ? children : [children];
  8080. const result = [];
  8081. vNodes.forEach((child) => {
  8082. var _a;
  8083. if (isArray$1(child)) {
  8084. result.push(...flattedChildren(child));
  8085. } else if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8086. result.push(child, ...flattedChildren(child.component.subTree));
  8087. } else if (vue.isVNode(child) && isArray$1(child.children)) {
  8088. result.push(...flattedChildren(child.children));
  8089. } else if (vue.isVNode(child) && child.shapeFlag === 2) {
  8090. result.push(...flattedChildren(child.type()));
  8091. } else {
  8092. result.push(child);
  8093. }
  8094. });
  8095. return result;
  8096. };
  8097. const unique = (arr) => [...new Set(arr)];
  8098. const castArray = (arr) => {
  8099. if (!arr && arr !== 0)
  8100. return [];
  8101. return isArray$1(arr) ? arr : [arr];
  8102. };
  8103. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8104. const mutable = (val) => val;
  8105. function throttleByRaf(cb) {
  8106. let timer = 0;
  8107. const throttle = (...args) => {
  8108. if (timer) {
  8109. cAF(timer);
  8110. }
  8111. timer = rAF(() => {
  8112. cb(...args);
  8113. timer = 0;
  8114. });
  8115. };
  8116. throttle.cancel = () => {
  8117. cAF(timer);
  8118. timer = 0;
  8119. };
  8120. return throttle;
  8121. }
  8122. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8123. const LISTENER_PREFIX = /^on[A-Z]/;
  8124. const useAttrs = (params = {}) => {
  8125. const { excludeListeners = false, excludeKeys } = params;
  8126. const allExcludeKeys = vue.computed(() => {
  8127. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8128. });
  8129. const instance = vue.getCurrentInstance();
  8130. if (!instance) {
  8131. return vue.computed(() => ({}));
  8132. }
  8133. return vue.computed(() => {
  8134. var _a;
  8135. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8136. });
  8137. };
  8138. function useCalcInputWidth() {
  8139. const calculatorRef = vue.shallowRef();
  8140. const calculatorWidth = vue.ref(0);
  8141. const MINIMUM_INPUT_WIDTH = 11;
  8142. const inputStyle = vue.computed(() => ({
  8143. minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
  8144. }));
  8145. const resetCalculatorWidth = () => {
  8146. var _a, _b;
  8147. calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
  8148. };
  8149. useResizeObserver(calculatorRef, resetCalculatorWidth);
  8150. return {
  8151. calculatorRef,
  8152. calculatorWidth,
  8153. inputStyle
  8154. };
  8155. }
  8156. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8157. vue.watch(() => vue.unref(condition), (val) => {
  8158. }, {
  8159. immediate: true
  8160. });
  8161. };
  8162. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8163. let transform = {
  8164. offsetX: 0,
  8165. offsetY: 0
  8166. };
  8167. const onMousedown = (e) => {
  8168. const downX = e.clientX;
  8169. const downY = e.clientY;
  8170. const { offsetX, offsetY } = transform;
  8171. const targetRect = targetRef.value.getBoundingClientRect();
  8172. const targetLeft = targetRect.left;
  8173. const targetTop = targetRect.top;
  8174. const targetWidth = targetRect.width;
  8175. const targetHeight = targetRect.height;
  8176. const clientWidth = document.documentElement.clientWidth;
  8177. const clientHeight = document.documentElement.clientHeight;
  8178. const minLeft = -targetLeft + offsetX;
  8179. const minTop = -targetTop + offsetY;
  8180. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8181. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8182. const onMousemove = (e2) => {
  8183. let moveX = offsetX + e2.clientX - downX;
  8184. let moveY = offsetY + e2.clientY - downY;
  8185. if (!(overflow == null ? void 0 : overflow.value)) {
  8186. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8187. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8188. }
  8189. transform = {
  8190. offsetX: moveX,
  8191. offsetY: moveY
  8192. };
  8193. if (targetRef.value) {
  8194. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8195. }
  8196. };
  8197. const onMouseup = () => {
  8198. document.removeEventListener("mousemove", onMousemove);
  8199. document.removeEventListener("mouseup", onMouseup);
  8200. };
  8201. document.addEventListener("mousemove", onMousemove);
  8202. document.addEventListener("mouseup", onMouseup);
  8203. };
  8204. const onDraggable = () => {
  8205. if (dragRef.value && targetRef.value) {
  8206. dragRef.value.addEventListener("mousedown", onMousedown);
  8207. }
  8208. };
  8209. const offDraggable = () => {
  8210. if (dragRef.value && targetRef.value) {
  8211. dragRef.value.removeEventListener("mousedown", onMousedown);
  8212. }
  8213. };
  8214. const resetPosition = () => {
  8215. transform = {
  8216. offsetX: 0,
  8217. offsetY: 0
  8218. };
  8219. if (targetRef.value) {
  8220. targetRef.value.style.transform = "none";
  8221. }
  8222. };
  8223. vue.onMounted(() => {
  8224. vue.watchEffect(() => {
  8225. if (draggable.value) {
  8226. onDraggable();
  8227. } else {
  8228. offDraggable();
  8229. }
  8230. });
  8231. });
  8232. vue.onBeforeUnmount(() => {
  8233. offDraggable();
  8234. });
  8235. return {
  8236. resetPosition
  8237. };
  8238. };
  8239. const useFocus = (el) => {
  8240. return {
  8241. focus: () => {
  8242. var _a, _b;
  8243. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8244. }
  8245. };
  8246. };
  8247. var English = {
  8248. name: "en",
  8249. el: {
  8250. breadcrumb: {
  8251. label: "Breadcrumb"
  8252. },
  8253. colorpicker: {
  8254. confirm: "OK",
  8255. clear: "Clear",
  8256. defaultLabel: "color picker",
  8257. description: "current color is {color}. press enter to select a new color.",
  8258. alphaLabel: "pick alpha value"
  8259. },
  8260. datepicker: {
  8261. now: "Now",
  8262. today: "Today",
  8263. cancel: "Cancel",
  8264. clear: "Clear",
  8265. confirm: "OK",
  8266. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8267. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8268. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8269. selectedDate: "Selected date",
  8270. selectDate: "Select date",
  8271. selectTime: "Select time",
  8272. startDate: "Start Date",
  8273. startTime: "Start Time",
  8274. endDate: "End Date",
  8275. endTime: "End Time",
  8276. prevYear: "Previous Year",
  8277. nextYear: "Next Year",
  8278. prevMonth: "Previous Month",
  8279. nextMonth: "Next Month",
  8280. year: "",
  8281. month1: "January",
  8282. month2: "February",
  8283. month3: "March",
  8284. month4: "April",
  8285. month5: "May",
  8286. month6: "June",
  8287. month7: "July",
  8288. month8: "August",
  8289. month9: "September",
  8290. month10: "October",
  8291. month11: "November",
  8292. month12: "December",
  8293. week: "week",
  8294. weeks: {
  8295. sun: "Sun",
  8296. mon: "Mon",
  8297. tue: "Tue",
  8298. wed: "Wed",
  8299. thu: "Thu",
  8300. fri: "Fri",
  8301. sat: "Sat"
  8302. },
  8303. weeksFull: {
  8304. sun: "Sunday",
  8305. mon: "Monday",
  8306. tue: "Tuesday",
  8307. wed: "Wednesday",
  8308. thu: "Thursday",
  8309. fri: "Friday",
  8310. sat: "Saturday"
  8311. },
  8312. months: {
  8313. jan: "Jan",
  8314. feb: "Feb",
  8315. mar: "Mar",
  8316. apr: "Apr",
  8317. may: "May",
  8318. jun: "Jun",
  8319. jul: "Jul",
  8320. aug: "Aug",
  8321. sep: "Sep",
  8322. oct: "Oct",
  8323. nov: "Nov",
  8324. dec: "Dec"
  8325. }
  8326. },
  8327. inputNumber: {
  8328. decrease: "decrease number",
  8329. increase: "increase number"
  8330. },
  8331. select: {
  8332. loading: "Loading",
  8333. noMatch: "No matching data",
  8334. noData: "No data",
  8335. placeholder: "Select"
  8336. },
  8337. mention: {
  8338. loading: "Loading"
  8339. },
  8340. dropdown: {
  8341. toggleDropdown: "Toggle Dropdown"
  8342. },
  8343. cascader: {
  8344. noMatch: "No matching data",
  8345. loading: "Loading",
  8346. placeholder: "Select",
  8347. noData: "No data"
  8348. },
  8349. pagination: {
  8350. goto: "Go to",
  8351. pagesize: "/page",
  8352. total: "Total {total}",
  8353. pageClassifier: "",
  8354. page: "Page",
  8355. prev: "Go to previous page",
  8356. next: "Go to next page",
  8357. currentPage: "page {pager}",
  8358. prevPages: "Previous {pager} pages",
  8359. nextPages: "Next {pager} pages",
  8360. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8361. },
  8362. dialog: {
  8363. close: "Close this dialog"
  8364. },
  8365. drawer: {
  8366. close: "Close this dialog"
  8367. },
  8368. messagebox: {
  8369. title: "Message",
  8370. confirm: "OK",
  8371. cancel: "Cancel",
  8372. error: "Illegal input",
  8373. close: "Close this dialog"
  8374. },
  8375. upload: {
  8376. deleteTip: "press delete to remove",
  8377. delete: "Delete",
  8378. preview: "Preview",
  8379. continue: "Continue"
  8380. },
  8381. slider: {
  8382. defaultLabel: "slider between {min} and {max}",
  8383. defaultRangeStartLabel: "pick start value",
  8384. defaultRangeEndLabel: "pick end value"
  8385. },
  8386. table: {
  8387. emptyText: "No Data",
  8388. confirmFilter: "Confirm",
  8389. resetFilter: "Reset",
  8390. clearFilter: "All",
  8391. sumText: "Sum"
  8392. },
  8393. tour: {
  8394. next: "Next",
  8395. previous: "Previous",
  8396. finish: "Finish"
  8397. },
  8398. tree: {
  8399. emptyText: "No Data"
  8400. },
  8401. transfer: {
  8402. noMatch: "No matching data",
  8403. noData: "No data",
  8404. titles: ["List 1", "List 2"],
  8405. filterPlaceholder: "Enter keyword",
  8406. noCheckedFormat: "{total} items",
  8407. hasCheckedFormat: "{checked}/{total} checked"
  8408. },
  8409. image: {
  8410. error: "FAILED"
  8411. },
  8412. pageHeader: {
  8413. title: "Back"
  8414. },
  8415. popconfirm: {
  8416. confirmButtonText: "Yes",
  8417. cancelButtonText: "No"
  8418. },
  8419. carousel: {
  8420. leftArrow: "Carousel arrow left",
  8421. rightArrow: "Carousel arrow right",
  8422. indicator: "Carousel switch to index {index}"
  8423. }
  8424. }
  8425. };
  8426. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8427. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8428. var _a;
  8429. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8430. });
  8431. const buildLocaleContext = (locale) => {
  8432. const lang = vue.computed(() => vue.unref(locale).name);
  8433. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8434. return {
  8435. lang,
  8436. locale: localeRef,
  8437. t: buildTranslator(locale)
  8438. };
  8439. };
  8440. const localeContextKey = Symbol("localeContextKey");
  8441. const useLocale = (localeOverrides) => {
  8442. const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
  8443. return buildLocaleContext(vue.computed(() => locale.value || English));
  8444. };
  8445. const defaultNamespace = "el";
  8446. const statePrefix = "is-";
  8447. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8448. let cls = `${namespace}-${block}`;
  8449. if (blockSuffix) {
  8450. cls += `-${blockSuffix}`;
  8451. }
  8452. if (element) {
  8453. cls += `__${element}`;
  8454. }
  8455. if (modifier) {
  8456. cls += `--${modifier}`;
  8457. }
  8458. return cls;
  8459. };
  8460. const namespaceContextKey = Symbol("namespaceContextKey");
  8461. const useGetDerivedNamespace = (namespaceOverrides) => {
  8462. const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
  8463. const namespace = vue.computed(() => {
  8464. return vue.unref(derivedNamespace) || defaultNamespace;
  8465. });
  8466. return namespace;
  8467. };
  8468. const useNamespace = (block, namespaceOverrides) => {
  8469. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8470. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8471. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8472. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8473. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8474. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8475. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8476. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8477. const is = (name, ...args) => {
  8478. const state = args.length >= 1 ? args[0] : true;
  8479. return name && state ? `${statePrefix}${name}` : "";
  8480. };
  8481. const cssVar = (object) => {
  8482. const styles = {};
  8483. for (const key in object) {
  8484. if (object[key]) {
  8485. styles[`--${namespace.value}-${key}`] = object[key];
  8486. }
  8487. }
  8488. return styles;
  8489. };
  8490. const cssVarBlock = (object) => {
  8491. const styles = {};
  8492. for (const key in object) {
  8493. if (object[key]) {
  8494. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8495. }
  8496. }
  8497. return styles;
  8498. };
  8499. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8500. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8501. return {
  8502. namespace,
  8503. b,
  8504. e,
  8505. m,
  8506. be,
  8507. em,
  8508. bm,
  8509. bem,
  8510. is,
  8511. cssVar,
  8512. cssVarName,
  8513. cssVarBlock,
  8514. cssVarBlockName
  8515. };
  8516. };
  8517. const useLockscreen = (trigger, options = {}) => {
  8518. if (!vue.isRef(trigger)) {
  8519. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8520. }
  8521. const ns = options.ns || useNamespace("popup");
  8522. const hiddenCls = vue.computed(() => ns.bm("parent", "hidden"));
  8523. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8524. return;
  8525. }
  8526. let scrollBarWidth = 0;
  8527. let withoutHiddenClass = false;
  8528. let bodyWidth = "0";
  8529. const cleanup = () => {
  8530. setTimeout(() => {
  8531. if (typeof document === "undefined")
  8532. return;
  8533. if (withoutHiddenClass && document) {
  8534. document.body.style.width = bodyWidth;
  8535. removeClass(document.body, hiddenCls.value);
  8536. }
  8537. }, 200);
  8538. };
  8539. vue.watch(trigger, (val) => {
  8540. if (!val) {
  8541. cleanup();
  8542. return;
  8543. }
  8544. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8545. if (withoutHiddenClass) {
  8546. bodyWidth = document.body.style.width;
  8547. addClass(document.body, hiddenCls.value);
  8548. }
  8549. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8550. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8551. const bodyOverflowY = getStyle(document.body, "overflowY");
  8552. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8553. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8554. }
  8555. });
  8556. vue.onScopeDispose(() => cleanup());
  8557. };
  8558. const modalStack = [];
  8559. const closeModal = (e) => {
  8560. if (modalStack.length === 0)
  8561. return;
  8562. if (e.code === EVENT_CODE.esc) {
  8563. e.stopPropagation();
  8564. const topModal = modalStack[modalStack.length - 1];
  8565. topModal.handleClose();
  8566. }
  8567. };
  8568. const useModal = (instance, visibleRef) => {
  8569. vue.watch(visibleRef, (val) => {
  8570. if (val) {
  8571. modalStack.push(instance);
  8572. } else {
  8573. modalStack.splice(modalStack.indexOf(instance), 1);
  8574. }
  8575. });
  8576. };
  8577. if (isClient)
  8578. useEventListener(document, "keydown", closeModal);
  8579. const _prop = buildProp({
  8580. type: definePropType(Boolean),
  8581. default: null
  8582. });
  8583. const _event = buildProp({
  8584. type: definePropType(Function)
  8585. });
  8586. const createModelToggleComposable = (name) => {
  8587. const updateEventKey = `update:${name}`;
  8588. const updateEventKeyRaw = `onUpdate:${name}`;
  8589. const useModelToggleEmits2 = [updateEventKey];
  8590. const useModelToggleProps2 = {
  8591. [name]: _prop,
  8592. [updateEventKeyRaw]: _event
  8593. };
  8594. const useModelToggle2 = ({
  8595. indicator,
  8596. toggleReason,
  8597. shouldHideWhenRouteChanges,
  8598. shouldProceed,
  8599. onShow,
  8600. onHide
  8601. }) => {
  8602. const instance = vue.getCurrentInstance();
  8603. const { emit } = instance;
  8604. const props = instance.props;
  8605. const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw]));
  8606. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8607. const doShow = (event) => {
  8608. if (indicator.value === true) {
  8609. return;
  8610. }
  8611. indicator.value = true;
  8612. if (toggleReason) {
  8613. toggleReason.value = event;
  8614. }
  8615. if (isFunction$1(onShow)) {
  8616. onShow(event);
  8617. }
  8618. };
  8619. const doHide = (event) => {
  8620. if (indicator.value === false) {
  8621. return;
  8622. }
  8623. indicator.value = false;
  8624. if (toggleReason) {
  8625. toggleReason.value = event;
  8626. }
  8627. if (isFunction$1(onHide)) {
  8628. onHide(event);
  8629. }
  8630. };
  8631. const show = (event) => {
  8632. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8633. return;
  8634. const shouldEmit = hasUpdateHandler.value && isClient;
  8635. if (shouldEmit) {
  8636. emit(updateEventKey, true);
  8637. }
  8638. if (isModelBindingAbsent.value || !shouldEmit) {
  8639. doShow(event);
  8640. }
  8641. };
  8642. const hide = (event) => {
  8643. if (props.disabled === true || !isClient)
  8644. return;
  8645. const shouldEmit = hasUpdateHandler.value && isClient;
  8646. if (shouldEmit) {
  8647. emit(updateEventKey, false);
  8648. }
  8649. if (isModelBindingAbsent.value || !shouldEmit) {
  8650. doHide(event);
  8651. }
  8652. };
  8653. const onChange = (val) => {
  8654. if (!isBoolean(val))
  8655. return;
  8656. if (props.disabled && val) {
  8657. if (hasUpdateHandler.value) {
  8658. emit(updateEventKey, false);
  8659. }
  8660. } else if (indicator.value !== val) {
  8661. if (val) {
  8662. doShow();
  8663. } else {
  8664. doHide();
  8665. }
  8666. }
  8667. };
  8668. const toggle = () => {
  8669. if (indicator.value) {
  8670. hide();
  8671. } else {
  8672. show();
  8673. }
  8674. };
  8675. vue.watch(() => props[name], onChange);
  8676. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8677. vue.watch(() => ({
  8678. ...instance.proxy.$route
  8679. }), () => {
  8680. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8681. hide();
  8682. }
  8683. });
  8684. }
  8685. vue.onMounted(() => {
  8686. onChange(props[name]);
  8687. });
  8688. return {
  8689. hide,
  8690. show,
  8691. toggle,
  8692. hasUpdateHandler
  8693. };
  8694. };
  8695. return {
  8696. useModelToggle: useModelToggle2,
  8697. useModelToggleProps: useModelToggleProps2,
  8698. useModelToggleEmits: useModelToggleEmits2
  8699. };
  8700. };
  8701. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8702. const usePreventGlobal = (indicator, evt, cb) => {
  8703. const prevent = (e) => {
  8704. if (cb(e))
  8705. e.stopImmediatePropagation();
  8706. };
  8707. let stop = void 0;
  8708. vue.watch(() => indicator.value, (val) => {
  8709. if (val) {
  8710. stop = useEventListener(document, evt, prevent, true);
  8711. } else {
  8712. stop == null ? void 0 : stop();
  8713. }
  8714. }, { immediate: true });
  8715. };
  8716. const useProp = (name) => {
  8717. const vm = vue.getCurrentInstance();
  8718. return vue.computed(() => {
  8719. var _a, _b;
  8720. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  8721. });
  8722. };
  8723. 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){return t.concat([e+"-"+U$1,e+"-"+J])},[]),Ee=[].concat(G,[me]).reduce(function(t,e){return t.concat([e,e+"-"+U$1,e+"-"+J])},[]),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];function C(t){return t?(t.nodeName||"").toLowerCase():null}function H(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Q(t){var e=H(t).Element;return t instanceof e||t instanceof Element}function B(t){var e=H(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Pe(t){if(typeof ShadowRoot=="undefined")return !1;var e=H(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Mt(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!B(i)||!C(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(a){var s=o[a];s===!1?i.removeAttribute(a):i.setAttribute(a,s===!0?"":s);}));});}function Rt(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),s=a.reduce(function(f,c){return f[c]="",f},{});!B(o)||!C(o)||(Object.assign(o.style,s),Object.keys(i).forEach(function(f){o.removeAttribute(f);}));});}}var Ae={name:"applyStyles",enabled:!0,phase:"write",fn:Mt,effect:Rt,requires:["computeStyles"]};function q(t){return t.split("-")[0]}var X$1=Math.max,ve=Math.min,Z=Math.round;function ee(t,e){e===void 0&&(e=!1);var n=t.getBoundingClientRect(),r=1,o=1;if(B(t)&&e){var i=t.offsetHeight,a=t.offsetWidth;a>0&&(r=Z(n.width)/a||1),i>0&&(o=Z(n.height)/i||1);}return {width:n.width/r,height:n.height/o,top:n.top/o,right:n.right/r,bottom:n.bottom/o,left:n.left/r,x:n.left/r,y:n.top/o}}function ke(t){var e=ee(t),n=t.offsetWidth,r=t.offsetHeight;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}}function it(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return !0;if(n&&Pe(n)){var r=e;do{if(r&&t.isSameNode(r))return !0;r=r.parentNode||r.host;}while(r)}return !1}function N$1(t){return H(t).getComputedStyle(t)}function Wt(t){return ["table","td","th"].indexOf(C(t))>=0}function I$1(t){return ((Q(t)?t.ownerDocument:t.document)||window.document).documentElement}function ge(t){return C(t)==="html"?t:t.assignedSlot||t.parentNode||(Pe(t)?t.host:null)||I$1(t)}function at(t){return !B(t)||N$1(t).position==="fixed"?null:t.offsetParent}function Bt(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,n=navigator.userAgent.indexOf("Trident")!==-1;if(n&&B(t)){var r=N$1(t);if(r.position==="fixed")return null}var o=ge(t);for(Pe(o)&&(o=o.host);B(o)&&["html","body"].indexOf(C(o))<0;){var i=N$1(o);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")return o;o=o.parentNode;}return null}function se(t){for(var e=H(t),n=at(t);n&&Wt(n)&&N$1(n).position==="static";)n=at(n);return n&&(C(n)==="html"||C(n)==="body"&&N$1(n).position==="static")?e:n||Bt(t)||e}function Le(t){return ["top","bottom"].indexOf(t)>=0?"x":"y"}function fe(t,e,n){return X$1(t,ve(e,n))}function St(t,e,n){var r=fe(t,e,n);return r>n?n:r}function st(){return {top:0,right:0,bottom:0,left:0}}function ft(t){return Object.assign({},st(),t)}function ct(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var Tt=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ft(typeof t!="number"?t:ct(t,G))};function Ht(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=q(n.placement),f=Le(s),c=[P$1,W].indexOf(s)>=0,u=c?"height":"width";if(!(!i||!a)){var m=Tt(o.padding,n),v=ke(i),l=f==="y"?E$1:P$1,h=f==="y"?R:W,p=n.rects.reference[u]+n.rects.reference[f]-a[f]-n.rects.popper[u],g=a[f]-n.rects.reference[f],x=se(i),y=x?f==="y"?x.clientHeight||0:x.clientWidth||0:0,$=p/2-g/2,d=m[l],b=y-v[u]-m[h],w=y/2-v[u]/2+$,O=fe(d,w,b),j=f;n.modifiersData[r]=(e={},e[j]=O,e.centerOffset=O-w,e);}}function Ct(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||!it(e.elements.popper,o)||(e.elements.arrow=o));}var pt={name:"arrow",enabled:!0,phase:"main",fn:Ht,effect:Ct,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function te(t){return t.split("-")[1]}var qt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vt(t){var e=t.x,n=t.y,r=window,o=r.devicePixelRatio||1;return {x:Z(e*o)/o||0,y:Z(n*o)/o||0}}function ut(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,a=t.offsets,s=t.position,f=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,m=t.isFixed,v=a.x,l=v===void 0?0:v,h=a.y,p=h===void 0?0:h,g=typeof u=="function"?u({x:l,y:p}):{x:l,y:p};l=g.x,p=g.y;var x=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),$=P$1,d=E$1,b=window;if(c){var w=se(n),O="clientHeight",j="clientWidth";if(w===H(n)&&(w=I$1(n),N$1(w).position!=="static"&&s==="absolute"&&(O="scrollHeight",j="scrollWidth")),w=w,o===E$1||(o===P$1||o===W)&&i===J){d=R;var A=m&&w===b&&b.visualViewport?b.visualViewport.height:w[O];p-=A-r.height,p*=f?1:-1;}if(o===P$1||(o===E$1||o===R)&&i===J){$=W;var k=m&&w===b&&b.visualViewport?b.visualViewport.width:w[j];l-=k-r.width,l*=f?1:-1;}}var D=Object.assign({position:s},c&&qt),S=u===!0?Vt({x:l,y:p}):{x:l,y:p};if(l=S.x,p=S.y,f){var L;return Object.assign({},D,(L={},L[d]=y?"0":"",L[$]=x?"0":"",L.transform=(b.devicePixelRatio||1)<=1?"translate("+l+"px, "+p+"px)":"translate3d("+l+"px, "+p+"px, 0)",L))}return Object.assign({},D,(e={},e[d]=y?p+"px":"",e[$]=x?l+"px":"",e.transform="",e))}function Nt(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,a=i===void 0?!0:i,s=n.roundOffsets,f=s===void 0?!0:s,c={placement:q(e.placement),variation:te(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ut(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:f})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ut(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement});}var Me={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:!0};function It(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,a=r.resize,s=a===void 0?!0:a,f=H(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",n.update,ye);}),s&&f.addEventListener("resize",n.update,ye),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",n.update,ye);}),s&&f.removeEventListener("resize",n.update,ye);}}var Re={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:It,data:{}},_t={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,function(e){return _t[e]})}var zt={start:"end",end:"start"};function lt(t){return t.replace(/start|end/g,function(e){return zt[e]})}function We(t){var e=H(t),n=e.pageXOffset,r=e.pageYOffset;return {scrollLeft:n,scrollTop:r}}function Be(t){return ee(I$1(t)).left+We(t).scrollLeft}function Ft(t){var e=H(t),n=I$1(t),r=e.visualViewport,o=n.clientWidth,i=n.clientHeight,a=0,s=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:o,height:i,x:a+Be(t),y:s}}function Ut(t){var e,n=I$1(t),r=We(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=X$1(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=X$1(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-r.scrollLeft+Be(t),f=-r.scrollTop;return N$1(o||n).direction==="rtl"&&(s+=X$1(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:f}}function Se(t){var e=N$1(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return /auto|scroll|overlay|hidden/.test(n+o+r)}function dt(t){return ["html","body","#document"].indexOf(C(t))>=0?t.ownerDocument.body:B(t)&&Se(t)?t:dt(ge(t))}function ce(t,e){var n;e===void 0&&(e=[]);var r=dt(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=H(r),a=o?[i].concat(i.visualViewport||[],Se(r)?r:[]):r,s=e.concat(a);return o?s:s.concat(ce(ge(a)))}function Te(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Xt(t){var e=ee(t);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}function ht(t,e){return e===je?Te(Ft(t)):Q(e)?Xt(e):Te(Ut(I$1(t)))}function Yt(t){var e=ce(ge(t)),n=["absolute","fixed"].indexOf(N$1(t).position)>=0,r=n&&B(t)?se(t):t;return Q(r)?e.filter(function(o){return Q(o)&&it(o,r)&&C(o)!=="body"}):[]}function Gt(t,e,n){var r=e==="clippingParents"?Yt(t):[].concat(e),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(s,f){var c=ht(t,f);return s.top=X$1(c.top,s.top),s.right=ve(c.right,s.right),s.bottom=ve(c.bottom,s.bottom),s.left=X$1(c.left,s.left),s},ht(t,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function mt(t){var e=t.reference,n=t.element,r=t.placement,o=r?q(r):null,i=r?te(r):null,a=e.x+e.width/2-n.width/2,s=e.y+e.height/2-n.height/2,f;switch(o){case E$1:f={x:a,y:e.y-n.height};break;case R:f={x:a,y:e.y+e.height};break;case W:f={x:e.x+e.width,y:s};break;case P$1:f={x:e.x-n.width,y:s};break;default:f={x:e.x,y:e.y};}var c=o?Le(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case U$1:f[c]=f[c]-(e[u]/2-n[u]/2);break;case J:f[c]=f[c]+(e[u]/2-n[u]/2);break}}return f}function ne(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.boundary,a=i===void 0?Xe:i,s=n.rootBoundary,f=s===void 0?je:s,c=n.elementContext,u=c===void 0?K:c,m=n.altBoundary,v=m===void 0?!1:m,l=n.padding,h=l===void 0?0:l,p=ft(typeof h!="number"?h:ct(h,G)),g=u===K?Ye:K,x=t.rects.popper,y=t.elements[v?g:u],$=Gt(Q(y)?y:y.contextElement||I$1(t.elements.popper),a,f),d=ee(t.elements.reference),b=mt({reference:d,element:x,strategy:"absolute",placement:o}),w=Te(Object.assign({},x,b)),O=u===K?w:d,j={top:$.top-O.top+p.top,bottom:O.bottom-$.bottom+p.bottom,left:$.left-O.left+p.left,right:O.right-$.right+p.right},A=t.modifiersData.offset;if(u===K&&A){var k=A[o];Object.keys(j).forEach(function(D){var S=[W,R].indexOf(D)>=0?1:-1,L=[E$1,R].indexOf(D)>=0?"y":"x";j[D]+=k[L]*S;});}return j}function Jt(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=f===void 0?Ee:f,u=te(r),m=u?s?De:De.filter(function(h){return te(h)===u}):G,v=m.filter(function(h){return c.indexOf(h)>=0});v.length===0&&(v=m);var l=v.reduce(function(h,p){return h[p]=ne(t,{placement:p,boundary:o,rootBoundary:i,padding:a})[q(p)],h},{});return Object.keys(l).sort(function(h,p){return l[h]-l[p]})}function Kt(t){if(q(t)===me)return [];var e=be(t);return [lt(t),e,lt(e)]}function Qt(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!0:a,f=n.fallbackPlacements,c=n.padding,u=n.boundary,m=n.rootBoundary,v=n.altBoundary,l=n.flipVariations,h=l===void 0?!0:l,p=n.allowedAutoPlacements,g=e.options.placement,x=q(g),y=x===g,$=f||(y||!h?[be(g)]:Kt(g)),d=[g].concat($).reduce(function(z,V){return z.concat(q(V)===me?Jt(e,{placement:V,boundary:u,rootBoundary:m,padding:c,flipVariations:h,allowedAutoPlacements:p}):V)},[]),b=e.rects.reference,w=e.rects.popper,O=new Map,j=!0,A=d[0],k=0;k<d.length;k++){var D=d[k],S=q(D),L=te(D)===U$1,re=[E$1,R].indexOf(S)>=0,oe=re?"width":"height",M=ne(e,{placement:D,boundary:u,rootBoundary:m,altBoundary:v,padding:c}),T=re?L?W:P$1:L?R:E$1;b[oe]>w[oe]&&(T=be(T));var pe=be(T),_=[];if(i&&_.push(M[S]<=0),s&&_.push(M[T]<=0,M[pe]<=0),_.every(function(z){return z})){A=D,j=!1;break}O.set(D,_);}if(j)for(var ue=h?3:1,xe=function(z){var V=d.find(function(de){var ae=O.get(de);if(ae)return ae.slice(0,z).every(function(Y){return Y})});if(V)return A=V,"break"},ie=ue;ie>0;ie--){var le=xe(ie);if(le==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0);}}var vt={name:"flip",enabled:!0,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:!1}};function gt(t,e,n){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}}function yt(t){return [E$1,W,R,P$1].some(function(e){return t[e]>=0})}function Zt(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,a=ne(e,{elementContext:"reference"}),s=ne(e,{altBoundary:!0}),f=gt(a,r),c=gt(s,o,i),u=yt(f),m=yt(c);e.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":m});}var bt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Zt};function en(t,e,n){var r=q(t),o=[P$1,E$1].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[P$1,W].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}function tn(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,a=Ee.reduce(function(u,m){return u[m]=en(m,e.rects,i),u},{}),s=a[e.placement],f=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=f,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a;}var wt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tn};function nn(t){var e=t.state,n=t.name;e.modifiersData[n]=mt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement});}var He={name:"popperOffsets",enabled:!0,phase:"read",fn:nn,data:{}};function rn(t){return t==="x"?"y":"x"}function on(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!1:a,f=n.boundary,c=n.rootBoundary,u=n.altBoundary,m=n.padding,v=n.tether,l=v===void 0?!0:v,h=n.tetherOffset,p=h===void 0?0:h,g=ne(e,{boundary:f,rootBoundary:c,padding:m,altBoundary:u}),x=q(e.placement),y=te(e.placement),$=!y,d=Le(x),b=rn(d),w=e.modifiersData.popperOffsets,O=e.rects.reference,j=e.rects.popper,A=typeof p=="function"?p(Object.assign({},e.rects,{placement:e.placement})):p,k=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),D=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,S={x:0,y:0};if(w){if(i){var L,re=d==="y"?E$1:P$1,oe=d==="y"?R:W,M=d==="y"?"height":"width",T=w[d],pe=T+g[re],_=T-g[oe],ue=l?-j[M]/2:0,xe=y===U$1?O[M]:j[M],ie=y===U$1?-j[M]:-O[M],le=e.elements.arrow,z=l&&le?ke(le):{width:0,height:0},V=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:st(),de=V[re],ae=V[oe],Y=fe(0,O[M],z[M]),jt=$?O[M]/2-ue-Y-de-k.mainAxis:xe-Y-de-k.mainAxis,Dt=$?-O[M]/2+ue+Y+ae+k.mainAxis:ie+Y+ae+k.mainAxis,Oe=e.elements.arrow&&se(e.elements.arrow),Et=Oe?d==="y"?Oe.clientTop||0:Oe.clientLeft||0:0,Ce=(L=D==null?void 0:D[d])!=null?L:0,Pt=T+jt-Ce-Et,At=T+Dt-Ce,qe=fe(l?ve(pe,Pt):pe,T,l?X$1(_,At):_);w[d]=qe,S[d]=qe-T;}if(s){var Ve,kt=d==="x"?E$1:P$1,Lt=d==="x"?R:W,F=w[b],he=b==="y"?"height":"width",Ne=F+g[kt],Ie=F-g[Lt],$e=[E$1,P$1].indexOf(x)!==-1,_e=(Ve=D==null?void 0:D[b])!=null?Ve:0,ze=$e?Ne:F-O[he]-j[he]-_e+k.altAxis,Fe=$e?F+O[he]+j[he]-_e-k.altAxis:Ie,Ue=l&&$e?St(ze,F,Fe):fe(l?ze:Ne,F,l?Fe:Ie);w[b]=Ue,S[b]=Ue-F;}e.modifiersData[r]=S;}}var xt={name:"preventOverflow",enabled:!0,phase:"main",fn:on,requiresIfExists:["offset"]};function an(t){return {scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function sn(t){return t===H(t)||!B(t)?We(t):an(t)}function fn(t){var e=t.getBoundingClientRect(),n=Z(e.width)/t.offsetWidth||1,r=Z(e.height)/t.offsetHeight||1;return n!==1||r!==1}function cn(t,e,n){n===void 0&&(n=!1);var r=B(e),o=B(e)&&fn(e),i=I$1(e),a=ee(t,o),s={scrollLeft:0,scrollTop:0},f={x:0,y:0};return (r||!r&&!n)&&((C(e)!=="body"||Se(i))&&(s=sn(e)),B(e)?(f=ee(e,!0),f.x+=e.clientLeft,f.y+=e.clientTop):i&&(f.x=Be(i))),{x:a.left+s.scrollLeft-f.x,y:a.top+s.scrollTop-f.y,width:a.width,height:a.height}}function pn(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i);});function o(i){n.add(i.name);var a=[].concat(i.requires||[],i.requiresIfExists||[]);a.forEach(function(s){if(!n.has(s)){var f=e.get(s);f&&o(f);}}),r.push(i);}return t.forEach(function(i){n.has(i.name)||o(i);}),r}function un(t){var e=pn(t);return ot.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function ln(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t());});})),e}}function dn(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function $t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return !e.some(function(r){return !(r&&typeof r.getBoundingClientRect=="function")})}function we(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,i=o===void 0?Ot:o;return function(a,s,f){f===void 0&&(f=i);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,i),modifiersData:{},elements:{reference:a,popper:s},attributes:{},styles:{}},u=[],m=!1,v={state:c,setOptions:function(p){var g=typeof p=="function"?p(c.options):p;h(),c.options=Object.assign({},i,c.options,g),c.scrollParents={reference:Q(a)?ce(a):a.contextElement?ce(a.contextElement):[],popper:ce(s)};var x=un(dn([].concat(r,c.options.modifiers)));return c.orderedModifiers=x.filter(function(y){return y.enabled}),l(),v.update()},forceUpdate:function(){if(!m){var p=c.elements,g=p.reference,x=p.popper;if($t(g,x)){c.rects={reference:cn(g,se(x),c.options.strategy==="fixed"),popper:ke(x)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(j){return c.modifiersData[j.name]=Object.assign({},j.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===!0){c.reset=!1,y=-1;continue}var $=c.orderedModifiers[y],d=$.fn,b=$.options,w=b===void 0?{}:b,O=$.name;typeof d=="function"&&(c=d({state:c,options:w,name:O,instance:v})||c);}}}},update:ln(function(){return new Promise(function(p){v.forceUpdate(),p(c);})}),destroy:function(){h(),m=!0;}};if(!$t(a,s))return v;v.setOptions(f).then(function(p){!m&&f.onFirstUpdate&&f.onFirstUpdate(p);});function l(){c.orderedModifiers.forEach(function(p){var g=p.name,x=p.options,y=x===void 0?{}:x,$=p.effect;if(typeof $=="function"){var d=$({state:c,name:g,instance:v,options:y}),b=function(){};u.push(d||b);}});}function h(){u.forEach(function(p){return p()}),u=[];}return v}}we();var mn=[Re,He,Me,Ae];we({defaultModifiers:mn});var gn=[Re,He,Me,Ae,wt,vt,xt,pt,bt],yn=we({defaultModifiers:gn});
  8724. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8725. const stateUpdater = {
  8726. name: "updateState",
  8727. enabled: true,
  8728. phase: "write",
  8729. fn: ({ state }) => {
  8730. const derivedState = deriveState(state);
  8731. Object.assign(states.value, derivedState);
  8732. },
  8733. requires: ["computeStyles"]
  8734. };
  8735. const options = vue.computed(() => {
  8736. const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
  8737. return {
  8738. onFirstUpdate,
  8739. placement: placement || "bottom",
  8740. strategy: strategy || "absolute",
  8741. modifiers: [
  8742. ...modifiers || [],
  8743. stateUpdater,
  8744. { name: "applyStyles", enabled: false }
  8745. ]
  8746. };
  8747. });
  8748. const instanceRef = vue.shallowRef();
  8749. const states = vue.ref({
  8750. styles: {
  8751. popper: {
  8752. position: vue.unref(options).strategy,
  8753. left: "0",
  8754. top: "0"
  8755. },
  8756. arrow: {
  8757. position: "absolute"
  8758. }
  8759. },
  8760. attributes: {}
  8761. });
  8762. const destroy = () => {
  8763. if (!instanceRef.value)
  8764. return;
  8765. instanceRef.value.destroy();
  8766. instanceRef.value = void 0;
  8767. };
  8768. vue.watch(options, (newOptions) => {
  8769. const instance = vue.unref(instanceRef);
  8770. if (instance) {
  8771. instance.setOptions(newOptions);
  8772. }
  8773. }, {
  8774. deep: true
  8775. });
  8776. vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8777. destroy();
  8778. if (!referenceElement || !popperElement)
  8779. return;
  8780. instanceRef.value = yn(referenceElement, popperElement, vue.unref(options));
  8781. });
  8782. vue.onBeforeUnmount(() => {
  8783. destroy();
  8784. });
  8785. return {
  8786. state: vue.computed(() => {
  8787. var _a;
  8788. return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  8789. }),
  8790. styles: vue.computed(() => vue.unref(states).styles),
  8791. attributes: vue.computed(() => vue.unref(states).attributes),
  8792. update: () => {
  8793. var _a;
  8794. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update();
  8795. },
  8796. forceUpdate: () => {
  8797. var _a;
  8798. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  8799. },
  8800. instanceRef: vue.computed(() => vue.unref(instanceRef))
  8801. };
  8802. };
  8803. function deriveState(state) {
  8804. const elements = Object.keys(state.elements);
  8805. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  8806. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  8807. return {
  8808. styles,
  8809. attributes
  8810. };
  8811. }
  8812. const useSameTarget = (handleClick) => {
  8813. if (!handleClick) {
  8814. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8815. }
  8816. let mousedownTarget = false;
  8817. let mouseupTarget = false;
  8818. const onClick = (e) => {
  8819. if (mousedownTarget && mouseupTarget) {
  8820. handleClick(e);
  8821. }
  8822. mousedownTarget = mouseupTarget = false;
  8823. };
  8824. const onMousedown = (e) => {
  8825. mousedownTarget = e.target === e.currentTarget;
  8826. };
  8827. const onMouseup = (e) => {
  8828. mouseupTarget = e.target === e.currentTarget;
  8829. };
  8830. return { onClick, onMousedown, onMouseup };
  8831. };
  8832. const useTeleport = (contentRenderer, appendToBody) => {
  8833. const isTeleportVisible = vue.ref(false);
  8834. if (!isClient) {
  8835. return {
  8836. isTeleportVisible,
  8837. showTeleport: NOOP,
  8838. hideTeleport: NOOP,
  8839. renderTeleport: NOOP
  8840. };
  8841. }
  8842. let $el = null;
  8843. const showTeleport = () => {
  8844. isTeleportVisible.value = true;
  8845. if ($el !== null)
  8846. return;
  8847. $el = createGlobalNode();
  8848. };
  8849. const hideTeleport = () => {
  8850. isTeleportVisible.value = false;
  8851. if ($el !== null) {
  8852. removeGlobalNode($el);
  8853. $el = null;
  8854. }
  8855. };
  8856. const renderTeleport = () => {
  8857. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  8858. };
  8859. vue.onUnmounted(hideTeleport);
  8860. return {
  8861. isTeleportVisible,
  8862. showTeleport,
  8863. hideTeleport,
  8864. renderTeleport
  8865. };
  8866. };
  8867. const useThrottleRender = (loading, throttle = 0) => {
  8868. if (throttle === 0)
  8869. return loading;
  8870. const initVal = isObject$1(throttle) && Boolean(throttle.initVal);
  8871. const throttled = vue.ref(initVal);
  8872. let timeoutHandle = null;
  8873. const dispatchThrottling = (timer) => {
  8874. if (isUndefined(timer)) {
  8875. throttled.value = loading.value;
  8876. return;
  8877. }
  8878. if (timeoutHandle) {
  8879. clearTimeout(timeoutHandle);
  8880. }
  8881. timeoutHandle = setTimeout(() => {
  8882. throttled.value = loading.value;
  8883. }, timer);
  8884. };
  8885. const dispatcher = (type) => {
  8886. if (type === "leading") {
  8887. if (isNumber(throttle)) {
  8888. dispatchThrottling(throttle);
  8889. } else {
  8890. dispatchThrottling(throttle.leading);
  8891. }
  8892. } else {
  8893. if (isObject$1(throttle)) {
  8894. dispatchThrottling(throttle.trailing);
  8895. } else {
  8896. throttled.value = false;
  8897. }
  8898. }
  8899. };
  8900. vue.onMounted(() => dispatcher("leading"));
  8901. vue.watch(() => loading.value, (val) => {
  8902. dispatcher(val ? "leading" : "trailing");
  8903. });
  8904. return throttled;
  8905. };
  8906. function useTimeout() {
  8907. let timeoutHandle;
  8908. const registerTimeout = (fn, delay) => {
  8909. cancelTimeout();
  8910. timeoutHandle = window.setTimeout(fn, delay);
  8911. };
  8912. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  8913. tryOnScopeDispose(() => cancelTimeout());
  8914. return {
  8915. registerTimeout,
  8916. cancelTimeout
  8917. };
  8918. }
  8919. const AFTER_APPEAR = "after-appear";
  8920. const AFTER_ENTER = "after-enter";
  8921. const AFTER_LEAVE = "after-leave";
  8922. const APPEAR = "appear";
  8923. const APPEAR_CANCELLED = "appear-cancelled";
  8924. const BEFORE_ENTER = "before-enter";
  8925. const BEFORE_LEAVE = "before-leave";
  8926. const ENTER = "enter";
  8927. const ENTER_CANCELLED = "enter-cancelled";
  8928. const LEAVE = "leave";
  8929. const LEAVE_CANCELLED = "leave-cancelled";
  8930. const useTransitionFallthroughEmits = [
  8931. AFTER_APPEAR,
  8932. AFTER_ENTER,
  8933. AFTER_LEAVE,
  8934. APPEAR,
  8935. APPEAR_CANCELLED,
  8936. BEFORE_ENTER,
  8937. BEFORE_LEAVE,
  8938. ENTER,
  8939. ENTER_CANCELLED,
  8940. LEAVE,
  8941. LEAVE_CANCELLED
  8942. ];
  8943. const useTransitionFallthrough = () => {
  8944. const { emit } = vue.getCurrentInstance();
  8945. return {
  8946. onAfterAppear: () => {
  8947. emit(AFTER_APPEAR);
  8948. },
  8949. onAfterEnter: () => {
  8950. emit(AFTER_ENTER);
  8951. },
  8952. onAfterLeave: () => {
  8953. emit(AFTER_LEAVE);
  8954. },
  8955. onAppearCancelled: () => {
  8956. emit(APPEAR_CANCELLED);
  8957. },
  8958. onBeforeEnter: () => {
  8959. emit(BEFORE_ENTER);
  8960. },
  8961. onBeforeLeave: () => {
  8962. emit(BEFORE_LEAVE);
  8963. },
  8964. onEnter: () => {
  8965. emit(ENTER);
  8966. },
  8967. onEnterCancelled: () => {
  8968. emit(ENTER_CANCELLED);
  8969. },
  8970. onLeave: () => {
  8971. emit(LEAVE);
  8972. },
  8973. onLeaveCancelled: () => {
  8974. emit(LEAVE_CANCELLED);
  8975. }
  8976. };
  8977. };
  8978. const defaultIdInjection = {
  8979. prefix: Math.floor(Math.random() * 1e4),
  8980. current: 0
  8981. };
  8982. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8983. const useIdInjection = () => {
  8984. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8985. };
  8986. const useId = (deterministicId) => {
  8987. const idInjection = useIdInjection();
  8988. const namespace = useGetDerivedNamespace();
  8989. const idRef = computedEager(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8990. return idRef;
  8991. };
  8992. let registeredEscapeHandlers = [];
  8993. const cachedHandler = (event) => {
  8994. if (event.code === EVENT_CODE.esc) {
  8995. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  8996. }
  8997. };
  8998. const useEscapeKeydown = (handler) => {
  8999. vue.onMounted(() => {
  9000. if (registeredEscapeHandlers.length === 0) {
  9001. document.addEventListener("keydown", cachedHandler);
  9002. }
  9003. if (isClient)
  9004. registeredEscapeHandlers.push(handler);
  9005. });
  9006. vue.onBeforeUnmount(() => {
  9007. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9008. if (registeredEscapeHandlers.length === 0) {
  9009. if (isClient)
  9010. document.removeEventListener("keydown", cachedHandler);
  9011. }
  9012. });
  9013. };
  9014. const usePopperContainerId = () => {
  9015. const namespace = useGetDerivedNamespace();
  9016. const idInjection = useIdInjection();
  9017. const id = vue.computed(() => {
  9018. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9019. });
  9020. const selector = vue.computed(() => `#${id.value}`);
  9021. return {
  9022. id,
  9023. selector
  9024. };
  9025. };
  9026. const createContainer = (id) => {
  9027. const container = document.createElement("div");
  9028. container.id = id;
  9029. document.body.appendChild(container);
  9030. return container;
  9031. };
  9032. const usePopperContainer = () => {
  9033. const { id, selector } = usePopperContainerId();
  9034. vue.onBeforeMount(() => {
  9035. if (!isClient)
  9036. return;
  9037. if (!document.body.querySelector(selector.value)) {
  9038. createContainer(id.value);
  9039. }
  9040. });
  9041. return {
  9042. id,
  9043. selector
  9044. };
  9045. };
  9046. const useDelayedRender = ({
  9047. indicator,
  9048. intermediateIndicator,
  9049. shouldSetIntermediate = () => true,
  9050. beforeShow,
  9051. afterShow,
  9052. afterHide,
  9053. beforeHide
  9054. }) => {
  9055. vue.watch(() => vue.unref(indicator), (val) => {
  9056. if (val) {
  9057. beforeShow == null ? void 0 : beforeShow();
  9058. vue.nextTick(() => {
  9059. if (!vue.unref(indicator))
  9060. return;
  9061. if (shouldSetIntermediate("show")) {
  9062. intermediateIndicator.value = true;
  9063. }
  9064. });
  9065. } else {
  9066. beforeHide == null ? void 0 : beforeHide();
  9067. vue.nextTick(() => {
  9068. if (vue.unref(indicator))
  9069. return;
  9070. if (shouldSetIntermediate("hide")) {
  9071. intermediateIndicator.value = false;
  9072. }
  9073. });
  9074. }
  9075. });
  9076. vue.watch(() => intermediateIndicator.value, (val) => {
  9077. if (val) {
  9078. afterShow == null ? void 0 : afterShow();
  9079. } else {
  9080. afterHide == null ? void 0 : afterHide();
  9081. }
  9082. });
  9083. };
  9084. const useDelayedToggleProps = buildProps({
  9085. showAfter: {
  9086. type: Number,
  9087. default: 0
  9088. },
  9089. hideAfter: {
  9090. type: Number,
  9091. default: 200
  9092. },
  9093. autoClose: {
  9094. type: Number,
  9095. default: 0
  9096. }
  9097. });
  9098. const useDelayedToggle = ({
  9099. showAfter,
  9100. hideAfter,
  9101. autoClose,
  9102. open,
  9103. close
  9104. }) => {
  9105. const { registerTimeout } = useTimeout();
  9106. const {
  9107. registerTimeout: registerTimeoutForAutoClose,
  9108. cancelTimeout: cancelTimeoutForAutoClose
  9109. } = useTimeout();
  9110. const onOpen = (event) => {
  9111. registerTimeout(() => {
  9112. open(event);
  9113. const _autoClose = vue.unref(autoClose);
  9114. if (isNumber(_autoClose) && _autoClose > 0) {
  9115. registerTimeoutForAutoClose(() => {
  9116. close(event);
  9117. }, _autoClose);
  9118. }
  9119. }, vue.unref(showAfter));
  9120. };
  9121. const onClose = (event) => {
  9122. cancelTimeoutForAutoClose();
  9123. registerTimeout(() => {
  9124. close(event);
  9125. }, vue.unref(hideAfter));
  9126. };
  9127. return {
  9128. onOpen,
  9129. onClose
  9130. };
  9131. };
  9132. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9133. const useForwardRef = (forwardRef) => {
  9134. const setForwardRef = (el) => {
  9135. forwardRef.value = el;
  9136. };
  9137. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9138. setForwardRef
  9139. });
  9140. };
  9141. const useForwardRefDirective = (setForwardRef) => {
  9142. return {
  9143. mounted(el) {
  9144. setForwardRef(el);
  9145. },
  9146. updated(el) {
  9147. setForwardRef(el);
  9148. },
  9149. unmounted() {
  9150. setForwardRef(null);
  9151. }
  9152. };
  9153. };
  9154. const initial = {
  9155. current: 0
  9156. };
  9157. const zIndex = vue.ref(0);
  9158. const defaultInitialZIndex = 2e3;
  9159. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9160. const zIndexContextKey = Symbol("zIndexContextKey");
  9161. const useZIndex = (zIndexOverrides) => {
  9162. const increasingInjection = vue.getCurrentInstance() ? vue.inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9163. const zIndexInjection = zIndexOverrides || (vue.getCurrentInstance() ? vue.inject(zIndexContextKey, void 0) : void 0);
  9164. const initialZIndex = vue.computed(() => {
  9165. const zIndexFromInjection = vue.unref(zIndexInjection);
  9166. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9167. });
  9168. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9169. const nextZIndex = () => {
  9170. increasingInjection.current++;
  9171. zIndex.value = increasingInjection.current;
  9172. return currentZIndex.value;
  9173. };
  9174. if (!isClient && !vue.inject(ZINDEX_INJECTION_KEY)) ;
  9175. return {
  9176. initialZIndex,
  9177. currentZIndex,
  9178. nextZIndex
  9179. };
  9180. };
  9181. function getSide(placement) {
  9182. return placement.split('-')[0];
  9183. }
  9184. function getAlignment(placement) {
  9185. return placement.split('-')[1];
  9186. }
  9187. function getMainAxisFromPlacement(placement) {
  9188. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9189. }
  9190. function getLengthFromAxis(axis) {
  9191. return axis === 'y' ? 'height' : 'width';
  9192. }
  9193. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9194. let {
  9195. reference,
  9196. floating
  9197. } = _ref;
  9198. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9199. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9200. const mainAxis = getMainAxisFromPlacement(placement);
  9201. const length = getLengthFromAxis(mainAxis);
  9202. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9203. const side = getSide(placement);
  9204. const isVertical = mainAxis === 'x';
  9205. let coords;
  9206. switch (side) {
  9207. case 'top':
  9208. coords = {
  9209. x: commonX,
  9210. y: reference.y - floating.height
  9211. };
  9212. break;
  9213. case 'bottom':
  9214. coords = {
  9215. x: commonX,
  9216. y: reference.y + reference.height
  9217. };
  9218. break;
  9219. case 'right':
  9220. coords = {
  9221. x: reference.x + reference.width,
  9222. y: commonY
  9223. };
  9224. break;
  9225. case 'left':
  9226. coords = {
  9227. x: reference.x - floating.width,
  9228. y: commonY
  9229. };
  9230. break;
  9231. default:
  9232. coords = {
  9233. x: reference.x,
  9234. y: reference.y
  9235. };
  9236. }
  9237. switch (getAlignment(placement)) {
  9238. case 'start':
  9239. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9240. break;
  9241. case 'end':
  9242. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9243. break;
  9244. }
  9245. return coords;
  9246. }
  9247. /**
  9248. * Computes the `x` and `y` coordinates that will place the floating element
  9249. * next to a reference element when it is given a certain positioning strategy.
  9250. *
  9251. * This export does not have any `platform` interface logic. You will need to
  9252. * write one for the platform you are using Floating UI with.
  9253. */
  9254. const computePosition$1 = async (reference, floating, config) => {
  9255. const {
  9256. placement = 'bottom',
  9257. strategy = 'absolute',
  9258. middleware = [],
  9259. platform
  9260. } = config;
  9261. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9262. let rects = await platform.getElementRects({
  9263. reference,
  9264. floating,
  9265. strategy
  9266. });
  9267. let {
  9268. x,
  9269. y
  9270. } = computeCoordsFromPlacement(rects, placement, rtl);
  9271. let statefulPlacement = placement;
  9272. let middlewareData = {};
  9273. let resetCount = 0;
  9274. for (let i = 0; i < middleware.length; i++) {
  9275. const {
  9276. name,
  9277. fn
  9278. } = middleware[i];
  9279. const {
  9280. x: nextX,
  9281. y: nextY,
  9282. data,
  9283. reset
  9284. } = await fn({
  9285. x,
  9286. y,
  9287. initialPlacement: placement,
  9288. placement: statefulPlacement,
  9289. strategy,
  9290. middlewareData,
  9291. rects,
  9292. platform,
  9293. elements: {
  9294. reference,
  9295. floating
  9296. }
  9297. });
  9298. x = nextX != null ? nextX : x;
  9299. y = nextY != null ? nextY : y;
  9300. middlewareData = { ...middlewareData,
  9301. [name]: { ...middlewareData[name],
  9302. ...data
  9303. }
  9304. };
  9305. if (reset && resetCount <= 50) {
  9306. resetCount++;
  9307. if (typeof reset === 'object') {
  9308. if (reset.placement) {
  9309. statefulPlacement = reset.placement;
  9310. }
  9311. if (reset.rects) {
  9312. rects = reset.rects === true ? await platform.getElementRects({
  9313. reference,
  9314. floating,
  9315. strategy
  9316. }) : reset.rects;
  9317. }
  9318. ({
  9319. x,
  9320. y
  9321. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9322. }
  9323. i = -1;
  9324. continue;
  9325. }
  9326. }
  9327. return {
  9328. x,
  9329. y,
  9330. placement: statefulPlacement,
  9331. strategy,
  9332. middlewareData
  9333. };
  9334. };
  9335. function expandPaddingObject(padding) {
  9336. return {
  9337. top: 0,
  9338. right: 0,
  9339. bottom: 0,
  9340. left: 0,
  9341. ...padding
  9342. };
  9343. }
  9344. function getSideObjectFromPadding(padding) {
  9345. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9346. top: padding,
  9347. right: padding,
  9348. bottom: padding,
  9349. left: padding
  9350. };
  9351. }
  9352. function rectToClientRect(rect) {
  9353. return { ...rect,
  9354. top: rect.y,
  9355. left: rect.x,
  9356. right: rect.x + rect.width,
  9357. bottom: rect.y + rect.height
  9358. };
  9359. }
  9360. /**
  9361. * Resolves with an object of overflow side offsets that determine how much the
  9362. * element is overflowing a given clipping boundary.
  9363. * - positive = overflowing the boundary by that number of pixels
  9364. * - negative = how many pixels left before it will overflow
  9365. * - 0 = lies flush with the boundary
  9366. * @see https://floating-ui.com/docs/detectOverflow
  9367. */
  9368. async function detectOverflow(middlewareArguments, options) {
  9369. var _await$platform$isEle;
  9370. if (options === void 0) {
  9371. options = {};
  9372. }
  9373. const {
  9374. x,
  9375. y,
  9376. platform,
  9377. rects,
  9378. elements,
  9379. strategy
  9380. } = middlewareArguments;
  9381. const {
  9382. boundary = 'clippingAncestors',
  9383. rootBoundary = 'viewport',
  9384. elementContext = 'floating',
  9385. altBoundary = false,
  9386. padding = 0
  9387. } = options;
  9388. const paddingObject = getSideObjectFromPadding(padding);
  9389. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9390. const element = elements[altBoundary ? altContext : elementContext];
  9391. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  9392. element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
  9393. boundary,
  9394. rootBoundary,
  9395. strategy
  9396. }));
  9397. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9398. rect: elementContext === 'floating' ? { ...rects.floating,
  9399. x,
  9400. y
  9401. } : rects.reference,
  9402. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  9403. strategy
  9404. }) : rects[elementContext]);
  9405. return {
  9406. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  9407. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  9408. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  9409. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  9410. };
  9411. }
  9412. const min$2 = Math.min;
  9413. const max$2 = Math.max;
  9414. function within(min$1, value, max$1) {
  9415. return max$2(min$1, min$2(value, max$1));
  9416. }
  9417. /**
  9418. * Positions an inner element of the floating element such that it is centered
  9419. * to the reference element.
  9420. * @see https://floating-ui.com/docs/arrow
  9421. */
  9422. const arrow = options => ({
  9423. name: 'arrow',
  9424. options,
  9425. async fn(middlewareArguments) {
  9426. // Since `element` is required, we don't Partial<> the type
  9427. const {
  9428. element,
  9429. padding = 0
  9430. } = options != null ? options : {};
  9431. const {
  9432. x,
  9433. y,
  9434. placement,
  9435. rects,
  9436. platform
  9437. } = middlewareArguments;
  9438. if (element == null) {
  9439. return {};
  9440. }
  9441. const paddingObject = getSideObjectFromPadding(padding);
  9442. const coords = {
  9443. x,
  9444. y
  9445. };
  9446. const axis = getMainAxisFromPlacement(placement);
  9447. const alignment = getAlignment(placement);
  9448. const length = getLengthFromAxis(axis);
  9449. const arrowDimensions = await platform.getDimensions(element);
  9450. const minProp = axis === 'y' ? 'top' : 'left';
  9451. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9452. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9453. const startDiff = coords[axis] - rects.reference[axis];
  9454. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9455. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9456. if (clientSize === 0) {
  9457. clientSize = rects.floating[length];
  9458. }
  9459. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9460. // point is outside the floating element's bounds
  9461. const min = paddingObject[minProp];
  9462. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9463. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9464. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9465. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9466. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9467. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9468. return {
  9469. [axis]: coords[axis] - alignmentOffset,
  9470. data: {
  9471. [axis]: offset,
  9472. centerOffset: center - offset
  9473. }
  9474. };
  9475. }
  9476. });
  9477. const hash$1 = {
  9478. left: 'right',
  9479. right: 'left',
  9480. bottom: 'top',
  9481. top: 'bottom'
  9482. };
  9483. function getOppositePlacement(placement) {
  9484. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  9485. }
  9486. function getAlignmentSides(placement, rects, rtl) {
  9487. if (rtl === void 0) {
  9488. rtl = false;
  9489. }
  9490. const alignment = getAlignment(placement);
  9491. const mainAxis = getMainAxisFromPlacement(placement);
  9492. const length = getLengthFromAxis(mainAxis);
  9493. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9494. if (rects.reference[length] > rects.floating[length]) {
  9495. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  9496. }
  9497. return {
  9498. main: mainAlignmentSide,
  9499. cross: getOppositePlacement(mainAlignmentSide)
  9500. };
  9501. }
  9502. const hash = {
  9503. start: 'end',
  9504. end: 'start'
  9505. };
  9506. function getOppositeAlignmentPlacement(placement) {
  9507. return placement.replace(/start|end/g, matched => hash[matched]);
  9508. }
  9509. function getExpandedPlacements(placement) {
  9510. const oppositePlacement = getOppositePlacement(placement);
  9511. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  9512. }
  9513. /**
  9514. * Changes the placement of the floating element to one that will fit if the
  9515. * initially specified `placement` does not.
  9516. * @see https://floating-ui.com/docs/flip
  9517. */
  9518. const flip = function (options) {
  9519. if (options === void 0) {
  9520. options = {};
  9521. }
  9522. return {
  9523. name: 'flip',
  9524. options,
  9525. async fn(middlewareArguments) {
  9526. var _middlewareData$flip;
  9527. const {
  9528. placement,
  9529. middlewareData,
  9530. rects,
  9531. initialPlacement,
  9532. platform,
  9533. elements
  9534. } = middlewareArguments;
  9535. const {
  9536. mainAxis: checkMainAxis = true,
  9537. crossAxis: checkCrossAxis = true,
  9538. fallbackPlacements: specifiedFallbackPlacements,
  9539. fallbackStrategy = 'bestFit',
  9540. flipAlignment = true,
  9541. ...detectOverflowOptions
  9542. } = options;
  9543. const side = getSide(placement);
  9544. const isBasePlacement = side === initialPlacement;
  9545. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  9546. const placements = [initialPlacement, ...fallbackPlacements];
  9547. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9548. const overflows = [];
  9549. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  9550. if (checkMainAxis) {
  9551. overflows.push(overflow[side]);
  9552. }
  9553. if (checkCrossAxis) {
  9554. const {
  9555. main,
  9556. cross
  9557. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9558. overflows.push(overflow[main], overflow[cross]);
  9559. }
  9560. overflowsData = [...overflowsData, {
  9561. placement,
  9562. overflows
  9563. }]; // One or more sides is overflowing
  9564. if (!overflows.every(side => side <= 0)) {
  9565. var _middlewareData$flip$, _middlewareData$flip2;
  9566. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  9567. const nextPlacement = placements[nextIndex];
  9568. if (nextPlacement) {
  9569. // Try next placement and re-run the lifecycle
  9570. return {
  9571. data: {
  9572. index: nextIndex,
  9573. overflows: overflowsData
  9574. },
  9575. reset: {
  9576. placement: nextPlacement
  9577. }
  9578. };
  9579. }
  9580. let resetPlacement = 'bottom';
  9581. switch (fallbackStrategy) {
  9582. case 'bestFit':
  9583. {
  9584. var _overflowsData$map$so;
  9585. const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
  9586. if (placement) {
  9587. resetPlacement = placement;
  9588. }
  9589. break;
  9590. }
  9591. case 'initialPlacement':
  9592. resetPlacement = initialPlacement;
  9593. break;
  9594. }
  9595. if (placement !== resetPlacement) {
  9596. return {
  9597. reset: {
  9598. placement: resetPlacement
  9599. }
  9600. };
  9601. }
  9602. }
  9603. return {};
  9604. }
  9605. };
  9606. };
  9607. async function convertValueToCoords(middlewareArguments, value) {
  9608. const {
  9609. placement,
  9610. platform,
  9611. elements
  9612. } = middlewareArguments;
  9613. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9614. const side = getSide(placement);
  9615. const alignment = getAlignment(placement);
  9616. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9617. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9618. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9619. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9620. let {
  9621. mainAxis,
  9622. crossAxis,
  9623. alignmentAxis
  9624. } = typeof rawValue === 'number' ? {
  9625. mainAxis: rawValue,
  9626. crossAxis: 0,
  9627. alignmentAxis: null
  9628. } : {
  9629. mainAxis: 0,
  9630. crossAxis: 0,
  9631. alignmentAxis: null,
  9632. ...rawValue
  9633. };
  9634. if (alignment && typeof alignmentAxis === 'number') {
  9635. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9636. }
  9637. return isVertical ? {
  9638. x: crossAxis * crossAxisMulti,
  9639. y: mainAxis * mainAxisMulti
  9640. } : {
  9641. x: mainAxis * mainAxisMulti,
  9642. y: crossAxis * crossAxisMulti
  9643. };
  9644. }
  9645. /**
  9646. * Displaces the floating element from its reference element.
  9647. * @see https://floating-ui.com/docs/offset
  9648. */
  9649. const offset = function (value) {
  9650. if (value === void 0) {
  9651. value = 0;
  9652. }
  9653. return {
  9654. name: 'offset',
  9655. options: value,
  9656. async fn(middlewareArguments) {
  9657. const {
  9658. x,
  9659. y
  9660. } = middlewareArguments;
  9661. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9662. return {
  9663. x: x + diffCoords.x,
  9664. y: y + diffCoords.y,
  9665. data: diffCoords
  9666. };
  9667. }
  9668. };
  9669. };
  9670. function getCrossAxis(axis) {
  9671. return axis === 'x' ? 'y' : 'x';
  9672. }
  9673. /**
  9674. * Shifts the floating element in order to keep it in view when it will overflow
  9675. * a clipping boundary.
  9676. * @see https://floating-ui.com/docs/shift
  9677. */
  9678. const shift = function (options) {
  9679. if (options === void 0) {
  9680. options = {};
  9681. }
  9682. return {
  9683. name: 'shift',
  9684. options,
  9685. async fn(middlewareArguments) {
  9686. const {
  9687. x,
  9688. y,
  9689. placement
  9690. } = middlewareArguments;
  9691. const {
  9692. mainAxis: checkMainAxis = true,
  9693. crossAxis: checkCrossAxis = false,
  9694. limiter = {
  9695. fn: _ref => {
  9696. let {
  9697. x,
  9698. y
  9699. } = _ref;
  9700. return {
  9701. x,
  9702. y
  9703. };
  9704. }
  9705. },
  9706. ...detectOverflowOptions
  9707. } = options;
  9708. const coords = {
  9709. x,
  9710. y
  9711. };
  9712. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9713. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  9714. const crossAxis = getCrossAxis(mainAxis);
  9715. let mainAxisCoord = coords[mainAxis];
  9716. let crossAxisCoord = coords[crossAxis];
  9717. if (checkMainAxis) {
  9718. const minSide = mainAxis === 'y' ? 'top' : 'left';
  9719. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  9720. const min = mainAxisCoord + overflow[minSide];
  9721. const max = mainAxisCoord - overflow[maxSide];
  9722. mainAxisCoord = within(min, mainAxisCoord, max);
  9723. }
  9724. if (checkCrossAxis) {
  9725. const minSide = crossAxis === 'y' ? 'top' : 'left';
  9726. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  9727. const min = crossAxisCoord + overflow[minSide];
  9728. const max = crossAxisCoord - overflow[maxSide];
  9729. crossAxisCoord = within(min, crossAxisCoord, max);
  9730. }
  9731. const limitedCoords = limiter.fn({ ...middlewareArguments,
  9732. [mainAxis]: mainAxisCoord,
  9733. [crossAxis]: crossAxisCoord
  9734. });
  9735. return { ...limitedCoords,
  9736. data: {
  9737. x: limitedCoords.x - x,
  9738. y: limitedCoords.y - y
  9739. }
  9740. };
  9741. }
  9742. };
  9743. };
  9744. function isWindow(value) {
  9745. return value && value.document && value.location && value.alert && value.setInterval;
  9746. }
  9747. function getWindow(node) {
  9748. if (node == null) {
  9749. return window;
  9750. }
  9751. if (!isWindow(node)) {
  9752. const ownerDocument = node.ownerDocument;
  9753. return ownerDocument ? ownerDocument.defaultView || window : window;
  9754. }
  9755. return node;
  9756. }
  9757. function getComputedStyle$1(element) {
  9758. return getWindow(element).getComputedStyle(element);
  9759. }
  9760. function getNodeName(node) {
  9761. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9762. }
  9763. function getUAString() {
  9764. const uaData = navigator.userAgentData;
  9765. if (uaData != null && uaData.brands) {
  9766. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9767. }
  9768. return navigator.userAgent;
  9769. }
  9770. function isHTMLElement(value) {
  9771. return value instanceof getWindow(value).HTMLElement;
  9772. }
  9773. function isElement(value) {
  9774. return value instanceof getWindow(value).Element;
  9775. }
  9776. function isNode(value) {
  9777. return value instanceof getWindow(value).Node;
  9778. }
  9779. function isShadowRoot(node) {
  9780. // Browsers without `ShadowRoot` support
  9781. if (typeof ShadowRoot === 'undefined') {
  9782. return false;
  9783. }
  9784. const OwnElement = getWindow(node).ShadowRoot;
  9785. return node instanceof OwnElement || node instanceof ShadowRoot;
  9786. }
  9787. function isOverflowElement(element) {
  9788. // Firefox wants us to check `-x` and `-y` variations as well
  9789. const {
  9790. overflow,
  9791. overflowX,
  9792. overflowY
  9793. } = getComputedStyle$1(element);
  9794. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9795. }
  9796. function isTableElement(element) {
  9797. return ['table', 'td', 'th'].includes(getNodeName(element));
  9798. }
  9799. function isContainingBlock(element) {
  9800. // TODO: Try and use feature detection here instead
  9801. const isFirefox = /firefox/i.test(getUAString());
  9802. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9803. // create a containing block.
  9804. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9805. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9806. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9807. }
  9808. function isLayoutViewport() {
  9809. // Not Safari
  9810. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9811. // • Always-visible scrollbar or not
  9812. // • Width of <html>, etc.
  9813. // const vV = win.visualViewport;
  9814. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9815. }
  9816. const min$1 = Math.min;
  9817. const max$1 = Math.max;
  9818. const round = Math.round;
  9819. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9820. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9821. if (includeScale === void 0) {
  9822. includeScale = false;
  9823. }
  9824. if (isFixedStrategy === void 0) {
  9825. isFixedStrategy = false;
  9826. }
  9827. const clientRect = element.getBoundingClientRect();
  9828. let scaleX = 1;
  9829. let scaleY = 1;
  9830. if (includeScale && isHTMLElement(element)) {
  9831. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9832. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9833. }
  9834. const win = isElement(element) ? getWindow(element) : window;
  9835. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9836. const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
  9837. const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
  9838. const width = clientRect.width / scaleX;
  9839. const height = clientRect.height / scaleY;
  9840. return {
  9841. width,
  9842. height,
  9843. top: y,
  9844. right: x + width,
  9845. bottom: y + height,
  9846. left: x,
  9847. x,
  9848. y
  9849. };
  9850. }
  9851. function getDocumentElement(node) {
  9852. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9853. }
  9854. function getNodeScroll(element) {
  9855. if (isElement(element)) {
  9856. return {
  9857. scrollLeft: element.scrollLeft,
  9858. scrollTop: element.scrollTop
  9859. };
  9860. }
  9861. return {
  9862. scrollLeft: element.pageXOffset,
  9863. scrollTop: element.pageYOffset
  9864. };
  9865. }
  9866. function getWindowScrollBarX(element) {
  9867. // If <html> has a CSS width greater than the viewport, then this will be
  9868. // incorrect for RTL.
  9869. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9870. }
  9871. function isScaled(element) {
  9872. const rect = getBoundingClientRect(element);
  9873. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9874. }
  9875. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9876. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9877. const documentElement = getDocumentElement(offsetParent);
  9878. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9879. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9880. let scroll = {
  9881. scrollLeft: 0,
  9882. scrollTop: 0
  9883. };
  9884. const offsets = {
  9885. x: 0,
  9886. y: 0
  9887. };
  9888. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9889. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9890. scroll = getNodeScroll(offsetParent);
  9891. }
  9892. if (isHTMLElement(offsetParent)) {
  9893. const offsetRect = getBoundingClientRect(offsetParent, true);
  9894. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9895. offsets.y = offsetRect.y + offsetParent.clientTop;
  9896. } else if (documentElement) {
  9897. offsets.x = getWindowScrollBarX(documentElement);
  9898. }
  9899. }
  9900. return {
  9901. x: rect.left + scroll.scrollLeft - offsets.x,
  9902. y: rect.top + scroll.scrollTop - offsets.y,
  9903. width: rect.width,
  9904. height: rect.height
  9905. };
  9906. }
  9907. function getParentNode(node) {
  9908. if (getNodeName(node) === 'html') {
  9909. return node;
  9910. }
  9911. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9912. // @ts-ignore
  9913. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9914. node.parentNode || ( // DOM Element detected
  9915. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9916. getDocumentElement(node) // fallback
  9917. );
  9918. }
  9919. function getTrueOffsetParent(element) {
  9920. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9921. return null;
  9922. }
  9923. return composedOffsetParent(element);
  9924. }
  9925. /**
  9926. * Polyfills the old offsetParent behavior from before the spec was changed:
  9927. * https://github.com/w3c/csswg-drafts/issues/159
  9928. */
  9929. function composedOffsetParent(element) {
  9930. let {
  9931. offsetParent
  9932. } = element;
  9933. let ancestor = element;
  9934. let foundInsideSlot = false;
  9935. while (ancestor && ancestor !== offsetParent) {
  9936. const {
  9937. assignedSlot
  9938. } = ancestor;
  9939. if (assignedSlot) {
  9940. let newOffsetParent = assignedSlot.offsetParent;
  9941. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9942. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9943. const oldDisplay = assignedSlot.style.display;
  9944. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9945. newOffsetParent = assignedSlot.offsetParent;
  9946. assignedSlot.style.display = oldDisplay;
  9947. if (!hadStyleAttribute) {
  9948. assignedSlot.removeAttribute('style');
  9949. }
  9950. }
  9951. ancestor = assignedSlot;
  9952. if (offsetParent !== newOffsetParent) {
  9953. offsetParent = newOffsetParent;
  9954. foundInsideSlot = true;
  9955. }
  9956. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9957. break;
  9958. }
  9959. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9960. }
  9961. return offsetParent;
  9962. }
  9963. function getContainingBlock(element) {
  9964. let currentNode = getParentNode(element);
  9965. if (isShadowRoot(currentNode)) {
  9966. currentNode = currentNode.host;
  9967. }
  9968. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9969. if (isContainingBlock(currentNode)) {
  9970. return currentNode;
  9971. } else {
  9972. const parent = currentNode.parentNode;
  9973. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9974. }
  9975. }
  9976. return null;
  9977. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9978. // such as table ancestors and cross browser bugs.
  9979. function getOffsetParent(element) {
  9980. const window = getWindow(element);
  9981. let offsetParent = getTrueOffsetParent(element);
  9982. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9983. offsetParent = getTrueOffsetParent(offsetParent);
  9984. }
  9985. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9986. return window;
  9987. }
  9988. return offsetParent || getContainingBlock(element) || window;
  9989. }
  9990. function getDimensions(element) {
  9991. if (isHTMLElement(element)) {
  9992. return {
  9993. width: element.offsetWidth,
  9994. height: element.offsetHeight
  9995. };
  9996. }
  9997. const rect = getBoundingClientRect(element);
  9998. return {
  9999. width: rect.width,
  10000. height: rect.height
  10001. };
  10002. }
  10003. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  10004. let {
  10005. rect,
  10006. offsetParent,
  10007. strategy
  10008. } = _ref;
  10009. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  10010. const documentElement = getDocumentElement(offsetParent);
  10011. if (offsetParent === documentElement) {
  10012. return rect;
  10013. }
  10014. let scroll = {
  10015. scrollLeft: 0,
  10016. scrollTop: 0
  10017. };
  10018. const offsets = {
  10019. x: 0,
  10020. y: 0
  10021. };
  10022. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  10023. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  10024. scroll = getNodeScroll(offsetParent);
  10025. }
  10026. if (isHTMLElement(offsetParent)) {
  10027. const offsetRect = getBoundingClientRect(offsetParent, true);
  10028. offsets.x = offsetRect.x + offsetParent.clientLeft;
  10029. offsets.y = offsetRect.y + offsetParent.clientTop;
  10030. } // This doesn't appear to be need to be negated.
  10031. // else if (documentElement) {
  10032. // offsets.x = getWindowScrollBarX(documentElement);
  10033. // }
  10034. }
  10035. return { ...rect,
  10036. x: rect.x - scroll.scrollLeft + offsets.x,
  10037. y: rect.y - scroll.scrollTop + offsets.y
  10038. };
  10039. }
  10040. function getViewportRect(element, strategy) {
  10041. const win = getWindow(element);
  10042. const html = getDocumentElement(element);
  10043. const visualViewport = win.visualViewport;
  10044. let width = html.clientWidth;
  10045. let height = html.clientHeight;
  10046. let x = 0;
  10047. let y = 0;
  10048. if (visualViewport) {
  10049. width = visualViewport.width;
  10050. height = visualViewport.height;
  10051. const layoutViewport = isLayoutViewport();
  10052. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  10053. x = visualViewport.offsetLeft;
  10054. y = visualViewport.offsetTop;
  10055. }
  10056. }
  10057. return {
  10058. width,
  10059. height,
  10060. x,
  10061. y
  10062. };
  10063. }
  10064. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  10065. function getDocumentRect(element) {
  10066. var _element$ownerDocumen;
  10067. const html = getDocumentElement(element);
  10068. const scroll = getNodeScroll(element);
  10069. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  10070. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  10071. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  10072. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  10073. const y = -scroll.scrollTop;
  10074. if (getComputedStyle$1(body || html).direction === 'rtl') {
  10075. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  10076. }
  10077. return {
  10078. width,
  10079. height,
  10080. x,
  10081. y
  10082. };
  10083. }
  10084. function getNearestOverflowAncestor(node) {
  10085. const parentNode = getParentNode(node);
  10086. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  10087. // @ts-ignore assume body is always available
  10088. return node.ownerDocument.body;
  10089. }
  10090. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  10091. return parentNode;
  10092. }
  10093. return getNearestOverflowAncestor(parentNode);
  10094. }
  10095. function getOverflowAncestors(node, list) {
  10096. var _node$ownerDocument;
  10097. if (list === void 0) {
  10098. list = [];
  10099. }
  10100. const scrollableAncestor = getNearestOverflowAncestor(node);
  10101. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  10102. const win = getWindow(scrollableAncestor);
  10103. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  10104. const updatedList = list.concat(target);
  10105. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  10106. updatedList.concat(getOverflowAncestors(target));
  10107. }
  10108. function contains(parent, child) {
  10109. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  10110. if (parent.contains(child)) {
  10111. return true;
  10112. } // then fallback to custom implementation with Shadow DOM support
  10113. else if (rootNode && isShadowRoot(rootNode)) {
  10114. let next = child;
  10115. do {
  10116. // use `===` replace node.isSameNode()
  10117. if (next && parent === next) {
  10118. return true;
  10119. } // @ts-ignore: need a better way to handle this...
  10120. next = next.parentNode || next.host;
  10121. } while (next);
  10122. }
  10123. return false;
  10124. }
  10125. function getInnerBoundingClientRect(element, strategy) {
  10126. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10127. const top = clientRect.top + element.clientTop;
  10128. const left = clientRect.left + element.clientLeft;
  10129. return {
  10130. top,
  10131. left,
  10132. x: left,
  10133. y: top,
  10134. right: left + element.clientWidth,
  10135. bottom: top + element.clientHeight,
  10136. width: element.clientWidth,
  10137. height: element.clientHeight
  10138. };
  10139. }
  10140. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10141. if (clippingParent === 'viewport') {
  10142. return rectToClientRect(getViewportRect(element, strategy));
  10143. }
  10144. if (isElement(clippingParent)) {
  10145. return getInnerBoundingClientRect(clippingParent, strategy);
  10146. }
  10147. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10148. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10149. // clipping (or hiding) overflowing elements with a position different from
  10150. // `initial`
  10151. function getClippingAncestors(element) {
  10152. const clippingAncestors = getOverflowAncestors(element);
  10153. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10154. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10155. if (!isElement(clipperElement)) {
  10156. return [];
  10157. } // @ts-ignore isElement check ensures we return Array<Element>
  10158. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10159. } // Gets the maximum area that the element is visible in due to any number of
  10160. // clipping ancestors
  10161. function getClippingRect(_ref) {
  10162. let {
  10163. element,
  10164. boundary,
  10165. rootBoundary,
  10166. strategy
  10167. } = _ref;
  10168. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10169. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10170. const firstClippingAncestor = clippingAncestors[0];
  10171. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10172. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10173. accRect.top = max$1(rect.top, accRect.top);
  10174. accRect.right = min$1(rect.right, accRect.right);
  10175. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10176. accRect.left = max$1(rect.left, accRect.left);
  10177. return accRect;
  10178. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10179. return {
  10180. width: clippingRect.right - clippingRect.left,
  10181. height: clippingRect.bottom - clippingRect.top,
  10182. x: clippingRect.left,
  10183. y: clippingRect.top
  10184. };
  10185. }
  10186. const platform = {
  10187. getClippingRect,
  10188. convertOffsetParentRelativeRectToViewportRelativeRect,
  10189. isElement,
  10190. getDimensions,
  10191. getOffsetParent,
  10192. getDocumentElement,
  10193. getElementRects: _ref => {
  10194. let {
  10195. reference,
  10196. floating,
  10197. strategy
  10198. } = _ref;
  10199. return {
  10200. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10201. floating: { ...getDimensions(floating),
  10202. x: 0,
  10203. y: 0
  10204. }
  10205. };
  10206. },
  10207. getClientRects: element => Array.from(element.getClientRects()),
  10208. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10209. };
  10210. /**
  10211. * Automatically updates the position of the floating element when necessary.
  10212. * @see https://floating-ui.com/docs/autoUpdate
  10213. */
  10214. function autoUpdate(reference, floating, update, options) {
  10215. if (options === void 0) {
  10216. options = {};
  10217. }
  10218. const {
  10219. ancestorScroll: _ancestorScroll = true,
  10220. ancestorResize: _ancestorResize = true,
  10221. elementResize = true,
  10222. animationFrame = false
  10223. } = options;
  10224. const ancestorScroll = _ancestorScroll && !animationFrame;
  10225. const ancestorResize = _ancestorResize && !animationFrame;
  10226. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  10227. ancestors.forEach(ancestor => {
  10228. ancestorScroll && ancestor.addEventListener('scroll', update, {
  10229. passive: true
  10230. });
  10231. ancestorResize && ancestor.addEventListener('resize', update);
  10232. });
  10233. let observer = null;
  10234. if (elementResize) {
  10235. let initialUpdate = true;
  10236. observer = new ResizeObserver(() => {
  10237. if (!initialUpdate) {
  10238. update();
  10239. }
  10240. initialUpdate = false;
  10241. });
  10242. isElement(reference) && !animationFrame && observer.observe(reference);
  10243. observer.observe(floating);
  10244. }
  10245. let frameId;
  10246. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  10247. if (animationFrame) {
  10248. frameLoop();
  10249. }
  10250. function frameLoop() {
  10251. const nextRefRect = getBoundingClientRect(reference);
  10252. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  10253. update();
  10254. }
  10255. prevRefRect = nextRefRect;
  10256. frameId = requestAnimationFrame(frameLoop);
  10257. }
  10258. update();
  10259. return () => {
  10260. var _observer;
  10261. ancestors.forEach(ancestor => {
  10262. ancestorScroll && ancestor.removeEventListener('scroll', update);
  10263. ancestorResize && ancestor.removeEventListener('resize', update);
  10264. });
  10265. (_observer = observer) == null ? void 0 : _observer.disconnect();
  10266. observer = null;
  10267. if (animationFrame) {
  10268. cancelAnimationFrame(frameId);
  10269. }
  10270. };
  10271. }
  10272. /**
  10273. * Computes the `x` and `y` coordinates that will place the floating element
  10274. * next to a reference element when it is given a certain CSS positioning
  10275. * strategy.
  10276. */
  10277. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10278. platform,
  10279. ...options
  10280. });
  10281. const useFloatingProps = buildProps({});
  10282. const unrefReference = (elRef) => {
  10283. if (!isClient)
  10284. return;
  10285. if (!elRef)
  10286. return elRef;
  10287. const unrefEl = unrefElement(elRef);
  10288. if (unrefEl)
  10289. return unrefEl;
  10290. return vue.isRef(elRef) ? unrefEl : elRef;
  10291. };
  10292. const getPositionDataWithUnit = (record, key) => {
  10293. const value = record == null ? void 0 : record[key];
  10294. return isNil(value) ? "" : `${value}px`;
  10295. };
  10296. const useFloating$1 = ({
  10297. middleware,
  10298. placement,
  10299. strategy
  10300. }) => {
  10301. const referenceRef = vue.ref();
  10302. const contentRef = vue.ref();
  10303. const x = vue.ref();
  10304. const y = vue.ref();
  10305. const middlewareData = vue.ref({});
  10306. const states = {
  10307. x,
  10308. y,
  10309. placement,
  10310. strategy,
  10311. middlewareData
  10312. };
  10313. const update = async () => {
  10314. if (!isClient)
  10315. return;
  10316. const referenceEl = unrefReference(referenceRef);
  10317. const contentEl = unrefElement(contentRef);
  10318. if (!referenceEl || !contentEl)
  10319. return;
  10320. const data = await computePosition(referenceEl, contentEl, {
  10321. placement: vue.unref(placement),
  10322. strategy: vue.unref(strategy),
  10323. middleware: vue.unref(middleware)
  10324. });
  10325. keysOf(states).forEach((key) => {
  10326. states[key].value = data[key];
  10327. });
  10328. };
  10329. vue.onMounted(() => {
  10330. vue.watchEffect(() => {
  10331. update();
  10332. });
  10333. });
  10334. return {
  10335. ...states,
  10336. update,
  10337. referenceRef,
  10338. contentRef
  10339. };
  10340. };
  10341. const arrowMiddleware = ({
  10342. arrowRef,
  10343. padding
  10344. }) => {
  10345. return {
  10346. name: "arrow",
  10347. options: {
  10348. element: arrowRef,
  10349. padding
  10350. },
  10351. fn(args) {
  10352. const arrowEl = vue.unref(arrowRef);
  10353. if (!arrowEl)
  10354. return {};
  10355. return arrow({
  10356. element: arrowEl,
  10357. padding
  10358. }).fn(args);
  10359. }
  10360. };
  10361. };
  10362. function useCursor(input) {
  10363. let selectionInfo;
  10364. function recordCursor() {
  10365. if (input.value == void 0)
  10366. return;
  10367. const { selectionStart, selectionEnd, value } = input.value;
  10368. if (selectionStart == null || selectionEnd == null)
  10369. return;
  10370. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10371. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10372. selectionInfo = {
  10373. selectionStart,
  10374. selectionEnd,
  10375. value,
  10376. beforeTxt,
  10377. afterTxt
  10378. };
  10379. }
  10380. function setCursor() {
  10381. if (input.value == void 0 || selectionInfo == void 0)
  10382. return;
  10383. const { value } = input.value;
  10384. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  10385. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10386. return;
  10387. let startPos = value.length;
  10388. if (value.endsWith(afterTxt)) {
  10389. startPos = value.length - afterTxt.length;
  10390. } else if (value.startsWith(beforeTxt)) {
  10391. startPos = beforeTxt.length;
  10392. } else {
  10393. const beforeLastChar = beforeTxt[selectionStart - 1];
  10394. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10395. if (newIndex !== -1) {
  10396. startPos = newIndex + 1;
  10397. }
  10398. }
  10399. input.value.setSelectionRange(startPos, startPos);
  10400. }
  10401. return [recordCursor, setCursor];
  10402. }
  10403. const getOrderedChildren = (vm, childComponentName, children) => {
  10404. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10405. var _a;
  10406. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10407. });
  10408. const uids = nodes.map((n) => n.component.uid);
  10409. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10410. };
  10411. const useOrderedChildren = (vm, childComponentName) => {
  10412. const children = {};
  10413. const orderedChildren = vue.shallowRef([]);
  10414. const addChild = (child) => {
  10415. children[child.uid] = child;
  10416. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10417. };
  10418. const removeChild = (uid) => {
  10419. delete children[uid];
  10420. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10421. };
  10422. return {
  10423. children: orderedChildren,
  10424. addChild,
  10425. removeChild
  10426. };
  10427. };
  10428. const useSizeProp = buildProp({
  10429. type: String,
  10430. values: componentSizes,
  10431. required: false
  10432. });
  10433. const useSizeProps = {
  10434. size: useSizeProp
  10435. };
  10436. const SIZE_INJECTION_KEY = Symbol("size");
  10437. const useGlobalSize = () => {
  10438. const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
  10439. return vue.computed(() => {
  10440. return vue.unref(injectedSize.size) || "";
  10441. });
  10442. };
  10443. function useFocusController(target, {
  10444. beforeFocus,
  10445. afterFocus,
  10446. beforeBlur,
  10447. afterBlur
  10448. } = {}) {
  10449. const instance = vue.getCurrentInstance();
  10450. const { emit } = instance;
  10451. const wrapperRef = vue.shallowRef();
  10452. const disabled = useProp("disabled");
  10453. const isFocused = vue.ref(false);
  10454. const handleFocus = (event) => {
  10455. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  10456. if (cancelFocus || isFocused.value)
  10457. return;
  10458. isFocused.value = true;
  10459. emit("focus", event);
  10460. afterFocus == null ? void 0 : afterFocus();
  10461. };
  10462. const handleBlur = (event) => {
  10463. var _a;
  10464. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  10465. if (cancelBlur || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)))
  10466. return;
  10467. isFocused.value = false;
  10468. emit("blur", event);
  10469. afterBlur == null ? void 0 : afterBlur();
  10470. };
  10471. const handleClick = () => {
  10472. var _a, _b;
  10473. if (((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement || disabled.value)
  10474. return;
  10475. (_b = target.value) == null ? void 0 : _b.focus();
  10476. };
  10477. vue.watch([wrapperRef, disabled], ([el, disabled2]) => {
  10478. if (!el)
  10479. return;
  10480. if (disabled2) {
  10481. el.removeAttribute("tabindex");
  10482. } else {
  10483. el.setAttribute("tabindex", "-1");
  10484. }
  10485. });
  10486. useEventListener(wrapperRef, "focus", handleFocus, true);
  10487. useEventListener(wrapperRef, "blur", handleBlur, true);
  10488. useEventListener(wrapperRef, "click", handleClick, true);
  10489. return {
  10490. isFocused,
  10491. wrapperRef,
  10492. handleFocus,
  10493. handleBlur
  10494. };
  10495. }
  10496. function useComposition({
  10497. afterComposition,
  10498. emit
  10499. }) {
  10500. const isComposing = vue.ref(false);
  10501. const handleCompositionStart = (event) => {
  10502. emit == null ? void 0 : emit("compositionstart", event);
  10503. isComposing.value = true;
  10504. };
  10505. const handleCompositionUpdate = (event) => {
  10506. var _a;
  10507. emit == null ? void 0 : emit("compositionupdate", event);
  10508. const text = (_a = event.target) == null ? void 0 : _a.value;
  10509. const lastCharacter = text[text.length - 1] || "";
  10510. isComposing.value = !isKorean(lastCharacter);
  10511. };
  10512. const handleCompositionEnd = (event) => {
  10513. emit == null ? void 0 : emit("compositionend", event);
  10514. if (isComposing.value) {
  10515. isComposing.value = false;
  10516. vue.nextTick(() => afterComposition(event));
  10517. }
  10518. };
  10519. const handleComposition = (event) => {
  10520. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  10521. };
  10522. return {
  10523. isComposing,
  10524. handleComposition,
  10525. handleCompositionStart,
  10526. handleCompositionUpdate,
  10527. handleCompositionEnd
  10528. };
  10529. }
  10530. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  10531. const SCOPE$3 = "use-empty-values";
  10532. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  10533. const DEFAULT_VALUE_ON_CLEAR = void 0;
  10534. const useEmptyValuesProps = buildProps({
  10535. emptyValues: Array,
  10536. valueOnClear: {
  10537. type: [String, Number, Boolean, Function],
  10538. default: void 0,
  10539. validator: (val) => isFunction$1(val) ? !val() : !val
  10540. }
  10541. });
  10542. const useEmptyValues = (props, defaultValue) => {
  10543. const config = vue.getCurrentInstance() ? vue.inject(emptyValuesContextKey, vue.ref({})) : vue.ref({});
  10544. const emptyValues = vue.computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  10545. const valueOnClear = vue.computed(() => {
  10546. if (isFunction$1(props.valueOnClear)) {
  10547. return props.valueOnClear();
  10548. } else if (props.valueOnClear !== void 0) {
  10549. return props.valueOnClear;
  10550. } else if (isFunction$1(config.value.valueOnClear)) {
  10551. return config.value.valueOnClear();
  10552. } else if (config.value.valueOnClear !== void 0) {
  10553. return config.value.valueOnClear;
  10554. }
  10555. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  10556. });
  10557. const isEmptyValue = (value) => {
  10558. return emptyValues.value.includes(value);
  10559. };
  10560. if (!emptyValues.value.includes(valueOnClear.value)) ;
  10561. return {
  10562. emptyValues,
  10563. valueOnClear,
  10564. isEmptyValue
  10565. };
  10566. };
  10567. const ariaProps = buildProps({
  10568. ariaLabel: String,
  10569. ariaOrientation: {
  10570. type: String,
  10571. values: ["horizontal", "vertical", "undefined"]
  10572. },
  10573. ariaControls: String
  10574. });
  10575. const useAriaProps = (arias) => {
  10576. return pick(ariaProps, arias);
  10577. };
  10578. const configProviderContextKey = Symbol();
  10579. const globalConfig = vue.ref();
  10580. function useGlobalConfig(key, defaultValue = void 0) {
  10581. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  10582. if (key) {
  10583. return vue.computed(() => {
  10584. var _a, _b;
  10585. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  10586. });
  10587. } else {
  10588. return config;
  10589. }
  10590. }
  10591. function useGlobalComponentSettings(block, sizeFallback) {
  10592. const config = useGlobalConfig();
  10593. const ns = useNamespace(block, vue.computed(() => {
  10594. var _a;
  10595. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  10596. }));
  10597. const locale = useLocale(vue.computed(() => {
  10598. var _a;
  10599. return (_a = config.value) == null ? void 0 : _a.locale;
  10600. }));
  10601. const zIndex = useZIndex(vue.computed(() => {
  10602. var _a;
  10603. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  10604. }));
  10605. const size = vue.computed(() => {
  10606. var _a;
  10607. return vue.unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  10608. });
  10609. provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
  10610. return {
  10611. ns,
  10612. locale,
  10613. zIndex,
  10614. size
  10615. };
  10616. }
  10617. const provideGlobalConfig = (config, app, global = false) => {
  10618. var _a;
  10619. const inSetup = !!vue.getCurrentInstance();
  10620. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10621. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  10622. if (!provideFn) {
  10623. return;
  10624. }
  10625. const context = vue.computed(() => {
  10626. const cfg = vue.unref(config);
  10627. if (!(oldConfig == null ? void 0 : oldConfig.value))
  10628. return cfg;
  10629. return mergeConfig(oldConfig.value, cfg);
  10630. });
  10631. provideFn(configProviderContextKey, context);
  10632. provideFn(localeContextKey, vue.computed(() => context.value.locale));
  10633. provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
  10634. provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
  10635. provideFn(SIZE_INJECTION_KEY, {
  10636. size: vue.computed(() => context.value.size || "")
  10637. });
  10638. provideFn(emptyValuesContextKey, vue.computed(() => ({
  10639. emptyValues: context.value.emptyValues,
  10640. valueOnClear: context.value.valueOnClear
  10641. })));
  10642. if (global || !globalConfig.value) {
  10643. globalConfig.value = context.value;
  10644. }
  10645. return context;
  10646. };
  10647. const mergeConfig = (a, b) => {
  10648. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  10649. const obj = {};
  10650. for (const key of keys) {
  10651. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  10652. }
  10653. return obj;
  10654. };
  10655. const configProviderProps = buildProps({
  10656. a11y: {
  10657. type: Boolean,
  10658. default: true
  10659. },
  10660. locale: {
  10661. type: definePropType(Object)
  10662. },
  10663. size: useSizeProp,
  10664. button: {
  10665. type: definePropType(Object)
  10666. },
  10667. experimentalFeatures: {
  10668. type: definePropType(Object)
  10669. },
  10670. keyboardNavigation: {
  10671. type: Boolean,
  10672. default: true
  10673. },
  10674. message: {
  10675. type: definePropType(Object)
  10676. },
  10677. zIndex: Number,
  10678. namespace: {
  10679. type: String,
  10680. default: "el"
  10681. },
  10682. ...useEmptyValuesProps
  10683. });
  10684. const messageConfig = {};
  10685. const ConfigProvider = vue.defineComponent({
  10686. name: "ElConfigProvider",
  10687. props: configProviderProps,
  10688. setup(props, { slots }) {
  10689. vue.watch(() => props.message, (val) => {
  10690. Object.assign(messageConfig, val != null ? val : {});
  10691. }, { immediate: true, deep: true });
  10692. const config = provideGlobalConfig(props);
  10693. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  10694. }
  10695. });
  10696. const ElConfigProvider = withInstall(ConfigProvider);
  10697. const version$1 = "2.9.8";
  10698. const makeInstaller = (components = []) => {
  10699. const install = (app, options) => {
  10700. if (app[INSTALLED_KEY])
  10701. return;
  10702. app[INSTALLED_KEY] = true;
  10703. components.forEach((c) => app.use(c));
  10704. if (options)
  10705. provideGlobalConfig(options, app, true);
  10706. };
  10707. return {
  10708. version: version$1,
  10709. install
  10710. };
  10711. };
  10712. const affixProps = buildProps({
  10713. zIndex: {
  10714. type: definePropType([Number, String]),
  10715. default: 100
  10716. },
  10717. target: {
  10718. type: String,
  10719. default: ""
  10720. },
  10721. offset: {
  10722. type: Number,
  10723. default: 0
  10724. },
  10725. position: {
  10726. type: String,
  10727. values: ["top", "bottom"],
  10728. default: "top"
  10729. }
  10730. });
  10731. const affixEmits = {
  10732. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10733. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10734. };
  10735. var _export_sfc = (sfc, props) => {
  10736. const target = sfc.__vccOpts || sfc;
  10737. for (const [key, val] of props) {
  10738. target[key] = val;
  10739. }
  10740. return target;
  10741. };
  10742. const COMPONENT_NAME$p = "ElAffix";
  10743. const __default__$1U = vue.defineComponent({
  10744. name: COMPONENT_NAME$p
  10745. });
  10746. const _sfc_main$2x = /* @__PURE__ */ vue.defineComponent({
  10747. ...__default__$1U,
  10748. props: affixProps,
  10749. emits: affixEmits,
  10750. setup(__props, { expose, emit }) {
  10751. const props = __props;
  10752. const ns = useNamespace("affix");
  10753. const target = vue.shallowRef();
  10754. const root = vue.shallowRef();
  10755. const scrollContainer = vue.shallowRef();
  10756. const { height: windowHeight } = useWindowSize();
  10757. const {
  10758. height: rootHeight,
  10759. width: rootWidth,
  10760. top: rootTop,
  10761. bottom: rootBottom,
  10762. update: updateRoot
  10763. } = useElementBounding(root, { windowScroll: false });
  10764. const targetRect = useElementBounding(target);
  10765. const fixed = vue.ref(false);
  10766. const scrollTop = vue.ref(0);
  10767. const transform = vue.ref(0);
  10768. const rootStyle = vue.computed(() => {
  10769. return {
  10770. height: fixed.value ? `${rootHeight.value}px` : "",
  10771. width: fixed.value ? `${rootWidth.value}px` : ""
  10772. };
  10773. });
  10774. const affixStyle = vue.computed(() => {
  10775. if (!fixed.value)
  10776. return {};
  10777. const offset = props.offset ? addUnit(props.offset) : 0;
  10778. return {
  10779. height: `${rootHeight.value}px`,
  10780. width: `${rootWidth.value}px`,
  10781. top: props.position === "top" ? offset : "",
  10782. bottom: props.position === "bottom" ? offset : "",
  10783. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10784. zIndex: props.zIndex
  10785. };
  10786. });
  10787. const update = () => {
  10788. if (!scrollContainer.value)
  10789. return;
  10790. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10791. const { position, target: target2, offset } = props;
  10792. const rootHeightOffset = offset + rootHeight.value;
  10793. if (position === "top") {
  10794. if (target2) {
  10795. const difference = targetRect.bottom.value - rootHeightOffset;
  10796. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  10797. transform.value = difference < 0 ? difference : 0;
  10798. } else {
  10799. fixed.value = offset > rootTop.value;
  10800. }
  10801. } else if (target2) {
  10802. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  10803. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10804. transform.value = difference < 0 ? -difference : 0;
  10805. } else {
  10806. fixed.value = windowHeight.value - offset < rootBottom.value;
  10807. }
  10808. };
  10809. const handleScroll = async () => {
  10810. updateRoot();
  10811. await vue.nextTick();
  10812. emit("scroll", {
  10813. scrollTop: scrollTop.value,
  10814. fixed: fixed.value
  10815. });
  10816. };
  10817. vue.watch(fixed, (val) => emit(CHANGE_EVENT, val));
  10818. vue.onMounted(() => {
  10819. var _a;
  10820. if (props.target) {
  10821. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10822. if (!target.value)
  10823. throwError(COMPONENT_NAME$p, `Target does not exist: ${props.target}`);
  10824. } else {
  10825. target.value = document.documentElement;
  10826. }
  10827. scrollContainer.value = getScrollContainer(root.value, true);
  10828. updateRoot();
  10829. });
  10830. useEventListener(scrollContainer, "scroll", handleScroll);
  10831. vue.watchEffect(update);
  10832. expose({
  10833. update,
  10834. updateRoot
  10835. });
  10836. return (_ctx, _cache) => {
  10837. return vue.openBlock(), vue.createElementBlock("div", {
  10838. ref_key: "root",
  10839. ref: root,
  10840. class: vue.normalizeClass(vue.unref(ns).b()),
  10841. style: vue.normalizeStyle(vue.unref(rootStyle))
  10842. }, [
  10843. vue.createElementVNode("div", {
  10844. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  10845. style: vue.normalizeStyle(vue.unref(affixStyle))
  10846. }, [
  10847. vue.renderSlot(_ctx.$slots, "default")
  10848. ], 6)
  10849. ], 6);
  10850. };
  10851. }
  10852. });
  10853. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2x, [["__file", "affix.vue"]]);
  10854. const ElAffix = withInstall(Affix);
  10855. const iconProps = buildProps({
  10856. size: {
  10857. type: definePropType([Number, String])
  10858. },
  10859. color: {
  10860. type: String
  10861. }
  10862. });
  10863. const __default__$1T = vue.defineComponent({
  10864. name: "ElIcon",
  10865. inheritAttrs: false
  10866. });
  10867. const _sfc_main$2w = /* @__PURE__ */ vue.defineComponent({
  10868. ...__default__$1T,
  10869. props: iconProps,
  10870. setup(__props) {
  10871. const props = __props;
  10872. const ns = useNamespace("icon");
  10873. const style = vue.computed(() => {
  10874. const { size, color } = props;
  10875. if (!size && !color)
  10876. return {};
  10877. return {
  10878. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10879. "--color": color
  10880. };
  10881. });
  10882. return (_ctx, _cache) => {
  10883. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  10884. class: vue.unref(ns).b(),
  10885. style: vue.unref(style)
  10886. }, _ctx.$attrs), [
  10887. vue.renderSlot(_ctx.$slots, "default")
  10888. ], 16);
  10889. };
  10890. }
  10891. });
  10892. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__file", "icon.vue"]]);
  10893. const ElIcon = withInstall(Icon);
  10894. const alertEffects = ["light", "dark"];
  10895. const alertProps = buildProps({
  10896. title: {
  10897. type: String,
  10898. default: ""
  10899. },
  10900. description: {
  10901. type: String,
  10902. default: ""
  10903. },
  10904. type: {
  10905. type: String,
  10906. values: keysOf(TypeComponentsMap),
  10907. default: "info"
  10908. },
  10909. closable: {
  10910. type: Boolean,
  10911. default: true
  10912. },
  10913. closeText: {
  10914. type: String,
  10915. default: ""
  10916. },
  10917. showIcon: Boolean,
  10918. center: Boolean,
  10919. effect: {
  10920. type: String,
  10921. values: alertEffects,
  10922. default: "light"
  10923. }
  10924. });
  10925. const alertEmits = {
  10926. close: (evt) => evt instanceof MouseEvent
  10927. };
  10928. const __default__$1S = vue.defineComponent({
  10929. name: "ElAlert"
  10930. });
  10931. const _sfc_main$2v = /* @__PURE__ */ vue.defineComponent({
  10932. ...__default__$1S,
  10933. props: alertProps,
  10934. emits: alertEmits,
  10935. setup(__props, { emit }) {
  10936. const props = __props;
  10937. const { Close } = TypeComponents;
  10938. const slots = vue.useSlots();
  10939. const ns = useNamespace("alert");
  10940. const visible = vue.ref(true);
  10941. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  10942. const hasDesc = vue.computed(() => !!(props.description || slots.default));
  10943. const close = (evt) => {
  10944. visible.value = false;
  10945. emit("close", evt);
  10946. };
  10947. return (_ctx, _cache) => {
  10948. return vue.openBlock(), vue.createBlock(vue.Transition, {
  10949. name: vue.unref(ns).b("fade"),
  10950. persisted: ""
  10951. }, {
  10952. default: vue.withCtx(() => [
  10953. vue.withDirectives(vue.createElementVNode("div", {
  10954. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.type), vue.unref(ns).is("center", _ctx.center), vue.unref(ns).is(_ctx.effect)]),
  10955. role: "alert"
  10956. }, [
  10957. _ctx.showIcon && (_ctx.$slots.icon || vue.unref(iconComponent)) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10958. key: 0,
  10959. class: vue.normalizeClass([vue.unref(ns).e("icon"), { [vue.unref(ns).is("big")]: vue.unref(hasDesc) }])
  10960. }, {
  10961. default: vue.withCtx(() => [
  10962. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  10963. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  10964. ])
  10965. ]),
  10966. _: 3
  10967. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  10968. vue.createElementVNode("div", {
  10969. class: vue.normalizeClass(vue.unref(ns).e("content"))
  10970. }, [
  10971. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  10972. key: 0,
  10973. class: vue.normalizeClass([vue.unref(ns).e("title"), { "with-description": vue.unref(hasDesc) }])
  10974. }, [
  10975. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  10976. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  10977. ])
  10978. ], 2)) : vue.createCommentVNode("v-if", true),
  10979. vue.unref(hasDesc) ? (vue.openBlock(), vue.createElementBlock("p", {
  10980. key: 1,
  10981. class: vue.normalizeClass(vue.unref(ns).e("description"))
  10982. }, [
  10983. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  10984. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  10985. ])
  10986. ], 2)) : vue.createCommentVNode("v-if", true),
  10987. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  10988. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  10989. key: 0,
  10990. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  10991. onClick: close
  10992. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10993. key: 1,
  10994. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  10995. onClick: close
  10996. }, {
  10997. default: vue.withCtx(() => [
  10998. vue.createVNode(vue.unref(Close))
  10999. ]),
  11000. _: 1
  11001. }, 8, ["class"]))
  11002. ], 64)) : vue.createCommentVNode("v-if", true)
  11003. ], 2)
  11004. ], 2), [
  11005. [vue.vShow, visible.value]
  11006. ])
  11007. ]),
  11008. _: 3
  11009. }, 8, ["name"]);
  11010. };
  11011. }
  11012. });
  11013. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2v, [["__file", "alert.vue"]]);
  11014. const ElAlert = withInstall(Alert);
  11015. const formContextKey = Symbol("formContextKey");
  11016. const formItemContextKey = Symbol("formItemContextKey");
  11017. const useFormSize = (fallback, ignore = {}) => {
  11018. const emptyRef = vue.ref(void 0);
  11019. const size = ignore.prop ? emptyRef : useProp("size");
  11020. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  11021. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  11022. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  11023. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  11024. };
  11025. const useFormDisabled = (fallback) => {
  11026. const disabled = useProp("disabled");
  11027. const form = vue.inject(formContextKey, void 0);
  11028. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  11029. };
  11030. const useSize = useFormSize;
  11031. const useDisabled = useFormDisabled;
  11032. const useFormItem = () => {
  11033. const form = vue.inject(formContextKey, void 0);
  11034. const formItem = vue.inject(formItemContextKey, void 0);
  11035. return {
  11036. form,
  11037. formItem
  11038. };
  11039. };
  11040. const useFormItemInputId = (props, {
  11041. formItemContext,
  11042. disableIdGeneration,
  11043. disableIdManagement
  11044. }) => {
  11045. if (!disableIdGeneration) {
  11046. disableIdGeneration = vue.ref(false);
  11047. }
  11048. if (!disableIdManagement) {
  11049. disableIdManagement = vue.ref(false);
  11050. }
  11051. const inputId = vue.ref();
  11052. let idUnwatch = void 0;
  11053. const isLabeledByFormItem = vue.computed(() => {
  11054. var _a;
  11055. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  11056. });
  11057. vue.onMounted(() => {
  11058. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  11059. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  11060. if (newId !== inputId.value) {
  11061. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11062. inputId.value && formItemContext.removeInputId(inputId.value);
  11063. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  11064. formItemContext.addInputId(newId);
  11065. }
  11066. }
  11067. inputId.value = newId;
  11068. }
  11069. }, { immediate: true });
  11070. });
  11071. vue.onUnmounted(() => {
  11072. idUnwatch && idUnwatch();
  11073. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11074. inputId.value && formItemContext.removeInputId(inputId.value);
  11075. }
  11076. });
  11077. return {
  11078. isLabeledByFormItem,
  11079. inputId
  11080. };
  11081. };
  11082. const formMetaProps = buildProps({
  11083. size: {
  11084. type: String,
  11085. values: componentSizes
  11086. },
  11087. disabled: Boolean
  11088. });
  11089. const formProps = buildProps({
  11090. ...formMetaProps,
  11091. model: Object,
  11092. rules: {
  11093. type: definePropType(Object)
  11094. },
  11095. labelPosition: {
  11096. type: String,
  11097. values: ["left", "right", "top"],
  11098. default: "right"
  11099. },
  11100. requireAsteriskPosition: {
  11101. type: String,
  11102. values: ["left", "right"],
  11103. default: "left"
  11104. },
  11105. labelWidth: {
  11106. type: [String, Number],
  11107. default: ""
  11108. },
  11109. labelSuffix: {
  11110. type: String,
  11111. default: ""
  11112. },
  11113. inline: Boolean,
  11114. inlineMessage: Boolean,
  11115. statusIcon: Boolean,
  11116. showMessage: {
  11117. type: Boolean,
  11118. default: true
  11119. },
  11120. validateOnRuleChange: {
  11121. type: Boolean,
  11122. default: true
  11123. },
  11124. hideRequiredAsterisk: Boolean,
  11125. scrollToError: Boolean,
  11126. scrollIntoViewOptions: {
  11127. type: [Object, Boolean]
  11128. }
  11129. });
  11130. const formEmits = {
  11131. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  11132. };
  11133. function useFormLabelWidth() {
  11134. const potentialLabelWidthArr = vue.ref([]);
  11135. const autoLabelWidth = vue.computed(() => {
  11136. if (!potentialLabelWidthArr.value.length)
  11137. return "0";
  11138. const max = Math.max(...potentialLabelWidthArr.value);
  11139. return max ? `${max}px` : "";
  11140. });
  11141. function getLabelWidthIndex(width) {
  11142. const index = potentialLabelWidthArr.value.indexOf(width);
  11143. if (index === -1 && autoLabelWidth.value === "0") ;
  11144. return index;
  11145. }
  11146. function registerLabelWidth(val, oldVal) {
  11147. if (val && oldVal) {
  11148. const index = getLabelWidthIndex(oldVal);
  11149. potentialLabelWidthArr.value.splice(index, 1, val);
  11150. } else if (val) {
  11151. potentialLabelWidthArr.value.push(val);
  11152. }
  11153. }
  11154. function deregisterLabelWidth(val) {
  11155. const index = getLabelWidthIndex(val);
  11156. if (index > -1) {
  11157. potentialLabelWidthArr.value.splice(index, 1);
  11158. }
  11159. }
  11160. return {
  11161. autoLabelWidth,
  11162. registerLabelWidth,
  11163. deregisterLabelWidth
  11164. };
  11165. }
  11166. const filterFields = (fields, props) => {
  11167. const normalized = castArray$1(props);
  11168. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  11169. };
  11170. const COMPONENT_NAME$o = "ElForm";
  11171. const __default__$1R = vue.defineComponent({
  11172. name: COMPONENT_NAME$o
  11173. });
  11174. const _sfc_main$2u = /* @__PURE__ */ vue.defineComponent({
  11175. ...__default__$1R,
  11176. props: formProps,
  11177. emits: formEmits,
  11178. setup(__props, { expose, emit }) {
  11179. const props = __props;
  11180. const fields = [];
  11181. const formSize = useFormSize();
  11182. const ns = useNamespace("form");
  11183. const formClasses = vue.computed(() => {
  11184. const { labelPosition, inline } = props;
  11185. return [
  11186. ns.b(),
  11187. ns.m(formSize.value || "default"),
  11188. {
  11189. [ns.m(`label-${labelPosition}`)]: labelPosition,
  11190. [ns.m("inline")]: inline
  11191. }
  11192. ];
  11193. });
  11194. const getField = (prop) => {
  11195. return fields.find((field) => field.prop === prop);
  11196. };
  11197. const addField = (field) => {
  11198. fields.push(field);
  11199. };
  11200. const removeField = (field) => {
  11201. if (field.prop) {
  11202. fields.splice(fields.indexOf(field), 1);
  11203. }
  11204. };
  11205. const resetFields = (properties = []) => {
  11206. if (!props.model) {
  11207. return;
  11208. }
  11209. filterFields(fields, properties).forEach((field) => field.resetField());
  11210. };
  11211. const clearValidate = (props2 = []) => {
  11212. filterFields(fields, props2).forEach((field) => field.clearValidate());
  11213. };
  11214. const isValidatable = vue.computed(() => {
  11215. const hasModel = !!props.model;
  11216. return hasModel;
  11217. });
  11218. const obtainValidateFields = (props2) => {
  11219. if (fields.length === 0)
  11220. return [];
  11221. const filteredFields = filterFields(fields, props2);
  11222. if (!filteredFields.length) {
  11223. return [];
  11224. }
  11225. return filteredFields;
  11226. };
  11227. const validate = async (callback) => validateField(void 0, callback);
  11228. const doValidateField = async (props2 = []) => {
  11229. if (!isValidatable.value)
  11230. return false;
  11231. const fields2 = obtainValidateFields(props2);
  11232. if (fields2.length === 0)
  11233. return true;
  11234. let validationErrors = {};
  11235. for (const field of fields2) {
  11236. try {
  11237. await field.validate("");
  11238. if (field.validateState === "error")
  11239. field.resetField();
  11240. } catch (fields3) {
  11241. validationErrors = {
  11242. ...validationErrors,
  11243. ...fields3
  11244. };
  11245. }
  11246. }
  11247. if (Object.keys(validationErrors).length === 0)
  11248. return true;
  11249. return Promise.reject(validationErrors);
  11250. };
  11251. const validateField = async (modelProps = [], callback) => {
  11252. const shouldThrow = !isFunction$1(callback);
  11253. try {
  11254. const result = await doValidateField(modelProps);
  11255. if (result === true) {
  11256. await (callback == null ? void 0 : callback(result));
  11257. }
  11258. return result;
  11259. } catch (e) {
  11260. if (e instanceof Error)
  11261. throw e;
  11262. const invalidFields = e;
  11263. if (props.scrollToError) {
  11264. scrollToField(Object.keys(invalidFields)[0]);
  11265. }
  11266. await (callback == null ? void 0 : callback(false, invalidFields));
  11267. return shouldThrow && Promise.reject(invalidFields);
  11268. }
  11269. };
  11270. const scrollToField = (prop) => {
  11271. var _a;
  11272. const field = filterFields(fields, prop)[0];
  11273. if (field) {
  11274. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  11275. }
  11276. };
  11277. vue.watch(() => props.rules, () => {
  11278. if (props.validateOnRuleChange) {
  11279. validate().catch((err) => debugWarn());
  11280. }
  11281. }, { deep: true, flush: "post" });
  11282. vue.provide(formContextKey, vue.reactive({
  11283. ...vue.toRefs(props),
  11284. emit,
  11285. resetFields,
  11286. clearValidate,
  11287. validateField,
  11288. getField,
  11289. addField,
  11290. removeField,
  11291. ...useFormLabelWidth()
  11292. }));
  11293. expose({
  11294. validate,
  11295. validateField,
  11296. resetFields,
  11297. clearValidate,
  11298. scrollToField,
  11299. fields
  11300. });
  11301. return (_ctx, _cache) => {
  11302. return vue.openBlock(), vue.createElementBlock("form", {
  11303. class: vue.normalizeClass(vue.unref(formClasses))
  11304. }, [
  11305. vue.renderSlot(_ctx.$slots, "default")
  11306. ], 2);
  11307. };
  11308. }
  11309. });
  11310. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2u, [["__file", "form.vue"]]);
  11311. function _extends() {
  11312. _extends = Object.assign ? Object.assign.bind() : function(target) {
  11313. for (var i = 1; i < arguments.length; i++) {
  11314. var source = arguments[i];
  11315. for (var key in source) {
  11316. if (Object.prototype.hasOwnProperty.call(source, key)) {
  11317. target[key] = source[key];
  11318. }
  11319. }
  11320. }
  11321. return target;
  11322. };
  11323. return _extends.apply(this, arguments);
  11324. }
  11325. function _inheritsLoose(subClass, superClass) {
  11326. subClass.prototype = Object.create(superClass.prototype);
  11327. subClass.prototype.constructor = subClass;
  11328. _setPrototypeOf(subClass, superClass);
  11329. }
  11330. function _getPrototypeOf(o) {
  11331. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  11332. return o2.__proto__ || Object.getPrototypeOf(o2);
  11333. };
  11334. return _getPrototypeOf(o);
  11335. }
  11336. function _setPrototypeOf(o, p) {
  11337. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  11338. o2.__proto__ = p2;
  11339. return o2;
  11340. };
  11341. return _setPrototypeOf(o, p);
  11342. }
  11343. function _isNativeReflectConstruct() {
  11344. if (typeof Reflect === "undefined" || !Reflect.construct)
  11345. return false;
  11346. if (Reflect.construct.sham)
  11347. return false;
  11348. if (typeof Proxy === "function")
  11349. return true;
  11350. try {
  11351. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  11352. }));
  11353. return true;
  11354. } catch (e) {
  11355. return false;
  11356. }
  11357. }
  11358. function _construct(Parent, args, Class) {
  11359. if (_isNativeReflectConstruct()) {
  11360. _construct = Reflect.construct.bind();
  11361. } else {
  11362. _construct = function _construct2(Parent2, args2, Class2) {
  11363. var a = [null];
  11364. a.push.apply(a, args2);
  11365. var Constructor = Function.bind.apply(Parent2, a);
  11366. var instance = new Constructor();
  11367. if (Class2)
  11368. _setPrototypeOf(instance, Class2.prototype);
  11369. return instance;
  11370. };
  11371. }
  11372. return _construct.apply(null, arguments);
  11373. }
  11374. function _isNativeFunction(fn) {
  11375. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11376. }
  11377. function _wrapNativeSuper(Class) {
  11378. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11379. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  11380. if (Class2 === null || !_isNativeFunction(Class2))
  11381. return Class2;
  11382. if (typeof Class2 !== "function") {
  11383. throw new TypeError("Super expression must either be null or a function");
  11384. }
  11385. if (typeof _cache !== "undefined") {
  11386. if (_cache.has(Class2))
  11387. return _cache.get(Class2);
  11388. _cache.set(Class2, Wrapper);
  11389. }
  11390. function Wrapper() {
  11391. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  11392. }
  11393. Wrapper.prototype = Object.create(Class2.prototype, {
  11394. constructor: {
  11395. value: Wrapper,
  11396. enumerable: false,
  11397. writable: true,
  11398. configurable: true
  11399. }
  11400. });
  11401. return _setPrototypeOf(Wrapper, Class2);
  11402. };
  11403. return _wrapNativeSuper(Class);
  11404. }
  11405. var formatRegExp = /%[sdj%]/g;
  11406. var warning = function warning2() {
  11407. };
  11408. if (typeof process !== "undefined" && process.env && false) {
  11409. warning = function warning3(type4, errors) {
  11410. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  11411. if (errors.every(function(e) {
  11412. return typeof e === "string";
  11413. })) {
  11414. console.warn(type4, errors);
  11415. }
  11416. }
  11417. };
  11418. }
  11419. function convertFieldsError(errors) {
  11420. if (!errors || !errors.length)
  11421. return null;
  11422. var fields = {};
  11423. errors.forEach(function(error) {
  11424. var field = error.field;
  11425. fields[field] = fields[field] || [];
  11426. fields[field].push(error);
  11427. });
  11428. return fields;
  11429. }
  11430. function format(template) {
  11431. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11432. args[_key - 1] = arguments[_key];
  11433. }
  11434. var i = 0;
  11435. var len = args.length;
  11436. if (typeof template === "function") {
  11437. return template.apply(null, args);
  11438. }
  11439. if (typeof template === "string") {
  11440. var str = template.replace(formatRegExp, function(x) {
  11441. if (x === "%%") {
  11442. return "%";
  11443. }
  11444. if (i >= len) {
  11445. return x;
  11446. }
  11447. switch (x) {
  11448. case "%s":
  11449. return String(args[i++]);
  11450. case "%d":
  11451. return Number(args[i++]);
  11452. case "%j":
  11453. try {
  11454. return JSON.stringify(args[i++]);
  11455. } catch (_) {
  11456. return "[Circular]";
  11457. }
  11458. break;
  11459. default:
  11460. return x;
  11461. }
  11462. });
  11463. return str;
  11464. }
  11465. return template;
  11466. }
  11467. function isNativeStringType(type4) {
  11468. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  11469. }
  11470. function isEmptyValue(value, type4) {
  11471. if (value === void 0 || value === null) {
  11472. return true;
  11473. }
  11474. if (type4 === "array" && Array.isArray(value) && !value.length) {
  11475. return true;
  11476. }
  11477. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  11478. return true;
  11479. }
  11480. return false;
  11481. }
  11482. function asyncParallelArray(arr, func, callback) {
  11483. var results = [];
  11484. var total = 0;
  11485. var arrLength = arr.length;
  11486. function count(errors) {
  11487. results.push.apply(results, errors || []);
  11488. total++;
  11489. if (total === arrLength) {
  11490. callback(results);
  11491. }
  11492. }
  11493. arr.forEach(function(a) {
  11494. func(a, count);
  11495. });
  11496. }
  11497. function asyncSerialArray(arr, func, callback) {
  11498. var index = 0;
  11499. var arrLength = arr.length;
  11500. function next(errors) {
  11501. if (errors && errors.length) {
  11502. callback(errors);
  11503. return;
  11504. }
  11505. var original = index;
  11506. index = index + 1;
  11507. if (original < arrLength) {
  11508. func(arr[original], next);
  11509. } else {
  11510. callback([]);
  11511. }
  11512. }
  11513. next([]);
  11514. }
  11515. function flattenObjArr(objArr) {
  11516. var ret = [];
  11517. Object.keys(objArr).forEach(function(k) {
  11518. ret.push.apply(ret, objArr[k] || []);
  11519. });
  11520. return ret;
  11521. }
  11522. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11523. _inheritsLoose(AsyncValidationError2, _Error);
  11524. function AsyncValidationError2(errors, fields) {
  11525. var _this;
  11526. _this = _Error.call(this, "Async Validation Error") || this;
  11527. _this.errors = errors;
  11528. _this.fields = fields;
  11529. return _this;
  11530. }
  11531. return AsyncValidationError2;
  11532. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11533. function asyncMap(objArr, option, func, callback, source) {
  11534. if (option.first) {
  11535. var _pending = new Promise(function(resolve, reject) {
  11536. var next = function next2(errors) {
  11537. callback(errors);
  11538. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11539. };
  11540. var flattenArr = flattenObjArr(objArr);
  11541. asyncSerialArray(flattenArr, func, next);
  11542. });
  11543. _pending["catch"](function(e) {
  11544. return e;
  11545. });
  11546. return _pending;
  11547. }
  11548. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11549. var objArrKeys = Object.keys(objArr);
  11550. var objArrLength = objArrKeys.length;
  11551. var total = 0;
  11552. var results = [];
  11553. var pending = new Promise(function(resolve, reject) {
  11554. var next = function next2(errors) {
  11555. results.push.apply(results, errors);
  11556. total++;
  11557. if (total === objArrLength) {
  11558. callback(results);
  11559. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11560. }
  11561. };
  11562. if (!objArrKeys.length) {
  11563. callback(results);
  11564. resolve(source);
  11565. }
  11566. objArrKeys.forEach(function(key) {
  11567. var arr = objArr[key];
  11568. if (firstFields.indexOf(key) !== -1) {
  11569. asyncSerialArray(arr, func, next);
  11570. } else {
  11571. asyncParallelArray(arr, func, next);
  11572. }
  11573. });
  11574. });
  11575. pending["catch"](function(e) {
  11576. return e;
  11577. });
  11578. return pending;
  11579. }
  11580. function isErrorObj(obj) {
  11581. return !!(obj && obj.message !== void 0);
  11582. }
  11583. function getValue(value, path) {
  11584. var v = value;
  11585. for (var i = 0; i < path.length; i++) {
  11586. if (v == void 0) {
  11587. return v;
  11588. }
  11589. v = v[path[i]];
  11590. }
  11591. return v;
  11592. }
  11593. function complementError(rule, source) {
  11594. return function(oe) {
  11595. var fieldValue;
  11596. if (rule.fullFields) {
  11597. fieldValue = getValue(source, rule.fullFields);
  11598. } else {
  11599. fieldValue = source[oe.field || rule.fullField];
  11600. }
  11601. if (isErrorObj(oe)) {
  11602. oe.field = oe.field || rule.fullField;
  11603. oe.fieldValue = fieldValue;
  11604. return oe;
  11605. }
  11606. return {
  11607. message: typeof oe === "function" ? oe() : oe,
  11608. fieldValue,
  11609. field: oe.field || rule.fullField
  11610. };
  11611. };
  11612. }
  11613. function deepMerge(target, source) {
  11614. if (source) {
  11615. for (var s in source) {
  11616. if (source.hasOwnProperty(s)) {
  11617. var value = source[s];
  11618. if (typeof value === "object" && typeof target[s] === "object") {
  11619. target[s] = _extends({}, target[s], value);
  11620. } else {
  11621. target[s] = value;
  11622. }
  11623. }
  11624. }
  11625. }
  11626. return target;
  11627. }
  11628. var required$1 = function required(rule, value, source, errors, options, type4) {
  11629. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  11630. errors.push(format(options.messages.required, rule.fullField));
  11631. }
  11632. };
  11633. var whitespace = function whitespace2(rule, value, source, errors, options) {
  11634. if (/^\s+$/.test(value) || value === "") {
  11635. errors.push(format(options.messages.whitespace, rule.fullField));
  11636. }
  11637. };
  11638. var urlReg;
  11639. var getUrlRegex = function() {
  11640. if (urlReg) {
  11641. return urlReg;
  11642. }
  11643. var word = "[a-fA-F\\d:]";
  11644. var b = function b2(options) {
  11645. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11646. };
  11647. 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}";
  11648. var v6seg = "[a-fA-F\\d]{1,4}";
  11649. 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();
  11650. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11651. var v4exact = new RegExp("^" + v4 + "$");
  11652. var v6exact = new RegExp("^" + v6 + "$");
  11653. var ip = function ip2(options) {
  11654. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11655. };
  11656. ip.v4 = function(options) {
  11657. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11658. };
  11659. ip.v6 = function(options) {
  11660. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11661. };
  11662. var protocol = "(?:(?:[a-z]+:)?//)";
  11663. var auth = "(?:\\S+(?::\\S*)?@)?";
  11664. var ipv4 = ip.v4().source;
  11665. var ipv6 = ip.v6().source;
  11666. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  11667. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  11668. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  11669. var port = "(?::\\d{2,5})?";
  11670. var path = '(?:[/?#][^\\s"]*)?';
  11671. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  11672. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11673. return urlReg;
  11674. };
  11675. var pattern$2 = {
  11676. 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,}))$/,
  11677. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11678. };
  11679. var types = {
  11680. integer: function integer(value) {
  11681. return types.number(value) && parseInt(value, 10) === value;
  11682. },
  11683. "float": function float(value) {
  11684. return types.number(value) && !types.integer(value);
  11685. },
  11686. array: function array(value) {
  11687. return Array.isArray(value);
  11688. },
  11689. regexp: function regexp(value) {
  11690. if (value instanceof RegExp) {
  11691. return true;
  11692. }
  11693. try {
  11694. return !!new RegExp(value);
  11695. } catch (e) {
  11696. return false;
  11697. }
  11698. },
  11699. date: function date(value) {
  11700. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11701. },
  11702. number: function number(value) {
  11703. if (isNaN(value)) {
  11704. return false;
  11705. }
  11706. return typeof value === "number";
  11707. },
  11708. object: function object(value) {
  11709. return typeof value === "object" && !types.array(value);
  11710. },
  11711. method: function method(value) {
  11712. return typeof value === "function";
  11713. },
  11714. email: function email(value) {
  11715. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11716. },
  11717. url: function url(value) {
  11718. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11719. },
  11720. hex: function hex(value) {
  11721. return typeof value === "string" && !!value.match(pattern$2.hex);
  11722. }
  11723. };
  11724. var type$1 = function type(rule, value, source, errors, options) {
  11725. if (rule.required && value === void 0) {
  11726. required$1(rule, value, source, errors, options);
  11727. return;
  11728. }
  11729. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  11730. var ruleType = rule.type;
  11731. if (custom.indexOf(ruleType) > -1) {
  11732. if (!types[ruleType](value)) {
  11733. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11734. }
  11735. } else if (ruleType && typeof value !== rule.type) {
  11736. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11737. }
  11738. };
  11739. var range = function range2(rule, value, source, errors, options) {
  11740. var len = typeof rule.len === "number";
  11741. var min = typeof rule.min === "number";
  11742. var max = typeof rule.max === "number";
  11743. var val = value;
  11744. var key = null;
  11745. var num = typeof value === "number";
  11746. var str = typeof value === "string";
  11747. var arr = Array.isArray(value);
  11748. if (num) {
  11749. key = "number";
  11750. } else if (str) {
  11751. key = "string";
  11752. } else if (arr) {
  11753. key = "array";
  11754. }
  11755. if (!key) {
  11756. return false;
  11757. }
  11758. if (arr) {
  11759. val = value.length;
  11760. }
  11761. if (str) {
  11762. val = value.length;
  11763. }
  11764. if (len) {
  11765. if (val !== rule.len) {
  11766. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  11767. }
  11768. } else if (min && !max && val < rule.min) {
  11769. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  11770. } else if (max && !min && val > rule.max) {
  11771. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  11772. } else if (min && max && (val < rule.min || val > rule.max)) {
  11773. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  11774. }
  11775. };
  11776. var ENUM$1 = "enum";
  11777. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  11778. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  11779. if (rule[ENUM$1].indexOf(value) === -1) {
  11780. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  11781. }
  11782. };
  11783. var pattern$1 = function pattern(rule, value, source, errors, options) {
  11784. if (rule.pattern) {
  11785. if (rule.pattern instanceof RegExp) {
  11786. rule.pattern.lastIndex = 0;
  11787. if (!rule.pattern.test(value)) {
  11788. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11789. }
  11790. } else if (typeof rule.pattern === "string") {
  11791. var _pattern = new RegExp(rule.pattern);
  11792. if (!_pattern.test(value)) {
  11793. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11794. }
  11795. }
  11796. }
  11797. };
  11798. var rules = {
  11799. required: required$1,
  11800. whitespace,
  11801. type: type$1,
  11802. range,
  11803. "enum": enumerable$1,
  11804. pattern: pattern$1
  11805. };
  11806. var string = function string2(rule, value, callback, source, options) {
  11807. var errors = [];
  11808. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11809. if (validate) {
  11810. if (isEmptyValue(value, "string") && !rule.required) {
  11811. return callback();
  11812. }
  11813. rules.required(rule, value, source, errors, options, "string");
  11814. if (!isEmptyValue(value, "string")) {
  11815. rules.type(rule, value, source, errors, options);
  11816. rules.range(rule, value, source, errors, options);
  11817. rules.pattern(rule, value, source, errors, options);
  11818. if (rule.whitespace === true) {
  11819. rules.whitespace(rule, value, source, errors, options);
  11820. }
  11821. }
  11822. }
  11823. callback(errors);
  11824. };
  11825. var method2 = function method3(rule, value, callback, source, options) {
  11826. var errors = [];
  11827. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11828. if (validate) {
  11829. if (isEmptyValue(value) && !rule.required) {
  11830. return callback();
  11831. }
  11832. rules.required(rule, value, source, errors, options);
  11833. if (value !== void 0) {
  11834. rules.type(rule, value, source, errors, options);
  11835. }
  11836. }
  11837. callback(errors);
  11838. };
  11839. var number2 = function number3(rule, value, callback, source, options) {
  11840. var errors = [];
  11841. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11842. if (validate) {
  11843. if (value === "") {
  11844. value = void 0;
  11845. }
  11846. if (isEmptyValue(value) && !rule.required) {
  11847. return callback();
  11848. }
  11849. rules.required(rule, value, source, errors, options);
  11850. if (value !== void 0) {
  11851. rules.type(rule, value, source, errors, options);
  11852. rules.range(rule, value, source, errors, options);
  11853. }
  11854. }
  11855. callback(errors);
  11856. };
  11857. var _boolean = function _boolean2(rule, value, callback, source, options) {
  11858. var errors = [];
  11859. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11860. if (validate) {
  11861. if (isEmptyValue(value) && !rule.required) {
  11862. return callback();
  11863. }
  11864. rules.required(rule, value, source, errors, options);
  11865. if (value !== void 0) {
  11866. rules.type(rule, value, source, errors, options);
  11867. }
  11868. }
  11869. callback(errors);
  11870. };
  11871. var regexp2 = function regexp3(rule, value, callback, source, options) {
  11872. var errors = [];
  11873. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11874. if (validate) {
  11875. if (isEmptyValue(value) && !rule.required) {
  11876. return callback();
  11877. }
  11878. rules.required(rule, value, source, errors, options);
  11879. if (!isEmptyValue(value)) {
  11880. rules.type(rule, value, source, errors, options);
  11881. }
  11882. }
  11883. callback(errors);
  11884. };
  11885. var integer2 = function integer3(rule, value, callback, source, options) {
  11886. var errors = [];
  11887. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11888. if (validate) {
  11889. if (isEmptyValue(value) && !rule.required) {
  11890. return callback();
  11891. }
  11892. rules.required(rule, value, source, errors, options);
  11893. if (value !== void 0) {
  11894. rules.type(rule, value, source, errors, options);
  11895. rules.range(rule, value, source, errors, options);
  11896. }
  11897. }
  11898. callback(errors);
  11899. };
  11900. var floatFn = function floatFn2(rule, value, callback, source, options) {
  11901. var errors = [];
  11902. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11903. if (validate) {
  11904. if (isEmptyValue(value) && !rule.required) {
  11905. return callback();
  11906. }
  11907. rules.required(rule, value, source, errors, options);
  11908. if (value !== void 0) {
  11909. rules.type(rule, value, source, errors, options);
  11910. rules.range(rule, value, source, errors, options);
  11911. }
  11912. }
  11913. callback(errors);
  11914. };
  11915. var array2 = function array3(rule, value, callback, source, options) {
  11916. var errors = [];
  11917. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11918. if (validate) {
  11919. if ((value === void 0 || value === null) && !rule.required) {
  11920. return callback();
  11921. }
  11922. rules.required(rule, value, source, errors, options, "array");
  11923. if (value !== void 0 && value !== null) {
  11924. rules.type(rule, value, source, errors, options);
  11925. rules.range(rule, value, source, errors, options);
  11926. }
  11927. }
  11928. callback(errors);
  11929. };
  11930. var object2 = function object3(rule, value, callback, source, options) {
  11931. var errors = [];
  11932. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11933. if (validate) {
  11934. if (isEmptyValue(value) && !rule.required) {
  11935. return callback();
  11936. }
  11937. rules.required(rule, value, source, errors, options);
  11938. if (value !== void 0) {
  11939. rules.type(rule, value, source, errors, options);
  11940. }
  11941. }
  11942. callback(errors);
  11943. };
  11944. var ENUM = "enum";
  11945. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  11946. var errors = [];
  11947. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11948. if (validate) {
  11949. if (isEmptyValue(value) && !rule.required) {
  11950. return callback();
  11951. }
  11952. rules.required(rule, value, source, errors, options);
  11953. if (value !== void 0) {
  11954. rules[ENUM](rule, value, source, errors, options);
  11955. }
  11956. }
  11957. callback(errors);
  11958. };
  11959. var pattern2 = function pattern3(rule, value, callback, source, options) {
  11960. var errors = [];
  11961. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11962. if (validate) {
  11963. if (isEmptyValue(value, "string") && !rule.required) {
  11964. return callback();
  11965. }
  11966. rules.required(rule, value, source, errors, options);
  11967. if (!isEmptyValue(value, "string")) {
  11968. rules.pattern(rule, value, source, errors, options);
  11969. }
  11970. }
  11971. callback(errors);
  11972. };
  11973. var date2 = function date3(rule, value, callback, source, options) {
  11974. var errors = [];
  11975. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11976. if (validate) {
  11977. if (isEmptyValue(value, "date") && !rule.required) {
  11978. return callback();
  11979. }
  11980. rules.required(rule, value, source, errors, options);
  11981. if (!isEmptyValue(value, "date")) {
  11982. var dateObject;
  11983. if (value instanceof Date) {
  11984. dateObject = value;
  11985. } else {
  11986. dateObject = new Date(value);
  11987. }
  11988. rules.type(rule, dateObject, source, errors, options);
  11989. if (dateObject) {
  11990. rules.range(rule, dateObject.getTime(), source, errors, options);
  11991. }
  11992. }
  11993. }
  11994. callback(errors);
  11995. };
  11996. var required2 = function required3(rule, value, callback, source, options) {
  11997. var errors = [];
  11998. var type4 = Array.isArray(value) ? "array" : typeof value;
  11999. rules.required(rule, value, source, errors, options, type4);
  12000. callback(errors);
  12001. };
  12002. var type2 = function type3(rule, value, callback, source, options) {
  12003. var ruleType = rule.type;
  12004. var errors = [];
  12005. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12006. if (validate) {
  12007. if (isEmptyValue(value, ruleType) && !rule.required) {
  12008. return callback();
  12009. }
  12010. rules.required(rule, value, source, errors, options, ruleType);
  12011. if (!isEmptyValue(value, ruleType)) {
  12012. rules.type(rule, value, source, errors, options);
  12013. }
  12014. }
  12015. callback(errors);
  12016. };
  12017. var any = function any2(rule, value, callback, source, options) {
  12018. var errors = [];
  12019. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12020. if (validate) {
  12021. if (isEmptyValue(value) && !rule.required) {
  12022. return callback();
  12023. }
  12024. rules.required(rule, value, source, errors, options);
  12025. }
  12026. callback(errors);
  12027. };
  12028. var validators = {
  12029. string,
  12030. method: method2,
  12031. number: number2,
  12032. "boolean": _boolean,
  12033. regexp: regexp2,
  12034. integer: integer2,
  12035. "float": floatFn,
  12036. array: array2,
  12037. object: object2,
  12038. "enum": enumerable2,
  12039. pattern: pattern2,
  12040. date: date2,
  12041. url: type2,
  12042. hex: type2,
  12043. email: type2,
  12044. required: required2,
  12045. any
  12046. };
  12047. function newMessages() {
  12048. return {
  12049. "default": "Validation error on field %s",
  12050. required: "%s is required",
  12051. "enum": "%s must be one of %s",
  12052. whitespace: "%s cannot be empty",
  12053. date: {
  12054. format: "%s date %s is invalid for format %s",
  12055. parse: "%s date could not be parsed, %s is invalid ",
  12056. invalid: "%s date %s is invalid"
  12057. },
  12058. types: {
  12059. string: "%s is not a %s",
  12060. method: "%s is not a %s (function)",
  12061. array: "%s is not an %s",
  12062. object: "%s is not an %s",
  12063. number: "%s is not a %s",
  12064. date: "%s is not a %s",
  12065. "boolean": "%s is not a %s",
  12066. integer: "%s is not an %s",
  12067. "float": "%s is not a %s",
  12068. regexp: "%s is not a valid %s",
  12069. email: "%s is not a valid %s",
  12070. url: "%s is not a valid %s",
  12071. hex: "%s is not a valid %s"
  12072. },
  12073. string: {
  12074. len: "%s must be exactly %s characters",
  12075. min: "%s must be at least %s characters",
  12076. max: "%s cannot be longer than %s characters",
  12077. range: "%s must be between %s and %s characters"
  12078. },
  12079. number: {
  12080. len: "%s must equal %s",
  12081. min: "%s cannot be less than %s",
  12082. max: "%s cannot be greater than %s",
  12083. range: "%s must be between %s and %s"
  12084. },
  12085. array: {
  12086. len: "%s must be exactly %s in length",
  12087. min: "%s cannot be less than %s in length",
  12088. max: "%s cannot be greater than %s in length",
  12089. range: "%s must be between %s and %s in length"
  12090. },
  12091. pattern: {
  12092. mismatch: "%s value %s does not match pattern %s"
  12093. },
  12094. clone: function clone() {
  12095. var cloned = JSON.parse(JSON.stringify(this));
  12096. cloned.clone = this.clone;
  12097. return cloned;
  12098. }
  12099. };
  12100. }
  12101. var messages = newMessages();
  12102. var Schema = /* @__PURE__ */ function() {
  12103. function Schema2(descriptor) {
  12104. this.rules = null;
  12105. this._messages = messages;
  12106. this.define(descriptor);
  12107. }
  12108. var _proto = Schema2.prototype;
  12109. _proto.define = function define(rules2) {
  12110. var _this = this;
  12111. if (!rules2) {
  12112. throw new Error("Cannot configure a schema with no rules");
  12113. }
  12114. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  12115. throw new Error("Rules must be an object");
  12116. }
  12117. this.rules = {};
  12118. Object.keys(rules2).forEach(function(name) {
  12119. var item = rules2[name];
  12120. _this.rules[name] = Array.isArray(item) ? item : [item];
  12121. });
  12122. };
  12123. _proto.messages = function messages2(_messages) {
  12124. if (_messages) {
  12125. this._messages = deepMerge(newMessages(), _messages);
  12126. }
  12127. return this._messages;
  12128. };
  12129. _proto.validate = function validate(source_, o, oc) {
  12130. var _this2 = this;
  12131. if (o === void 0) {
  12132. o = {};
  12133. }
  12134. if (oc === void 0) {
  12135. oc = function oc2() {
  12136. };
  12137. }
  12138. var source = source_;
  12139. var options = o;
  12140. var callback = oc;
  12141. if (typeof options === "function") {
  12142. callback = options;
  12143. options = {};
  12144. }
  12145. if (!this.rules || Object.keys(this.rules).length === 0) {
  12146. if (callback) {
  12147. callback(null, source);
  12148. }
  12149. return Promise.resolve(source);
  12150. }
  12151. function complete(results) {
  12152. var errors = [];
  12153. var fields = {};
  12154. function add(e) {
  12155. if (Array.isArray(e)) {
  12156. var _errors;
  12157. errors = (_errors = errors).concat.apply(_errors, e);
  12158. } else {
  12159. errors.push(e);
  12160. }
  12161. }
  12162. for (var i = 0; i < results.length; i++) {
  12163. add(results[i]);
  12164. }
  12165. if (!errors.length) {
  12166. callback(null, source);
  12167. } else {
  12168. fields = convertFieldsError(errors);
  12169. callback(errors, fields);
  12170. }
  12171. }
  12172. if (options.messages) {
  12173. var messages$1 = this.messages();
  12174. if (messages$1 === messages) {
  12175. messages$1 = newMessages();
  12176. }
  12177. deepMerge(messages$1, options.messages);
  12178. options.messages = messages$1;
  12179. } else {
  12180. options.messages = this.messages();
  12181. }
  12182. var series = {};
  12183. var keys = options.keys || Object.keys(this.rules);
  12184. keys.forEach(function(z) {
  12185. var arr = _this2.rules[z];
  12186. var value = source[z];
  12187. arr.forEach(function(r) {
  12188. var rule = r;
  12189. if (typeof rule.transform === "function") {
  12190. if (source === source_) {
  12191. source = _extends({}, source);
  12192. }
  12193. value = source[z] = rule.transform(value);
  12194. }
  12195. if (typeof rule === "function") {
  12196. rule = {
  12197. validator: rule
  12198. };
  12199. } else {
  12200. rule = _extends({}, rule);
  12201. }
  12202. rule.validator = _this2.getValidationMethod(rule);
  12203. if (!rule.validator) {
  12204. return;
  12205. }
  12206. rule.field = z;
  12207. rule.fullField = rule.fullField || z;
  12208. rule.type = _this2.getType(rule);
  12209. series[z] = series[z] || [];
  12210. series[z].push({
  12211. rule,
  12212. value,
  12213. source,
  12214. field: z
  12215. });
  12216. });
  12217. });
  12218. var errorFields = {};
  12219. return asyncMap(series, options, function(data, doIt) {
  12220. var rule = data.rule;
  12221. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  12222. deep = deep && (rule.required || !rule.required && data.value);
  12223. rule.field = data.field;
  12224. function addFullField(key, schema) {
  12225. return _extends({}, schema, {
  12226. fullField: rule.fullField + "." + key,
  12227. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  12228. });
  12229. }
  12230. function cb(e) {
  12231. if (e === void 0) {
  12232. e = [];
  12233. }
  12234. var errorList = Array.isArray(e) ? e : [e];
  12235. if (!options.suppressWarning && errorList.length) {
  12236. Schema2.warning("async-validator:", errorList);
  12237. }
  12238. if (errorList.length && rule.message !== void 0) {
  12239. errorList = [].concat(rule.message);
  12240. }
  12241. var filledErrors = errorList.map(complementError(rule, source));
  12242. if (options.first && filledErrors.length) {
  12243. errorFields[rule.field] = 1;
  12244. return doIt(filledErrors);
  12245. }
  12246. if (!deep) {
  12247. doIt(filledErrors);
  12248. } else {
  12249. if (rule.required && !data.value) {
  12250. if (rule.message !== void 0) {
  12251. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  12252. } else if (options.error) {
  12253. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  12254. }
  12255. return doIt(filledErrors);
  12256. }
  12257. var fieldsSchema = {};
  12258. if (rule.defaultField) {
  12259. Object.keys(data.value).map(function(key) {
  12260. fieldsSchema[key] = rule.defaultField;
  12261. });
  12262. }
  12263. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  12264. var paredFieldsSchema = {};
  12265. Object.keys(fieldsSchema).forEach(function(field) {
  12266. var fieldSchema = fieldsSchema[field];
  12267. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  12268. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  12269. });
  12270. var schema = new Schema2(paredFieldsSchema);
  12271. schema.messages(options.messages);
  12272. if (data.rule.options) {
  12273. data.rule.options.messages = options.messages;
  12274. data.rule.options.error = options.error;
  12275. }
  12276. schema.validate(data.value, data.rule.options || options, function(errs) {
  12277. var finalErrors = [];
  12278. if (filledErrors && filledErrors.length) {
  12279. finalErrors.push.apply(finalErrors, filledErrors);
  12280. }
  12281. if (errs && errs.length) {
  12282. finalErrors.push.apply(finalErrors, errs);
  12283. }
  12284. doIt(finalErrors.length ? finalErrors : null);
  12285. });
  12286. }
  12287. }
  12288. var res;
  12289. if (rule.asyncValidator) {
  12290. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  12291. } else if (rule.validator) {
  12292. try {
  12293. res = rule.validator(rule, data.value, cb, data.source, options);
  12294. } catch (error) {
  12295. console.error == null ? void 0 : console.error(error);
  12296. if (!options.suppressValidatorError) {
  12297. setTimeout(function() {
  12298. throw error;
  12299. }, 0);
  12300. }
  12301. cb(error.message);
  12302. }
  12303. if (res === true) {
  12304. cb();
  12305. } else if (res === false) {
  12306. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  12307. } else if (res instanceof Array) {
  12308. cb(res);
  12309. } else if (res instanceof Error) {
  12310. cb(res.message);
  12311. }
  12312. }
  12313. if (res && res.then) {
  12314. res.then(function() {
  12315. return cb();
  12316. }, function(e) {
  12317. return cb(e);
  12318. });
  12319. }
  12320. }, function(results) {
  12321. complete(results);
  12322. }, source);
  12323. };
  12324. _proto.getType = function getType(rule) {
  12325. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  12326. rule.type = "pattern";
  12327. }
  12328. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  12329. throw new Error(format("Unknown rule type %s", rule.type));
  12330. }
  12331. return rule.type || "string";
  12332. };
  12333. _proto.getValidationMethod = function getValidationMethod(rule) {
  12334. if (typeof rule.validator === "function") {
  12335. return rule.validator;
  12336. }
  12337. var keys = Object.keys(rule);
  12338. var messageIndex = keys.indexOf("message");
  12339. if (messageIndex !== -1) {
  12340. keys.splice(messageIndex, 1);
  12341. }
  12342. if (keys.length === 1 && keys[0] === "required") {
  12343. return validators.required;
  12344. }
  12345. return validators[this.getType(rule)] || void 0;
  12346. };
  12347. return Schema2;
  12348. }();
  12349. Schema.register = function register(type4, validator) {
  12350. if (typeof validator !== "function") {
  12351. throw new Error("Cannot register a validator by type, validator is not a function");
  12352. }
  12353. validators[type4] = validator;
  12354. };
  12355. Schema.warning = warning;
  12356. Schema.messages = messages;
  12357. Schema.validators = validators;
  12358. const formItemValidateStates = [
  12359. "",
  12360. "error",
  12361. "validating",
  12362. "success"
  12363. ];
  12364. const formItemProps = buildProps({
  12365. label: String,
  12366. labelWidth: {
  12367. type: [String, Number],
  12368. default: ""
  12369. },
  12370. labelPosition: {
  12371. type: String,
  12372. values: ["left", "right", "top", ""],
  12373. default: ""
  12374. },
  12375. prop: {
  12376. type: definePropType([String, Array])
  12377. },
  12378. required: {
  12379. type: Boolean,
  12380. default: void 0
  12381. },
  12382. rules: {
  12383. type: definePropType([Object, Array])
  12384. },
  12385. error: String,
  12386. validateStatus: {
  12387. type: String,
  12388. values: formItemValidateStates
  12389. },
  12390. for: String,
  12391. inlineMessage: {
  12392. type: [String, Boolean],
  12393. default: ""
  12394. },
  12395. showMessage: {
  12396. type: Boolean,
  12397. default: true
  12398. },
  12399. size: {
  12400. type: String,
  12401. values: componentSizes
  12402. }
  12403. });
  12404. const COMPONENT_NAME$n = "ElLabelWrap";
  12405. var FormLabelWrap = vue.defineComponent({
  12406. name: COMPONENT_NAME$n,
  12407. props: {
  12408. isAutoWidth: Boolean,
  12409. updateAll: Boolean
  12410. },
  12411. setup(props, {
  12412. slots
  12413. }) {
  12414. const formContext = vue.inject(formContextKey, void 0);
  12415. const formItemContext = vue.inject(formItemContextKey);
  12416. if (!formItemContext)
  12417. throwError(COMPONENT_NAME$n, "usage: <el-form-item><label-wrap /></el-form-item>");
  12418. const ns = useNamespace("form");
  12419. const el = vue.ref();
  12420. const computedWidth = vue.ref(0);
  12421. const getLabelWidth = () => {
  12422. var _a;
  12423. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  12424. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12425. return Math.ceil(Number.parseFloat(width));
  12426. } else {
  12427. return 0;
  12428. }
  12429. };
  12430. const updateLabelWidth = (action = "update") => {
  12431. vue.nextTick(() => {
  12432. if (slots.default && props.isAutoWidth) {
  12433. if (action === "update") {
  12434. computedWidth.value = getLabelWidth();
  12435. } else if (action === "remove") {
  12436. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  12437. }
  12438. }
  12439. });
  12440. };
  12441. const updateLabelWidthFn = () => updateLabelWidth("update");
  12442. vue.onMounted(() => {
  12443. updateLabelWidthFn();
  12444. });
  12445. vue.onBeforeUnmount(() => {
  12446. updateLabelWidth("remove");
  12447. });
  12448. vue.onUpdated(() => updateLabelWidthFn());
  12449. vue.watch(computedWidth, (val, oldVal) => {
  12450. if (props.updateAll) {
  12451. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  12452. }
  12453. });
  12454. useResizeObserver(vue.computed(() => {
  12455. var _a, _b;
  12456. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  12457. }), updateLabelWidthFn);
  12458. return () => {
  12459. var _a, _b;
  12460. if (!slots)
  12461. return null;
  12462. const {
  12463. isAutoWidth
  12464. } = props;
  12465. if (isAutoWidth) {
  12466. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  12467. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  12468. const style = {};
  12469. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12470. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12471. const labelPosition = formItemContext.labelPosition || formContext.labelPosition;
  12472. const marginPosition = labelPosition === "left" ? "marginRight" : "marginLeft";
  12473. if (marginWidth) {
  12474. style[marginPosition] = `${marginWidth}px`;
  12475. }
  12476. }
  12477. return vue.createVNode("div", {
  12478. "ref": el,
  12479. "class": [ns.be("item", "label-wrap")],
  12480. "style": style
  12481. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  12482. } else {
  12483. return vue.createVNode(vue.Fragment, {
  12484. "ref": el
  12485. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  12486. }
  12487. };
  12488. }
  12489. });
  12490. const __default__$1Q = vue.defineComponent({
  12491. name: "ElFormItem"
  12492. });
  12493. const _sfc_main$2t = /* @__PURE__ */ vue.defineComponent({
  12494. ...__default__$1Q,
  12495. props: formItemProps,
  12496. setup(__props, { expose }) {
  12497. const props = __props;
  12498. const slots = vue.useSlots();
  12499. const formContext = vue.inject(formContextKey, void 0);
  12500. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  12501. const _size = useFormSize(void 0, { formItem: false });
  12502. const ns = useNamespace("form-item");
  12503. const labelId = useId().value;
  12504. const inputIds = vue.ref([]);
  12505. const validateState = vue.ref("");
  12506. const validateStateDebounced = refDebounced(validateState, 100);
  12507. const validateMessage = vue.ref("");
  12508. const formItemRef = vue.ref();
  12509. let initialValue = void 0;
  12510. let isResettingField = false;
  12511. const labelPosition = vue.computed(() => props.labelPosition || (formContext == null ? void 0 : formContext.labelPosition));
  12512. const labelStyle = vue.computed(() => {
  12513. if (labelPosition.value === "top") {
  12514. return {};
  12515. }
  12516. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12517. if (labelWidth)
  12518. return { width: labelWidth };
  12519. return {};
  12520. });
  12521. const contentStyle = vue.computed(() => {
  12522. if (labelPosition.value === "top" || (formContext == null ? void 0 : formContext.inline)) {
  12523. return {};
  12524. }
  12525. if (!props.label && !props.labelWidth && isNested) {
  12526. return {};
  12527. }
  12528. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12529. if (!props.label && !slots.label) {
  12530. return { marginLeft: labelWidth };
  12531. }
  12532. return {};
  12533. });
  12534. const formItemClasses = vue.computed(() => [
  12535. ns.b(),
  12536. ns.m(_size.value),
  12537. ns.is("error", validateState.value === "error"),
  12538. ns.is("validating", validateState.value === "validating"),
  12539. ns.is("success", validateState.value === "success"),
  12540. ns.is("required", isRequired.value || props.required),
  12541. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  12542. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  12543. {
  12544. [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon,
  12545. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  12546. }
  12547. ]);
  12548. const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  12549. const validateClasses = vue.computed(() => [
  12550. ns.e("error"),
  12551. { [ns.em("error", "inline")]: _inlineMessage.value }
  12552. ]);
  12553. const propString = vue.computed(() => {
  12554. if (!props.prop)
  12555. return "";
  12556. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  12557. });
  12558. const hasLabel = vue.computed(() => {
  12559. return !!(props.label || slots.label);
  12560. });
  12561. const labelFor = vue.computed(() => {
  12562. return props.for || (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  12563. });
  12564. const isGroup = vue.computed(() => {
  12565. return !labelFor.value && hasLabel.value;
  12566. });
  12567. const isNested = !!parentFormItemContext;
  12568. const fieldValue = vue.computed(() => {
  12569. const model = formContext == null ? void 0 : formContext.model;
  12570. if (!model || !props.prop) {
  12571. return;
  12572. }
  12573. return getProp(model, props.prop).value;
  12574. });
  12575. const normalizedRules = vue.computed(() => {
  12576. const { required } = props;
  12577. const rules = [];
  12578. if (props.rules) {
  12579. rules.push(...castArray$1(props.rules));
  12580. }
  12581. const formRules = formContext == null ? void 0 : formContext.rules;
  12582. if (formRules && props.prop) {
  12583. const _rules = getProp(formRules, props.prop).value;
  12584. if (_rules) {
  12585. rules.push(...castArray$1(_rules));
  12586. }
  12587. }
  12588. if (required !== void 0) {
  12589. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  12590. if (requiredRules.length > 0) {
  12591. for (const [rule, i] of requiredRules) {
  12592. if (rule.required === required)
  12593. continue;
  12594. rules[i] = { ...rule, required };
  12595. }
  12596. } else {
  12597. rules.push({ required });
  12598. }
  12599. }
  12600. return rules;
  12601. });
  12602. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  12603. const getFilteredRule = (trigger) => {
  12604. const rules = normalizedRules.value;
  12605. return rules.filter((rule) => {
  12606. if (!rule.trigger || !trigger)
  12607. return true;
  12608. if (isArray$1(rule.trigger)) {
  12609. return rule.trigger.includes(trigger);
  12610. } else {
  12611. return rule.trigger === trigger;
  12612. }
  12613. }).map(({ trigger: trigger2, ...rule }) => rule);
  12614. };
  12615. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  12616. const shouldShowError = vue.computed(() => {
  12617. var _a;
  12618. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  12619. });
  12620. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  12621. const setValidationState = (state) => {
  12622. validateState.value = state;
  12623. };
  12624. const onValidationFailed = (error) => {
  12625. var _a, _b;
  12626. const { errors, fields } = error;
  12627. if (!errors || !fields) {
  12628. console.error(error);
  12629. }
  12630. setValidationState("error");
  12631. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  12632. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  12633. };
  12634. const onValidationSucceeded = () => {
  12635. setValidationState("success");
  12636. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  12637. };
  12638. const doValidate = async (rules) => {
  12639. const modelName = propString.value;
  12640. const validator = new Schema({
  12641. [modelName]: rules
  12642. });
  12643. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12644. onValidationSucceeded();
  12645. return true;
  12646. }).catch((err) => {
  12647. onValidationFailed(err);
  12648. return Promise.reject(err);
  12649. });
  12650. };
  12651. const validate = async (trigger, callback) => {
  12652. if (isResettingField || !props.prop) {
  12653. return false;
  12654. }
  12655. const hasCallback = isFunction$1(callback);
  12656. if (!validateEnabled.value) {
  12657. callback == null ? void 0 : callback(false);
  12658. return false;
  12659. }
  12660. const rules = getFilteredRule(trigger);
  12661. if (rules.length === 0) {
  12662. callback == null ? void 0 : callback(true);
  12663. return true;
  12664. }
  12665. setValidationState("validating");
  12666. return doValidate(rules).then(() => {
  12667. callback == null ? void 0 : callback(true);
  12668. return true;
  12669. }).catch((err) => {
  12670. const { fields } = err;
  12671. callback == null ? void 0 : callback(false, fields);
  12672. return hasCallback ? false : Promise.reject(fields);
  12673. });
  12674. };
  12675. const clearValidate = () => {
  12676. setValidationState("");
  12677. validateMessage.value = "";
  12678. isResettingField = false;
  12679. };
  12680. const resetField = async () => {
  12681. const model = formContext == null ? void 0 : formContext.model;
  12682. if (!model || !props.prop)
  12683. return;
  12684. const computedValue = getProp(model, props.prop);
  12685. isResettingField = true;
  12686. computedValue.value = clone(initialValue);
  12687. await vue.nextTick();
  12688. clearValidate();
  12689. isResettingField = false;
  12690. };
  12691. const addInputId = (id) => {
  12692. if (!inputIds.value.includes(id)) {
  12693. inputIds.value.push(id);
  12694. }
  12695. };
  12696. const removeInputId = (id) => {
  12697. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12698. };
  12699. vue.watch(() => props.error, (val) => {
  12700. validateMessage.value = val || "";
  12701. setValidationState(val ? "error" : "");
  12702. }, { immediate: true });
  12703. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12704. const context = vue.reactive({
  12705. ...vue.toRefs(props),
  12706. $el: formItemRef,
  12707. size: _size,
  12708. validateState,
  12709. labelId,
  12710. inputIds,
  12711. isGroup,
  12712. hasLabel,
  12713. fieldValue,
  12714. addInputId,
  12715. removeInputId,
  12716. resetField,
  12717. clearValidate,
  12718. validate
  12719. });
  12720. vue.provide(formItemContextKey, context);
  12721. vue.onMounted(() => {
  12722. if (props.prop) {
  12723. formContext == null ? void 0 : formContext.addField(context);
  12724. initialValue = clone(fieldValue.value);
  12725. }
  12726. });
  12727. vue.onBeforeUnmount(() => {
  12728. formContext == null ? void 0 : formContext.removeField(context);
  12729. });
  12730. expose({
  12731. size: _size,
  12732. validateMessage,
  12733. validateState,
  12734. validate,
  12735. clearValidate,
  12736. resetField
  12737. });
  12738. return (_ctx, _cache) => {
  12739. var _a;
  12740. return vue.openBlock(), vue.createElementBlock("div", {
  12741. ref_key: "formItemRef",
  12742. ref: formItemRef,
  12743. class: vue.normalizeClass(vue.unref(formItemClasses)),
  12744. role: vue.unref(isGroup) ? "group" : void 0,
  12745. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  12746. }, [
  12747. vue.createVNode(vue.unref(FormLabelWrap), {
  12748. "is-auto-width": vue.unref(labelStyle).width === "auto",
  12749. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  12750. }, {
  12751. default: vue.withCtx(() => [
  12752. vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  12753. key: 0,
  12754. id: vue.unref(labelId),
  12755. for: vue.unref(labelFor),
  12756. class: vue.normalizeClass(vue.unref(ns).e("label")),
  12757. style: vue.normalizeStyle(vue.unref(labelStyle))
  12758. }, {
  12759. default: vue.withCtx(() => [
  12760. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  12761. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  12762. ])
  12763. ]),
  12764. _: 3
  12765. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  12766. ]),
  12767. _: 3
  12768. }, 8, ["is-auto-width", "update-all"]),
  12769. vue.createElementVNode("div", {
  12770. class: vue.normalizeClass(vue.unref(ns).e("content")),
  12771. style: vue.normalizeStyle(vue.unref(contentStyle))
  12772. }, [
  12773. vue.renderSlot(_ctx.$slots, "default"),
  12774. vue.createVNode(vue.TransitionGroup, {
  12775. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  12776. }, {
  12777. default: vue.withCtx(() => [
  12778. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  12779. key: 0,
  12780. error: validateMessage.value
  12781. }, () => [
  12782. vue.createElementVNode("div", {
  12783. class: vue.normalizeClass(vue.unref(validateClasses))
  12784. }, vue.toDisplayString(validateMessage.value), 3)
  12785. ]) : vue.createCommentVNode("v-if", true)
  12786. ]),
  12787. _: 3
  12788. }, 8, ["name"])
  12789. ], 6)
  12790. ], 10, ["role", "aria-labelledby"]);
  12791. };
  12792. }
  12793. });
  12794. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2t, [["__file", "form-item.vue"]]);
  12795. const ElForm = withInstall(Form, {
  12796. FormItem
  12797. });
  12798. const ElFormItem = withNoopInstall(FormItem);
  12799. let hiddenTextarea = void 0;
  12800. const HIDDEN_STYLE = {
  12801. height: "0",
  12802. visibility: "hidden",
  12803. overflow: isFirefox() ? "" : "hidden",
  12804. position: "absolute",
  12805. "z-index": "-1000",
  12806. top: "0",
  12807. right: "0"
  12808. };
  12809. const CONTEXT_STYLE = [
  12810. "letter-spacing",
  12811. "line-height",
  12812. "padding-top",
  12813. "padding-bottom",
  12814. "font-family",
  12815. "font-weight",
  12816. "font-size",
  12817. "text-rendering",
  12818. "text-transform",
  12819. "width",
  12820. "text-indent",
  12821. "padding-left",
  12822. "padding-right",
  12823. "border-width",
  12824. "box-sizing"
  12825. ];
  12826. function calculateNodeStyling(targetElement) {
  12827. const style = window.getComputedStyle(targetElement);
  12828. const boxSizing = style.getPropertyValue("box-sizing");
  12829. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  12830. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  12831. const contextStyle = CONTEXT_STYLE.map((name) => [
  12832. name,
  12833. style.getPropertyValue(name)
  12834. ]);
  12835. return { contextStyle, paddingSize, borderSize, boxSizing };
  12836. }
  12837. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  12838. var _a;
  12839. if (!hiddenTextarea) {
  12840. hiddenTextarea = document.createElement("textarea");
  12841. document.body.appendChild(hiddenTextarea);
  12842. }
  12843. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  12844. contextStyle.forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value));
  12845. Object.entries(HIDDEN_STYLE).forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value, "important"));
  12846. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  12847. let height = hiddenTextarea.scrollHeight;
  12848. const result = {};
  12849. if (boxSizing === "border-box") {
  12850. height = height + borderSize;
  12851. } else if (boxSizing === "content-box") {
  12852. height = height - paddingSize;
  12853. }
  12854. hiddenTextarea.value = "";
  12855. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  12856. if (isNumber(minRows)) {
  12857. let minHeight = singleRowHeight * minRows;
  12858. if (boxSizing === "border-box") {
  12859. minHeight = minHeight + paddingSize + borderSize;
  12860. }
  12861. height = Math.max(minHeight, height);
  12862. result.minHeight = `${minHeight}px`;
  12863. }
  12864. if (isNumber(maxRows)) {
  12865. let maxHeight = singleRowHeight * maxRows;
  12866. if (boxSizing === "border-box") {
  12867. maxHeight = maxHeight + paddingSize + borderSize;
  12868. }
  12869. height = Math.min(maxHeight, height);
  12870. }
  12871. result.height = `${height}px`;
  12872. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  12873. hiddenTextarea = void 0;
  12874. return result;
  12875. }
  12876. const inputProps = buildProps({
  12877. id: {
  12878. type: String,
  12879. default: void 0
  12880. },
  12881. size: useSizeProp,
  12882. disabled: Boolean,
  12883. modelValue: {
  12884. type: definePropType([
  12885. String,
  12886. Number,
  12887. Object
  12888. ]),
  12889. default: ""
  12890. },
  12891. maxlength: {
  12892. type: [String, Number]
  12893. },
  12894. minlength: {
  12895. type: [String, Number]
  12896. },
  12897. type: {
  12898. type: String,
  12899. default: "text"
  12900. },
  12901. resize: {
  12902. type: String,
  12903. values: ["none", "both", "horizontal", "vertical"]
  12904. },
  12905. autosize: {
  12906. type: definePropType([Boolean, Object]),
  12907. default: false
  12908. },
  12909. autocomplete: {
  12910. type: String,
  12911. default: "off"
  12912. },
  12913. formatter: {
  12914. type: Function
  12915. },
  12916. parser: {
  12917. type: Function
  12918. },
  12919. placeholder: {
  12920. type: String
  12921. },
  12922. form: {
  12923. type: String
  12924. },
  12925. readonly: Boolean,
  12926. clearable: Boolean,
  12927. showPassword: Boolean,
  12928. showWordLimit: Boolean,
  12929. suffixIcon: {
  12930. type: iconPropType
  12931. },
  12932. prefixIcon: {
  12933. type: iconPropType
  12934. },
  12935. containerRole: {
  12936. type: String,
  12937. default: void 0
  12938. },
  12939. tabindex: {
  12940. type: [String, Number],
  12941. default: 0
  12942. },
  12943. validateEvent: {
  12944. type: Boolean,
  12945. default: true
  12946. },
  12947. inputStyle: {
  12948. type: definePropType([Object, Array, String]),
  12949. default: () => mutable({})
  12950. },
  12951. autofocus: Boolean,
  12952. rows: {
  12953. type: Number,
  12954. default: 2
  12955. },
  12956. ...useAriaProps(["ariaLabel"])
  12957. });
  12958. const inputEmits = {
  12959. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  12960. input: (value) => isString$1(value),
  12961. change: (value) => isString$1(value),
  12962. focus: (evt) => evt instanceof FocusEvent,
  12963. blur: (evt) => evt instanceof FocusEvent,
  12964. clear: () => true,
  12965. mouseleave: (evt) => evt instanceof MouseEvent,
  12966. mouseenter: (evt) => evt instanceof MouseEvent,
  12967. keydown: (evt) => evt instanceof Event,
  12968. compositionstart: (evt) => evt instanceof CompositionEvent,
  12969. compositionupdate: (evt) => evt instanceof CompositionEvent,
  12970. compositionend: (evt) => evt instanceof CompositionEvent
  12971. };
  12972. const COMPONENT_NAME$m = "ElInput";
  12973. const __default__$1P = vue.defineComponent({
  12974. name: COMPONENT_NAME$m,
  12975. inheritAttrs: false
  12976. });
  12977. const _sfc_main$2s = /* @__PURE__ */ vue.defineComponent({
  12978. ...__default__$1P,
  12979. props: inputProps,
  12980. emits: inputEmits,
  12981. setup(__props, { expose, emit }) {
  12982. const props = __props;
  12983. const rawAttrs = vue.useAttrs();
  12984. const attrs = useAttrs();
  12985. const slots = vue.useSlots();
  12986. const containerKls = vue.computed(() => [
  12987. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  12988. nsInput.m(inputSize.value),
  12989. nsInput.is("disabled", inputDisabled.value),
  12990. nsInput.is("exceed", inputExceed.value),
  12991. {
  12992. [nsInput.b("group")]: slots.prepend || slots.append,
  12993. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  12994. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  12995. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  12996. [nsInput.b("hidden")]: props.type === "hidden"
  12997. },
  12998. rawAttrs.class
  12999. ]);
  13000. const wrapperKls = vue.computed(() => [
  13001. nsInput.e("wrapper"),
  13002. nsInput.is("focus", isFocused.value)
  13003. ]);
  13004. const { form: elForm, formItem: elFormItem } = useFormItem();
  13005. const { inputId } = useFormItemInputId(props, {
  13006. formItemContext: elFormItem
  13007. });
  13008. const inputSize = useFormSize();
  13009. const inputDisabled = useFormDisabled();
  13010. const nsInput = useNamespace("input");
  13011. const nsTextarea = useNamespace("textarea");
  13012. const input = vue.shallowRef();
  13013. const textarea = vue.shallowRef();
  13014. const hovering = vue.ref(false);
  13015. const passwordVisible = vue.ref(false);
  13016. const countStyle = vue.ref();
  13017. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  13018. const _ref = vue.computed(() => input.value || textarea.value);
  13019. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  13020. beforeFocus() {
  13021. return inputDisabled.value;
  13022. },
  13023. afterBlur() {
  13024. var _a;
  13025. if (props.validateEvent) {
  13026. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  13027. }
  13028. }
  13029. });
  13030. const needStatusIcon = vue.computed(() => {
  13031. var _a;
  13032. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  13033. });
  13034. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  13035. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  13036. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  13037. const containerStyle = vue.computed(() => [
  13038. rawAttrs.style
  13039. ]);
  13040. const textareaStyle = vue.computed(() => [
  13041. props.inputStyle,
  13042. textareaCalcStyle.value,
  13043. { resize: props.resize }
  13044. ]);
  13045. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  13046. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  13047. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value && (!!nativeInputValue.value || isFocused.value));
  13048. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  13049. const textLength = vue.computed(() => nativeInputValue.value.length);
  13050. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  13051. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  13052. const [recordCursor, setCursor] = useCursor(input);
  13053. useResizeObserver(textarea, (entries) => {
  13054. onceInitSizeTextarea();
  13055. if (!isWordLimitVisible.value || props.resize !== "both")
  13056. return;
  13057. const entry = entries[0];
  13058. const { width } = entry.contentRect;
  13059. countStyle.value = {
  13060. right: `calc(100% - ${width + 15 + 6}px)`
  13061. };
  13062. });
  13063. const resizeTextarea = () => {
  13064. const { type, autosize } = props;
  13065. if (!isClient || type !== "textarea" || !textarea.value)
  13066. return;
  13067. if (autosize) {
  13068. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  13069. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  13070. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  13071. textareaCalcStyle.value = {
  13072. overflowY: "hidden",
  13073. ...textareaStyle2
  13074. };
  13075. vue.nextTick(() => {
  13076. textarea.value.offsetHeight;
  13077. textareaCalcStyle.value = textareaStyle2;
  13078. });
  13079. } else {
  13080. textareaCalcStyle.value = {
  13081. minHeight: calcTextareaHeight(textarea.value).minHeight
  13082. };
  13083. }
  13084. };
  13085. const createOnceInitResize = (resizeTextarea2) => {
  13086. let isInit = false;
  13087. return () => {
  13088. var _a;
  13089. if (isInit || !props.autosize)
  13090. return;
  13091. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  13092. if (!isElHidden) {
  13093. resizeTextarea2();
  13094. isInit = true;
  13095. }
  13096. };
  13097. };
  13098. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  13099. const setNativeInputValue = () => {
  13100. const input2 = _ref.value;
  13101. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  13102. if (!input2 || input2.value === formatterValue)
  13103. return;
  13104. input2.value = formatterValue;
  13105. };
  13106. const handleInput = async (event) => {
  13107. recordCursor();
  13108. let { value } = event.target;
  13109. if (props.formatter && props.parser) {
  13110. value = props.parser(value);
  13111. }
  13112. if (isComposing.value)
  13113. return;
  13114. if (value === nativeInputValue.value) {
  13115. setNativeInputValue();
  13116. return;
  13117. }
  13118. emit(UPDATE_MODEL_EVENT, value);
  13119. emit(INPUT_EVENT, value);
  13120. await vue.nextTick();
  13121. setNativeInputValue();
  13122. setCursor();
  13123. };
  13124. const handleChange = (event) => {
  13125. let { value } = event.target;
  13126. if (props.formatter && props.parser) {
  13127. value = props.parser(value);
  13128. }
  13129. emit(CHANGE_EVENT, value);
  13130. };
  13131. const {
  13132. isComposing,
  13133. handleCompositionStart,
  13134. handleCompositionUpdate,
  13135. handleCompositionEnd
  13136. } = useComposition({ emit, afterComposition: handleInput });
  13137. const handlePasswordVisible = () => {
  13138. recordCursor();
  13139. passwordVisible.value = !passwordVisible.value;
  13140. setTimeout(setCursor);
  13141. };
  13142. const focus = () => {
  13143. var _a;
  13144. return (_a = _ref.value) == null ? void 0 : _a.focus();
  13145. };
  13146. const blur = () => {
  13147. var _a;
  13148. return (_a = _ref.value) == null ? void 0 : _a.blur();
  13149. };
  13150. const handleMouseLeave = (evt) => {
  13151. hovering.value = false;
  13152. emit("mouseleave", evt);
  13153. };
  13154. const handleMouseEnter = (evt) => {
  13155. hovering.value = true;
  13156. emit("mouseenter", evt);
  13157. };
  13158. const handleKeydown = (evt) => {
  13159. emit("keydown", evt);
  13160. };
  13161. const select = () => {
  13162. var _a;
  13163. (_a = _ref.value) == null ? void 0 : _a.select();
  13164. };
  13165. const clear = () => {
  13166. emit(UPDATE_MODEL_EVENT, "");
  13167. emit(CHANGE_EVENT, "");
  13168. emit("clear");
  13169. emit(INPUT_EVENT, "");
  13170. };
  13171. vue.watch(() => props.modelValue, () => {
  13172. var _a;
  13173. vue.nextTick(() => resizeTextarea());
  13174. if (props.validateEvent) {
  13175. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  13176. }
  13177. });
  13178. vue.watch(nativeInputValue, () => setNativeInputValue());
  13179. vue.watch(() => props.type, async () => {
  13180. await vue.nextTick();
  13181. setNativeInputValue();
  13182. resizeTextarea();
  13183. });
  13184. vue.onMounted(() => {
  13185. if (!props.formatter && props.parser) ;
  13186. setNativeInputValue();
  13187. vue.nextTick(resizeTextarea);
  13188. });
  13189. expose({
  13190. input,
  13191. textarea,
  13192. ref: _ref,
  13193. textareaStyle,
  13194. autosize: vue.toRef(props, "autosize"),
  13195. isComposing,
  13196. focus,
  13197. blur,
  13198. select,
  13199. clear,
  13200. resizeTextarea
  13201. });
  13202. return (_ctx, _cache) => {
  13203. return vue.openBlock(), vue.createElementBlock("div", {
  13204. class: vue.normalizeClass([
  13205. vue.unref(containerKls),
  13206. {
  13207. [vue.unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  13208. [vue.unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  13209. }
  13210. ]),
  13211. style: vue.normalizeStyle(vue.unref(containerStyle)),
  13212. onMouseenter: handleMouseEnter,
  13213. onMouseleave: handleMouseLeave
  13214. }, [
  13215. vue.createCommentVNode(" input "),
  13216. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13217. vue.createCommentVNode(" prepend slot "),
  13218. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  13219. key: 0,
  13220. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  13221. }, [
  13222. vue.renderSlot(_ctx.$slots, "prepend")
  13223. ], 2)) : vue.createCommentVNode("v-if", true),
  13224. vue.createElementVNode("div", {
  13225. ref_key: "wrapperRef",
  13226. ref: wrapperRef,
  13227. class: vue.normalizeClass(vue.unref(wrapperKls))
  13228. }, [
  13229. vue.createCommentVNode(" prefix slot "),
  13230. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  13231. key: 0,
  13232. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  13233. }, [
  13234. vue.createElementVNode("span", {
  13235. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner"))
  13236. }, [
  13237. vue.renderSlot(_ctx.$slots, "prefix"),
  13238. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13239. key: 0,
  13240. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13241. }, {
  13242. default: vue.withCtx(() => [
  13243. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  13244. ]),
  13245. _: 1
  13246. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13247. ], 2)
  13248. ], 2)) : vue.createCommentVNode("v-if", true),
  13249. vue.createElementVNode("input", vue.mergeProps({
  13250. id: vue.unref(inputId),
  13251. ref_key: "input",
  13252. ref: input,
  13253. class: vue.unref(nsInput).e("inner")
  13254. }, vue.unref(attrs), {
  13255. minlength: _ctx.minlength,
  13256. maxlength: _ctx.maxlength,
  13257. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  13258. disabled: vue.unref(inputDisabled),
  13259. readonly: _ctx.readonly,
  13260. autocomplete: _ctx.autocomplete,
  13261. tabindex: _ctx.tabindex,
  13262. "aria-label": _ctx.ariaLabel,
  13263. placeholder: _ctx.placeholder,
  13264. style: _ctx.inputStyle,
  13265. form: _ctx.form,
  13266. autofocus: _ctx.autofocus,
  13267. role: _ctx.containerRole,
  13268. onCompositionstart: vue.unref(handleCompositionStart),
  13269. onCompositionupdate: vue.unref(handleCompositionUpdate),
  13270. onCompositionend: vue.unref(handleCompositionEnd),
  13271. onInput: handleInput,
  13272. onChange: handleChange,
  13273. onKeydown: handleKeydown
  13274. }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  13275. vue.createCommentVNode(" suffix slot "),
  13276. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13277. key: 1,
  13278. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  13279. }, [
  13280. vue.createElementVNode("span", {
  13281. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner"))
  13282. }, [
  13283. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13284. vue.renderSlot(_ctx.$slots, "suffix"),
  13285. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13286. key: 0,
  13287. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13288. }, {
  13289. default: vue.withCtx(() => [
  13290. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  13291. ]),
  13292. _: 1
  13293. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13294. ], 64)) : vue.createCommentVNode("v-if", true),
  13295. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13296. key: 1,
  13297. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  13298. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  13299. onClick: clear
  13300. }, {
  13301. default: vue.withCtx(() => [
  13302. vue.createVNode(vue.unref(circle_close_default))
  13303. ]),
  13304. _: 1
  13305. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  13306. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13307. key: 2,
  13308. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  13309. onClick: handlePasswordVisible
  13310. }, {
  13311. default: vue.withCtx(() => [
  13312. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  13313. ]),
  13314. _: 1
  13315. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  13316. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13317. key: 3,
  13318. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13319. }, [
  13320. vue.createElementVNode("span", {
  13321. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  13322. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 3)
  13323. ], 2)) : vue.createCommentVNode("v-if", true),
  13324. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13325. key: 4,
  13326. class: vue.normalizeClass([
  13327. vue.unref(nsInput).e("icon"),
  13328. vue.unref(nsInput).e("validateIcon"),
  13329. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  13330. ])
  13331. }, {
  13332. default: vue.withCtx(() => [
  13333. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  13334. ]),
  13335. _: 1
  13336. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13337. ], 2)
  13338. ], 2)) : vue.createCommentVNode("v-if", true)
  13339. ], 2),
  13340. vue.createCommentVNode(" append slot "),
  13341. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  13342. key: 1,
  13343. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  13344. }, [
  13345. vue.renderSlot(_ctx.$slots, "append")
  13346. ], 2)) : vue.createCommentVNode("v-if", true)
  13347. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  13348. vue.createCommentVNode(" textarea "),
  13349. vue.createElementVNode("textarea", vue.mergeProps({
  13350. id: vue.unref(inputId),
  13351. ref_key: "textarea",
  13352. ref: textarea,
  13353. class: [vue.unref(nsTextarea).e("inner"), vue.unref(nsInput).is("focus", vue.unref(isFocused))]
  13354. }, vue.unref(attrs), {
  13355. minlength: _ctx.minlength,
  13356. maxlength: _ctx.maxlength,
  13357. tabindex: _ctx.tabindex,
  13358. disabled: vue.unref(inputDisabled),
  13359. readonly: _ctx.readonly,
  13360. autocomplete: _ctx.autocomplete,
  13361. style: vue.unref(textareaStyle),
  13362. "aria-label": _ctx.ariaLabel,
  13363. placeholder: _ctx.placeholder,
  13364. form: _ctx.form,
  13365. autofocus: _ctx.autofocus,
  13366. rows: _ctx.rows,
  13367. role: _ctx.containerRole,
  13368. onCompositionstart: vue.unref(handleCompositionStart),
  13369. onCompositionupdate: vue.unref(handleCompositionUpdate),
  13370. onCompositionend: vue.unref(handleCompositionEnd),
  13371. onInput: handleInput,
  13372. onFocus: vue.unref(handleFocus),
  13373. onBlur: vue.unref(handleBlur),
  13374. onChange: handleChange,
  13375. onKeydown: handleKeydown
  13376. }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
  13377. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13378. key: 0,
  13379. style: vue.normalizeStyle(countStyle.value),
  13380. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13381. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 7)) : vue.createCommentVNode("v-if", true)
  13382. ], 64))
  13383. ], 38);
  13384. };
  13385. }
  13386. });
  13387. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__file", "input.vue"]]);
  13388. const ElInput = withInstall(Input);
  13389. const GAP = 4;
  13390. const BAR_MAP = {
  13391. vertical: {
  13392. offset: "offsetHeight",
  13393. scroll: "scrollTop",
  13394. scrollSize: "scrollHeight",
  13395. size: "height",
  13396. key: "vertical",
  13397. axis: "Y",
  13398. client: "clientY",
  13399. direction: "top"
  13400. },
  13401. horizontal: {
  13402. offset: "offsetWidth",
  13403. scroll: "scrollLeft",
  13404. scrollSize: "scrollWidth",
  13405. size: "width",
  13406. key: "horizontal",
  13407. axis: "X",
  13408. client: "clientX",
  13409. direction: "left"
  13410. }
  13411. };
  13412. const renderThumbStyle$1 = ({
  13413. move,
  13414. size,
  13415. bar
  13416. }) => ({
  13417. [bar.size]: size,
  13418. transform: `translate${bar.axis}(${move}%)`
  13419. });
  13420. const scrollbarContextKey = Symbol("scrollbarContextKey");
  13421. const thumbProps = buildProps({
  13422. vertical: Boolean,
  13423. size: String,
  13424. move: Number,
  13425. ratio: {
  13426. type: Number,
  13427. required: true
  13428. },
  13429. always: Boolean
  13430. });
  13431. const COMPONENT_NAME$l = "Thumb";
  13432. const _sfc_main$2r = /* @__PURE__ */ vue.defineComponent({
  13433. __name: "thumb",
  13434. props: thumbProps,
  13435. setup(__props) {
  13436. const props = __props;
  13437. const scrollbar = vue.inject(scrollbarContextKey);
  13438. const ns = useNamespace("scrollbar");
  13439. if (!scrollbar)
  13440. throwError(COMPONENT_NAME$l, "can not inject scrollbar context");
  13441. const instance = vue.ref();
  13442. const thumb = vue.ref();
  13443. const thumbState = vue.ref({});
  13444. const visible = vue.ref(false);
  13445. let cursorDown = false;
  13446. let cursorLeave = false;
  13447. let originalOnSelectStart = isClient ? document.onselectstart : null;
  13448. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  13449. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  13450. size: props.size,
  13451. move: props.move,
  13452. bar: bar.value
  13453. }));
  13454. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  13455. const clickThumbHandler = (e) => {
  13456. var _a;
  13457. e.stopPropagation();
  13458. if (e.ctrlKey || [1, 2].includes(e.button))
  13459. return;
  13460. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  13461. startDrag(e);
  13462. const el = e.currentTarget;
  13463. if (!el)
  13464. return;
  13465. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  13466. };
  13467. const clickTrackHandler = (e) => {
  13468. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  13469. return;
  13470. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  13471. const thumbHalf = thumb.value[bar.value.offset] / 2;
  13472. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13473. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13474. };
  13475. const startDrag = (e) => {
  13476. e.stopImmediatePropagation();
  13477. cursorDown = true;
  13478. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  13479. document.addEventListener("mouseup", mouseUpDocumentHandler);
  13480. originalOnSelectStart = document.onselectstart;
  13481. document.onselectstart = () => false;
  13482. };
  13483. const mouseMoveDocumentHandler = (e) => {
  13484. if (!instance.value || !thumb.value)
  13485. return;
  13486. if (cursorDown === false)
  13487. return;
  13488. const prevPage = thumbState.value[bar.value.axis];
  13489. if (!prevPage)
  13490. return;
  13491. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  13492. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  13493. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13494. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13495. };
  13496. const mouseUpDocumentHandler = () => {
  13497. cursorDown = false;
  13498. thumbState.value[bar.value.axis] = 0;
  13499. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  13500. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13501. restoreOnselectstart();
  13502. if (cursorLeave)
  13503. visible.value = false;
  13504. };
  13505. const mouseMoveScrollbarHandler = () => {
  13506. cursorLeave = false;
  13507. visible.value = !!props.size;
  13508. };
  13509. const mouseLeaveScrollbarHandler = () => {
  13510. cursorLeave = true;
  13511. visible.value = cursorDown;
  13512. };
  13513. vue.onBeforeUnmount(() => {
  13514. restoreOnselectstart();
  13515. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13516. });
  13517. const restoreOnselectstart = () => {
  13518. if (document.onselectstart !== originalOnSelectStart)
  13519. document.onselectstart = originalOnSelectStart;
  13520. };
  13521. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  13522. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  13523. return (_ctx, _cache) => {
  13524. return vue.openBlock(), vue.createBlock(vue.Transition, {
  13525. name: vue.unref(ns).b("fade"),
  13526. persisted: ""
  13527. }, {
  13528. default: vue.withCtx(() => [
  13529. vue.withDirectives(vue.createElementVNode("div", {
  13530. ref_key: "instance",
  13531. ref: instance,
  13532. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  13533. onMousedown: clickTrackHandler,
  13534. onClick: vue.withModifiers(() => {
  13535. }, ["stop"])
  13536. }, [
  13537. vue.createElementVNode("div", {
  13538. ref_key: "thumb",
  13539. ref: thumb,
  13540. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  13541. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  13542. onMousedown: clickThumbHandler
  13543. }, null, 38)
  13544. ], 42, ["onClick"]), [
  13545. [vue.vShow, _ctx.always || visible.value]
  13546. ])
  13547. ]),
  13548. _: 1
  13549. }, 8, ["name"]);
  13550. };
  13551. }
  13552. });
  13553. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2r, [["__file", "thumb.vue"]]);
  13554. const barProps = buildProps({
  13555. always: {
  13556. type: Boolean,
  13557. default: true
  13558. },
  13559. minSize: {
  13560. type: Number,
  13561. required: true
  13562. }
  13563. });
  13564. const _sfc_main$2q = /* @__PURE__ */ vue.defineComponent({
  13565. __name: "bar",
  13566. props: barProps,
  13567. setup(__props, { expose }) {
  13568. const props = __props;
  13569. const scrollbar = vue.inject(scrollbarContextKey);
  13570. const moveX = vue.ref(0);
  13571. const moveY = vue.ref(0);
  13572. const sizeWidth = vue.ref("");
  13573. const sizeHeight = vue.ref("");
  13574. const ratioY = vue.ref(1);
  13575. const ratioX = vue.ref(1);
  13576. const handleScroll = (wrap) => {
  13577. if (wrap) {
  13578. const offsetHeight = wrap.offsetHeight - GAP;
  13579. const offsetWidth = wrap.offsetWidth - GAP;
  13580. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  13581. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  13582. }
  13583. };
  13584. const update = () => {
  13585. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  13586. if (!wrap)
  13587. return;
  13588. const offsetHeight = wrap.offsetHeight - GAP;
  13589. const offsetWidth = wrap.offsetWidth - GAP;
  13590. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  13591. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  13592. const height = Math.max(originalHeight, props.minSize);
  13593. const width = Math.max(originalWidth, props.minSize);
  13594. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  13595. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  13596. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  13597. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  13598. };
  13599. expose({
  13600. handleScroll,
  13601. update
  13602. });
  13603. return (_ctx, _cache) => {
  13604. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  13605. vue.createVNode(Thumb, {
  13606. move: moveX.value,
  13607. ratio: ratioX.value,
  13608. size: sizeWidth.value,
  13609. always: _ctx.always
  13610. }, null, 8, ["move", "ratio", "size", "always"]),
  13611. vue.createVNode(Thumb, {
  13612. move: moveY.value,
  13613. ratio: ratioY.value,
  13614. size: sizeHeight.value,
  13615. vertical: "",
  13616. always: _ctx.always
  13617. }, null, 8, ["move", "ratio", "size", "always"])
  13618. ], 64);
  13619. };
  13620. }
  13621. });
  13622. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "bar.vue"]]);
  13623. const scrollbarProps = buildProps({
  13624. height: {
  13625. type: [String, Number],
  13626. default: ""
  13627. },
  13628. maxHeight: {
  13629. type: [String, Number],
  13630. default: ""
  13631. },
  13632. native: {
  13633. type: Boolean,
  13634. default: false
  13635. },
  13636. wrapStyle: {
  13637. type: definePropType([String, Object, Array]),
  13638. default: ""
  13639. },
  13640. wrapClass: {
  13641. type: [String, Array],
  13642. default: ""
  13643. },
  13644. viewClass: {
  13645. type: [String, Array],
  13646. default: ""
  13647. },
  13648. viewStyle: {
  13649. type: [String, Array, Object],
  13650. default: ""
  13651. },
  13652. noresize: Boolean,
  13653. tag: {
  13654. type: String,
  13655. default: "div"
  13656. },
  13657. always: Boolean,
  13658. minSize: {
  13659. type: Number,
  13660. default: 20
  13661. },
  13662. tabindex: {
  13663. type: [String, Number],
  13664. default: void 0
  13665. },
  13666. id: String,
  13667. role: String,
  13668. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  13669. });
  13670. const scrollbarEmits = {
  13671. scroll: ({
  13672. scrollTop,
  13673. scrollLeft
  13674. }) => [scrollTop, scrollLeft].every(isNumber)
  13675. };
  13676. const COMPONENT_NAME$k = "ElScrollbar";
  13677. const __default__$1O = vue.defineComponent({
  13678. name: COMPONENT_NAME$k
  13679. });
  13680. const _sfc_main$2p = /* @__PURE__ */ vue.defineComponent({
  13681. ...__default__$1O,
  13682. props: scrollbarProps,
  13683. emits: scrollbarEmits,
  13684. setup(__props, { expose, emit }) {
  13685. const props = __props;
  13686. const ns = useNamespace("scrollbar");
  13687. let stopResizeObserver = void 0;
  13688. let stopResizeListener = void 0;
  13689. let wrapScrollTop = 0;
  13690. let wrapScrollLeft = 0;
  13691. const scrollbarRef = vue.ref();
  13692. const wrapRef = vue.ref();
  13693. const resizeRef = vue.ref();
  13694. const barRef = vue.ref();
  13695. const wrapStyle = vue.computed(() => {
  13696. const style = {};
  13697. if (props.height)
  13698. style.height = addUnit(props.height);
  13699. if (props.maxHeight)
  13700. style.maxHeight = addUnit(props.maxHeight);
  13701. return [props.wrapStyle, style];
  13702. });
  13703. const wrapKls = vue.computed(() => {
  13704. return [
  13705. props.wrapClass,
  13706. ns.e("wrap"),
  13707. { [ns.em("wrap", "hidden-default")]: !props.native }
  13708. ];
  13709. });
  13710. const resizeKls = vue.computed(() => {
  13711. return [ns.e("view"), props.viewClass];
  13712. });
  13713. const handleScroll = () => {
  13714. var _a;
  13715. if (wrapRef.value) {
  13716. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13717. wrapScrollTop = wrapRef.value.scrollTop;
  13718. wrapScrollLeft = wrapRef.value.scrollLeft;
  13719. emit("scroll", {
  13720. scrollTop: wrapRef.value.scrollTop,
  13721. scrollLeft: wrapRef.value.scrollLeft
  13722. });
  13723. }
  13724. };
  13725. function scrollTo(arg1, arg2) {
  13726. if (isObject$1(arg1)) {
  13727. wrapRef.value.scrollTo(arg1);
  13728. } else if (isNumber(arg1) && isNumber(arg2)) {
  13729. wrapRef.value.scrollTo(arg1, arg2);
  13730. }
  13731. }
  13732. const setScrollTop = (value) => {
  13733. if (!isNumber(value)) {
  13734. return;
  13735. }
  13736. wrapRef.value.scrollTop = value;
  13737. };
  13738. const setScrollLeft = (value) => {
  13739. if (!isNumber(value)) {
  13740. return;
  13741. }
  13742. wrapRef.value.scrollLeft = value;
  13743. };
  13744. const update = () => {
  13745. var _a;
  13746. (_a = barRef.value) == null ? void 0 : _a.update();
  13747. };
  13748. vue.watch(() => props.noresize, (noresize) => {
  13749. if (noresize) {
  13750. stopResizeObserver == null ? void 0 : stopResizeObserver();
  13751. stopResizeListener == null ? void 0 : stopResizeListener();
  13752. } else {
  13753. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  13754. stopResizeListener = useEventListener("resize", update);
  13755. }
  13756. }, { immediate: true });
  13757. vue.watch(() => [props.maxHeight, props.height], () => {
  13758. if (!props.native)
  13759. vue.nextTick(() => {
  13760. var _a;
  13761. update();
  13762. if (wrapRef.value) {
  13763. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13764. }
  13765. });
  13766. });
  13767. vue.provide(scrollbarContextKey, vue.reactive({
  13768. scrollbarElement: scrollbarRef,
  13769. wrapElement: wrapRef
  13770. }));
  13771. vue.onActivated(() => {
  13772. if (wrapRef.value) {
  13773. wrapRef.value.scrollTop = wrapScrollTop;
  13774. wrapRef.value.scrollLeft = wrapScrollLeft;
  13775. }
  13776. });
  13777. vue.onMounted(() => {
  13778. if (!props.native)
  13779. vue.nextTick(() => {
  13780. update();
  13781. });
  13782. });
  13783. vue.onUpdated(() => update());
  13784. expose({
  13785. wrapRef,
  13786. update,
  13787. scrollTo,
  13788. setScrollTop,
  13789. setScrollLeft,
  13790. handleScroll
  13791. });
  13792. return (_ctx, _cache) => {
  13793. return vue.openBlock(), vue.createElementBlock("div", {
  13794. ref_key: "scrollbarRef",
  13795. ref: scrollbarRef,
  13796. class: vue.normalizeClass(vue.unref(ns).b())
  13797. }, [
  13798. vue.createElementVNode("div", {
  13799. ref_key: "wrapRef",
  13800. ref: wrapRef,
  13801. class: vue.normalizeClass(vue.unref(wrapKls)),
  13802. style: vue.normalizeStyle(vue.unref(wrapStyle)),
  13803. tabindex: _ctx.tabindex,
  13804. onScroll: handleScroll
  13805. }, [
  13806. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  13807. id: _ctx.id,
  13808. ref_key: "resizeRef",
  13809. ref: resizeRef,
  13810. class: vue.normalizeClass(vue.unref(resizeKls)),
  13811. style: vue.normalizeStyle(_ctx.viewStyle),
  13812. role: _ctx.role,
  13813. "aria-label": _ctx.ariaLabel,
  13814. "aria-orientation": _ctx.ariaOrientation
  13815. }, {
  13816. default: vue.withCtx(() => [
  13817. vue.renderSlot(_ctx.$slots, "default")
  13818. ]),
  13819. _: 3
  13820. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  13821. ], 46, ["tabindex"]),
  13822. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  13823. key: 0,
  13824. ref_key: "barRef",
  13825. ref: barRef,
  13826. always: _ctx.always,
  13827. "min-size": _ctx.minSize
  13828. }, null, 8, ["always", "min-size"])) : vue.createCommentVNode("v-if", true)
  13829. ], 2);
  13830. };
  13831. }
  13832. });
  13833. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "scrollbar.vue"]]);
  13834. const ElScrollbar = withInstall(Scrollbar$1);
  13835. const POPPER_INJECTION_KEY = Symbol("popper");
  13836. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  13837. const Effect = {
  13838. LIGHT: "light",
  13839. DARK: "dark"
  13840. };
  13841. const roleTypes = [
  13842. "dialog",
  13843. "grid",
  13844. "group",
  13845. "listbox",
  13846. "menu",
  13847. "navigation",
  13848. "tooltip",
  13849. "tree"
  13850. ];
  13851. const popperProps = buildProps({
  13852. role: {
  13853. type: String,
  13854. values: roleTypes,
  13855. default: "tooltip"
  13856. }
  13857. });
  13858. const usePopperProps = popperProps;
  13859. const __default__$1N = vue.defineComponent({
  13860. name: "ElPopper",
  13861. inheritAttrs: false
  13862. });
  13863. const _sfc_main$2o = /* @__PURE__ */ vue.defineComponent({
  13864. ...__default__$1N,
  13865. props: popperProps,
  13866. setup(__props, { expose }) {
  13867. const props = __props;
  13868. const triggerRef = vue.ref();
  13869. const popperInstanceRef = vue.ref();
  13870. const contentRef = vue.ref();
  13871. const referenceRef = vue.ref();
  13872. const role = vue.computed(() => props.role);
  13873. const popperProvides = {
  13874. triggerRef,
  13875. popperInstanceRef,
  13876. contentRef,
  13877. referenceRef,
  13878. role
  13879. };
  13880. expose(popperProvides);
  13881. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  13882. return (_ctx, _cache) => {
  13883. return vue.renderSlot(_ctx.$slots, "default");
  13884. };
  13885. }
  13886. });
  13887. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "popper.vue"]]);
  13888. const popperArrowProps = buildProps({
  13889. arrowOffset: {
  13890. type: Number,
  13891. default: 5
  13892. }
  13893. });
  13894. const usePopperArrowProps = popperArrowProps;
  13895. const __default__$1M = vue.defineComponent({
  13896. name: "ElPopperArrow",
  13897. inheritAttrs: false
  13898. });
  13899. const _sfc_main$2n = /* @__PURE__ */ vue.defineComponent({
  13900. ...__default__$1M,
  13901. props: popperArrowProps,
  13902. setup(__props, { expose }) {
  13903. const props = __props;
  13904. const ns = useNamespace("popper");
  13905. const { arrowOffset, arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  13906. vue.watch(() => props.arrowOffset, (val) => {
  13907. arrowOffset.value = val;
  13908. });
  13909. vue.onBeforeUnmount(() => {
  13910. arrowRef.value = void 0;
  13911. });
  13912. expose({
  13913. arrowRef
  13914. });
  13915. return (_ctx, _cache) => {
  13916. return vue.openBlock(), vue.createElementBlock("span", {
  13917. ref_key: "arrowRef",
  13918. ref: arrowRef,
  13919. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  13920. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  13921. "data-popper-arrow": ""
  13922. }, null, 6);
  13923. };
  13924. }
  13925. });
  13926. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "arrow.vue"]]);
  13927. const NAME = "ElOnlyChild";
  13928. const OnlyChild = vue.defineComponent({
  13929. name: NAME,
  13930. setup(_, {
  13931. slots,
  13932. attrs
  13933. }) {
  13934. var _a;
  13935. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  13936. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  13937. return () => {
  13938. var _a2;
  13939. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  13940. if (!defaultSlot)
  13941. return null;
  13942. if (defaultSlot.length > 1) {
  13943. return null;
  13944. }
  13945. const firstLegitNode = findFirstLegitChild(defaultSlot);
  13946. if (!firstLegitNode) {
  13947. return null;
  13948. }
  13949. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  13950. };
  13951. }
  13952. });
  13953. function findFirstLegitChild(node) {
  13954. if (!node)
  13955. return null;
  13956. const children = node;
  13957. for (const child of children) {
  13958. if (isObject$1(child)) {
  13959. switch (child.type) {
  13960. case vue.Comment:
  13961. continue;
  13962. case vue.Text:
  13963. case "svg":
  13964. return wrapTextContent(child);
  13965. case vue.Fragment:
  13966. return findFirstLegitChild(child.children);
  13967. default:
  13968. return child;
  13969. }
  13970. }
  13971. return wrapTextContent(child);
  13972. }
  13973. return null;
  13974. }
  13975. function wrapTextContent(s) {
  13976. const ns = useNamespace("only-child");
  13977. return vue.createVNode("span", {
  13978. "class": ns.e("content")
  13979. }, [s]);
  13980. }
  13981. const popperTriggerProps = buildProps({
  13982. virtualRef: {
  13983. type: definePropType(Object)
  13984. },
  13985. virtualTriggering: Boolean,
  13986. onMouseenter: {
  13987. type: definePropType(Function)
  13988. },
  13989. onMouseleave: {
  13990. type: definePropType(Function)
  13991. },
  13992. onClick: {
  13993. type: definePropType(Function)
  13994. },
  13995. onKeydown: {
  13996. type: definePropType(Function)
  13997. },
  13998. onFocus: {
  13999. type: definePropType(Function)
  14000. },
  14001. onBlur: {
  14002. type: definePropType(Function)
  14003. },
  14004. onContextmenu: {
  14005. type: definePropType(Function)
  14006. },
  14007. id: String,
  14008. open: Boolean
  14009. });
  14010. const usePopperTriggerProps = popperTriggerProps;
  14011. const __default__$1L = vue.defineComponent({
  14012. name: "ElPopperTrigger",
  14013. inheritAttrs: false
  14014. });
  14015. const _sfc_main$2m = /* @__PURE__ */ vue.defineComponent({
  14016. ...__default__$1L,
  14017. props: popperTriggerProps,
  14018. setup(__props, { expose }) {
  14019. const props = __props;
  14020. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  14021. useForwardRef(triggerRef);
  14022. const ariaControls = vue.computed(() => {
  14023. return ariaHaspopup.value ? props.id : void 0;
  14024. });
  14025. const ariaDescribedby = vue.computed(() => {
  14026. if (role && role.value === "tooltip") {
  14027. return props.open && props.id ? props.id : void 0;
  14028. }
  14029. return void 0;
  14030. });
  14031. const ariaHaspopup = vue.computed(() => {
  14032. if (role && role.value !== "tooltip") {
  14033. return role.value;
  14034. }
  14035. return void 0;
  14036. });
  14037. const ariaExpanded = vue.computed(() => {
  14038. return ariaHaspopup.value ? `${props.open}` : void 0;
  14039. });
  14040. let virtualTriggerAriaStopWatch = void 0;
  14041. const TRIGGER_ELE_EVENTS = [
  14042. "onMouseenter",
  14043. "onMouseleave",
  14044. "onClick",
  14045. "onKeydown",
  14046. "onFocus",
  14047. "onBlur",
  14048. "onContextmenu"
  14049. ];
  14050. vue.onMounted(() => {
  14051. vue.watch(() => props.virtualRef, (virtualEl) => {
  14052. if (virtualEl) {
  14053. triggerRef.value = unrefElement(virtualEl);
  14054. }
  14055. }, {
  14056. immediate: true
  14057. });
  14058. vue.watch(triggerRef, (el, prevEl) => {
  14059. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14060. virtualTriggerAriaStopWatch = void 0;
  14061. if (isElement$1(el)) {
  14062. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14063. var _a;
  14064. const handler = props[eventName];
  14065. if (handler) {
  14066. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  14067. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  14068. }
  14069. });
  14070. if (isFocusable(el)) {
  14071. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  14072. [
  14073. "aria-controls",
  14074. "aria-describedby",
  14075. "aria-haspopup",
  14076. "aria-expanded"
  14077. ].forEach((key, idx) => {
  14078. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14079. });
  14080. }, { immediate: true });
  14081. }
  14082. }
  14083. if (isElement$1(prevEl) && isFocusable(prevEl)) {
  14084. [
  14085. "aria-controls",
  14086. "aria-describedby",
  14087. "aria-haspopup",
  14088. "aria-expanded"
  14089. ].forEach((key) => prevEl.removeAttribute(key));
  14090. }
  14091. }, {
  14092. immediate: true
  14093. });
  14094. });
  14095. vue.onBeforeUnmount(() => {
  14096. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14097. virtualTriggerAriaStopWatch = void 0;
  14098. if (triggerRef.value && isElement$1(triggerRef.value)) {
  14099. const el = triggerRef.value;
  14100. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14101. const handler = props[eventName];
  14102. if (handler) {
  14103. el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
  14104. }
  14105. });
  14106. triggerRef.value = void 0;
  14107. }
  14108. });
  14109. expose({
  14110. triggerRef
  14111. });
  14112. return (_ctx, _cache) => {
  14113. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  14114. "aria-controls": vue.unref(ariaControls),
  14115. "aria-describedby": vue.unref(ariaDescribedby),
  14116. "aria-expanded": vue.unref(ariaExpanded),
  14117. "aria-haspopup": vue.unref(ariaHaspopup)
  14118. }), {
  14119. default: vue.withCtx(() => [
  14120. vue.renderSlot(_ctx.$slots, "default")
  14121. ]),
  14122. _: 3
  14123. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  14124. };
  14125. }
  14126. });
  14127. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "trigger.vue"]]);
  14128. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  14129. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  14130. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  14131. const FOCUS_AFTER_TRAPPED_OPTS = {
  14132. cancelable: true,
  14133. bubbles: false
  14134. };
  14135. const FOCUSOUT_PREVENTED_OPTS = {
  14136. cancelable: true,
  14137. bubbles: false
  14138. };
  14139. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  14140. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  14141. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  14142. const focusReason = vue.ref();
  14143. const lastUserFocusTimestamp = vue.ref(0);
  14144. const lastAutomatedFocusTimestamp = vue.ref(0);
  14145. let focusReasonUserCount = 0;
  14146. const obtainAllFocusableElements = (element) => {
  14147. const nodes = [];
  14148. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  14149. acceptNode: (node) => {
  14150. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  14151. if (node.disabled || node.hidden || isHiddenInput)
  14152. return NodeFilter.FILTER_SKIP;
  14153. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  14154. }
  14155. });
  14156. while (walker.nextNode())
  14157. nodes.push(walker.currentNode);
  14158. return nodes;
  14159. };
  14160. const getVisibleElement = (elements, container) => {
  14161. for (const element of elements) {
  14162. if (!isHidden(element, container))
  14163. return element;
  14164. }
  14165. };
  14166. const isHidden = (element, container) => {
  14167. if (getComputedStyle(element).visibility === "hidden")
  14168. return true;
  14169. while (element) {
  14170. if (container && element === container)
  14171. return false;
  14172. if (getComputedStyle(element).display === "none")
  14173. return true;
  14174. element = element.parentElement;
  14175. }
  14176. return false;
  14177. };
  14178. const getEdges = (container) => {
  14179. const focusable = obtainAllFocusableElements(container);
  14180. const first = getVisibleElement(focusable, container);
  14181. const last = getVisibleElement(focusable.reverse(), container);
  14182. return [first, last];
  14183. };
  14184. const isSelectable = (element) => {
  14185. return element instanceof HTMLInputElement && "select" in element;
  14186. };
  14187. const tryFocus = (element, shouldSelect) => {
  14188. if (element && element.focus) {
  14189. const prevFocusedElement = document.activeElement;
  14190. let cleanup = false;
  14191. if (isElement$1(element) && !isFocusable(element) && !element.getAttribute("tabindex")) {
  14192. element.setAttribute("tabindex", "-1");
  14193. cleanup = true;
  14194. }
  14195. element.focus({ preventScroll: true });
  14196. lastAutomatedFocusTimestamp.value = window.performance.now();
  14197. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  14198. element.select();
  14199. }
  14200. if (isElement$1(element) && cleanup) {
  14201. element.removeAttribute("tabindex");
  14202. }
  14203. }
  14204. };
  14205. function removeFromStack(list, item) {
  14206. const copy = [...list];
  14207. const idx = list.indexOf(item);
  14208. if (idx !== -1) {
  14209. copy.splice(idx, 1);
  14210. }
  14211. return copy;
  14212. }
  14213. const createFocusableStack = () => {
  14214. let stack = [];
  14215. const push = (layer) => {
  14216. const currentLayer = stack[0];
  14217. if (currentLayer && layer !== currentLayer) {
  14218. currentLayer.pause();
  14219. }
  14220. stack = removeFromStack(stack, layer);
  14221. stack.unshift(layer);
  14222. };
  14223. const remove = (layer) => {
  14224. var _a, _b;
  14225. stack = removeFromStack(stack, layer);
  14226. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  14227. };
  14228. return {
  14229. push,
  14230. remove
  14231. };
  14232. };
  14233. const focusFirstDescendant = (elements, shouldSelect = false) => {
  14234. const prevFocusedElement = document.activeElement;
  14235. for (const element of elements) {
  14236. tryFocus(element, shouldSelect);
  14237. if (document.activeElement !== prevFocusedElement)
  14238. return;
  14239. }
  14240. };
  14241. const focusableStack = createFocusableStack();
  14242. const isFocusCausedByUserEvent = () => {
  14243. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  14244. };
  14245. const notifyFocusReasonPointer = () => {
  14246. focusReason.value = "pointer";
  14247. lastUserFocusTimestamp.value = window.performance.now();
  14248. };
  14249. const notifyFocusReasonKeydown = () => {
  14250. focusReason.value = "keyboard";
  14251. lastUserFocusTimestamp.value = window.performance.now();
  14252. };
  14253. const useFocusReason = () => {
  14254. vue.onMounted(() => {
  14255. if (focusReasonUserCount === 0) {
  14256. document.addEventListener("mousedown", notifyFocusReasonPointer);
  14257. document.addEventListener("touchstart", notifyFocusReasonPointer);
  14258. document.addEventListener("keydown", notifyFocusReasonKeydown);
  14259. }
  14260. focusReasonUserCount++;
  14261. });
  14262. vue.onBeforeUnmount(() => {
  14263. focusReasonUserCount--;
  14264. if (focusReasonUserCount <= 0) {
  14265. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  14266. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  14267. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  14268. }
  14269. });
  14270. return {
  14271. focusReason,
  14272. lastUserFocusTimestamp,
  14273. lastAutomatedFocusTimestamp
  14274. };
  14275. };
  14276. const createFocusOutPreventedEvent = (detail) => {
  14277. return new CustomEvent(FOCUSOUT_PREVENTED, {
  14278. ...FOCUSOUT_PREVENTED_OPTS,
  14279. detail
  14280. });
  14281. };
  14282. const _sfc_main$2l = vue.defineComponent({
  14283. name: "ElFocusTrap",
  14284. inheritAttrs: false,
  14285. props: {
  14286. loop: Boolean,
  14287. trapped: Boolean,
  14288. focusTrapEl: Object,
  14289. focusStartEl: {
  14290. type: [Object, String],
  14291. default: "first"
  14292. }
  14293. },
  14294. emits: [
  14295. ON_TRAP_FOCUS_EVT,
  14296. ON_RELEASE_FOCUS_EVT,
  14297. "focusin",
  14298. "focusout",
  14299. "focusout-prevented",
  14300. "release-requested"
  14301. ],
  14302. setup(props, { emit }) {
  14303. const forwardRef = vue.ref();
  14304. let lastFocusBeforeTrapped;
  14305. let lastFocusAfterTrapped;
  14306. const { focusReason } = useFocusReason();
  14307. useEscapeKeydown((event) => {
  14308. if (props.trapped && !focusLayer.paused) {
  14309. emit("release-requested", event);
  14310. }
  14311. });
  14312. const focusLayer = {
  14313. paused: false,
  14314. pause() {
  14315. this.paused = true;
  14316. },
  14317. resume() {
  14318. this.paused = false;
  14319. }
  14320. };
  14321. const onKeydown = (e) => {
  14322. if (!props.loop && !props.trapped)
  14323. return;
  14324. if (focusLayer.paused)
  14325. return;
  14326. const { code, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  14327. const { loop } = props;
  14328. const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  14329. const currentFocusingEl = document.activeElement;
  14330. if (isTabbing && currentFocusingEl) {
  14331. const container = currentTarget;
  14332. const [first, last] = getEdges(container);
  14333. const isTabbable = first && last;
  14334. if (!isTabbable) {
  14335. if (currentFocusingEl === container) {
  14336. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14337. focusReason: focusReason.value
  14338. });
  14339. emit("focusout-prevented", focusoutPreventedEvent);
  14340. if (!focusoutPreventedEvent.defaultPrevented) {
  14341. e.preventDefault();
  14342. }
  14343. }
  14344. } else {
  14345. if (!shiftKey && currentFocusingEl === last) {
  14346. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14347. focusReason: focusReason.value
  14348. });
  14349. emit("focusout-prevented", focusoutPreventedEvent);
  14350. if (!focusoutPreventedEvent.defaultPrevented) {
  14351. e.preventDefault();
  14352. if (loop)
  14353. tryFocus(first, true);
  14354. }
  14355. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  14356. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14357. focusReason: focusReason.value
  14358. });
  14359. emit("focusout-prevented", focusoutPreventedEvent);
  14360. if (!focusoutPreventedEvent.defaultPrevented) {
  14361. e.preventDefault();
  14362. if (loop)
  14363. tryFocus(last, true);
  14364. }
  14365. }
  14366. }
  14367. }
  14368. };
  14369. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  14370. focusTrapRef: forwardRef,
  14371. onKeydown
  14372. });
  14373. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  14374. if (focusTrapEl) {
  14375. forwardRef.value = focusTrapEl;
  14376. }
  14377. }, { immediate: true });
  14378. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  14379. if (forwardRef2) {
  14380. forwardRef2.addEventListener("keydown", onKeydown);
  14381. forwardRef2.addEventListener("focusin", onFocusIn);
  14382. forwardRef2.addEventListener("focusout", onFocusOut);
  14383. }
  14384. if (oldForwardRef) {
  14385. oldForwardRef.removeEventListener("keydown", onKeydown);
  14386. oldForwardRef.removeEventListener("focusin", onFocusIn);
  14387. oldForwardRef.removeEventListener("focusout", onFocusOut);
  14388. }
  14389. });
  14390. const trapOnFocus = (e) => {
  14391. emit(ON_TRAP_FOCUS_EVT, e);
  14392. };
  14393. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  14394. const onFocusIn = (e) => {
  14395. const trapContainer = vue.unref(forwardRef);
  14396. if (!trapContainer)
  14397. return;
  14398. const target = e.target;
  14399. const relatedTarget = e.relatedTarget;
  14400. const isFocusedInTrap = target && trapContainer.contains(target);
  14401. if (!props.trapped) {
  14402. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  14403. if (!isPrevFocusedInTrap) {
  14404. lastFocusBeforeTrapped = relatedTarget;
  14405. }
  14406. }
  14407. if (isFocusedInTrap)
  14408. emit("focusin", e);
  14409. if (focusLayer.paused)
  14410. return;
  14411. if (props.trapped) {
  14412. if (isFocusedInTrap) {
  14413. lastFocusAfterTrapped = target;
  14414. } else {
  14415. tryFocus(lastFocusAfterTrapped, true);
  14416. }
  14417. }
  14418. };
  14419. const onFocusOut = (e) => {
  14420. const trapContainer = vue.unref(forwardRef);
  14421. if (focusLayer.paused || !trapContainer)
  14422. return;
  14423. if (props.trapped) {
  14424. const relatedTarget = e.relatedTarget;
  14425. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  14426. setTimeout(() => {
  14427. if (!focusLayer.paused && props.trapped) {
  14428. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14429. focusReason: focusReason.value
  14430. });
  14431. emit("focusout-prevented", focusoutPreventedEvent);
  14432. if (!focusoutPreventedEvent.defaultPrevented) {
  14433. tryFocus(lastFocusAfterTrapped, true);
  14434. }
  14435. }
  14436. }, 0);
  14437. }
  14438. } else {
  14439. const target = e.target;
  14440. const isFocusedInTrap = target && trapContainer.contains(target);
  14441. if (!isFocusedInTrap)
  14442. emit("focusout", e);
  14443. }
  14444. };
  14445. async function startTrap() {
  14446. await vue.nextTick();
  14447. const trapContainer = vue.unref(forwardRef);
  14448. if (trapContainer) {
  14449. focusableStack.push(focusLayer);
  14450. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  14451. lastFocusBeforeTrapped = prevFocusedElement;
  14452. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  14453. if (!isPrevFocusContained) {
  14454. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  14455. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14456. trapContainer.dispatchEvent(focusEvent);
  14457. if (!focusEvent.defaultPrevented) {
  14458. vue.nextTick(() => {
  14459. let focusStartEl = props.focusStartEl;
  14460. if (!isString$1(focusStartEl)) {
  14461. tryFocus(focusStartEl);
  14462. if (document.activeElement !== focusStartEl) {
  14463. focusStartEl = "first";
  14464. }
  14465. }
  14466. if (focusStartEl === "first") {
  14467. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  14468. }
  14469. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  14470. tryFocus(trapContainer);
  14471. }
  14472. });
  14473. }
  14474. }
  14475. }
  14476. }
  14477. function stopTrap() {
  14478. const trapContainer = vue.unref(forwardRef);
  14479. if (trapContainer) {
  14480. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14481. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  14482. ...FOCUS_AFTER_TRAPPED_OPTS,
  14483. detail: {
  14484. focusReason: focusReason.value
  14485. }
  14486. });
  14487. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14488. trapContainer.dispatchEvent(releasedEvent);
  14489. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  14490. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  14491. }
  14492. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14493. focusableStack.remove(focusLayer);
  14494. }
  14495. }
  14496. vue.onMounted(() => {
  14497. if (props.trapped) {
  14498. startTrap();
  14499. }
  14500. vue.watch(() => props.trapped, (trapped) => {
  14501. if (trapped) {
  14502. startTrap();
  14503. } else {
  14504. stopTrap();
  14505. }
  14506. });
  14507. });
  14508. vue.onBeforeUnmount(() => {
  14509. if (props.trapped) {
  14510. stopTrap();
  14511. }
  14512. if (forwardRef.value) {
  14513. forwardRef.value.removeEventListener("keydown", onKeydown);
  14514. forwardRef.value.removeEventListener("focusin", onFocusIn);
  14515. forwardRef.value.removeEventListener("focusout", onFocusOut);
  14516. forwardRef.value = void 0;
  14517. }
  14518. });
  14519. return {
  14520. onKeydown
  14521. };
  14522. }
  14523. });
  14524. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  14525. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  14526. }
  14527. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["render", _sfc_render$r], ["__file", "focus-trap.vue"]]);
  14528. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  14529. const popperCoreConfigProps = buildProps({
  14530. boundariesPadding: {
  14531. type: Number,
  14532. default: 0
  14533. },
  14534. fallbackPlacements: {
  14535. type: definePropType(Array),
  14536. default: void 0
  14537. },
  14538. gpuAcceleration: {
  14539. type: Boolean,
  14540. default: true
  14541. },
  14542. offset: {
  14543. type: Number,
  14544. default: 12
  14545. },
  14546. placement: {
  14547. type: String,
  14548. values: Ee,
  14549. default: "bottom"
  14550. },
  14551. popperOptions: {
  14552. type: definePropType(Object),
  14553. default: () => ({})
  14554. },
  14555. strategy: {
  14556. type: String,
  14557. values: POSITIONING_STRATEGIES,
  14558. default: "absolute"
  14559. }
  14560. });
  14561. const popperContentProps = buildProps({
  14562. ...popperCoreConfigProps,
  14563. id: String,
  14564. style: {
  14565. type: definePropType([String, Array, Object])
  14566. },
  14567. className: {
  14568. type: definePropType([String, Array, Object])
  14569. },
  14570. effect: {
  14571. type: definePropType(String),
  14572. default: "dark"
  14573. },
  14574. visible: Boolean,
  14575. enterable: {
  14576. type: Boolean,
  14577. default: true
  14578. },
  14579. pure: Boolean,
  14580. focusOnShow: {
  14581. type: Boolean,
  14582. default: false
  14583. },
  14584. trapping: {
  14585. type: Boolean,
  14586. default: false
  14587. },
  14588. popperClass: {
  14589. type: definePropType([String, Array, Object])
  14590. },
  14591. popperStyle: {
  14592. type: definePropType([String, Array, Object])
  14593. },
  14594. referenceEl: {
  14595. type: definePropType(Object)
  14596. },
  14597. triggerTargetEl: {
  14598. type: definePropType(Object)
  14599. },
  14600. stopPopperMouseEvent: {
  14601. type: Boolean,
  14602. default: true
  14603. },
  14604. virtualTriggering: Boolean,
  14605. zIndex: Number,
  14606. ...useAriaProps(["ariaLabel"])
  14607. });
  14608. const popperContentEmits = {
  14609. mouseenter: (evt) => evt instanceof MouseEvent,
  14610. mouseleave: (evt) => evt instanceof MouseEvent,
  14611. focus: () => true,
  14612. blur: () => true,
  14613. close: () => true
  14614. };
  14615. const usePopperCoreConfigProps = popperCoreConfigProps;
  14616. const usePopperContentProps = popperContentProps;
  14617. const usePopperContentEmits = popperContentEmits;
  14618. const buildPopperOptions = (props, modifiers = []) => {
  14619. const { placement, strategy, popperOptions } = props;
  14620. const options = {
  14621. placement,
  14622. strategy,
  14623. ...popperOptions,
  14624. modifiers: [...genModifiers(props), ...modifiers]
  14625. };
  14626. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  14627. return options;
  14628. };
  14629. const unwrapMeasurableEl = ($el) => {
  14630. if (!isClient)
  14631. return;
  14632. return unrefElement($el);
  14633. };
  14634. function genModifiers(options) {
  14635. const { offset, gpuAcceleration, fallbackPlacements } = options;
  14636. return [
  14637. {
  14638. name: "offset",
  14639. options: {
  14640. offset: [0, offset != null ? offset : 12]
  14641. }
  14642. },
  14643. {
  14644. name: "preventOverflow",
  14645. options: {
  14646. padding: {
  14647. top: 2,
  14648. bottom: 2,
  14649. left: 5,
  14650. right: 5
  14651. }
  14652. }
  14653. },
  14654. {
  14655. name: "flip",
  14656. options: {
  14657. padding: 5,
  14658. fallbackPlacements
  14659. }
  14660. },
  14661. {
  14662. name: "computeStyles",
  14663. options: {
  14664. gpuAcceleration
  14665. }
  14666. }
  14667. ];
  14668. }
  14669. function deriveExtraModifiers(options, modifiers) {
  14670. if (modifiers) {
  14671. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  14672. }
  14673. }
  14674. const DEFAULT_ARROW_OFFSET = 0;
  14675. const usePopperContent = (props) => {
  14676. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  14677. const arrowRef = vue.ref();
  14678. const arrowOffset = vue.ref();
  14679. const eventListenerModifier = vue.computed(() => {
  14680. return {
  14681. name: "eventListeners",
  14682. enabled: !!props.visible
  14683. };
  14684. });
  14685. const arrowModifier = vue.computed(() => {
  14686. var _a;
  14687. const arrowEl = vue.unref(arrowRef);
  14688. const offset = (_a = vue.unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  14689. return {
  14690. name: "arrow",
  14691. enabled: !isUndefined$1(arrowEl),
  14692. options: {
  14693. element: arrowEl,
  14694. padding: offset
  14695. }
  14696. };
  14697. });
  14698. const options = vue.computed(() => {
  14699. return {
  14700. onFirstUpdate: () => {
  14701. update();
  14702. },
  14703. ...buildPopperOptions(props, [
  14704. vue.unref(arrowModifier),
  14705. vue.unref(eventListenerModifier)
  14706. ])
  14707. };
  14708. });
  14709. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  14710. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  14711. vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  14712. vue.onMounted(() => {
  14713. vue.watch(() => {
  14714. var _a;
  14715. return (_a = vue.unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
  14716. }, () => {
  14717. update();
  14718. });
  14719. });
  14720. return {
  14721. attributes,
  14722. arrowRef,
  14723. contentRef,
  14724. instanceRef,
  14725. state,
  14726. styles,
  14727. role,
  14728. forceUpdate,
  14729. update
  14730. };
  14731. };
  14732. const usePopperContentDOM = (props, {
  14733. attributes,
  14734. styles,
  14735. role
  14736. }) => {
  14737. const { nextZIndex } = useZIndex();
  14738. const ns = useNamespace("popper");
  14739. const contentAttrs = vue.computed(() => vue.unref(attributes).popper);
  14740. const contentZIndex = vue.ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  14741. const contentClass = vue.computed(() => [
  14742. ns.b(),
  14743. ns.is("pure", props.pure),
  14744. ns.is(props.effect),
  14745. props.popperClass
  14746. ]);
  14747. const contentStyle = vue.computed(() => {
  14748. return [
  14749. { zIndex: vue.unref(contentZIndex) },
  14750. vue.unref(styles).popper,
  14751. props.popperStyle || {}
  14752. ];
  14753. });
  14754. const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0);
  14755. const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {});
  14756. const updateZIndex = () => {
  14757. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  14758. };
  14759. return {
  14760. ariaModal,
  14761. arrowStyle,
  14762. contentAttrs,
  14763. contentClass,
  14764. contentStyle,
  14765. contentZIndex,
  14766. updateZIndex
  14767. };
  14768. };
  14769. const usePopperContentFocusTrap = (props, emit) => {
  14770. const trapped = vue.ref(false);
  14771. const focusStartRef = vue.ref();
  14772. const onFocusAfterTrapped = () => {
  14773. emit("focus");
  14774. };
  14775. const onFocusAfterReleased = (event) => {
  14776. var _a;
  14777. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  14778. focusStartRef.value = "first";
  14779. emit("blur");
  14780. }
  14781. };
  14782. const onFocusInTrap = (event) => {
  14783. if (props.visible && !trapped.value) {
  14784. if (event.target) {
  14785. focusStartRef.value = event.target;
  14786. }
  14787. trapped.value = true;
  14788. }
  14789. };
  14790. const onFocusoutPrevented = (event) => {
  14791. if (!props.trapping) {
  14792. if (event.detail.focusReason === "pointer") {
  14793. event.preventDefault();
  14794. }
  14795. trapped.value = false;
  14796. }
  14797. };
  14798. const onReleaseRequested = () => {
  14799. trapped.value = false;
  14800. emit("close");
  14801. };
  14802. return {
  14803. focusStartRef,
  14804. trapped,
  14805. onFocusAfterReleased,
  14806. onFocusAfterTrapped,
  14807. onFocusInTrap,
  14808. onFocusoutPrevented,
  14809. onReleaseRequested
  14810. };
  14811. };
  14812. const __default__$1K = vue.defineComponent({
  14813. name: "ElPopperContent"
  14814. });
  14815. const _sfc_main$2k = /* @__PURE__ */ vue.defineComponent({
  14816. ...__default__$1K,
  14817. props: popperContentProps,
  14818. emits: popperContentEmits,
  14819. setup(__props, { expose, emit }) {
  14820. const props = __props;
  14821. const {
  14822. focusStartRef,
  14823. trapped,
  14824. onFocusAfterReleased,
  14825. onFocusAfterTrapped,
  14826. onFocusInTrap,
  14827. onFocusoutPrevented,
  14828. onReleaseRequested
  14829. } = usePopperContentFocusTrap(props, emit);
  14830. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  14831. const {
  14832. ariaModal,
  14833. arrowStyle,
  14834. contentAttrs,
  14835. contentClass,
  14836. contentStyle,
  14837. updateZIndex
  14838. } = usePopperContentDOM(props, {
  14839. styles,
  14840. attributes,
  14841. role
  14842. });
  14843. const formItemContext = vue.inject(formItemContextKey, void 0);
  14844. const arrowOffset = vue.ref();
  14845. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  14846. arrowStyle,
  14847. arrowRef,
  14848. arrowOffset
  14849. });
  14850. if (formItemContext) {
  14851. vue.provide(formItemContextKey, {
  14852. ...formItemContext,
  14853. addInputId: NOOP,
  14854. removeInputId: NOOP
  14855. });
  14856. }
  14857. let triggerTargetAriaStopWatch = void 0;
  14858. const updatePopper = (shouldUpdateZIndex = true) => {
  14859. update();
  14860. shouldUpdateZIndex && updateZIndex();
  14861. };
  14862. const togglePopperAlive = () => {
  14863. updatePopper(false);
  14864. if (props.visible && props.focusOnShow) {
  14865. trapped.value = true;
  14866. } else if (props.visible === false) {
  14867. trapped.value = false;
  14868. }
  14869. };
  14870. vue.onMounted(() => {
  14871. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  14872. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14873. triggerTargetAriaStopWatch = void 0;
  14874. const el = vue.unref(triggerTargetEl || contentRef.value);
  14875. const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value);
  14876. if (isElement$1(el)) {
  14877. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  14878. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  14879. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14880. });
  14881. }, { immediate: true });
  14882. }
  14883. if (prevEl !== el && isElement$1(prevEl)) {
  14884. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  14885. prevEl.removeAttribute(key);
  14886. });
  14887. }
  14888. }, { immediate: true });
  14889. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  14890. });
  14891. vue.onBeforeUnmount(() => {
  14892. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14893. triggerTargetAriaStopWatch = void 0;
  14894. });
  14895. expose({
  14896. popperContentRef: contentRef,
  14897. popperInstanceRef: instanceRef,
  14898. updatePopper,
  14899. contentStyle
  14900. });
  14901. return (_ctx, _cache) => {
  14902. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  14903. ref_key: "contentRef",
  14904. ref: contentRef
  14905. }, vue.unref(contentAttrs), {
  14906. style: vue.unref(contentStyle),
  14907. class: vue.unref(contentClass),
  14908. tabindex: "-1",
  14909. onMouseenter: (e) => _ctx.$emit("mouseenter", e),
  14910. onMouseleave: (e) => _ctx.$emit("mouseleave", e)
  14911. }), [
  14912. vue.createVNode(vue.unref(ElFocusTrap), {
  14913. trapped: vue.unref(trapped),
  14914. "trap-on-focus-in": true,
  14915. "focus-trap-el": vue.unref(contentRef),
  14916. "focus-start-el": vue.unref(focusStartRef),
  14917. onFocusAfterTrapped: vue.unref(onFocusAfterTrapped),
  14918. onFocusAfterReleased: vue.unref(onFocusAfterReleased),
  14919. onFocusin: vue.unref(onFocusInTrap),
  14920. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  14921. onReleaseRequested: vue.unref(onReleaseRequested)
  14922. }, {
  14923. default: vue.withCtx(() => [
  14924. vue.renderSlot(_ctx.$slots, "default")
  14925. ]),
  14926. _: 3
  14927. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  14928. ], 16, ["onMouseenter", "onMouseleave"]);
  14929. };
  14930. }
  14931. });
  14932. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "content.vue"]]);
  14933. const ElPopper = withInstall(Popper);
  14934. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  14935. const useTooltipContentProps = buildProps({
  14936. ...useDelayedToggleProps,
  14937. ...popperContentProps,
  14938. appendTo: {
  14939. type: definePropType([String, Object])
  14940. },
  14941. content: {
  14942. type: String,
  14943. default: ""
  14944. },
  14945. rawContent: Boolean,
  14946. persistent: Boolean,
  14947. visible: {
  14948. type: definePropType(Boolean),
  14949. default: null
  14950. },
  14951. transition: String,
  14952. teleported: {
  14953. type: Boolean,
  14954. default: true
  14955. },
  14956. disabled: Boolean,
  14957. ...useAriaProps(["ariaLabel"])
  14958. });
  14959. const useTooltipTriggerProps = buildProps({
  14960. ...popperTriggerProps,
  14961. disabled: Boolean,
  14962. trigger: {
  14963. type: definePropType([String, Array]),
  14964. default: "hover"
  14965. },
  14966. triggerKeys: {
  14967. type: definePropType(Array),
  14968. default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
  14969. }
  14970. });
  14971. const {
  14972. useModelToggleProps: useTooltipModelToggleProps,
  14973. useModelToggleEmits: useTooltipModelToggleEmits,
  14974. useModelToggle: useTooltipModelToggle
  14975. } = createModelToggleComposable("visible");
  14976. const useTooltipProps = buildProps({
  14977. ...popperProps,
  14978. ...useTooltipModelToggleProps,
  14979. ...useTooltipContentProps,
  14980. ...useTooltipTriggerProps,
  14981. ...popperArrowProps,
  14982. showArrow: {
  14983. type: Boolean,
  14984. default: true
  14985. }
  14986. });
  14987. const tooltipEmits = [
  14988. ...useTooltipModelToggleEmits,
  14989. "before-show",
  14990. "before-hide",
  14991. "show",
  14992. "hide",
  14993. "open",
  14994. "close"
  14995. ];
  14996. const isTriggerType = (trigger, type) => {
  14997. if (isArray$1(trigger)) {
  14998. return trigger.includes(type);
  14999. }
  15000. return trigger === type;
  15001. };
  15002. const whenTrigger = (trigger, type, handler) => {
  15003. return (e) => {
  15004. isTriggerType(vue.unref(trigger), type) && handler(e);
  15005. };
  15006. };
  15007. const __default__$1J = vue.defineComponent({
  15008. name: "ElTooltipTrigger"
  15009. });
  15010. const _sfc_main$2j = /* @__PURE__ */ vue.defineComponent({
  15011. ...__default__$1J,
  15012. props: useTooltipTriggerProps,
  15013. setup(__props, { expose }) {
  15014. const props = __props;
  15015. const ns = useNamespace("tooltip");
  15016. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  15017. const triggerRef = vue.ref(null);
  15018. const stopWhenControlledOrDisabled = () => {
  15019. if (vue.unref(controlled) || props.disabled) {
  15020. return true;
  15021. }
  15022. };
  15023. const trigger = vue.toRef(props, "trigger");
  15024. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  15025. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  15026. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  15027. if (e.button === 0) {
  15028. onToggle(e);
  15029. }
  15030. }));
  15031. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  15032. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  15033. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  15034. e.preventDefault();
  15035. onToggle(e);
  15036. }));
  15037. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  15038. const { code } = e;
  15039. if (props.triggerKeys.includes(code)) {
  15040. e.preventDefault();
  15041. onToggle(e);
  15042. }
  15043. });
  15044. expose({
  15045. triggerRef
  15046. });
  15047. return (_ctx, _cache) => {
  15048. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  15049. id: vue.unref(id),
  15050. "virtual-ref": _ctx.virtualRef,
  15051. open: vue.unref(open),
  15052. "virtual-triggering": _ctx.virtualTriggering,
  15053. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  15054. onBlur: vue.unref(onBlur),
  15055. onClick: vue.unref(onClick),
  15056. onContextmenu: vue.unref(onContextMenu),
  15057. onFocus: vue.unref(onFocus),
  15058. onMouseenter: vue.unref(onMouseenter),
  15059. onMouseleave: vue.unref(onMouseleave),
  15060. onKeydown: vue.unref(onKeydown)
  15061. }, {
  15062. default: vue.withCtx(() => [
  15063. vue.renderSlot(_ctx.$slots, "default")
  15064. ]),
  15065. _: 3
  15066. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  15067. };
  15068. }
  15069. });
  15070. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["__file", "trigger.vue"]]);
  15071. const teleportProps = buildProps({
  15072. to: {
  15073. type: definePropType([String, Object]),
  15074. required: true
  15075. },
  15076. disabled: Boolean
  15077. });
  15078. const _sfc_main$2i = /* @__PURE__ */ vue.defineComponent({
  15079. __name: "teleport",
  15080. props: teleportProps,
  15081. setup(__props) {
  15082. return (_ctx, _cache) => {
  15083. return _ctx.disabled ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.Teleport, {
  15084. key: 1,
  15085. to: _ctx.to
  15086. }, [
  15087. vue.renderSlot(_ctx.$slots, "default")
  15088. ], 8, ["to"]));
  15089. };
  15090. }
  15091. });
  15092. var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "teleport.vue"]]);
  15093. const ElTeleport = withInstall(Teleport);
  15094. var ElTeleport$1 = ElTeleport;
  15095. const __default__$1I = vue.defineComponent({
  15096. name: "ElTooltipContent",
  15097. inheritAttrs: false
  15098. });
  15099. const _sfc_main$2h = /* @__PURE__ */ vue.defineComponent({
  15100. ...__default__$1I,
  15101. props: useTooltipContentProps,
  15102. setup(__props, { expose }) {
  15103. const props = __props;
  15104. const { selector } = usePopperContainerId();
  15105. const ns = useNamespace("tooltip");
  15106. const contentRef = vue.ref();
  15107. let stopHandle;
  15108. const {
  15109. controlled,
  15110. id,
  15111. open,
  15112. trigger,
  15113. onClose,
  15114. onOpen,
  15115. onShow,
  15116. onHide,
  15117. onBeforeShow,
  15118. onBeforeHide
  15119. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  15120. const transitionClass = vue.computed(() => {
  15121. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  15122. });
  15123. const persistentRef = vue.computed(() => {
  15124. return props.persistent;
  15125. });
  15126. vue.onBeforeUnmount(() => {
  15127. stopHandle == null ? void 0 : stopHandle();
  15128. });
  15129. const shouldRender = vue.computed(() => {
  15130. return vue.unref(persistentRef) ? true : vue.unref(open);
  15131. });
  15132. const shouldShow = vue.computed(() => {
  15133. return props.disabled ? false : vue.unref(open);
  15134. });
  15135. const appendTo = vue.computed(() => {
  15136. return props.appendTo || selector.value;
  15137. });
  15138. const contentStyle = vue.computed(() => {
  15139. var _a;
  15140. return (_a = props.style) != null ? _a : {};
  15141. });
  15142. const ariaHidden = vue.ref(true);
  15143. const onTransitionLeave = () => {
  15144. onHide();
  15145. isFocusInsideContent() && tryFocus(document.body);
  15146. ariaHidden.value = true;
  15147. };
  15148. const stopWhenControlled = () => {
  15149. if (vue.unref(controlled))
  15150. return true;
  15151. };
  15152. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  15153. if (props.enterable && vue.unref(trigger) === "hover") {
  15154. onOpen();
  15155. }
  15156. });
  15157. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  15158. if (vue.unref(trigger) === "hover") {
  15159. onClose();
  15160. }
  15161. });
  15162. const onBeforeEnter = () => {
  15163. var _a, _b;
  15164. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15165. onBeforeShow == null ? void 0 : onBeforeShow();
  15166. };
  15167. const onBeforeLeave = () => {
  15168. onBeforeHide == null ? void 0 : onBeforeHide();
  15169. };
  15170. const onAfterShow = () => {
  15171. onShow();
  15172. stopHandle = onClickOutside(vue.computed(() => {
  15173. var _a;
  15174. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15175. }), () => {
  15176. if (vue.unref(controlled))
  15177. return;
  15178. const $trigger = vue.unref(trigger);
  15179. if ($trigger !== "hover") {
  15180. onClose();
  15181. }
  15182. });
  15183. };
  15184. const onBlur = () => {
  15185. if (!props.virtualTriggering) {
  15186. onClose();
  15187. }
  15188. };
  15189. const isFocusInsideContent = (event) => {
  15190. var _a;
  15191. const popperContent = (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15192. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  15193. return popperContent == null ? void 0 : popperContent.contains(activeElement);
  15194. };
  15195. vue.watch(() => vue.unref(open), (val) => {
  15196. if (!val) {
  15197. stopHandle == null ? void 0 : stopHandle();
  15198. } else {
  15199. ariaHidden.value = false;
  15200. }
  15201. }, {
  15202. flush: "post"
  15203. });
  15204. vue.watch(() => props.content, () => {
  15205. var _a, _b;
  15206. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15207. });
  15208. expose({
  15209. contentRef,
  15210. isFocusInsideContent
  15211. });
  15212. return (_ctx, _cache) => {
  15213. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  15214. disabled: !_ctx.teleported,
  15215. to: vue.unref(appendTo)
  15216. }, {
  15217. default: vue.withCtx(() => [
  15218. vue.createVNode(vue.Transition, {
  15219. name: vue.unref(transitionClass),
  15220. onAfterLeave: onTransitionLeave,
  15221. onBeforeEnter,
  15222. onAfterEnter: onAfterShow,
  15223. onBeforeLeave
  15224. }, {
  15225. default: vue.withCtx(() => [
  15226. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  15227. key: 0,
  15228. id: vue.unref(id),
  15229. ref_key: "contentRef",
  15230. ref: contentRef
  15231. }, _ctx.$attrs, {
  15232. "aria-label": _ctx.ariaLabel,
  15233. "aria-hidden": ariaHidden.value,
  15234. "boundaries-padding": _ctx.boundariesPadding,
  15235. "fallback-placements": _ctx.fallbackPlacements,
  15236. "gpu-acceleration": _ctx.gpuAcceleration,
  15237. offset: _ctx.offset,
  15238. placement: _ctx.placement,
  15239. "popper-options": _ctx.popperOptions,
  15240. strategy: _ctx.strategy,
  15241. effect: _ctx.effect,
  15242. enterable: _ctx.enterable,
  15243. pure: _ctx.pure,
  15244. "popper-class": _ctx.popperClass,
  15245. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  15246. "reference-el": _ctx.referenceEl,
  15247. "trigger-target-el": _ctx.triggerTargetEl,
  15248. visible: vue.unref(shouldShow),
  15249. "z-index": _ctx.zIndex,
  15250. onMouseenter: vue.unref(onContentEnter),
  15251. onMouseleave: vue.unref(onContentLeave),
  15252. onBlur,
  15253. onClose: vue.unref(onClose)
  15254. }), {
  15255. default: vue.withCtx(() => [
  15256. vue.renderSlot(_ctx.$slots, "default")
  15257. ]),
  15258. _: 3
  15259. }, 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"])), [
  15260. [vue.vShow, vue.unref(shouldShow)]
  15261. ]) : vue.createCommentVNode("v-if", true)
  15262. ]),
  15263. _: 3
  15264. }, 8, ["name"])
  15265. ]),
  15266. _: 3
  15267. }, 8, ["disabled", "to"]);
  15268. };
  15269. }
  15270. });
  15271. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "content.vue"]]);
  15272. const __default__$1H = vue.defineComponent({
  15273. name: "ElTooltip"
  15274. });
  15275. const _sfc_main$2g = /* @__PURE__ */ vue.defineComponent({
  15276. ...__default__$1H,
  15277. props: useTooltipProps,
  15278. emits: tooltipEmits,
  15279. setup(__props, { expose, emit }) {
  15280. const props = __props;
  15281. usePopperContainer();
  15282. const id = useId();
  15283. const popperRef = vue.ref();
  15284. const contentRef = vue.ref();
  15285. const updatePopper = () => {
  15286. var _a;
  15287. const popperComponent = vue.unref(popperRef);
  15288. if (popperComponent) {
  15289. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  15290. }
  15291. };
  15292. const open = vue.ref(false);
  15293. const toggleReason = vue.ref();
  15294. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  15295. indicator: open,
  15296. toggleReason
  15297. });
  15298. const { onOpen, onClose } = useDelayedToggle({
  15299. showAfter: vue.toRef(props, "showAfter"),
  15300. hideAfter: vue.toRef(props, "hideAfter"),
  15301. autoClose: vue.toRef(props, "autoClose"),
  15302. open: show,
  15303. close: hide
  15304. });
  15305. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  15306. vue.provide(TOOLTIP_INJECTION_KEY, {
  15307. controlled,
  15308. id,
  15309. open: vue.readonly(open),
  15310. trigger: vue.toRef(props, "trigger"),
  15311. onOpen: (event) => {
  15312. onOpen(event);
  15313. },
  15314. onClose: (event) => {
  15315. onClose(event);
  15316. },
  15317. onToggle: (event) => {
  15318. if (vue.unref(open)) {
  15319. onClose(event);
  15320. } else {
  15321. onOpen(event);
  15322. }
  15323. },
  15324. onShow: () => {
  15325. emit("show", toggleReason.value);
  15326. },
  15327. onHide: () => {
  15328. emit("hide", toggleReason.value);
  15329. },
  15330. onBeforeShow: () => {
  15331. emit("before-show", toggleReason.value);
  15332. },
  15333. onBeforeHide: () => {
  15334. emit("before-hide", toggleReason.value);
  15335. },
  15336. updatePopper
  15337. });
  15338. vue.watch(() => props.disabled, (disabled) => {
  15339. if (disabled && open.value) {
  15340. open.value = false;
  15341. }
  15342. });
  15343. const isFocusInsideContent = (event) => {
  15344. var _a;
  15345. return (_a = contentRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  15346. };
  15347. vue.onDeactivated(() => open.value && hide());
  15348. expose({
  15349. popperRef,
  15350. contentRef,
  15351. isFocusInsideContent,
  15352. updatePopper,
  15353. onOpen,
  15354. onClose,
  15355. hide
  15356. });
  15357. return (_ctx, _cache) => {
  15358. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  15359. ref_key: "popperRef",
  15360. ref: popperRef,
  15361. role: _ctx.role
  15362. }, {
  15363. default: vue.withCtx(() => [
  15364. vue.createVNode(ElTooltipTrigger, {
  15365. disabled: _ctx.disabled,
  15366. trigger: _ctx.trigger,
  15367. "trigger-keys": _ctx.triggerKeys,
  15368. "virtual-ref": _ctx.virtualRef,
  15369. "virtual-triggering": _ctx.virtualTriggering
  15370. }, {
  15371. default: vue.withCtx(() => [
  15372. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  15373. ]),
  15374. _: 3
  15375. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  15376. vue.createVNode(ElTooltipContent, {
  15377. ref_key: "contentRef",
  15378. ref: contentRef,
  15379. "aria-label": _ctx.ariaLabel,
  15380. "boundaries-padding": _ctx.boundariesPadding,
  15381. content: _ctx.content,
  15382. disabled: _ctx.disabled,
  15383. effect: _ctx.effect,
  15384. enterable: _ctx.enterable,
  15385. "fallback-placements": _ctx.fallbackPlacements,
  15386. "hide-after": _ctx.hideAfter,
  15387. "gpu-acceleration": _ctx.gpuAcceleration,
  15388. offset: _ctx.offset,
  15389. persistent: _ctx.persistent,
  15390. "popper-class": _ctx.popperClass,
  15391. "popper-style": _ctx.popperStyle,
  15392. placement: _ctx.placement,
  15393. "popper-options": _ctx.popperOptions,
  15394. pure: _ctx.pure,
  15395. "raw-content": _ctx.rawContent,
  15396. "reference-el": _ctx.referenceEl,
  15397. "trigger-target-el": _ctx.triggerTargetEl,
  15398. "show-after": _ctx.showAfter,
  15399. strategy: _ctx.strategy,
  15400. teleported: _ctx.teleported,
  15401. transition: _ctx.transition,
  15402. "virtual-triggering": _ctx.virtualTriggering,
  15403. "z-index": _ctx.zIndex,
  15404. "append-to": _ctx.appendTo
  15405. }, {
  15406. default: vue.withCtx(() => [
  15407. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  15408. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  15409. key: 0,
  15410. innerHTML: _ctx.content
  15411. }, null, 8, ["innerHTML"])) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.content), 1))
  15412. ]),
  15413. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  15414. key: 0,
  15415. "arrow-offset": _ctx.arrowOffset
  15416. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  15417. ]),
  15418. _: 3
  15419. }, 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"])
  15420. ]),
  15421. _: 3
  15422. }, 8, ["role"]);
  15423. };
  15424. }
  15425. });
  15426. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "tooltip.vue"]]);
  15427. const ElTooltip = withInstall(Tooltip);
  15428. const autocompleteProps = buildProps({
  15429. valueKey: {
  15430. type: String,
  15431. default: "value"
  15432. },
  15433. modelValue: {
  15434. type: [String, Number],
  15435. default: ""
  15436. },
  15437. debounce: {
  15438. type: Number,
  15439. default: 300
  15440. },
  15441. placement: {
  15442. type: definePropType(String),
  15443. values: [
  15444. "top",
  15445. "top-start",
  15446. "top-end",
  15447. "bottom",
  15448. "bottom-start",
  15449. "bottom-end"
  15450. ],
  15451. default: "bottom-start"
  15452. },
  15453. fetchSuggestions: {
  15454. type: definePropType([Function, Array]),
  15455. default: NOOP
  15456. },
  15457. popperClass: {
  15458. type: String,
  15459. default: ""
  15460. },
  15461. triggerOnFocus: {
  15462. type: Boolean,
  15463. default: true
  15464. },
  15465. selectWhenUnmatched: {
  15466. type: Boolean,
  15467. default: false
  15468. },
  15469. hideLoading: {
  15470. type: Boolean,
  15471. default: false
  15472. },
  15473. teleported: useTooltipContentProps.teleported,
  15474. highlightFirstItem: {
  15475. type: Boolean,
  15476. default: false
  15477. },
  15478. fitInputWidth: {
  15479. type: Boolean,
  15480. default: false
  15481. },
  15482. clearable: {
  15483. type: Boolean,
  15484. default: false
  15485. },
  15486. disabled: {
  15487. type: Boolean,
  15488. default: false
  15489. },
  15490. name: String,
  15491. ...useAriaProps(["ariaLabel"])
  15492. });
  15493. const autocompleteEmits = {
  15494. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  15495. [INPUT_EVENT]: (value) => isString$1(value),
  15496. [CHANGE_EVENT]: (value) => isString$1(value),
  15497. focus: (evt) => evt instanceof FocusEvent,
  15498. blur: (evt) => evt instanceof FocusEvent,
  15499. clear: () => true,
  15500. select: (item) => isObject$1(item)
  15501. };
  15502. const COMPONENT_NAME$j = "ElAutocomplete";
  15503. const __default__$1G = vue.defineComponent({
  15504. name: COMPONENT_NAME$j,
  15505. inheritAttrs: false
  15506. });
  15507. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  15508. ...__default__$1G,
  15509. props: autocompleteProps,
  15510. emits: autocompleteEmits,
  15511. setup(__props, { expose, emit }) {
  15512. const props = __props;
  15513. const attrs = useAttrs();
  15514. const rawAttrs = vue.useAttrs();
  15515. const disabled = useFormDisabled();
  15516. const ns = useNamespace("autocomplete");
  15517. const inputRef = vue.ref();
  15518. const regionRef = vue.ref();
  15519. const popperRef = vue.ref();
  15520. const listboxRef = vue.ref();
  15521. let readonly = false;
  15522. let ignoreFocusEvent = false;
  15523. const suggestions = vue.ref([]);
  15524. const highlightedIndex = vue.ref(-1);
  15525. const dropdownWidth = vue.ref("");
  15526. const activated = vue.ref(false);
  15527. const suggestionDisabled = vue.ref(false);
  15528. const loading = vue.ref(false);
  15529. const listboxId = useId();
  15530. const styles = vue.computed(() => rawAttrs.style);
  15531. const suggestionVisible = vue.computed(() => {
  15532. const isValidData = suggestions.value.length > 0;
  15533. return (isValidData || loading.value) && activated.value;
  15534. });
  15535. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  15536. const refInput = vue.computed(() => {
  15537. if (inputRef.value) {
  15538. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15539. }
  15540. return [];
  15541. });
  15542. const onSuggestionShow = () => {
  15543. if (suggestionVisible.value) {
  15544. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  15545. }
  15546. };
  15547. const onHide = () => {
  15548. highlightedIndex.value = -1;
  15549. };
  15550. const getData = async (queryString) => {
  15551. if (suggestionDisabled.value)
  15552. return;
  15553. const cb = (suggestionList) => {
  15554. loading.value = false;
  15555. if (suggestionDisabled.value)
  15556. return;
  15557. if (isArray$1(suggestionList)) {
  15558. suggestions.value = suggestionList;
  15559. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  15560. } else {
  15561. throwError(COMPONENT_NAME$j, "autocomplete suggestions must be an array");
  15562. }
  15563. };
  15564. loading.value = true;
  15565. if (isArray$1(props.fetchSuggestions)) {
  15566. cb(props.fetchSuggestions);
  15567. } else {
  15568. const result = await props.fetchSuggestions(queryString, cb);
  15569. if (isArray$1(result))
  15570. cb(result);
  15571. }
  15572. };
  15573. const debouncedGetData = debounce(getData, props.debounce);
  15574. const handleInput = (value) => {
  15575. const valuePresented = !!value;
  15576. emit(INPUT_EVENT, value);
  15577. emit(UPDATE_MODEL_EVENT, value);
  15578. suggestionDisabled.value = false;
  15579. activated.value || (activated.value = valuePresented);
  15580. if (!props.triggerOnFocus && !value) {
  15581. suggestionDisabled.value = true;
  15582. suggestions.value = [];
  15583. return;
  15584. }
  15585. debouncedGetData(value);
  15586. };
  15587. const handleMouseDown = (event) => {
  15588. var _a;
  15589. if (disabled.value)
  15590. return;
  15591. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15592. activated.value = true;
  15593. }
  15594. };
  15595. const handleChange = (value) => {
  15596. emit(CHANGE_EVENT, value);
  15597. };
  15598. const handleFocus = (evt) => {
  15599. var _a;
  15600. if (!ignoreFocusEvent) {
  15601. activated.value = true;
  15602. emit("focus", evt);
  15603. const queryString = (_a = props.modelValue) != null ? _a : "";
  15604. if (props.triggerOnFocus && !readonly) {
  15605. debouncedGetData(String(queryString));
  15606. }
  15607. } else {
  15608. ignoreFocusEvent = false;
  15609. }
  15610. };
  15611. const handleBlur = (evt) => {
  15612. setTimeout(() => {
  15613. var _a;
  15614. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  15615. ignoreFocusEvent = true;
  15616. return;
  15617. }
  15618. activated.value && close();
  15619. emit("blur", evt);
  15620. });
  15621. };
  15622. const handleClear = () => {
  15623. activated.value = false;
  15624. emit(UPDATE_MODEL_EVENT, "");
  15625. emit("clear");
  15626. };
  15627. const handleKeyEnter = async () => {
  15628. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  15629. handleSelect(suggestions.value[highlightedIndex.value]);
  15630. } else if (props.selectWhenUnmatched) {
  15631. emit("select", { value: props.modelValue });
  15632. suggestions.value = [];
  15633. highlightedIndex.value = -1;
  15634. }
  15635. };
  15636. const handleKeyEscape = (evt) => {
  15637. if (suggestionVisible.value) {
  15638. evt.preventDefault();
  15639. evt.stopPropagation();
  15640. close();
  15641. }
  15642. };
  15643. const close = () => {
  15644. activated.value = false;
  15645. };
  15646. const focus = () => {
  15647. var _a;
  15648. (_a = inputRef.value) == null ? void 0 : _a.focus();
  15649. };
  15650. const blur = () => {
  15651. var _a;
  15652. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15653. };
  15654. const handleSelect = async (item) => {
  15655. emit(INPUT_EVENT, item[props.valueKey]);
  15656. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  15657. emit("select", item);
  15658. suggestions.value = [];
  15659. highlightedIndex.value = -1;
  15660. };
  15661. const highlight = (index) => {
  15662. if (!suggestionVisible.value || loading.value)
  15663. return;
  15664. if (index < 0) {
  15665. highlightedIndex.value = -1;
  15666. return;
  15667. }
  15668. if (index >= suggestions.value.length) {
  15669. index = suggestions.value.length - 1;
  15670. }
  15671. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15672. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  15673. const highlightItem = suggestionList[index];
  15674. const scrollTop = suggestion.scrollTop;
  15675. const { offsetTop, scrollHeight } = highlightItem;
  15676. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  15677. suggestion.scrollTop += scrollHeight;
  15678. }
  15679. if (offsetTop < scrollTop) {
  15680. suggestion.scrollTop -= scrollHeight;
  15681. }
  15682. highlightedIndex.value = index;
  15683. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15684. };
  15685. const stopHandle = onClickOutside(listboxRef, () => {
  15686. var _a;
  15687. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent())
  15688. return;
  15689. suggestionVisible.value && close();
  15690. });
  15691. vue.onBeforeUnmount(() => {
  15692. stopHandle == null ? void 0 : stopHandle();
  15693. });
  15694. vue.onMounted(() => {
  15695. inputRef.value.ref.setAttribute("role", "textbox");
  15696. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  15697. inputRef.value.ref.setAttribute("aria-controls", "id");
  15698. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15699. readonly = inputRef.value.ref.hasAttribute("readonly");
  15700. });
  15701. expose({
  15702. highlightedIndex,
  15703. activated,
  15704. loading,
  15705. inputRef,
  15706. popperRef,
  15707. suggestions,
  15708. handleSelect,
  15709. handleKeyEnter,
  15710. focus,
  15711. blur,
  15712. close,
  15713. highlight,
  15714. getData
  15715. });
  15716. return (_ctx, _cache) => {
  15717. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  15718. ref_key: "popperRef",
  15719. ref: popperRef,
  15720. visible: vue.unref(suggestionVisible),
  15721. placement: _ctx.placement,
  15722. "fallback-placements": ["bottom-start", "top-start"],
  15723. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  15724. teleported: _ctx.teleported,
  15725. "gpu-acceleration": false,
  15726. pure: "",
  15727. "manual-mode": "",
  15728. effect: "light",
  15729. trigger: "click",
  15730. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  15731. persistent: "",
  15732. role: "listbox",
  15733. onBeforeShow: onSuggestionShow,
  15734. onHide
  15735. }, {
  15736. content: vue.withCtx(() => [
  15737. vue.createElementVNode("div", {
  15738. ref_key: "regionRef",
  15739. ref: regionRef,
  15740. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  15741. style: vue.normalizeStyle({
  15742. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15743. outline: "none"
  15744. }),
  15745. role: "region"
  15746. }, [
  15747. vue.createVNode(vue.unref(ElScrollbar), {
  15748. id: vue.unref(listboxId),
  15749. tag: "ul",
  15750. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  15751. "view-class": vue.unref(ns).be("suggestion", "list"),
  15752. role: "listbox"
  15753. }, {
  15754. default: vue.withCtx(() => [
  15755. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", { key: 0 }, [
  15756. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  15757. vue.createVNode(vue.unref(ElIcon), {
  15758. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  15759. }, {
  15760. default: vue.withCtx(() => [
  15761. vue.createVNode(vue.unref(loading_default))
  15762. ]),
  15763. _: 1
  15764. }, 8, ["class"])
  15765. ])
  15766. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  15767. return vue.openBlock(), vue.createElementBlock("li", {
  15768. id: `${vue.unref(listboxId)}-item-${index}`,
  15769. key: index,
  15770. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  15771. role: "option",
  15772. "aria-selected": highlightedIndex.value === index,
  15773. onClick: ($event) => handleSelect(item)
  15774. }, [
  15775. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  15776. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  15777. ])
  15778. ], 10, ["id", "aria-selected", "onClick"]);
  15779. }), 128))
  15780. ]),
  15781. _: 3
  15782. }, 8, ["id", "wrap-class", "view-class"])
  15783. ], 6)
  15784. ]),
  15785. default: vue.withCtx(() => [
  15786. vue.createElementVNode("div", {
  15787. ref_key: "listboxRef",
  15788. ref: listboxRef,
  15789. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  15790. style: vue.normalizeStyle(vue.unref(styles)),
  15791. role: "combobox",
  15792. "aria-haspopup": "listbox",
  15793. "aria-expanded": vue.unref(suggestionVisible),
  15794. "aria-owns": vue.unref(listboxId)
  15795. }, [
  15796. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  15797. ref_key: "inputRef",
  15798. ref: inputRef
  15799. }, vue.unref(attrs), {
  15800. clearable: _ctx.clearable,
  15801. disabled: vue.unref(disabled),
  15802. name: _ctx.name,
  15803. "model-value": _ctx.modelValue,
  15804. "aria-label": _ctx.ariaLabel,
  15805. onInput: handleInput,
  15806. onChange: handleChange,
  15807. onFocus: handleFocus,
  15808. onBlur: handleBlur,
  15809. onClear: handleClear,
  15810. onKeydown: [
  15811. vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"]),
  15812. vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"]),
  15813. vue.withKeys(handleKeyEnter, ["enter"]),
  15814. vue.withKeys(close, ["tab"]),
  15815. vue.withKeys(handleKeyEscape, ["esc"])
  15816. ],
  15817. onMousedown: handleMouseDown
  15818. }), vue.createSlots({
  15819. _: 2
  15820. }, [
  15821. _ctx.$slots.prepend ? {
  15822. name: "prepend",
  15823. fn: vue.withCtx(() => [
  15824. vue.renderSlot(_ctx.$slots, "prepend")
  15825. ])
  15826. } : void 0,
  15827. _ctx.$slots.append ? {
  15828. name: "append",
  15829. fn: vue.withCtx(() => [
  15830. vue.renderSlot(_ctx.$slots, "append")
  15831. ])
  15832. } : void 0,
  15833. _ctx.$slots.prefix ? {
  15834. name: "prefix",
  15835. fn: vue.withCtx(() => [
  15836. vue.renderSlot(_ctx.$slots, "prefix")
  15837. ])
  15838. } : void 0,
  15839. _ctx.$slots.suffix ? {
  15840. name: "suffix",
  15841. fn: vue.withCtx(() => [
  15842. vue.renderSlot(_ctx.$slots, "suffix")
  15843. ])
  15844. } : void 0
  15845. ]), 1040, ["clearable", "disabled", "name", "model-value", "aria-label", "onKeydown"])
  15846. ], 14, ["aria-expanded", "aria-owns"])
  15847. ]),
  15848. _: 3
  15849. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  15850. };
  15851. }
  15852. });
  15853. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "autocomplete.vue"]]);
  15854. const ElAutocomplete = withInstall(Autocomplete);
  15855. const avatarProps = buildProps({
  15856. size: {
  15857. type: [Number, String],
  15858. values: componentSizes,
  15859. default: "",
  15860. validator: (val) => isNumber(val)
  15861. },
  15862. shape: {
  15863. type: String,
  15864. values: ["circle", "square"],
  15865. default: "circle"
  15866. },
  15867. icon: {
  15868. type: iconPropType
  15869. },
  15870. src: {
  15871. type: String,
  15872. default: ""
  15873. },
  15874. alt: String,
  15875. srcSet: String,
  15876. fit: {
  15877. type: definePropType(String),
  15878. default: "cover"
  15879. }
  15880. });
  15881. const avatarEmits = {
  15882. error: (evt) => evt instanceof Event
  15883. };
  15884. const __default__$1F = vue.defineComponent({
  15885. name: "ElAvatar"
  15886. });
  15887. const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({
  15888. ...__default__$1F,
  15889. props: avatarProps,
  15890. emits: avatarEmits,
  15891. setup(__props, { emit }) {
  15892. const props = __props;
  15893. const ns = useNamespace("avatar");
  15894. const hasLoadError = vue.ref(false);
  15895. const avatarClass = vue.computed(() => {
  15896. const { size, icon, shape } = props;
  15897. const classList = [ns.b()];
  15898. if (isString$1(size))
  15899. classList.push(ns.m(size));
  15900. if (icon)
  15901. classList.push(ns.m("icon"));
  15902. if (shape)
  15903. classList.push(ns.m(shape));
  15904. return classList;
  15905. });
  15906. const sizeStyle = vue.computed(() => {
  15907. const { size } = props;
  15908. return isNumber(size) ? ns.cssVarBlock({
  15909. size: addUnit(size) || ""
  15910. }) : void 0;
  15911. });
  15912. const fitStyle = vue.computed(() => ({
  15913. objectFit: props.fit
  15914. }));
  15915. vue.watch(() => props.src, () => hasLoadError.value = false);
  15916. function handleError(e) {
  15917. hasLoadError.value = true;
  15918. emit("error", e);
  15919. }
  15920. return (_ctx, _cache) => {
  15921. return vue.openBlock(), vue.createElementBlock("span", {
  15922. class: vue.normalizeClass(vue.unref(avatarClass)),
  15923. style: vue.normalizeStyle(vue.unref(sizeStyle))
  15924. }, [
  15925. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  15926. key: 0,
  15927. src: _ctx.src,
  15928. alt: _ctx.alt,
  15929. srcset: _ctx.srcSet,
  15930. style: vue.normalizeStyle(vue.unref(fitStyle)),
  15931. onError: handleError
  15932. }, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  15933. default: vue.withCtx(() => [
  15934. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  15935. ]),
  15936. _: 1
  15937. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  15938. ], 6);
  15939. };
  15940. }
  15941. });
  15942. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "avatar.vue"]]);
  15943. const ElAvatar = withInstall(Avatar);
  15944. const backtopProps = {
  15945. visibilityHeight: {
  15946. type: Number,
  15947. default: 200
  15948. },
  15949. target: {
  15950. type: String,
  15951. default: ""
  15952. },
  15953. right: {
  15954. type: Number,
  15955. default: 40
  15956. },
  15957. bottom: {
  15958. type: Number,
  15959. default: 40
  15960. }
  15961. };
  15962. const backtopEmits = {
  15963. click: (evt) => evt instanceof MouseEvent
  15964. };
  15965. const useBackTop = (props, emit, componentName) => {
  15966. const el = vue.shallowRef();
  15967. const container = vue.shallowRef();
  15968. const visible = vue.ref(false);
  15969. const handleScroll = () => {
  15970. if (el.value)
  15971. visible.value = el.value.scrollTop >= props.visibilityHeight;
  15972. };
  15973. const handleClick = (event) => {
  15974. var _a;
  15975. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  15976. emit("click", event);
  15977. };
  15978. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  15979. useEventListener(container, "scroll", handleScrollThrottled);
  15980. vue.onMounted(() => {
  15981. var _a;
  15982. container.value = document;
  15983. el.value = document.documentElement;
  15984. if (props.target) {
  15985. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  15986. if (!el.value) {
  15987. throwError(componentName, `target does not exist: ${props.target}`);
  15988. }
  15989. container.value = el.value;
  15990. }
  15991. handleScroll();
  15992. });
  15993. return {
  15994. visible,
  15995. handleClick
  15996. };
  15997. };
  15998. const COMPONENT_NAME$i = "ElBacktop";
  15999. const __default__$1E = vue.defineComponent({
  16000. name: COMPONENT_NAME$i
  16001. });
  16002. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  16003. ...__default__$1E,
  16004. props: backtopProps,
  16005. emits: backtopEmits,
  16006. setup(__props, { emit }) {
  16007. const props = __props;
  16008. const ns = useNamespace("backtop");
  16009. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$i);
  16010. const backTopStyle = vue.computed(() => ({
  16011. right: `${props.right}px`,
  16012. bottom: `${props.bottom}px`
  16013. }));
  16014. return (_ctx, _cache) => {
  16015. return vue.openBlock(), vue.createBlock(vue.Transition, {
  16016. name: `${vue.unref(ns).namespace.value}-fade-in`
  16017. }, {
  16018. default: vue.withCtx(() => [
  16019. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  16020. key: 0,
  16021. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  16022. class: vue.normalizeClass(vue.unref(ns).b()),
  16023. onClick: vue.withModifiers(vue.unref(handleClick), ["stop"])
  16024. }, [
  16025. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  16026. vue.createVNode(vue.unref(ElIcon), {
  16027. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  16028. }, {
  16029. default: vue.withCtx(() => [
  16030. vue.createVNode(vue.unref(caret_top_default))
  16031. ]),
  16032. _: 1
  16033. }, 8, ["class"])
  16034. ])
  16035. ], 14, ["onClick"])) : vue.createCommentVNode("v-if", true)
  16036. ]),
  16037. _: 3
  16038. }, 8, ["name"]);
  16039. };
  16040. }
  16041. });
  16042. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "backtop.vue"]]);
  16043. const ElBacktop = withInstall(Backtop);
  16044. const badgeProps = buildProps({
  16045. value: {
  16046. type: [String, Number],
  16047. default: ""
  16048. },
  16049. max: {
  16050. type: Number,
  16051. default: 99
  16052. },
  16053. isDot: Boolean,
  16054. hidden: Boolean,
  16055. type: {
  16056. type: String,
  16057. values: ["primary", "success", "warning", "info", "danger"],
  16058. default: "danger"
  16059. },
  16060. showZero: {
  16061. type: Boolean,
  16062. default: true
  16063. },
  16064. color: String,
  16065. badgeStyle: {
  16066. type: definePropType([String, Object, Array])
  16067. },
  16068. offset: {
  16069. type: definePropType(Array),
  16070. default: [0, 0]
  16071. },
  16072. badgeClass: {
  16073. type: String
  16074. }
  16075. });
  16076. const __default__$1D = vue.defineComponent({
  16077. name: "ElBadge"
  16078. });
  16079. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  16080. ...__default__$1D,
  16081. props: badgeProps,
  16082. setup(__props, { expose }) {
  16083. const props = __props;
  16084. const ns = useNamespace("badge");
  16085. const content = vue.computed(() => {
  16086. if (props.isDot)
  16087. return "";
  16088. if (isNumber(props.value) && isNumber(props.max)) {
  16089. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  16090. }
  16091. return `${props.value}`;
  16092. });
  16093. const style = vue.computed(() => {
  16094. var _a, _b, _c, _d, _e;
  16095. return [
  16096. {
  16097. backgroundColor: props.color,
  16098. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  16099. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  16100. },
  16101. (_e = props.badgeStyle) != null ? _e : {}
  16102. ];
  16103. });
  16104. expose({
  16105. content
  16106. });
  16107. return (_ctx, _cache) => {
  16108. return vue.openBlock(), vue.createElementBlock("div", {
  16109. class: vue.normalizeClass(vue.unref(ns).b())
  16110. }, [
  16111. vue.renderSlot(_ctx.$slots, "default"),
  16112. vue.createVNode(vue.Transition, {
  16113. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  16114. persisted: ""
  16115. }, {
  16116. default: vue.withCtx(() => [
  16117. vue.withDirectives(vue.createElementVNode("sup", {
  16118. class: vue.normalizeClass([
  16119. vue.unref(ns).e("content"),
  16120. vue.unref(ns).em("content", _ctx.type),
  16121. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  16122. vue.unref(ns).is("dot", _ctx.isDot),
  16123. vue.unref(ns).is("hide-zero", !_ctx.showZero && props.value === 0),
  16124. _ctx.badgeClass
  16125. ]),
  16126. style: vue.normalizeStyle(vue.unref(style))
  16127. }, [
  16128. vue.renderSlot(_ctx.$slots, "content", { value: vue.unref(content) }, () => [
  16129. vue.createTextVNode(vue.toDisplayString(vue.unref(content)), 1)
  16130. ])
  16131. ], 6), [
  16132. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot || _ctx.$slots.content)]
  16133. ])
  16134. ]),
  16135. _: 3
  16136. }, 8, ["name"])
  16137. ], 2);
  16138. };
  16139. }
  16140. });
  16141. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "badge.vue"]]);
  16142. const ElBadge = withInstall(Badge);
  16143. const breadcrumbKey = Symbol("breadcrumbKey");
  16144. const breadcrumbProps = buildProps({
  16145. separator: {
  16146. type: String,
  16147. default: "/"
  16148. },
  16149. separatorIcon: {
  16150. type: iconPropType
  16151. }
  16152. });
  16153. const __default__$1C = vue.defineComponent({
  16154. name: "ElBreadcrumb"
  16155. });
  16156. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  16157. ...__default__$1C,
  16158. props: breadcrumbProps,
  16159. setup(__props) {
  16160. const props = __props;
  16161. const { t } = useLocale();
  16162. const ns = useNamespace("breadcrumb");
  16163. const breadcrumb = vue.ref();
  16164. vue.provide(breadcrumbKey, props);
  16165. vue.onMounted(() => {
  16166. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  16167. if (items.length) {
  16168. items[items.length - 1].setAttribute("aria-current", "page");
  16169. }
  16170. });
  16171. return (_ctx, _cache) => {
  16172. return vue.openBlock(), vue.createElementBlock("div", {
  16173. ref_key: "breadcrumb",
  16174. ref: breadcrumb,
  16175. class: vue.normalizeClass(vue.unref(ns).b()),
  16176. "aria-label": vue.unref(t)("el.breadcrumb.label"),
  16177. role: "navigation"
  16178. }, [
  16179. vue.renderSlot(_ctx.$slots, "default")
  16180. ], 10, ["aria-label"]);
  16181. };
  16182. }
  16183. });
  16184. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "breadcrumb.vue"]]);
  16185. const breadcrumbItemProps = buildProps({
  16186. to: {
  16187. type: definePropType([String, Object]),
  16188. default: ""
  16189. },
  16190. replace: Boolean
  16191. });
  16192. const __default__$1B = vue.defineComponent({
  16193. name: "ElBreadcrumbItem"
  16194. });
  16195. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  16196. ...__default__$1B,
  16197. props: breadcrumbItemProps,
  16198. setup(__props) {
  16199. const props = __props;
  16200. const instance = vue.getCurrentInstance();
  16201. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  16202. const ns = useNamespace("breadcrumb");
  16203. const router = instance.appContext.config.globalProperties.$router;
  16204. const link = vue.ref();
  16205. const onClick = () => {
  16206. if (!props.to || !router)
  16207. return;
  16208. props.replace ? router.replace(props.to) : router.push(props.to);
  16209. };
  16210. return (_ctx, _cache) => {
  16211. var _a, _b;
  16212. return vue.openBlock(), vue.createElementBlock("span", {
  16213. class: vue.normalizeClass(vue.unref(ns).e("item"))
  16214. }, [
  16215. vue.createElementVNode("span", {
  16216. ref_key: "link",
  16217. ref: link,
  16218. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  16219. role: "link",
  16220. onClick
  16221. }, [
  16222. vue.renderSlot(_ctx.$slots, "default")
  16223. ], 2),
  16224. ((_a = vue.unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16225. key: 0,
  16226. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  16227. }, {
  16228. default: vue.withCtx(() => [
  16229. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(breadcrumbContext).separatorIcon)))
  16230. ]),
  16231. _: 1
  16232. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  16233. key: 1,
  16234. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  16235. role: "presentation"
  16236. }, vue.toDisplayString((_b = vue.unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  16237. ], 2);
  16238. };
  16239. }
  16240. });
  16241. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "breadcrumb-item.vue"]]);
  16242. const ElBreadcrumb = withInstall(Breadcrumb, {
  16243. BreadcrumbItem
  16244. });
  16245. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  16246. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  16247. const useButton = (props, emit) => {
  16248. useDeprecated({
  16249. from: "type.text",
  16250. replacement: "link",
  16251. version: "3.0.0",
  16252. scope: "props",
  16253. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  16254. }, vue.computed(() => props.type === "text"));
  16255. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  16256. const globalConfig = useGlobalConfig("button");
  16257. const { form } = useFormItem();
  16258. const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  16259. const _disabled = useFormDisabled();
  16260. const _ref = vue.ref();
  16261. const slots = vue.useSlots();
  16262. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  16263. const autoInsertSpace = vue.computed(() => {
  16264. var _a, _b, _c;
  16265. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  16266. });
  16267. const _props = vue.computed(() => {
  16268. if (props.tag === "button") {
  16269. return {
  16270. ariaDisabled: _disabled.value || props.loading,
  16271. disabled: _disabled.value || props.loading,
  16272. autofocus: props.autofocus,
  16273. type: props.nativeType
  16274. };
  16275. }
  16276. return {};
  16277. });
  16278. const shouldAddSpace = vue.computed(() => {
  16279. var _a;
  16280. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  16281. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  16282. const slot = defaultSlot[0];
  16283. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  16284. const text = slot.children;
  16285. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  16286. }
  16287. }
  16288. return false;
  16289. });
  16290. const handleClick = (evt) => {
  16291. if (_disabled.value || props.loading) {
  16292. evt.stopPropagation();
  16293. return;
  16294. }
  16295. if (props.nativeType === "reset") {
  16296. form == null ? void 0 : form.resetFields();
  16297. }
  16298. emit("click", evt);
  16299. };
  16300. return {
  16301. _disabled,
  16302. _size,
  16303. _type,
  16304. _ref,
  16305. _props,
  16306. shouldAddSpace,
  16307. handleClick
  16308. };
  16309. };
  16310. const buttonTypes = [
  16311. "default",
  16312. "primary",
  16313. "success",
  16314. "warning",
  16315. "info",
  16316. "danger",
  16317. "text",
  16318. ""
  16319. ];
  16320. const buttonNativeTypes = ["button", "submit", "reset"];
  16321. const buttonProps = buildProps({
  16322. size: useSizeProp,
  16323. disabled: Boolean,
  16324. type: {
  16325. type: String,
  16326. values: buttonTypes,
  16327. default: ""
  16328. },
  16329. icon: {
  16330. type: iconPropType
  16331. },
  16332. nativeType: {
  16333. type: String,
  16334. values: buttonNativeTypes,
  16335. default: "button"
  16336. },
  16337. loading: Boolean,
  16338. loadingIcon: {
  16339. type: iconPropType,
  16340. default: () => loading_default
  16341. },
  16342. plain: Boolean,
  16343. text: Boolean,
  16344. link: Boolean,
  16345. bg: Boolean,
  16346. autofocus: Boolean,
  16347. round: Boolean,
  16348. circle: Boolean,
  16349. color: String,
  16350. dark: Boolean,
  16351. autoInsertSpace: {
  16352. type: Boolean,
  16353. default: void 0
  16354. },
  16355. tag: {
  16356. type: definePropType([String, Object]),
  16357. default: "button"
  16358. }
  16359. });
  16360. const buttonEmits = {
  16361. click: (evt) => evt instanceof MouseEvent
  16362. };
  16363. function bound01$1(n, max) {
  16364. if (isOnePointZero$1(n)) {
  16365. n = "100%";
  16366. }
  16367. var isPercent = isPercentage$1(n);
  16368. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  16369. if (isPercent) {
  16370. n = parseInt(String(n * max), 10) / 100;
  16371. }
  16372. if (Math.abs(n - max) < 1e-6) {
  16373. return 1;
  16374. }
  16375. if (max === 360) {
  16376. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  16377. } else {
  16378. n = n % max / parseFloat(String(max));
  16379. }
  16380. return n;
  16381. }
  16382. function clamp01(val) {
  16383. return Math.min(1, Math.max(0, val));
  16384. }
  16385. function isOnePointZero$1(n) {
  16386. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  16387. }
  16388. function isPercentage$1(n) {
  16389. return typeof n === "string" && n.indexOf("%") !== -1;
  16390. }
  16391. function boundAlpha(a) {
  16392. a = parseFloat(a);
  16393. if (isNaN(a) || a < 0 || a > 1) {
  16394. a = 1;
  16395. }
  16396. return a;
  16397. }
  16398. function convertToPercentage(n) {
  16399. if (n <= 1) {
  16400. return "".concat(Number(n) * 100, "%");
  16401. }
  16402. return n;
  16403. }
  16404. function pad2(c) {
  16405. return c.length === 1 ? "0" + c : String(c);
  16406. }
  16407. function rgbToRgb(r, g, b) {
  16408. return {
  16409. r: bound01$1(r, 255) * 255,
  16410. g: bound01$1(g, 255) * 255,
  16411. b: bound01$1(b, 255) * 255
  16412. };
  16413. }
  16414. function rgbToHsl(r, g, b) {
  16415. r = bound01$1(r, 255);
  16416. g = bound01$1(g, 255);
  16417. b = bound01$1(b, 255);
  16418. var max = Math.max(r, g, b);
  16419. var min = Math.min(r, g, b);
  16420. var h = 0;
  16421. var s = 0;
  16422. var l = (max + min) / 2;
  16423. if (max === min) {
  16424. s = 0;
  16425. h = 0;
  16426. } else {
  16427. var d = max - min;
  16428. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  16429. switch (max) {
  16430. case r:
  16431. h = (g - b) / d + (g < b ? 6 : 0);
  16432. break;
  16433. case g:
  16434. h = (b - r) / d + 2;
  16435. break;
  16436. case b:
  16437. h = (r - g) / d + 4;
  16438. break;
  16439. }
  16440. h /= 6;
  16441. }
  16442. return { h, s, l };
  16443. }
  16444. function hue2rgb(p, q, t) {
  16445. if (t < 0) {
  16446. t += 1;
  16447. }
  16448. if (t > 1) {
  16449. t -= 1;
  16450. }
  16451. if (t < 1 / 6) {
  16452. return p + (q - p) * (6 * t);
  16453. }
  16454. if (t < 1 / 2) {
  16455. return q;
  16456. }
  16457. if (t < 2 / 3) {
  16458. return p + (q - p) * (2 / 3 - t) * 6;
  16459. }
  16460. return p;
  16461. }
  16462. function hslToRgb(h, s, l) {
  16463. var r;
  16464. var g;
  16465. var b;
  16466. h = bound01$1(h, 360);
  16467. s = bound01$1(s, 100);
  16468. l = bound01$1(l, 100);
  16469. if (s === 0) {
  16470. g = l;
  16471. b = l;
  16472. r = l;
  16473. } else {
  16474. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  16475. var p = 2 * l - q;
  16476. r = hue2rgb(p, q, h + 1 / 3);
  16477. g = hue2rgb(p, q, h);
  16478. b = hue2rgb(p, q, h - 1 / 3);
  16479. }
  16480. return { r: r * 255, g: g * 255, b: b * 255 };
  16481. }
  16482. function rgbToHsv(r, g, b) {
  16483. r = bound01$1(r, 255);
  16484. g = bound01$1(g, 255);
  16485. b = bound01$1(b, 255);
  16486. var max = Math.max(r, g, b);
  16487. var min = Math.min(r, g, b);
  16488. var h = 0;
  16489. var v = max;
  16490. var d = max - min;
  16491. var s = max === 0 ? 0 : d / max;
  16492. if (max === min) {
  16493. h = 0;
  16494. } else {
  16495. switch (max) {
  16496. case r:
  16497. h = (g - b) / d + (g < b ? 6 : 0);
  16498. break;
  16499. case g:
  16500. h = (b - r) / d + 2;
  16501. break;
  16502. case b:
  16503. h = (r - g) / d + 4;
  16504. break;
  16505. }
  16506. h /= 6;
  16507. }
  16508. return { h, s, v };
  16509. }
  16510. function hsvToRgb(h, s, v) {
  16511. h = bound01$1(h, 360) * 6;
  16512. s = bound01$1(s, 100);
  16513. v = bound01$1(v, 100);
  16514. var i = Math.floor(h);
  16515. var f = h - i;
  16516. var p = v * (1 - s);
  16517. var q = v * (1 - f * s);
  16518. var t = v * (1 - (1 - f) * s);
  16519. var mod = i % 6;
  16520. var r = [v, q, p, p, t, v][mod];
  16521. var g = [t, v, v, q, p, p][mod];
  16522. var b = [p, p, t, v, v, q][mod];
  16523. return { r: r * 255, g: g * 255, b: b * 255 };
  16524. }
  16525. function rgbToHex(r, g, b, allow3Char) {
  16526. var hex = [
  16527. pad2(Math.round(r).toString(16)),
  16528. pad2(Math.round(g).toString(16)),
  16529. pad2(Math.round(b).toString(16))
  16530. ];
  16531. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  16532. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16533. }
  16534. return hex.join("");
  16535. }
  16536. function rgbaToHex(r, g, b, a, allow4Char) {
  16537. var hex = [
  16538. pad2(Math.round(r).toString(16)),
  16539. pad2(Math.round(g).toString(16)),
  16540. pad2(Math.round(b).toString(16)),
  16541. pad2(convertDecimalToHex(a))
  16542. ];
  16543. 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))) {
  16544. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16545. }
  16546. return hex.join("");
  16547. }
  16548. function convertDecimalToHex(d) {
  16549. return Math.round(parseFloat(d) * 255).toString(16);
  16550. }
  16551. function convertHexToDecimal(h) {
  16552. return parseIntFromHex(h) / 255;
  16553. }
  16554. function parseIntFromHex(val) {
  16555. return parseInt(val, 16);
  16556. }
  16557. function numberInputToObject(color) {
  16558. return {
  16559. r: color >> 16,
  16560. g: (color & 65280) >> 8,
  16561. b: color & 255
  16562. };
  16563. }
  16564. var names = {
  16565. aliceblue: "#f0f8ff",
  16566. antiquewhite: "#faebd7",
  16567. aqua: "#00ffff",
  16568. aquamarine: "#7fffd4",
  16569. azure: "#f0ffff",
  16570. beige: "#f5f5dc",
  16571. bisque: "#ffe4c4",
  16572. black: "#000000",
  16573. blanchedalmond: "#ffebcd",
  16574. blue: "#0000ff",
  16575. blueviolet: "#8a2be2",
  16576. brown: "#a52a2a",
  16577. burlywood: "#deb887",
  16578. cadetblue: "#5f9ea0",
  16579. chartreuse: "#7fff00",
  16580. chocolate: "#d2691e",
  16581. coral: "#ff7f50",
  16582. cornflowerblue: "#6495ed",
  16583. cornsilk: "#fff8dc",
  16584. crimson: "#dc143c",
  16585. cyan: "#00ffff",
  16586. darkblue: "#00008b",
  16587. darkcyan: "#008b8b",
  16588. darkgoldenrod: "#b8860b",
  16589. darkgray: "#a9a9a9",
  16590. darkgreen: "#006400",
  16591. darkgrey: "#a9a9a9",
  16592. darkkhaki: "#bdb76b",
  16593. darkmagenta: "#8b008b",
  16594. darkolivegreen: "#556b2f",
  16595. darkorange: "#ff8c00",
  16596. darkorchid: "#9932cc",
  16597. darkred: "#8b0000",
  16598. darksalmon: "#e9967a",
  16599. darkseagreen: "#8fbc8f",
  16600. darkslateblue: "#483d8b",
  16601. darkslategray: "#2f4f4f",
  16602. darkslategrey: "#2f4f4f",
  16603. darkturquoise: "#00ced1",
  16604. darkviolet: "#9400d3",
  16605. deeppink: "#ff1493",
  16606. deepskyblue: "#00bfff",
  16607. dimgray: "#696969",
  16608. dimgrey: "#696969",
  16609. dodgerblue: "#1e90ff",
  16610. firebrick: "#b22222",
  16611. floralwhite: "#fffaf0",
  16612. forestgreen: "#228b22",
  16613. fuchsia: "#ff00ff",
  16614. gainsboro: "#dcdcdc",
  16615. ghostwhite: "#f8f8ff",
  16616. goldenrod: "#daa520",
  16617. gold: "#ffd700",
  16618. gray: "#808080",
  16619. green: "#008000",
  16620. greenyellow: "#adff2f",
  16621. grey: "#808080",
  16622. honeydew: "#f0fff0",
  16623. hotpink: "#ff69b4",
  16624. indianred: "#cd5c5c",
  16625. indigo: "#4b0082",
  16626. ivory: "#fffff0",
  16627. khaki: "#f0e68c",
  16628. lavenderblush: "#fff0f5",
  16629. lavender: "#e6e6fa",
  16630. lawngreen: "#7cfc00",
  16631. lemonchiffon: "#fffacd",
  16632. lightblue: "#add8e6",
  16633. lightcoral: "#f08080",
  16634. lightcyan: "#e0ffff",
  16635. lightgoldenrodyellow: "#fafad2",
  16636. lightgray: "#d3d3d3",
  16637. lightgreen: "#90ee90",
  16638. lightgrey: "#d3d3d3",
  16639. lightpink: "#ffb6c1",
  16640. lightsalmon: "#ffa07a",
  16641. lightseagreen: "#20b2aa",
  16642. lightskyblue: "#87cefa",
  16643. lightslategray: "#778899",
  16644. lightslategrey: "#778899",
  16645. lightsteelblue: "#b0c4de",
  16646. lightyellow: "#ffffe0",
  16647. lime: "#00ff00",
  16648. limegreen: "#32cd32",
  16649. linen: "#faf0e6",
  16650. magenta: "#ff00ff",
  16651. maroon: "#800000",
  16652. mediumaquamarine: "#66cdaa",
  16653. mediumblue: "#0000cd",
  16654. mediumorchid: "#ba55d3",
  16655. mediumpurple: "#9370db",
  16656. mediumseagreen: "#3cb371",
  16657. mediumslateblue: "#7b68ee",
  16658. mediumspringgreen: "#00fa9a",
  16659. mediumturquoise: "#48d1cc",
  16660. mediumvioletred: "#c71585",
  16661. midnightblue: "#191970",
  16662. mintcream: "#f5fffa",
  16663. mistyrose: "#ffe4e1",
  16664. moccasin: "#ffe4b5",
  16665. navajowhite: "#ffdead",
  16666. navy: "#000080",
  16667. oldlace: "#fdf5e6",
  16668. olive: "#808000",
  16669. olivedrab: "#6b8e23",
  16670. orange: "#ffa500",
  16671. orangered: "#ff4500",
  16672. orchid: "#da70d6",
  16673. palegoldenrod: "#eee8aa",
  16674. palegreen: "#98fb98",
  16675. paleturquoise: "#afeeee",
  16676. palevioletred: "#db7093",
  16677. papayawhip: "#ffefd5",
  16678. peachpuff: "#ffdab9",
  16679. peru: "#cd853f",
  16680. pink: "#ffc0cb",
  16681. plum: "#dda0dd",
  16682. powderblue: "#b0e0e6",
  16683. purple: "#800080",
  16684. rebeccapurple: "#663399",
  16685. red: "#ff0000",
  16686. rosybrown: "#bc8f8f",
  16687. royalblue: "#4169e1",
  16688. saddlebrown: "#8b4513",
  16689. salmon: "#fa8072",
  16690. sandybrown: "#f4a460",
  16691. seagreen: "#2e8b57",
  16692. seashell: "#fff5ee",
  16693. sienna: "#a0522d",
  16694. silver: "#c0c0c0",
  16695. skyblue: "#87ceeb",
  16696. slateblue: "#6a5acd",
  16697. slategray: "#708090",
  16698. slategrey: "#708090",
  16699. snow: "#fffafa",
  16700. springgreen: "#00ff7f",
  16701. steelblue: "#4682b4",
  16702. tan: "#d2b48c",
  16703. teal: "#008080",
  16704. thistle: "#d8bfd8",
  16705. tomato: "#ff6347",
  16706. turquoise: "#40e0d0",
  16707. violet: "#ee82ee",
  16708. wheat: "#f5deb3",
  16709. white: "#ffffff",
  16710. whitesmoke: "#f5f5f5",
  16711. yellow: "#ffff00",
  16712. yellowgreen: "#9acd32"
  16713. };
  16714. function inputToRGB(color) {
  16715. var rgb = { r: 0, g: 0, b: 0 };
  16716. var a = 1;
  16717. var s = null;
  16718. var v = null;
  16719. var l = null;
  16720. var ok = false;
  16721. var format = false;
  16722. if (typeof color === "string") {
  16723. color = stringInputToObject(color);
  16724. }
  16725. if (typeof color === "object") {
  16726. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16727. rgb = rgbToRgb(color.r, color.g, color.b);
  16728. ok = true;
  16729. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16730. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16731. s = convertToPercentage(color.s);
  16732. v = convertToPercentage(color.v);
  16733. rgb = hsvToRgb(color.h, s, v);
  16734. ok = true;
  16735. format = "hsv";
  16736. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16737. s = convertToPercentage(color.s);
  16738. l = convertToPercentage(color.l);
  16739. rgb = hslToRgb(color.h, s, l);
  16740. ok = true;
  16741. format = "hsl";
  16742. }
  16743. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  16744. a = color.a;
  16745. }
  16746. }
  16747. a = boundAlpha(a);
  16748. return {
  16749. ok,
  16750. format: color.format || format,
  16751. r: Math.min(255, Math.max(rgb.r, 0)),
  16752. g: Math.min(255, Math.max(rgb.g, 0)),
  16753. b: Math.min(255, Math.max(rgb.b, 0)),
  16754. a
  16755. };
  16756. }
  16757. var CSS_INTEGER = "[-\\+]?\\d+%?";
  16758. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  16759. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  16760. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16761. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16762. var matchers = {
  16763. CSS_UNIT: new RegExp(CSS_UNIT),
  16764. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16765. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16766. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16767. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16768. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16769. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16770. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16771. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16772. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16773. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16774. };
  16775. function stringInputToObject(color) {
  16776. color = color.trim().toLowerCase();
  16777. if (color.length === 0) {
  16778. return false;
  16779. }
  16780. var named = false;
  16781. if (names[color]) {
  16782. color = names[color];
  16783. named = true;
  16784. } else if (color === "transparent") {
  16785. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  16786. }
  16787. var match = matchers.rgb.exec(color);
  16788. if (match) {
  16789. return { r: match[1], g: match[2], b: match[3] };
  16790. }
  16791. match = matchers.rgba.exec(color);
  16792. if (match) {
  16793. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  16794. }
  16795. match = matchers.hsl.exec(color);
  16796. if (match) {
  16797. return { h: match[1], s: match[2], l: match[3] };
  16798. }
  16799. match = matchers.hsla.exec(color);
  16800. if (match) {
  16801. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  16802. }
  16803. match = matchers.hsv.exec(color);
  16804. if (match) {
  16805. return { h: match[1], s: match[2], v: match[3] };
  16806. }
  16807. match = matchers.hsva.exec(color);
  16808. if (match) {
  16809. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  16810. }
  16811. match = matchers.hex8.exec(color);
  16812. if (match) {
  16813. return {
  16814. r: parseIntFromHex(match[1]),
  16815. g: parseIntFromHex(match[2]),
  16816. b: parseIntFromHex(match[3]),
  16817. a: convertHexToDecimal(match[4]),
  16818. format: named ? "name" : "hex8"
  16819. };
  16820. }
  16821. match = matchers.hex6.exec(color);
  16822. if (match) {
  16823. return {
  16824. r: parseIntFromHex(match[1]),
  16825. g: parseIntFromHex(match[2]),
  16826. b: parseIntFromHex(match[3]),
  16827. format: named ? "name" : "hex"
  16828. };
  16829. }
  16830. match = matchers.hex4.exec(color);
  16831. if (match) {
  16832. return {
  16833. r: parseIntFromHex(match[1] + match[1]),
  16834. g: parseIntFromHex(match[2] + match[2]),
  16835. b: parseIntFromHex(match[3] + match[3]),
  16836. a: convertHexToDecimal(match[4] + match[4]),
  16837. format: named ? "name" : "hex8"
  16838. };
  16839. }
  16840. match = matchers.hex3.exec(color);
  16841. if (match) {
  16842. return {
  16843. r: parseIntFromHex(match[1] + match[1]),
  16844. g: parseIntFromHex(match[2] + match[2]),
  16845. b: parseIntFromHex(match[3] + match[3]),
  16846. format: named ? "name" : "hex"
  16847. };
  16848. }
  16849. return false;
  16850. }
  16851. function isValidCSSUnit(color) {
  16852. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  16853. }
  16854. var TinyColor = function() {
  16855. function TinyColor2(color, opts) {
  16856. if (color === void 0) {
  16857. color = "";
  16858. }
  16859. if (opts === void 0) {
  16860. opts = {};
  16861. }
  16862. var _a;
  16863. if (color instanceof TinyColor2) {
  16864. return color;
  16865. }
  16866. if (typeof color === "number") {
  16867. color = numberInputToObject(color);
  16868. }
  16869. this.originalInput = color;
  16870. var rgb = inputToRGB(color);
  16871. this.originalInput = color;
  16872. this.r = rgb.r;
  16873. this.g = rgb.g;
  16874. this.b = rgb.b;
  16875. this.a = rgb.a;
  16876. this.roundA = Math.round(100 * this.a) / 100;
  16877. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  16878. this.gradientType = opts.gradientType;
  16879. if (this.r < 1) {
  16880. this.r = Math.round(this.r);
  16881. }
  16882. if (this.g < 1) {
  16883. this.g = Math.round(this.g);
  16884. }
  16885. if (this.b < 1) {
  16886. this.b = Math.round(this.b);
  16887. }
  16888. this.isValid = rgb.ok;
  16889. }
  16890. TinyColor2.prototype.isDark = function() {
  16891. return this.getBrightness() < 128;
  16892. };
  16893. TinyColor2.prototype.isLight = function() {
  16894. return !this.isDark();
  16895. };
  16896. TinyColor2.prototype.getBrightness = function() {
  16897. var rgb = this.toRgb();
  16898. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16899. };
  16900. TinyColor2.prototype.getLuminance = function() {
  16901. var rgb = this.toRgb();
  16902. var R;
  16903. var G;
  16904. var B;
  16905. var RsRGB = rgb.r / 255;
  16906. var GsRGB = rgb.g / 255;
  16907. var BsRGB = rgb.b / 255;
  16908. if (RsRGB <= 0.03928) {
  16909. R = RsRGB / 12.92;
  16910. } else {
  16911. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  16912. }
  16913. if (GsRGB <= 0.03928) {
  16914. G = GsRGB / 12.92;
  16915. } else {
  16916. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  16917. }
  16918. if (BsRGB <= 0.03928) {
  16919. B = BsRGB / 12.92;
  16920. } else {
  16921. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  16922. }
  16923. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  16924. };
  16925. TinyColor2.prototype.getAlpha = function() {
  16926. return this.a;
  16927. };
  16928. TinyColor2.prototype.setAlpha = function(alpha) {
  16929. this.a = boundAlpha(alpha);
  16930. this.roundA = Math.round(100 * this.a) / 100;
  16931. return this;
  16932. };
  16933. TinyColor2.prototype.toHsv = function() {
  16934. var hsv = rgbToHsv(this.r, this.g, this.b);
  16935. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  16936. };
  16937. TinyColor2.prototype.toHsvString = function() {
  16938. var hsv = rgbToHsv(this.r, this.g, this.b);
  16939. var h = Math.round(hsv.h * 360);
  16940. var s = Math.round(hsv.s * 100);
  16941. var v = Math.round(hsv.v * 100);
  16942. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  16943. };
  16944. TinyColor2.prototype.toHsl = function() {
  16945. var hsl = rgbToHsl(this.r, this.g, this.b);
  16946. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  16947. };
  16948. TinyColor2.prototype.toHslString = function() {
  16949. var hsl = rgbToHsl(this.r, this.g, this.b);
  16950. var h = Math.round(hsl.h * 360);
  16951. var s = Math.round(hsl.s * 100);
  16952. var l = Math.round(hsl.l * 100);
  16953. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  16954. };
  16955. TinyColor2.prototype.toHex = function(allow3Char) {
  16956. if (allow3Char === void 0) {
  16957. allow3Char = false;
  16958. }
  16959. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16960. };
  16961. TinyColor2.prototype.toHexString = function(allow3Char) {
  16962. if (allow3Char === void 0) {
  16963. allow3Char = false;
  16964. }
  16965. return "#" + this.toHex(allow3Char);
  16966. };
  16967. TinyColor2.prototype.toHex8 = function(allow4Char) {
  16968. if (allow4Char === void 0) {
  16969. allow4Char = false;
  16970. }
  16971. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16972. };
  16973. TinyColor2.prototype.toHex8String = function(allow4Char) {
  16974. if (allow4Char === void 0) {
  16975. allow4Char = false;
  16976. }
  16977. return "#" + this.toHex8(allow4Char);
  16978. };
  16979. TinyColor2.prototype.toRgb = function() {
  16980. return {
  16981. r: Math.round(this.r),
  16982. g: Math.round(this.g),
  16983. b: Math.round(this.b),
  16984. a: this.a
  16985. };
  16986. };
  16987. TinyColor2.prototype.toRgbString = function() {
  16988. var r = Math.round(this.r);
  16989. var g = Math.round(this.g);
  16990. var b = Math.round(this.b);
  16991. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  16992. };
  16993. TinyColor2.prototype.toPercentageRgb = function() {
  16994. var fmt = function(x) {
  16995. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  16996. };
  16997. return {
  16998. r: fmt(this.r),
  16999. g: fmt(this.g),
  17000. b: fmt(this.b),
  17001. a: this.a
  17002. };
  17003. };
  17004. TinyColor2.prototype.toPercentageRgbString = function() {
  17005. var rnd = function(x) {
  17006. return Math.round(bound01$1(x, 255) * 100);
  17007. };
  17008. 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, ")");
  17009. };
  17010. TinyColor2.prototype.toName = function() {
  17011. if (this.a === 0) {
  17012. return "transparent";
  17013. }
  17014. if (this.a < 1) {
  17015. return false;
  17016. }
  17017. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  17018. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  17019. var _b = _a[_i], key = _b[0], value = _b[1];
  17020. if (hex === value) {
  17021. return key;
  17022. }
  17023. }
  17024. return false;
  17025. };
  17026. TinyColor2.prototype.toString = function(format) {
  17027. var formatSet = Boolean(format);
  17028. format = format !== null && format !== void 0 ? format : this.format;
  17029. var formattedString = false;
  17030. var hasAlpha = this.a < 1 && this.a >= 0;
  17031. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  17032. if (needsAlphaFormat) {
  17033. if (format === "name" && this.a === 0) {
  17034. return this.toName();
  17035. }
  17036. return this.toRgbString();
  17037. }
  17038. if (format === "rgb") {
  17039. formattedString = this.toRgbString();
  17040. }
  17041. if (format === "prgb") {
  17042. formattedString = this.toPercentageRgbString();
  17043. }
  17044. if (format === "hex" || format === "hex6") {
  17045. formattedString = this.toHexString();
  17046. }
  17047. if (format === "hex3") {
  17048. formattedString = this.toHexString(true);
  17049. }
  17050. if (format === "hex4") {
  17051. formattedString = this.toHex8String(true);
  17052. }
  17053. if (format === "hex8") {
  17054. formattedString = this.toHex8String();
  17055. }
  17056. if (format === "name") {
  17057. formattedString = this.toName();
  17058. }
  17059. if (format === "hsl") {
  17060. formattedString = this.toHslString();
  17061. }
  17062. if (format === "hsv") {
  17063. formattedString = this.toHsvString();
  17064. }
  17065. return formattedString || this.toHexString();
  17066. };
  17067. TinyColor2.prototype.toNumber = function() {
  17068. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  17069. };
  17070. TinyColor2.prototype.clone = function() {
  17071. return new TinyColor2(this.toString());
  17072. };
  17073. TinyColor2.prototype.lighten = function(amount) {
  17074. if (amount === void 0) {
  17075. amount = 10;
  17076. }
  17077. var hsl = this.toHsl();
  17078. hsl.l += amount / 100;
  17079. hsl.l = clamp01(hsl.l);
  17080. return new TinyColor2(hsl);
  17081. };
  17082. TinyColor2.prototype.brighten = function(amount) {
  17083. if (amount === void 0) {
  17084. amount = 10;
  17085. }
  17086. var rgb = this.toRgb();
  17087. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  17088. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  17089. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  17090. return new TinyColor2(rgb);
  17091. };
  17092. TinyColor2.prototype.darken = function(amount) {
  17093. if (amount === void 0) {
  17094. amount = 10;
  17095. }
  17096. var hsl = this.toHsl();
  17097. hsl.l -= amount / 100;
  17098. hsl.l = clamp01(hsl.l);
  17099. return new TinyColor2(hsl);
  17100. };
  17101. TinyColor2.prototype.tint = function(amount) {
  17102. if (amount === void 0) {
  17103. amount = 10;
  17104. }
  17105. return this.mix("white", amount);
  17106. };
  17107. TinyColor2.prototype.shade = function(amount) {
  17108. if (amount === void 0) {
  17109. amount = 10;
  17110. }
  17111. return this.mix("black", amount);
  17112. };
  17113. TinyColor2.prototype.desaturate = function(amount) {
  17114. if (amount === void 0) {
  17115. amount = 10;
  17116. }
  17117. var hsl = this.toHsl();
  17118. hsl.s -= amount / 100;
  17119. hsl.s = clamp01(hsl.s);
  17120. return new TinyColor2(hsl);
  17121. };
  17122. TinyColor2.prototype.saturate = function(amount) {
  17123. if (amount === void 0) {
  17124. amount = 10;
  17125. }
  17126. var hsl = this.toHsl();
  17127. hsl.s += amount / 100;
  17128. hsl.s = clamp01(hsl.s);
  17129. return new TinyColor2(hsl);
  17130. };
  17131. TinyColor2.prototype.greyscale = function() {
  17132. return this.desaturate(100);
  17133. };
  17134. TinyColor2.prototype.spin = function(amount) {
  17135. var hsl = this.toHsl();
  17136. var hue = (hsl.h + amount) % 360;
  17137. hsl.h = hue < 0 ? 360 + hue : hue;
  17138. return new TinyColor2(hsl);
  17139. };
  17140. TinyColor2.prototype.mix = function(color, amount) {
  17141. if (amount === void 0) {
  17142. amount = 50;
  17143. }
  17144. var rgb1 = this.toRgb();
  17145. var rgb2 = new TinyColor2(color).toRgb();
  17146. var p = amount / 100;
  17147. var rgba = {
  17148. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  17149. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  17150. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  17151. a: (rgb2.a - rgb1.a) * p + rgb1.a
  17152. };
  17153. return new TinyColor2(rgba);
  17154. };
  17155. TinyColor2.prototype.analogous = function(results, slices) {
  17156. if (results === void 0) {
  17157. results = 6;
  17158. }
  17159. if (slices === void 0) {
  17160. slices = 30;
  17161. }
  17162. var hsl = this.toHsl();
  17163. var part = 360 / slices;
  17164. var ret = [this];
  17165. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  17166. hsl.h = (hsl.h + part) % 360;
  17167. ret.push(new TinyColor2(hsl));
  17168. }
  17169. return ret;
  17170. };
  17171. TinyColor2.prototype.complement = function() {
  17172. var hsl = this.toHsl();
  17173. hsl.h = (hsl.h + 180) % 360;
  17174. return new TinyColor2(hsl);
  17175. };
  17176. TinyColor2.prototype.monochromatic = function(results) {
  17177. if (results === void 0) {
  17178. results = 6;
  17179. }
  17180. var hsv = this.toHsv();
  17181. var h = hsv.h;
  17182. var s = hsv.s;
  17183. var v = hsv.v;
  17184. var res = [];
  17185. var modification = 1 / results;
  17186. while (results--) {
  17187. res.push(new TinyColor2({ h, s, v }));
  17188. v = (v + modification) % 1;
  17189. }
  17190. return res;
  17191. };
  17192. TinyColor2.prototype.splitcomplement = function() {
  17193. var hsl = this.toHsl();
  17194. var h = hsl.h;
  17195. return [
  17196. this,
  17197. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  17198. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  17199. ];
  17200. };
  17201. TinyColor2.prototype.onBackground = function(background) {
  17202. var fg = this.toRgb();
  17203. var bg = new TinyColor2(background).toRgb();
  17204. return new TinyColor2({
  17205. r: bg.r + (fg.r - bg.r) * fg.a,
  17206. g: bg.g + (fg.g - bg.g) * fg.a,
  17207. b: bg.b + (fg.b - bg.b) * fg.a
  17208. });
  17209. };
  17210. TinyColor2.prototype.triad = function() {
  17211. return this.polyad(3);
  17212. };
  17213. TinyColor2.prototype.tetrad = function() {
  17214. return this.polyad(4);
  17215. };
  17216. TinyColor2.prototype.polyad = function(n) {
  17217. var hsl = this.toHsl();
  17218. var h = hsl.h;
  17219. var result = [this];
  17220. var increment = 360 / n;
  17221. for (var i = 1; i < n; i++) {
  17222. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  17223. }
  17224. return result;
  17225. };
  17226. TinyColor2.prototype.equals = function(color) {
  17227. return this.toRgbString() === new TinyColor2(color).toRgbString();
  17228. };
  17229. return TinyColor2;
  17230. }();
  17231. function darken(color, amount = 20) {
  17232. return color.mix("#141414", amount).toString();
  17233. }
  17234. function useButtonCustomStyle(props) {
  17235. const _disabled = useFormDisabled();
  17236. const ns = useNamespace("button");
  17237. return vue.computed(() => {
  17238. let styles = {};
  17239. let buttonColor = props.color;
  17240. if (buttonColor) {
  17241. const match = buttonColor.match(/var\((.*?)\)/);
  17242. if (match) {
  17243. buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  17244. }
  17245. const color = new TinyColor(buttonColor);
  17246. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  17247. if (props.plain) {
  17248. styles = ns.cssVarBlock({
  17249. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  17250. "text-color": buttonColor,
  17251. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  17252. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  17253. "hover-bg-color": buttonColor,
  17254. "hover-border-color": buttonColor,
  17255. "active-bg-color": activeBgColor,
  17256. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  17257. "active-border-color": activeBgColor
  17258. });
  17259. if (_disabled.value) {
  17260. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  17261. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  17262. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  17263. }
  17264. } else {
  17265. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  17266. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  17267. styles = ns.cssVarBlock({
  17268. "bg-color": buttonColor,
  17269. "text-color": textColor,
  17270. "border-color": buttonColor,
  17271. "hover-bg-color": hoverBgColor,
  17272. "hover-text-color": textColor,
  17273. "hover-border-color": hoverBgColor,
  17274. "active-bg-color": activeBgColor,
  17275. "active-border-color": activeBgColor
  17276. });
  17277. if (_disabled.value) {
  17278. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  17279. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  17280. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  17281. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  17282. }
  17283. }
  17284. }
  17285. return styles;
  17286. });
  17287. }
  17288. const __default__$1A = vue.defineComponent({
  17289. name: "ElButton"
  17290. });
  17291. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  17292. ...__default__$1A,
  17293. props: buttonProps,
  17294. emits: buttonEmits,
  17295. setup(__props, { expose, emit }) {
  17296. const props = __props;
  17297. const buttonStyle = useButtonCustomStyle(props);
  17298. const ns = useNamespace("button");
  17299. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  17300. const buttonKls = vue.computed(() => [
  17301. ns.b(),
  17302. ns.m(_type.value),
  17303. ns.m(_size.value),
  17304. ns.is("disabled", _disabled.value),
  17305. ns.is("loading", props.loading),
  17306. ns.is("plain", props.plain),
  17307. ns.is("round", props.round),
  17308. ns.is("circle", props.circle),
  17309. ns.is("text", props.text),
  17310. ns.is("link", props.link),
  17311. ns.is("has-bg", props.bg)
  17312. ]);
  17313. expose({
  17314. ref: _ref,
  17315. size: _size,
  17316. type: _type,
  17317. disabled: _disabled,
  17318. shouldAddSpace
  17319. });
  17320. return (_ctx, _cache) => {
  17321. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({
  17322. ref_key: "_ref",
  17323. ref: _ref
  17324. }, vue.unref(_props), {
  17325. class: vue.unref(buttonKls),
  17326. style: vue.unref(buttonStyle),
  17327. onClick: vue.unref(handleClick)
  17328. }), {
  17329. default: vue.withCtx(() => [
  17330. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  17331. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  17332. key: 1,
  17333. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  17334. }, {
  17335. default: vue.withCtx(() => [
  17336. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  17337. ]),
  17338. _: 1
  17339. }, 8, ["class"]))
  17340. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  17341. default: vue.withCtx(() => [
  17342. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  17343. ]),
  17344. _: 3
  17345. })) : vue.createCommentVNode("v-if", true),
  17346. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  17347. key: 2,
  17348. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  17349. }, [
  17350. vue.renderSlot(_ctx.$slots, "default")
  17351. ], 2)) : vue.createCommentVNode("v-if", true)
  17352. ]),
  17353. _: 3
  17354. }, 16, ["class", "style", "onClick"]);
  17355. };
  17356. }
  17357. });
  17358. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "button.vue"]]);
  17359. const buttonGroupProps = {
  17360. size: buttonProps.size,
  17361. type: buttonProps.type
  17362. };
  17363. const __default__$1z = vue.defineComponent({
  17364. name: "ElButtonGroup"
  17365. });
  17366. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  17367. ...__default__$1z,
  17368. props: buttonGroupProps,
  17369. setup(__props) {
  17370. const props = __props;
  17371. vue.provide(buttonGroupContextKey, vue.reactive({
  17372. size: vue.toRef(props, "size"),
  17373. type: vue.toRef(props, "type")
  17374. }));
  17375. const ns = useNamespace("button");
  17376. return (_ctx, _cache) => {
  17377. return vue.openBlock(), vue.createElementBlock("div", {
  17378. class: vue.normalizeClass(vue.unref(ns).b("group"))
  17379. }, [
  17380. vue.renderSlot(_ctx.$slots, "default")
  17381. ], 2);
  17382. };
  17383. }
  17384. });
  17385. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "button-group.vue"]]);
  17386. const ElButton = withInstall(Button, {
  17387. ButtonGroup
  17388. });
  17389. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  17390. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17391. var dayjs_min = {exports: {}};
  17392. (function(module, exports) {
  17393. !function(t, e) {
  17394. module.exports = e() ;
  17395. }(commonjsGlobal, function() {
  17396. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "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, M = { 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) {
  17397. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  17398. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  17399. } }, m = function(t2, e2, n2) {
  17400. var r2 = String(t2);
  17401. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  17402. }, v = { s: m, z: function(t2) {
  17403. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  17404. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  17405. }, m: function t2(e2, n2) {
  17406. if (e2.date() < n2.date())
  17407. return -t2(n2, e2);
  17408. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
  17409. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  17410. }, a: function(t2) {
  17411. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  17412. }, p: function(t2) {
  17413. return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  17414. }, u: function(t2) {
  17415. return t2 === void 0;
  17416. } }, g = "en", D = {};
  17417. D[g] = M;
  17418. var p = "$isDayjsObject", S = function(t2) {
  17419. return t2 instanceof _ || !(!t2 || !t2[p]);
  17420. }, w = function t2(e2, n2, r2) {
  17421. var i2;
  17422. if (!e2)
  17423. return g;
  17424. if (typeof e2 == "string") {
  17425. var s2 = e2.toLowerCase();
  17426. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  17427. var u2 = e2.split("-");
  17428. if (!i2 && u2.length > 1)
  17429. return t2(u2[0]);
  17430. } else {
  17431. var a2 = e2.name;
  17432. D[a2] = e2, i2 = a2;
  17433. }
  17434. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  17435. }, O = function(t2, e2) {
  17436. if (S(t2))
  17437. return t2.clone();
  17438. var n2 = typeof e2 == "object" ? e2 : {};
  17439. return n2.date = t2, n2.args = arguments, new _(n2);
  17440. }, b = v;
  17441. b.l = w, b.i = S, b.w = function(t2, e2) {
  17442. return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  17443. };
  17444. var _ = function() {
  17445. function M2(t2) {
  17446. this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
  17447. }
  17448. var m2 = M2.prototype;
  17449. return m2.parse = function(t2) {
  17450. this.$d = function(t3) {
  17451. var e2 = t3.date, n2 = t3.utc;
  17452. if (e2 === null)
  17453. return new Date(NaN);
  17454. if (b.u(e2))
  17455. return new Date();
  17456. if (e2 instanceof Date)
  17457. return new Date(e2);
  17458. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  17459. var r2 = e2.match($);
  17460. if (r2) {
  17461. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  17462. return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
  17463. }
  17464. }
  17465. return new Date(e2);
  17466. }(t2), this.init();
  17467. }, m2.init = function() {
  17468. var t2 = this.$d;
  17469. 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();
  17470. }, m2.$utils = function() {
  17471. return b;
  17472. }, m2.isValid = function() {
  17473. return !(this.$d.toString() === l);
  17474. }, m2.isSame = function(t2, e2) {
  17475. var n2 = O(t2);
  17476. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  17477. }, m2.isAfter = function(t2, e2) {
  17478. return O(t2) < this.startOf(e2);
  17479. }, m2.isBefore = function(t2, e2) {
  17480. return this.endOf(e2) < O(t2);
  17481. }, m2.$g = function(t2, e2, n2) {
  17482. return b.u(t2) ? this[e2] : this.set(n2, t2);
  17483. }, m2.unix = function() {
  17484. return Math.floor(this.valueOf() / 1e3);
  17485. }, m2.valueOf = function() {
  17486. return this.$d.getTime();
  17487. }, m2.startOf = function(t2, e2) {
  17488. var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
  17489. var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  17490. return r2 ? i2 : i2.endOf(a);
  17491. }, $2 = function(t3, e3) {
  17492. return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  17493. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
  17494. switch (f2) {
  17495. case h:
  17496. return r2 ? l2(1, 0) : l2(31, 11);
  17497. case c:
  17498. return r2 ? l2(1, M3) : l2(0, M3 + 1);
  17499. case o:
  17500. var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
  17501. return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  17502. case a:
  17503. case d:
  17504. return $2(v2 + "Hours", 0);
  17505. case u:
  17506. return $2(v2 + "Minutes", 1);
  17507. case s:
  17508. return $2(v2 + "Seconds", 2);
  17509. case i:
  17510. return $2(v2 + "Milliseconds", 3);
  17511. default:
  17512. return this.clone();
  17513. }
  17514. }, m2.endOf = function(t2) {
  17515. return this.startOf(t2, false);
  17516. }, m2.$set = function(t2, e2) {
  17517. var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
  17518. if (o2 === c || o2 === h) {
  17519. var y2 = this.clone().set(d, 1);
  17520. y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  17521. } else
  17522. l2 && this.$d[l2]($2);
  17523. return this.init(), this;
  17524. }, m2.set = function(t2, e2) {
  17525. return this.clone().$set(t2, e2);
  17526. }, m2.get = function(t2) {
  17527. return this[b.p(t2)]();
  17528. }, m2.add = function(r2, f2) {
  17529. var d2, l2 = this;
  17530. r2 = Number(r2);
  17531. var $2 = b.p(f2), y2 = function(t2) {
  17532. var e2 = O(l2);
  17533. return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
  17534. };
  17535. if ($2 === c)
  17536. return this.set(c, this.$M + r2);
  17537. if ($2 === h)
  17538. return this.set(h, this.$y + r2);
  17539. if ($2 === a)
  17540. return y2(1);
  17541. if ($2 === o)
  17542. return y2(7);
  17543. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
  17544. return b.w(m3, this);
  17545. }, m2.subtract = function(t2, e2) {
  17546. return this.add(-1 * t2, e2);
  17547. }, m2.format = function(t2) {
  17548. var e2 = this, n2 = this.$locale();
  17549. if (!this.isValid())
  17550. return n2.invalidDate || l;
  17551. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
  17552. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  17553. }, d2 = function(t3) {
  17554. return b.s(s2 % 12 || 12, t3, "0");
  17555. }, $2 = f2 || function(t3, e3, n3) {
  17556. var r3 = t3 < 12 ? "AM" : "PM";
  17557. return n3 ? r3.toLowerCase() : r3;
  17558. };
  17559. return r2.replace(y, function(t3, r3) {
  17560. return r3 || function(t4) {
  17561. switch (t4) {
  17562. case "YY":
  17563. return String(e2.$y).slice(-2);
  17564. case "YYYY":
  17565. return b.s(e2.$y, 4, "0");
  17566. case "M":
  17567. return a2 + 1;
  17568. case "MM":
  17569. return b.s(a2 + 1, 2, "0");
  17570. case "MMM":
  17571. return h2(n2.monthsShort, a2, c2, 3);
  17572. case "MMMM":
  17573. return h2(c2, a2);
  17574. case "D":
  17575. return e2.$D;
  17576. case "DD":
  17577. return b.s(e2.$D, 2, "0");
  17578. case "d":
  17579. return String(e2.$W);
  17580. case "dd":
  17581. return h2(n2.weekdaysMin, e2.$W, o2, 2);
  17582. case "ddd":
  17583. return h2(n2.weekdaysShort, e2.$W, o2, 3);
  17584. case "dddd":
  17585. return o2[e2.$W];
  17586. case "H":
  17587. return String(s2);
  17588. case "HH":
  17589. return b.s(s2, 2, "0");
  17590. case "h":
  17591. return d2(1);
  17592. case "hh":
  17593. return d2(2);
  17594. case "a":
  17595. return $2(s2, u2, true);
  17596. case "A":
  17597. return $2(s2, u2, false);
  17598. case "m":
  17599. return String(u2);
  17600. case "mm":
  17601. return b.s(u2, 2, "0");
  17602. case "s":
  17603. return String(e2.$s);
  17604. case "ss":
  17605. return b.s(e2.$s, 2, "0");
  17606. case "SSS":
  17607. return b.s(e2.$ms, 3, "0");
  17608. case "Z":
  17609. return i2;
  17610. }
  17611. return null;
  17612. }(t3) || i2.replace(":", "");
  17613. });
  17614. }, m2.utcOffset = function() {
  17615. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17616. }, m2.diff = function(r2, d2, l2) {
  17617. var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
  17618. return b.m(y2, m3);
  17619. };
  17620. switch (M3) {
  17621. case h:
  17622. $2 = D2() / 12;
  17623. break;
  17624. case c:
  17625. $2 = D2();
  17626. break;
  17627. case f:
  17628. $2 = D2() / 3;
  17629. break;
  17630. case o:
  17631. $2 = (g2 - v2) / 6048e5;
  17632. break;
  17633. case a:
  17634. $2 = (g2 - v2) / 864e5;
  17635. break;
  17636. case u:
  17637. $2 = g2 / n;
  17638. break;
  17639. case s:
  17640. $2 = g2 / e;
  17641. break;
  17642. case i:
  17643. $2 = g2 / t;
  17644. break;
  17645. default:
  17646. $2 = g2;
  17647. }
  17648. return l2 ? $2 : b.a($2);
  17649. }, m2.daysInMonth = function() {
  17650. return this.endOf(c).$D;
  17651. }, m2.$locale = function() {
  17652. return D[this.$L];
  17653. }, m2.locale = function(t2, e2) {
  17654. if (!t2)
  17655. return this.$L;
  17656. var n2 = this.clone(), r2 = w(t2, e2, true);
  17657. return r2 && (n2.$L = r2), n2;
  17658. }, m2.clone = function() {
  17659. return b.w(this.$d, this);
  17660. }, m2.toDate = function() {
  17661. return new Date(this.valueOf());
  17662. }, m2.toJSON = function() {
  17663. return this.isValid() ? this.toISOString() : null;
  17664. }, m2.toISOString = function() {
  17665. return this.$d.toISOString();
  17666. }, m2.toString = function() {
  17667. return this.$d.toUTCString();
  17668. }, M2;
  17669. }(), k = _.prototype;
  17670. return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
  17671. k[t2[1]] = function(e2) {
  17672. return this.$g(e2, t2[0], t2[1]);
  17673. };
  17674. }), O.extend = function(t2, e2) {
  17675. return t2.$i || (t2(e2, _, O), t2.$i = true), O;
  17676. }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
  17677. return O(1e3 * t2);
  17678. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  17679. });
  17680. })(dayjs_min);
  17681. var dayjs = dayjs_min.exports;
  17682. var customParseFormat$1 = {exports: {}};
  17683. (function(module, exports) {
  17684. !function(e, t) {
  17685. module.exports = t() ;
  17686. }(commonjsGlobal, function() {
  17687. 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|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
  17688. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  17689. };
  17690. var f = function(e2) {
  17691. return function(t2) {
  17692. this[e2] = +t2;
  17693. };
  17694. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  17695. (this.zone || (this.zone = {})).offset = function(e3) {
  17696. if (!e3)
  17697. return 0;
  17698. if (e3 === "Z")
  17699. return 0;
  17700. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  17701. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  17702. }(e2);
  17703. }], u = function(e2) {
  17704. var t2 = s[e2];
  17705. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  17706. }, d = function(e2, t2) {
  17707. var n2, r2 = s.meridiem;
  17708. if (r2) {
  17709. for (var i2 = 1; i2 <= 24; i2 += 1)
  17710. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  17711. n2 = i2 > 12;
  17712. break;
  17713. }
  17714. } else
  17715. n2 = e2 === (t2 ? "pm" : "PM");
  17716. return n2;
  17717. }, c = { A: [o, function(e2) {
  17718. this.afternoon = d(e2, false);
  17719. }], a: [o, function(e2) {
  17720. this.afternoon = d(e2, true);
  17721. }], Q: [n, function(e2) {
  17722. this.month = 3 * (e2 - 1) + 1;
  17723. }], S: [n, function(e2) {
  17724. this.milliseconds = 100 * +e2;
  17725. }], SS: [r, function(e2) {
  17726. this.milliseconds = 10 * +e2;
  17727. }], SSS: [/\d{3}/, function(e2) {
  17728. this.milliseconds = +e2;
  17729. }], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) {
  17730. var t2 = s.ordinal, n2 = e2.match(/\d+/);
  17731. if (this.day = n2[0], t2)
  17732. for (var r2 = 1; r2 <= 31; r2 += 1)
  17733. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  17734. }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
  17735. var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
  17736. return e3.slice(0, 3);
  17737. })).indexOf(e2) + 1;
  17738. if (n2 < 1)
  17739. throw new Error();
  17740. this.month = n2 % 12 || n2;
  17741. }], MMMM: [o, function(e2) {
  17742. var t2 = u("months").indexOf(e2) + 1;
  17743. if (t2 < 1)
  17744. throw new Error();
  17745. this.month = t2 % 12 || t2;
  17746. }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
  17747. this.year = a(e2);
  17748. }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
  17749. function l(n2) {
  17750. var r2, i2;
  17751. r2 = n2, i2 = s && s.formats;
  17752. for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  17753. var o3 = r3 && r3.toUpperCase();
  17754. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  17755. return t3 || n4.slice(1);
  17756. });
  17757. })).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
  17758. var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
  17759. o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
  17760. }
  17761. return function(e2) {
  17762. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  17763. var i3 = o2[n3];
  17764. if (typeof i3 == "string")
  17765. r3 += i3.length;
  17766. else {
  17767. var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
  17768. f3.call(t2, u3), e2 = e2.replace(u3, "");
  17769. }
  17770. }
  17771. return function(e3) {
  17772. var t3 = e3.afternoon;
  17773. if (t3 !== void 0) {
  17774. var n4 = e3.hours;
  17775. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  17776. }
  17777. }(t2), t2;
  17778. };
  17779. }
  17780. return function(e2, t2, n2) {
  17781. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
  17782. var r2 = t2.prototype, i2 = r2.parse;
  17783. r2.parse = function(e3) {
  17784. var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
  17785. this.$u = r3;
  17786. var a2 = o2[1];
  17787. if (typeof a2 == "string") {
  17788. var f2 = o2[2] === true, h2 = o2[3] === true, u2 = f2 || h2, d2 = o2[2];
  17789. h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
  17790. try {
  17791. if (["x", "X"].indexOf(t4) > -1)
  17792. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  17793. var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
  17794. o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
  17795. var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
  17796. return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
  17797. } catch (e5) {
  17798. return new Date("");
  17799. }
  17800. }(t3, a2, r3, n2), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), s = {};
  17801. } else if (a2 instanceof Array)
  17802. for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
  17803. o2[1] = a2[m - 1];
  17804. var M = n2.apply(this, o2);
  17805. if (M.isValid()) {
  17806. this.$d = M.$d, this.$L = M.$L, this.init();
  17807. break;
  17808. }
  17809. m === c2 && (this.$d = new Date(""));
  17810. }
  17811. else
  17812. i2.call(this, e3);
  17813. };
  17814. };
  17815. });
  17816. })(customParseFormat$1);
  17817. var customParseFormat = customParseFormat$1.exports;
  17818. const timeUnits$1 = ["hours", "minutes", "seconds"];
  17819. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17820. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17821. const DEFAULT_FORMATS_DATEPICKER = {
  17822. date: DEFAULT_FORMATS_DATE,
  17823. dates: DEFAULT_FORMATS_DATE,
  17824. week: "gggg[w]ww",
  17825. year: "YYYY",
  17826. years: "YYYY",
  17827. month: "YYYY-MM",
  17828. months: "YYYY-MM",
  17829. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17830. monthrange: "YYYY-MM",
  17831. yearrange: "YYYY",
  17832. daterange: DEFAULT_FORMATS_DATE,
  17833. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17834. };
  17835. const buildTimeList = (value, bound) => {
  17836. return [
  17837. value > 0 ? value - 1 : void 0,
  17838. value,
  17839. value < bound ? value + 1 : void 0
  17840. ];
  17841. };
  17842. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17843. const extractDateFormat = (format) => {
  17844. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17845. };
  17846. const extractTimeFormat = (format) => {
  17847. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17848. };
  17849. const dateEquals = function(a, b) {
  17850. const aIsDate = isDate$1(a);
  17851. const bIsDate = isDate$1(b);
  17852. if (aIsDate && bIsDate) {
  17853. return a.getTime() === b.getTime();
  17854. }
  17855. if (!aIsDate && !bIsDate) {
  17856. return a === b;
  17857. }
  17858. return false;
  17859. };
  17860. const valueEquals = function(a, b) {
  17861. const aIsArray = isArray$1(a);
  17862. const bIsArray = isArray$1(b);
  17863. if (aIsArray && bIsArray) {
  17864. if (a.length !== b.length) {
  17865. return false;
  17866. }
  17867. return a.every((item, index) => dateEquals(item, b[index]));
  17868. }
  17869. if (!aIsArray && !bIsArray) {
  17870. return dateEquals(a, b);
  17871. }
  17872. return false;
  17873. };
  17874. const parseDate = function(date, format, lang) {
  17875. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  17876. return day.isValid() ? day : void 0;
  17877. };
  17878. const formatter = function(date, format, lang) {
  17879. if (isEmpty(format))
  17880. return date;
  17881. if (format === "x")
  17882. return +date;
  17883. return dayjs(date).locale(lang).format(format);
  17884. };
  17885. const makeList = (total, method) => {
  17886. var _a;
  17887. const arr = [];
  17888. const disabledArr = method == null ? void 0 : method();
  17889. for (let i = 0; i < total; i++) {
  17890. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  17891. }
  17892. return arr;
  17893. };
  17894. const dayOrDaysToDate = (dayOrDays) => {
  17895. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  17896. };
  17897. const disabledTimeListsProps = buildProps({
  17898. disabledHours: {
  17899. type: definePropType(Function)
  17900. },
  17901. disabledMinutes: {
  17902. type: definePropType(Function)
  17903. },
  17904. disabledSeconds: {
  17905. type: definePropType(Function)
  17906. }
  17907. });
  17908. const timePanelSharedProps = buildProps({
  17909. visible: Boolean,
  17910. actualVisible: {
  17911. type: Boolean,
  17912. default: void 0
  17913. },
  17914. format: {
  17915. type: String,
  17916. default: ""
  17917. }
  17918. });
  17919. const timePickerDefaultProps = buildProps({
  17920. id: {
  17921. type: definePropType([Array, String])
  17922. },
  17923. name: {
  17924. type: definePropType([Array, String])
  17925. },
  17926. popperClass: {
  17927. type: String,
  17928. default: ""
  17929. },
  17930. format: String,
  17931. valueFormat: String,
  17932. dateFormat: String,
  17933. timeFormat: String,
  17934. type: {
  17935. type: String,
  17936. default: ""
  17937. },
  17938. clearable: {
  17939. type: Boolean,
  17940. default: true
  17941. },
  17942. clearIcon: {
  17943. type: definePropType([String, Object]),
  17944. default: circle_close_default
  17945. },
  17946. editable: {
  17947. type: Boolean,
  17948. default: true
  17949. },
  17950. prefixIcon: {
  17951. type: definePropType([String, Object]),
  17952. default: ""
  17953. },
  17954. size: useSizeProp,
  17955. readonly: Boolean,
  17956. disabled: Boolean,
  17957. placeholder: {
  17958. type: String,
  17959. default: ""
  17960. },
  17961. popperOptions: {
  17962. type: definePropType(Object),
  17963. default: () => ({})
  17964. },
  17965. modelValue: {
  17966. type: definePropType([Date, Array, String, Number]),
  17967. default: ""
  17968. },
  17969. rangeSeparator: {
  17970. type: String,
  17971. default: "-"
  17972. },
  17973. startPlaceholder: String,
  17974. endPlaceholder: String,
  17975. defaultValue: {
  17976. type: definePropType([Date, Array])
  17977. },
  17978. defaultTime: {
  17979. type: definePropType([Date, Array])
  17980. },
  17981. isRange: Boolean,
  17982. ...disabledTimeListsProps,
  17983. disabledDate: {
  17984. type: Function
  17985. },
  17986. cellClassName: {
  17987. type: Function
  17988. },
  17989. shortcuts: {
  17990. type: Array,
  17991. default: () => []
  17992. },
  17993. arrowControl: Boolean,
  17994. tabindex: {
  17995. type: definePropType([String, Number]),
  17996. default: 0
  17997. },
  17998. validateEvent: {
  17999. type: Boolean,
  18000. default: true
  18001. },
  18002. unlinkPanels: Boolean,
  18003. placement: {
  18004. type: definePropType(String),
  18005. values: Ee,
  18006. default: "bottom"
  18007. },
  18008. fallbackPlacements: {
  18009. type: definePropType(Array),
  18010. default: ["bottom", "top", "right", "left"]
  18011. },
  18012. ...useEmptyValuesProps,
  18013. ...useAriaProps(["ariaLabel"]),
  18014. showNow: {
  18015. type: Boolean,
  18016. default: true
  18017. }
  18018. });
  18019. const timePickerRangeTriggerProps = buildProps({
  18020. id: {
  18021. type: definePropType(Array)
  18022. },
  18023. name: {
  18024. type: definePropType(Array)
  18025. },
  18026. modelValue: {
  18027. type: definePropType([Array, String])
  18028. },
  18029. startPlaceholder: String,
  18030. endPlaceholder: String,
  18031. disabled: Boolean
  18032. });
  18033. const timePickerRngeTriggerProps = timePickerRangeTriggerProps;
  18034. const __default__$1y = vue.defineComponent({
  18035. name: "PickerRangeTrigger",
  18036. inheritAttrs: false
  18037. });
  18038. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  18039. ...__default__$1y,
  18040. props: timePickerRangeTriggerProps,
  18041. emits: [
  18042. "mouseenter",
  18043. "mouseleave",
  18044. "click",
  18045. "touchstart",
  18046. "focus",
  18047. "blur",
  18048. "startInput",
  18049. "endInput",
  18050. "startChange",
  18051. "endChange"
  18052. ],
  18053. setup(__props, { expose, emit }) {
  18054. const attrs = useAttrs();
  18055. const nsDate = useNamespace("date");
  18056. const nsRange = useNamespace("range");
  18057. const inputRef = vue.ref();
  18058. const endInputRef = vue.ref();
  18059. const { wrapperRef, isFocused } = useFocusController(inputRef);
  18060. const handleClick = (evt) => {
  18061. emit("click", evt);
  18062. };
  18063. const handleMouseEnter = (evt) => {
  18064. emit("mouseenter", evt);
  18065. };
  18066. const handleMouseLeave = (evt) => {
  18067. emit("mouseleave", evt);
  18068. };
  18069. const handleTouchStart = (evt) => {
  18070. emit("mouseenter", evt);
  18071. };
  18072. const handleStartInput = (evt) => {
  18073. emit("startInput", evt);
  18074. };
  18075. const handleEndInput = (evt) => {
  18076. emit("endInput", evt);
  18077. };
  18078. const handleStartChange = (evt) => {
  18079. emit("startChange", evt);
  18080. };
  18081. const handleEndChange = (evt) => {
  18082. emit("endChange", evt);
  18083. };
  18084. const focus = () => {
  18085. var _a;
  18086. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18087. };
  18088. const blur = () => {
  18089. var _a, _b;
  18090. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18091. (_b = endInputRef.value) == null ? void 0 : _b.blur();
  18092. };
  18093. expose({
  18094. focus,
  18095. blur
  18096. });
  18097. return (_ctx, _cache) => {
  18098. return vue.openBlock(), vue.createElementBlock("div", {
  18099. ref_key: "wrapperRef",
  18100. ref: wrapperRef,
  18101. class: vue.normalizeClass([vue.unref(nsDate).is("active", vue.unref(isFocused)), _ctx.$attrs.class]),
  18102. style: vue.normalizeStyle(_ctx.$attrs.style),
  18103. onClick: handleClick,
  18104. onMouseenter: handleMouseEnter,
  18105. onMouseleave: handleMouseLeave,
  18106. onTouchstartPassive: handleTouchStart
  18107. }, [
  18108. vue.renderSlot(_ctx.$slots, "prefix"),
  18109. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  18110. id: _ctx.id && _ctx.id[0],
  18111. ref_key: "inputRef",
  18112. ref: inputRef,
  18113. name: _ctx.name && _ctx.name[0],
  18114. placeholder: _ctx.startPlaceholder,
  18115. value: _ctx.modelValue && _ctx.modelValue[0],
  18116. class: vue.unref(nsRange).b("input"),
  18117. disabled: _ctx.disabled,
  18118. onInput: handleStartInput,
  18119. onChange: handleStartChange
  18120. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  18121. vue.renderSlot(_ctx.$slots, "range-separator"),
  18122. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  18123. id: _ctx.id && _ctx.id[1],
  18124. ref_key: "endInputRef",
  18125. ref: endInputRef,
  18126. name: _ctx.name && _ctx.name[1],
  18127. placeholder: _ctx.endPlaceholder,
  18128. value: _ctx.modelValue && _ctx.modelValue[1],
  18129. class: vue.unref(nsRange).b("input"),
  18130. disabled: _ctx.disabled,
  18131. onInput: handleEndInput,
  18132. onChange: handleEndChange
  18133. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  18134. vue.renderSlot(_ctx.$slots, "suffix")
  18135. ], 38);
  18136. };
  18137. }
  18138. });
  18139. var PickerRangeTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "picker-range-trigger.vue"]]);
  18140. const __default__$1x = vue.defineComponent({
  18141. name: "Picker"
  18142. });
  18143. const _sfc_main$26 = /* @__PURE__ */ vue.defineComponent({
  18144. ...__default__$1x,
  18145. props: timePickerDefaultProps,
  18146. emits: [
  18147. UPDATE_MODEL_EVENT,
  18148. CHANGE_EVENT,
  18149. "focus",
  18150. "blur",
  18151. "clear",
  18152. "calendar-change",
  18153. "panel-change",
  18154. "visible-change",
  18155. "keydown"
  18156. ],
  18157. setup(__props, { expose, emit }) {
  18158. const props = __props;
  18159. const attrs = vue.useAttrs();
  18160. const { lang } = useLocale();
  18161. const nsDate = useNamespace("date");
  18162. const nsInput = useNamespace("input");
  18163. const nsRange = useNamespace("range");
  18164. const { form, formItem } = useFormItem();
  18165. const elPopperOptions = vue.inject("ElPopperOptions", {});
  18166. const { valueOnClear } = useEmptyValues(props, null);
  18167. const refPopper = vue.ref();
  18168. const inputRef = vue.ref();
  18169. const pickerVisible = vue.ref(false);
  18170. const pickerActualVisible = vue.ref(false);
  18171. const valueOnOpen = vue.ref(null);
  18172. let hasJustTabExitedInput = false;
  18173. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  18174. beforeFocus() {
  18175. return props.readonly || pickerDisabled.value;
  18176. },
  18177. afterFocus() {
  18178. pickerVisible.value = true;
  18179. },
  18180. beforeBlur(event) {
  18181. var _a;
  18182. return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
  18183. },
  18184. afterBlur() {
  18185. handleChange();
  18186. pickerVisible.value = false;
  18187. hasJustTabExitedInput = false;
  18188. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  18189. }
  18190. });
  18191. const rangeInputKls = vue.computed(() => [
  18192. nsDate.b("editor"),
  18193. nsDate.bm("editor", props.type),
  18194. nsInput.e("wrapper"),
  18195. nsDate.is("disabled", pickerDisabled.value),
  18196. nsDate.is("active", pickerVisible.value),
  18197. nsRange.b("editor"),
  18198. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  18199. attrs.class
  18200. ]);
  18201. const clearIconKls = vue.computed(() => [
  18202. nsInput.e("icon"),
  18203. nsRange.e("close-icon"),
  18204. !showClose.value ? nsRange.e("close-icon--hidden") : ""
  18205. ]);
  18206. vue.watch(pickerVisible, (val) => {
  18207. if (!val) {
  18208. userInput.value = null;
  18209. vue.nextTick(() => {
  18210. emitChange(props.modelValue);
  18211. });
  18212. } else {
  18213. vue.nextTick(() => {
  18214. if (val) {
  18215. valueOnOpen.value = props.modelValue;
  18216. }
  18217. });
  18218. }
  18219. });
  18220. const emitChange = (val, isClear) => {
  18221. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  18222. emit(CHANGE_EVENT, val);
  18223. isClear && (valueOnOpen.value = val);
  18224. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  18225. }
  18226. };
  18227. const emitInput = (input) => {
  18228. if (!valueEquals(props.modelValue, input)) {
  18229. let formatted;
  18230. if (isArray$1(input)) {
  18231. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  18232. } else if (input) {
  18233. formatted = formatter(input, props.valueFormat, lang.value);
  18234. }
  18235. emit(UPDATE_MODEL_EVENT, input ? formatted : input, lang.value);
  18236. }
  18237. };
  18238. const emitKeydown = (e) => {
  18239. emit("keydown", e);
  18240. };
  18241. const refInput = vue.computed(() => {
  18242. if (inputRef.value) {
  18243. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  18244. }
  18245. return [];
  18246. });
  18247. const setSelectionRange = (start, end, pos) => {
  18248. const _inputs = refInput.value;
  18249. if (!_inputs.length)
  18250. return;
  18251. if (!pos || pos === "min") {
  18252. _inputs[0].setSelectionRange(start, end);
  18253. _inputs[0].focus();
  18254. } else if (pos === "max") {
  18255. _inputs[1].setSelectionRange(start, end);
  18256. _inputs[1].focus();
  18257. }
  18258. };
  18259. const onPick = (date = "", visible = false) => {
  18260. pickerVisible.value = visible;
  18261. let result;
  18262. if (isArray$1(date)) {
  18263. result = date.map((_) => _.toDate());
  18264. } else {
  18265. result = date ? date.toDate() : date;
  18266. }
  18267. userInput.value = null;
  18268. emitInput(result);
  18269. };
  18270. const onBeforeShow = () => {
  18271. pickerActualVisible.value = true;
  18272. };
  18273. const onShow = () => {
  18274. emit("visible-change", true);
  18275. };
  18276. const onHide = () => {
  18277. pickerActualVisible.value = false;
  18278. pickerVisible.value = false;
  18279. emit("visible-change", false);
  18280. };
  18281. const handleOpen = () => {
  18282. pickerVisible.value = true;
  18283. };
  18284. const handleClose = () => {
  18285. pickerVisible.value = false;
  18286. };
  18287. const pickerDisabled = vue.computed(() => {
  18288. return props.disabled || (form == null ? void 0 : form.disabled);
  18289. });
  18290. const parsedValue = vue.computed(() => {
  18291. let dayOrDays;
  18292. if (valueIsEmpty.value) {
  18293. if (pickerOptions.value.getDefaultValue) {
  18294. dayOrDays = pickerOptions.value.getDefaultValue();
  18295. }
  18296. } else {
  18297. if (isArray$1(props.modelValue)) {
  18298. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  18299. } else {
  18300. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  18301. }
  18302. }
  18303. if (pickerOptions.value.getRangeAvailableTime) {
  18304. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  18305. if (!isEqual$1(availableResult, dayOrDays)) {
  18306. dayOrDays = availableResult;
  18307. if (!valueIsEmpty.value) {
  18308. emitInput(dayOrDaysToDate(dayOrDays));
  18309. }
  18310. }
  18311. }
  18312. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  18313. dayOrDays = [];
  18314. }
  18315. return dayOrDays;
  18316. });
  18317. const displayValue = vue.computed(() => {
  18318. if (!pickerOptions.value.panelReady)
  18319. return "";
  18320. const formattedValue = formatDayjsToString(parsedValue.value);
  18321. if (isArray$1(userInput.value)) {
  18322. return [
  18323. userInput.value[0] || formattedValue && formattedValue[0] || "",
  18324. userInput.value[1] || formattedValue && formattedValue[1] || ""
  18325. ];
  18326. } else if (userInput.value !== null) {
  18327. return userInput.value;
  18328. }
  18329. if (!isTimePicker.value && valueIsEmpty.value)
  18330. return "";
  18331. if (!pickerVisible.value && valueIsEmpty.value)
  18332. return "";
  18333. if (formattedValue) {
  18334. return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  18335. }
  18336. return "";
  18337. });
  18338. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  18339. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  18340. const isDatesPicker = vue.computed(() => props.type === "dates");
  18341. const isMonthsPicker = vue.computed(() => props.type === "months");
  18342. const isYearsPicker = vue.computed(() => props.type === "years");
  18343. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  18344. const showClose = vue.ref(false);
  18345. const onClearIconClick = (event) => {
  18346. if (props.readonly || pickerDisabled.value)
  18347. return;
  18348. if (showClose.value) {
  18349. event.stopPropagation();
  18350. if (pickerOptions.value.handleClear) {
  18351. pickerOptions.value.handleClear();
  18352. } else {
  18353. emitInput(valueOnClear.value);
  18354. }
  18355. emitChange(valueOnClear.value, true);
  18356. showClose.value = false;
  18357. onHide();
  18358. }
  18359. emit("clear");
  18360. };
  18361. const valueIsEmpty = vue.computed(() => {
  18362. const { modelValue } = props;
  18363. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  18364. });
  18365. const onMouseDownInput = async (event) => {
  18366. var _a;
  18367. if (props.readonly || pickerDisabled.value)
  18368. return;
  18369. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18370. pickerVisible.value = true;
  18371. }
  18372. };
  18373. const onMouseEnter = () => {
  18374. if (props.readonly || pickerDisabled.value)
  18375. return;
  18376. if (!valueIsEmpty.value && props.clearable) {
  18377. showClose.value = true;
  18378. }
  18379. };
  18380. const onMouseLeave = () => {
  18381. showClose.value = false;
  18382. };
  18383. const onTouchStartInput = (event) => {
  18384. var _a;
  18385. if (props.readonly || pickerDisabled.value)
  18386. return;
  18387. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18388. pickerVisible.value = true;
  18389. }
  18390. };
  18391. const isRangeInput = vue.computed(() => {
  18392. return props.type.includes("range");
  18393. });
  18394. const pickerSize = useFormSize();
  18395. const popperEl = vue.computed(() => {
  18396. var _a, _b;
  18397. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  18398. });
  18399. const stophandle = onClickOutside(inputRef, (e) => {
  18400. const unrefedPopperEl = vue.unref(popperEl);
  18401. const inputEl = unrefElement(inputRef);
  18402. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
  18403. return;
  18404. pickerVisible.value = false;
  18405. });
  18406. vue.onBeforeUnmount(() => {
  18407. stophandle == null ? void 0 : stophandle();
  18408. });
  18409. const userInput = vue.ref(null);
  18410. const handleChange = () => {
  18411. if (userInput.value) {
  18412. const value = parseUserInputToDayjs(displayValue.value);
  18413. if (value) {
  18414. if (isValidValue(value)) {
  18415. emitInput(dayOrDaysToDate(value));
  18416. userInput.value = null;
  18417. }
  18418. }
  18419. }
  18420. if (userInput.value === "") {
  18421. emitInput(valueOnClear.value);
  18422. emitChange(valueOnClear.value, true);
  18423. userInput.value = null;
  18424. }
  18425. };
  18426. const parseUserInputToDayjs = (value) => {
  18427. if (!value)
  18428. return null;
  18429. return pickerOptions.value.parseUserInput(value);
  18430. };
  18431. const formatDayjsToString = (value) => {
  18432. if (!value)
  18433. return null;
  18434. return pickerOptions.value.formatToString(value);
  18435. };
  18436. const isValidValue = (value) => {
  18437. return pickerOptions.value.isValidValue(value);
  18438. };
  18439. const handleKeydownInput = async (event) => {
  18440. if (props.readonly || pickerDisabled.value)
  18441. return;
  18442. const { code } = event;
  18443. emitKeydown(event);
  18444. if (code === EVENT_CODE.esc) {
  18445. if (pickerVisible.value === true) {
  18446. pickerVisible.value = false;
  18447. event.preventDefault();
  18448. event.stopPropagation();
  18449. }
  18450. return;
  18451. }
  18452. if (code === EVENT_CODE.down) {
  18453. if (pickerOptions.value.handleFocusPicker) {
  18454. event.preventDefault();
  18455. event.stopPropagation();
  18456. }
  18457. if (pickerVisible.value === false) {
  18458. pickerVisible.value = true;
  18459. await vue.nextTick();
  18460. }
  18461. if (pickerOptions.value.handleFocusPicker) {
  18462. pickerOptions.value.handleFocusPicker();
  18463. return;
  18464. }
  18465. }
  18466. if (code === EVENT_CODE.tab) {
  18467. hasJustTabExitedInput = true;
  18468. return;
  18469. }
  18470. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  18471. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  18472. handleChange();
  18473. pickerVisible.value = false;
  18474. }
  18475. event.stopPropagation();
  18476. return;
  18477. }
  18478. if (userInput.value) {
  18479. event.stopPropagation();
  18480. return;
  18481. }
  18482. if (pickerOptions.value.handleKeydownInput) {
  18483. pickerOptions.value.handleKeydownInput(event);
  18484. }
  18485. };
  18486. const onUserInput = (e) => {
  18487. userInput.value = e;
  18488. if (!pickerVisible.value) {
  18489. pickerVisible.value = true;
  18490. }
  18491. };
  18492. const handleStartInput = (event) => {
  18493. const target = event.target;
  18494. if (userInput.value) {
  18495. userInput.value = [target.value, userInput.value[1]];
  18496. } else {
  18497. userInput.value = [target.value, null];
  18498. }
  18499. };
  18500. const handleEndInput = (event) => {
  18501. const target = event.target;
  18502. if (userInput.value) {
  18503. userInput.value = [userInput.value[0], target.value];
  18504. } else {
  18505. userInput.value = [null, target.value];
  18506. }
  18507. };
  18508. const handleStartChange = () => {
  18509. var _a;
  18510. const values = userInput.value;
  18511. const value = parseUserInputToDayjs(values && values[0]);
  18512. const parsedVal = vue.unref(parsedValue);
  18513. if (value && value.isValid()) {
  18514. userInput.value = [
  18515. formatDayjsToString(value),
  18516. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  18517. ];
  18518. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  18519. if (isValidValue(newValue)) {
  18520. emitInput(dayOrDaysToDate(newValue));
  18521. userInput.value = null;
  18522. }
  18523. }
  18524. };
  18525. const handleEndChange = () => {
  18526. var _a;
  18527. const values = vue.unref(userInput);
  18528. const value = parseUserInputToDayjs(values && values[1]);
  18529. const parsedVal = vue.unref(parsedValue);
  18530. if (value && value.isValid()) {
  18531. userInput.value = [
  18532. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  18533. formatDayjsToString(value)
  18534. ];
  18535. const newValue = [parsedVal && parsedVal[0], value];
  18536. if (isValidValue(newValue)) {
  18537. emitInput(dayOrDaysToDate(newValue));
  18538. userInput.value = null;
  18539. }
  18540. }
  18541. };
  18542. const pickerOptions = vue.ref({});
  18543. const onSetPickerOption = (e) => {
  18544. pickerOptions.value[e[0]] = e[1];
  18545. pickerOptions.value.panelReady = true;
  18546. };
  18547. const onCalendarChange = (e) => {
  18548. emit("calendar-change", e);
  18549. };
  18550. const onPanelChange = (value, mode, view) => {
  18551. emit("panel-change", value, mode, view);
  18552. };
  18553. const focus = () => {
  18554. var _a;
  18555. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18556. };
  18557. const blur = () => {
  18558. var _a;
  18559. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18560. };
  18561. vue.provide("EP_PICKER_BASE", {
  18562. props
  18563. });
  18564. expose({
  18565. focus,
  18566. blur,
  18567. handleOpen,
  18568. handleClose,
  18569. onPick
  18570. });
  18571. return (_ctx, _cache) => {
  18572. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  18573. ref_key: "refPopper",
  18574. ref: refPopper,
  18575. visible: pickerVisible.value,
  18576. effect: "light",
  18577. pure: "",
  18578. trigger: "click"
  18579. }, _ctx.$attrs, {
  18580. role: "dialog",
  18581. teleported: "",
  18582. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  18583. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  18584. "popper-options": vue.unref(elPopperOptions),
  18585. "fallback-placements": _ctx.fallbackPlacements,
  18586. "gpu-acceleration": false,
  18587. placement: _ctx.placement,
  18588. "stop-popper-mouse-event": false,
  18589. "hide-after": 0,
  18590. persistent: "",
  18591. onBeforeShow,
  18592. onShow,
  18593. onHide
  18594. }), {
  18595. default: vue.withCtx(() => [
  18596. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  18597. key: 0,
  18598. id: _ctx.id,
  18599. ref_key: "inputRef",
  18600. ref: inputRef,
  18601. "container-role": "combobox",
  18602. "model-value": vue.unref(displayValue),
  18603. name: _ctx.name,
  18604. size: vue.unref(pickerSize),
  18605. disabled: vue.unref(pickerDisabled),
  18606. placeholder: _ctx.placeholder,
  18607. class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  18608. style: vue.normalizeStyle(_ctx.$attrs.style),
  18609. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || vue.unref(isMonthsPicker) || vue.unref(isYearsPicker) || _ctx.type === "week",
  18610. "aria-label": _ctx.ariaLabel,
  18611. tabindex: _ctx.tabindex,
  18612. "validate-event": false,
  18613. onInput: onUserInput,
  18614. onFocus: vue.unref(handleFocus),
  18615. onBlur: vue.unref(handleBlur),
  18616. onKeydown: handleKeydownInput,
  18617. onChange: handleChange,
  18618. onMousedown: onMouseDownInput,
  18619. onMouseenter: onMouseEnter,
  18620. onMouseleave: onMouseLeave,
  18621. onTouchstartPassive: onTouchStartInput,
  18622. onClick: vue.withModifiers(() => {
  18623. }, ["stop"])
  18624. }, {
  18625. prefix: vue.withCtx(() => [
  18626. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18627. key: 0,
  18628. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  18629. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  18630. onTouchstartPassive: onTouchStartInput
  18631. }, {
  18632. default: vue.withCtx(() => [
  18633. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18634. ]),
  18635. _: 1
  18636. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18637. ]),
  18638. suffix: vue.withCtx(() => [
  18639. showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18640. key: 0,
  18641. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  18642. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  18643. onClick: onClearIconClick
  18644. }, {
  18645. default: vue.withCtx(() => [
  18646. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18647. ]),
  18648. _: 1
  18649. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18650. ]),
  18651. _: 1
  18652. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (vue.openBlock(), vue.createBlock(PickerRangeTrigger, {
  18653. key: 1,
  18654. id: _ctx.id,
  18655. ref_key: "inputRef",
  18656. ref: inputRef,
  18657. "model-value": vue.unref(displayValue),
  18658. name: _ctx.name,
  18659. disabled: vue.unref(pickerDisabled),
  18660. readonly: !_ctx.editable || _ctx.readonly,
  18661. "start-placeholder": _ctx.startPlaceholder,
  18662. "end-placeholder": _ctx.endPlaceholder,
  18663. class: vue.normalizeClass(vue.unref(rangeInputKls)),
  18664. style: vue.normalizeStyle(_ctx.$attrs.style),
  18665. "aria-label": _ctx.ariaLabel,
  18666. tabindex: _ctx.tabindex,
  18667. autocomplete: "off",
  18668. role: "combobox",
  18669. onClick: onMouseDownInput,
  18670. onFocus: vue.unref(handleFocus),
  18671. onBlur: vue.unref(handleBlur),
  18672. onStartInput: handleStartInput,
  18673. onStartChange: handleStartChange,
  18674. onEndInput: handleEndInput,
  18675. onEndChange: handleEndChange,
  18676. onMousedown: onMouseDownInput,
  18677. onMouseenter: onMouseEnter,
  18678. onMouseleave: onMouseLeave,
  18679. onTouchstartPassive: onTouchStartInput,
  18680. onKeydown: handleKeydownInput
  18681. }, {
  18682. prefix: vue.withCtx(() => [
  18683. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18684. key: 0,
  18685. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")])
  18686. }, {
  18687. default: vue.withCtx(() => [
  18688. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18689. ]),
  18690. _: 1
  18691. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  18692. ]),
  18693. "range-separator": vue.withCtx(() => [
  18694. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  18695. vue.createElementVNode("span", {
  18696. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  18697. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  18698. ])
  18699. ]),
  18700. suffix: vue.withCtx(() => [
  18701. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18702. key: 0,
  18703. class: vue.normalizeClass(vue.unref(clearIconKls)),
  18704. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  18705. onClick: onClearIconClick
  18706. }, {
  18707. default: vue.withCtx(() => [
  18708. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18709. ]),
  18710. _: 1
  18711. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18712. ]),
  18713. _: 3
  18714. }, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
  18715. ]),
  18716. content: vue.withCtx(() => [
  18717. vue.renderSlot(_ctx.$slots, "default", {
  18718. visible: pickerVisible.value,
  18719. actualVisible: pickerActualVisible.value,
  18720. parsedValue: vue.unref(parsedValue),
  18721. format: _ctx.format,
  18722. dateFormat: _ctx.dateFormat,
  18723. timeFormat: _ctx.timeFormat,
  18724. unlinkPanels: _ctx.unlinkPanels,
  18725. type: _ctx.type,
  18726. defaultValue: _ctx.defaultValue,
  18727. showNow: _ctx.showNow,
  18728. onPick,
  18729. onSelectRange: setSelectionRange,
  18730. onSetPickerOption,
  18731. onCalendarChange,
  18732. onPanelChange,
  18733. onMousedown: vue.withModifiers(() => {
  18734. }, ["stop"])
  18735. })
  18736. ]),
  18737. _: 3
  18738. }, 16, ["visible", "transition", "popper-class", "popper-options", "fallback-placements", "placement"]);
  18739. };
  18740. }
  18741. });
  18742. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "picker.vue"]]);
  18743. const panelTimePickerProps = buildProps({
  18744. ...timePanelSharedProps,
  18745. datetimeRole: String,
  18746. parsedValue: {
  18747. type: definePropType(Object)
  18748. }
  18749. });
  18750. const useTimePanel = ({
  18751. getAvailableHours,
  18752. getAvailableMinutes,
  18753. getAvailableSeconds
  18754. }) => {
  18755. const getAvailableTime = (date, role, first, compareDate) => {
  18756. const availableTimeGetters = {
  18757. hour: getAvailableHours,
  18758. minute: getAvailableMinutes,
  18759. second: getAvailableSeconds
  18760. };
  18761. let result = date;
  18762. ["hour", "minute", "second"].forEach((type) => {
  18763. if (availableTimeGetters[type]) {
  18764. let availableTimeSlots;
  18765. const method = availableTimeGetters[type];
  18766. switch (type) {
  18767. case "minute": {
  18768. availableTimeSlots = method(result.hour(), role, compareDate);
  18769. break;
  18770. }
  18771. case "second": {
  18772. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18773. break;
  18774. }
  18775. default: {
  18776. availableTimeSlots = method(role, compareDate);
  18777. break;
  18778. }
  18779. }
  18780. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  18781. const pos = first ? 0 : availableTimeSlots.length - 1;
  18782. result = result[type](availableTimeSlots[pos]);
  18783. }
  18784. }
  18785. });
  18786. return result;
  18787. };
  18788. const timePickerOptions = {};
  18789. const onSetOption = ([key, val]) => {
  18790. timePickerOptions[key] = val;
  18791. };
  18792. return {
  18793. timePickerOptions,
  18794. getAvailableTime,
  18795. onSetOption
  18796. };
  18797. };
  18798. const makeAvailableArr = (disabledList) => {
  18799. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18800. const getNumber = (predicate) => predicate !== true;
  18801. return disabledList.map(trueOrNumber).filter(getNumber);
  18802. };
  18803. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18804. const getHoursList = (role, compare) => {
  18805. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  18806. };
  18807. const getMinutesList = (hour, role, compare) => {
  18808. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  18809. };
  18810. const getSecondsList = (hour, minute, role, compare) => {
  18811. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  18812. };
  18813. return {
  18814. getHoursList,
  18815. getMinutesList,
  18816. getSecondsList
  18817. };
  18818. };
  18819. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18820. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18821. const getAvailableHours = (role, compare) => {
  18822. return makeAvailableArr(getHoursList(role, compare));
  18823. };
  18824. const getAvailableMinutes = (hour, role, compare) => {
  18825. return makeAvailableArr(getMinutesList(hour, role, compare));
  18826. };
  18827. const getAvailableSeconds = (hour, minute, role, compare) => {
  18828. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18829. };
  18830. return {
  18831. getAvailableHours,
  18832. getAvailableMinutes,
  18833. getAvailableSeconds
  18834. };
  18835. };
  18836. const useOldValue = (props) => {
  18837. const oldValue = vue.ref(props.parsedValue);
  18838. vue.watch(() => props.visible, (val) => {
  18839. if (!val) {
  18840. oldValue.value = props.parsedValue;
  18841. }
  18842. });
  18843. return oldValue;
  18844. };
  18845. const nodeList = /* @__PURE__ */ new Map();
  18846. if (isClient) {
  18847. let startClick;
  18848. document.addEventListener("mousedown", (e) => startClick = e);
  18849. document.addEventListener("mouseup", (e) => {
  18850. if (startClick) {
  18851. for (const handlers of nodeList.values()) {
  18852. for (const { documentHandler } of handlers) {
  18853. documentHandler(e, startClick);
  18854. }
  18855. }
  18856. startClick = void 0;
  18857. }
  18858. });
  18859. }
  18860. function createDocumentHandler(el, binding) {
  18861. let excludes = [];
  18862. if (isArray$1(binding.arg)) {
  18863. excludes = binding.arg;
  18864. } else if (isElement$1(binding.arg)) {
  18865. excludes.push(binding.arg);
  18866. }
  18867. return function(mouseup, mousedown) {
  18868. const popperRef = binding.instance.popperRef;
  18869. const mouseUpTarget = mouseup.target;
  18870. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  18871. const isBound = !binding || !binding.instance;
  18872. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18873. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18874. const isSelf = el === mouseUpTarget;
  18875. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18876. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18877. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  18878. return;
  18879. }
  18880. binding.value(mouseup, mousedown);
  18881. };
  18882. }
  18883. const ClickOutside = {
  18884. beforeMount(el, binding) {
  18885. if (!nodeList.has(el)) {
  18886. nodeList.set(el, []);
  18887. }
  18888. nodeList.get(el).push({
  18889. documentHandler: createDocumentHandler(el, binding),
  18890. bindingFn: binding.value
  18891. });
  18892. },
  18893. updated(el, binding) {
  18894. if (!nodeList.has(el)) {
  18895. nodeList.set(el, []);
  18896. }
  18897. const handlers = nodeList.get(el);
  18898. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18899. const newHandler = {
  18900. documentHandler: createDocumentHandler(el, binding),
  18901. bindingFn: binding.value
  18902. };
  18903. if (oldHandlerIndex >= 0) {
  18904. handlers.splice(oldHandlerIndex, 1, newHandler);
  18905. } else {
  18906. handlers.push(newHandler);
  18907. }
  18908. },
  18909. unmounted(el) {
  18910. nodeList.delete(el);
  18911. }
  18912. };
  18913. const REPEAT_INTERVAL = 100;
  18914. const REPEAT_DELAY = 600;
  18915. const vRepeatClick = {
  18916. beforeMount(el, binding) {
  18917. const value = binding.value;
  18918. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18919. let intervalId;
  18920. let delayId;
  18921. const handler = () => isFunction$1(value) ? value() : value.handler();
  18922. const clear = () => {
  18923. if (delayId) {
  18924. clearTimeout(delayId);
  18925. delayId = void 0;
  18926. }
  18927. if (intervalId) {
  18928. clearInterval(intervalId);
  18929. intervalId = void 0;
  18930. }
  18931. };
  18932. el.addEventListener("mousedown", (evt) => {
  18933. if (evt.button !== 0)
  18934. return;
  18935. clear();
  18936. handler();
  18937. document.addEventListener("mouseup", () => clear(), {
  18938. once: true
  18939. });
  18940. delayId = setTimeout(() => {
  18941. intervalId = setInterval(() => {
  18942. handler();
  18943. }, interval);
  18944. }, delay);
  18945. });
  18946. }
  18947. };
  18948. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18949. const FOCUS_STACK = [];
  18950. const FOCUS_HANDLER = (e) => {
  18951. if (FOCUS_STACK.length === 0)
  18952. return;
  18953. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18954. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  18955. if (focusableElement.length === 1) {
  18956. e.preventDefault();
  18957. if (document.activeElement !== focusableElement[0]) {
  18958. focusableElement[0].focus();
  18959. }
  18960. return;
  18961. }
  18962. const goingBackward = e.shiftKey;
  18963. const isFirst = e.target === focusableElement[0];
  18964. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18965. if (isFirst && goingBackward) {
  18966. e.preventDefault();
  18967. focusableElement[focusableElement.length - 1].focus();
  18968. }
  18969. if (isLast && !goingBackward) {
  18970. e.preventDefault();
  18971. focusableElement[0].focus();
  18972. }
  18973. }
  18974. };
  18975. const TrapFocus = {
  18976. beforeMount(el) {
  18977. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18978. FOCUS_STACK.push(el);
  18979. if (FOCUS_STACK.length <= 1) {
  18980. document.addEventListener("keydown", FOCUS_HANDLER);
  18981. }
  18982. },
  18983. updated(el) {
  18984. vue.nextTick(() => {
  18985. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18986. });
  18987. },
  18988. unmounted() {
  18989. FOCUS_STACK.shift();
  18990. if (FOCUS_STACK.length === 0) {
  18991. document.removeEventListener("keydown", FOCUS_HANDLER);
  18992. }
  18993. }
  18994. };
  18995. var v=!1,o,f,s,u,d,N,l,p,m,w,D,x,E,M,F;function a(){if(!v){v=!0;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);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){o=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,o&&document&&document.documentMode&&(o=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);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;}else o=f=s=d=u=NaN;if(i){if(i[1]){var t=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);l=t?parseFloat(t[1].replace("_",".")):!0;}else l=!1;p=!!i[2],m=!!i[3];}else l=p=m=!1;}}var _={ie:function(){return a()||o},ieCompatibilityMode:function(){return a()||N>o},ie64:function(){return _.ie()&&D},firefox:function(){return a()||f},opera:function(){return a()||s},webkit:function(){return a()||u},safari:function(){return _.webkit()},chrome:function(){return a()||d},windows:function(){return a()||p},osx:function(){return a()||l},linux:function(){return a()||m},iphone:function(){return a()||x},mobile:function(){return a()||x||E||w||F},nativeApp:function(){return a()||M},android:function(){return a()||w},ipad:function(){return a()||E}},A=_;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;var X;h.canUseDOM&&(X=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function S(e,n){if(!h.canUseDOM||n&&!("addEventListener"in document))return !1;var i="on"+e,r=i in document;if(!r){var t=document.createElement("div");t.setAttribute(i,"return;"),r=typeof t[i]=="function";}return !r&&X&&e==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var b=S;var O=10,I=40,P=800;function T(e){var n=0,i=0,r=0,t=0;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}}T.getEventType=function(){return A.firefox()?"DOMMouseScroll":b("wheel")?"wheel":"mousewheel"};var Y=T;/**
  18996. * Checks if an event is supported in the current execution environment.
  18997. *
  18998. * NOTE: This will not work correctly for non-generic events such as `change`,
  18999. * `reset`, `load`, `error`, and `select`.
  19000. *
  19001. * Borrows from Modernizr.
  19002. *
  19003. * @param {string} eventNameSuffix Event name, e.g. "click".
  19004. * @param {?boolean} capture Check if the capture phase is supported.
  19005. * @return {boolean} True if the event is supported.
  19006. * @internal
  19007. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  19008. */
  19009. const mousewheel = function(element, callback) {
  19010. if (element && element.addEventListener) {
  19011. const fn = function(event) {
  19012. const normalized = Y(event);
  19013. callback && Reflect.apply(callback, this, [event, normalized]);
  19014. };
  19015. element.addEventListener("wheel", fn, { passive: true });
  19016. }
  19017. };
  19018. const Mousewheel = {
  19019. beforeMount(el, binding) {
  19020. mousewheel(el, binding.value);
  19021. }
  19022. };
  19023. const basicTimeSpinnerProps = buildProps({
  19024. role: {
  19025. type: String,
  19026. required: true
  19027. },
  19028. spinnerDate: {
  19029. type: definePropType(Object),
  19030. required: true
  19031. },
  19032. showSeconds: {
  19033. type: Boolean,
  19034. default: true
  19035. },
  19036. arrowControl: Boolean,
  19037. amPmMode: {
  19038. type: definePropType(String),
  19039. default: ""
  19040. },
  19041. ...disabledTimeListsProps
  19042. });
  19043. const _sfc_main$25 = /* @__PURE__ */ vue.defineComponent({
  19044. __name: "basic-time-spinner",
  19045. props: basicTimeSpinnerProps,
  19046. emits: [CHANGE_EVENT, "select-range", "set-option"],
  19047. setup(__props, { emit }) {
  19048. const props = __props;
  19049. const pickerBase = vue.inject("EP_PICKER_BASE");
  19050. const { isRange, format } = pickerBase.props;
  19051. const ns = useNamespace("time");
  19052. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  19053. let isScrolling = false;
  19054. const currentScrollbar = vue.ref();
  19055. const listHoursRef = vue.ref();
  19056. const listMinutesRef = vue.ref();
  19057. const listSecondsRef = vue.ref();
  19058. const listRefsMap = {
  19059. hours: listHoursRef,
  19060. minutes: listMinutesRef,
  19061. seconds: listSecondsRef
  19062. };
  19063. const spinnerItems = vue.computed(() => {
  19064. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  19065. });
  19066. const timePartials = vue.computed(() => {
  19067. const { spinnerDate } = props;
  19068. const hours = spinnerDate.hour();
  19069. const minutes = spinnerDate.minute();
  19070. const seconds = spinnerDate.second();
  19071. return { hours, minutes, seconds };
  19072. });
  19073. const timeList = vue.computed(() => {
  19074. const { hours, minutes } = vue.unref(timePartials);
  19075. const { role, spinnerDate } = props;
  19076. const compare = !isRange ? spinnerDate : void 0;
  19077. return {
  19078. hours: getHoursList(role, compare),
  19079. minutes: getMinutesList(hours, role, compare),
  19080. seconds: getSecondsList(hours, minutes, role, compare)
  19081. };
  19082. });
  19083. const arrowControlTimeList = vue.computed(() => {
  19084. const { hours, minutes, seconds } = vue.unref(timePartials);
  19085. return {
  19086. hours: buildTimeList(hours, 23),
  19087. minutes: buildTimeList(minutes, 59),
  19088. seconds: buildTimeList(seconds, 59)
  19089. };
  19090. });
  19091. const debouncedResetScroll = debounce((type) => {
  19092. isScrolling = false;
  19093. adjustCurrentSpinner(type);
  19094. }, 200);
  19095. const getAmPmFlag = (hour) => {
  19096. const shouldShowAmPm = !!props.amPmMode;
  19097. if (!shouldShowAmPm)
  19098. return "";
  19099. const isCapital = props.amPmMode === "A";
  19100. let content = hour < 12 ? " am" : " pm";
  19101. if (isCapital)
  19102. content = content.toUpperCase();
  19103. return content;
  19104. };
  19105. const emitSelectRange = (type) => {
  19106. let range = [0, 0];
  19107. if (!format || format === DEFAULT_FORMATS_TIME) {
  19108. switch (type) {
  19109. case "hours":
  19110. range = [0, 2];
  19111. break;
  19112. case "minutes":
  19113. range = [3, 5];
  19114. break;
  19115. case "seconds":
  19116. range = [6, 8];
  19117. break;
  19118. }
  19119. }
  19120. const [left, right] = range;
  19121. emit("select-range", left, right);
  19122. currentScrollbar.value = type;
  19123. };
  19124. const adjustCurrentSpinner = (type) => {
  19125. adjustSpinner(type, vue.unref(timePartials)[type]);
  19126. };
  19127. const adjustSpinners = () => {
  19128. adjustCurrentSpinner("hours");
  19129. adjustCurrentSpinner("minutes");
  19130. adjustCurrentSpinner("seconds");
  19131. };
  19132. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  19133. const adjustSpinner = (type, value) => {
  19134. if (props.arrowControl)
  19135. return;
  19136. const scrollbar = vue.unref(listRefsMap[type]);
  19137. if (scrollbar && scrollbar.$el) {
  19138. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  19139. }
  19140. };
  19141. const typeItemHeight = (type) => {
  19142. const scrollbar = vue.unref(listRefsMap[type]);
  19143. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  19144. if (listItem) {
  19145. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  19146. }
  19147. return 0;
  19148. };
  19149. const onIncrement = () => {
  19150. scrollDown(1);
  19151. };
  19152. const onDecrement = () => {
  19153. scrollDown(-1);
  19154. };
  19155. const scrollDown = (step) => {
  19156. if (!currentScrollbar.value) {
  19157. emitSelectRange("hours");
  19158. }
  19159. const label = currentScrollbar.value;
  19160. const now = vue.unref(timePartials)[label];
  19161. const total = currentScrollbar.value === "hours" ? 24 : 60;
  19162. const next = findNextUnDisabled(label, now, step, total);
  19163. modifyDateField(label, next);
  19164. adjustSpinner(label, next);
  19165. vue.nextTick(() => emitSelectRange(label));
  19166. };
  19167. const findNextUnDisabled = (type, now, step, total) => {
  19168. let next = (now + step + total) % total;
  19169. const list = vue.unref(timeList)[type];
  19170. while (list[next] && next !== now) {
  19171. next = (next + step + total) % total;
  19172. }
  19173. return next;
  19174. };
  19175. const modifyDateField = (type, value) => {
  19176. const list = vue.unref(timeList)[type];
  19177. const isDisabled = list[value];
  19178. if (isDisabled)
  19179. return;
  19180. const { hours, minutes, seconds } = vue.unref(timePartials);
  19181. let changeTo;
  19182. switch (type) {
  19183. case "hours":
  19184. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  19185. break;
  19186. case "minutes":
  19187. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  19188. break;
  19189. case "seconds":
  19190. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  19191. break;
  19192. }
  19193. emit(CHANGE_EVENT, changeTo);
  19194. };
  19195. const handleClick = (type, { value, disabled }) => {
  19196. if (!disabled) {
  19197. modifyDateField(type, value);
  19198. emitSelectRange(type);
  19199. adjustSpinner(type, value);
  19200. }
  19201. };
  19202. const handleScroll = (type) => {
  19203. const scrollbar = vue.unref(listRefsMap[type]);
  19204. if (!scrollbar)
  19205. return;
  19206. isScrolling = true;
  19207. debouncedResetScroll(type);
  19208. const value = Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  19209. modifyDateField(type, value);
  19210. };
  19211. const scrollBarHeight = (type) => {
  19212. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  19213. };
  19214. const bindScrollEvent = () => {
  19215. const bindFunction = (type) => {
  19216. const scrollbar = vue.unref(listRefsMap[type]);
  19217. if (scrollbar && scrollbar.$el) {
  19218. getScrollbarElement(scrollbar.$el).onscroll = () => {
  19219. handleScroll(type);
  19220. };
  19221. }
  19222. };
  19223. bindFunction("hours");
  19224. bindFunction("minutes");
  19225. bindFunction("seconds");
  19226. };
  19227. vue.onMounted(() => {
  19228. vue.nextTick(() => {
  19229. !props.arrowControl && bindScrollEvent();
  19230. adjustSpinners();
  19231. if (props.role === "start")
  19232. emitSelectRange("hours");
  19233. });
  19234. });
  19235. const setRef = (scrollbar, type) => {
  19236. listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
  19237. };
  19238. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  19239. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  19240. vue.watch(() => props.spinnerDate, () => {
  19241. if (isScrolling)
  19242. return;
  19243. adjustSpinners();
  19244. });
  19245. return (_ctx, _cache) => {
  19246. return vue.openBlock(), vue.createElementBlock("div", {
  19247. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  19248. }, [
  19249. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  19250. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  19251. key: item,
  19252. ref_for: true,
  19253. ref: (scrollbar) => setRef(scrollbar, item),
  19254. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  19255. "wrap-style": "max-height: inherit;",
  19256. "view-class": vue.unref(ns).be("spinner", "list"),
  19257. noresize: "",
  19258. tag: "ul",
  19259. onMouseenter: ($event) => emitSelectRange(item),
  19260. onMousemove: ($event) => adjustCurrentSpinner(item)
  19261. }, {
  19262. default: vue.withCtx(() => [
  19263. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  19264. return vue.openBlock(), vue.createElementBlock("li", {
  19265. key,
  19266. class: vue.normalizeClass([
  19267. vue.unref(ns).be("spinner", "item"),
  19268. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  19269. vue.unref(ns).is("disabled", disabled)
  19270. ]),
  19271. onClick: ($event) => handleClick(item, { value: key, disabled })
  19272. }, [
  19273. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19274. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  19275. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  19276. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  19277. ], 64))
  19278. ], 10, ["onClick"]);
  19279. }), 128))
  19280. ]),
  19281. _: 2
  19282. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  19283. }), 128)) : vue.createCommentVNode("v-if", true),
  19284. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  19285. return vue.openBlock(), vue.createElementBlock("div", {
  19286. key: item,
  19287. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  19288. onMouseenter: ($event) => emitSelectRange(item)
  19289. }, [
  19290. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  19291. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  19292. }, {
  19293. default: vue.withCtx(() => [
  19294. vue.createVNode(vue.unref(arrow_up_default))
  19295. ]),
  19296. _: 1
  19297. }, 8, ["class"])), [
  19298. [vue.unref(vRepeatClick), onDecrement]
  19299. ]),
  19300. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  19301. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  19302. }, {
  19303. default: vue.withCtx(() => [
  19304. vue.createVNode(vue.unref(arrow_down_default))
  19305. ]),
  19306. _: 1
  19307. }, 8, ["class"])), [
  19308. [vue.unref(vRepeatClick), onIncrement]
  19309. ]),
  19310. vue.createElementVNode("ul", {
  19311. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  19312. }, [
  19313. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  19314. return vue.openBlock(), vue.createElementBlock("li", {
  19315. key,
  19316. class: vue.normalizeClass([
  19317. vue.unref(ns).be("spinner", "item"),
  19318. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  19319. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  19320. ])
  19321. }, [
  19322. vue.unref(isNumber)(time) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19323. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19324. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  19325. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  19326. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  19327. ], 64))
  19328. ], 64)) : vue.createCommentVNode("v-if", true)
  19329. ], 2);
  19330. }), 128))
  19331. ], 2)
  19332. ], 42, ["onMouseenter"]);
  19333. }), 128)) : vue.createCommentVNode("v-if", true)
  19334. ], 2);
  19335. };
  19336. }
  19337. });
  19338. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "basic-time-spinner.vue"]]);
  19339. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  19340. __name: "panel-time-pick",
  19341. props: panelTimePickerProps,
  19342. emits: ["pick", "select-range", "set-picker-option"],
  19343. setup(__props, { emit }) {
  19344. const props = __props;
  19345. const pickerBase = vue.inject("EP_PICKER_BASE");
  19346. const {
  19347. arrowControl,
  19348. disabledHours,
  19349. disabledMinutes,
  19350. disabledSeconds,
  19351. defaultValue
  19352. } = pickerBase.props;
  19353. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  19354. const ns = useNamespace("time");
  19355. const { t, lang } = useLocale();
  19356. const selectionRange = vue.ref([0, 2]);
  19357. const oldValue = useOldValue(props);
  19358. const transitionName = vue.computed(() => {
  19359. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  19360. });
  19361. const showSeconds = vue.computed(() => {
  19362. return props.format.includes("ss");
  19363. });
  19364. const amPmMode = vue.computed(() => {
  19365. if (props.format.includes("A"))
  19366. return "A";
  19367. if (props.format.includes("a"))
  19368. return "a";
  19369. return "";
  19370. });
  19371. const isValidValue = (_date) => {
  19372. const parsedDate = dayjs(_date).locale(lang.value);
  19373. const result = getRangeAvailableTime(parsedDate);
  19374. return parsedDate.isSame(result);
  19375. };
  19376. const handleCancel = () => {
  19377. emit("pick", oldValue.value, false);
  19378. };
  19379. const handleConfirm = (visible = false, first = false) => {
  19380. if (first)
  19381. return;
  19382. emit("pick", props.parsedValue, visible);
  19383. };
  19384. const handleChange = (_date) => {
  19385. if (!props.visible) {
  19386. return;
  19387. }
  19388. const result = getRangeAvailableTime(_date).millisecond(0);
  19389. emit("pick", result, true);
  19390. };
  19391. const setSelectionRange = (start, end) => {
  19392. emit("select-range", start, end);
  19393. selectionRange.value = [start, end];
  19394. };
  19395. const changeSelectionRange = (step) => {
  19396. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  19397. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19398. const index = list.indexOf(selectionRange.value[0]);
  19399. const next = (index + step + list.length) % list.length;
  19400. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19401. };
  19402. const handleKeydown = (event) => {
  19403. const code = event.code;
  19404. const { left, right, up, down } = EVENT_CODE;
  19405. if ([left, right].includes(code)) {
  19406. const step = code === left ? -1 : 1;
  19407. changeSelectionRange(step);
  19408. event.preventDefault();
  19409. return;
  19410. }
  19411. if ([up, down].includes(code)) {
  19412. const step = code === up ? -1 : 1;
  19413. timePickerOptions["start_scrollDown"](step);
  19414. event.preventDefault();
  19415. return;
  19416. }
  19417. };
  19418. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  19419. getAvailableHours,
  19420. getAvailableMinutes,
  19421. getAvailableSeconds
  19422. });
  19423. const getRangeAvailableTime = (date) => {
  19424. return getAvailableTime(date, props.datetimeRole || "", true);
  19425. };
  19426. const parseUserInput = (value) => {
  19427. if (!value)
  19428. return null;
  19429. return dayjs(value, props.format).locale(lang.value);
  19430. };
  19431. const formatToString = (value) => {
  19432. if (!value)
  19433. return null;
  19434. return value.format(props.format);
  19435. };
  19436. const getDefaultValue = () => {
  19437. return dayjs(defaultValue).locale(lang.value);
  19438. };
  19439. emit("set-picker-option", ["isValidValue", isValidValue]);
  19440. emit("set-picker-option", ["formatToString", formatToString]);
  19441. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19442. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19443. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19444. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19445. return (_ctx, _cache) => {
  19446. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  19447. default: vue.withCtx(() => [
  19448. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  19449. key: 0,
  19450. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  19451. }, [
  19452. vue.createElementVNode("div", {
  19453. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  19454. }, [
  19455. vue.createVNode(TimeSpinner, {
  19456. ref: "spinner",
  19457. role: _ctx.datetimeRole || "start",
  19458. "arrow-control": vue.unref(arrowControl),
  19459. "show-seconds": vue.unref(showSeconds),
  19460. "am-pm-mode": vue.unref(amPmMode),
  19461. "spinner-date": _ctx.parsedValue,
  19462. "disabled-hours": vue.unref(disabledHours),
  19463. "disabled-minutes": vue.unref(disabledMinutes),
  19464. "disabled-seconds": vue.unref(disabledSeconds),
  19465. onChange: handleChange,
  19466. onSetOption: vue.unref(onSetOption),
  19467. onSelectRange: setSelectionRange
  19468. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  19469. ], 2),
  19470. vue.createElementVNode("div", {
  19471. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  19472. }, [
  19473. vue.createElementVNode("button", {
  19474. type: "button",
  19475. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  19476. onClick: handleCancel
  19477. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  19478. vue.createElementVNode("button", {
  19479. type: "button",
  19480. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  19481. onClick: ($event) => handleConfirm()
  19482. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["onClick"])
  19483. ], 2)
  19484. ], 2)) : vue.createCommentVNode("v-if", true)
  19485. ]),
  19486. _: 1
  19487. }, 8, ["name"]);
  19488. };
  19489. }
  19490. });
  19491. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "panel-time-pick.vue"]]);
  19492. const panelTimeRangeProps = buildProps({
  19493. ...timePanelSharedProps,
  19494. parsedValue: {
  19495. type: definePropType(Array)
  19496. }
  19497. });
  19498. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  19499. __name: "panel-time-range",
  19500. props: panelTimeRangeProps,
  19501. emits: ["pick", "select-range", "set-picker-option"],
  19502. setup(__props, { emit }) {
  19503. const props = __props;
  19504. const makeSelectRange = (start, end) => {
  19505. const result = [];
  19506. for (let i = start; i <= end; i++) {
  19507. result.push(i);
  19508. }
  19509. return result;
  19510. };
  19511. const { t, lang } = useLocale();
  19512. const nsTime = useNamespace("time");
  19513. const nsPicker = useNamespace("picker");
  19514. const pickerBase = vue.inject("EP_PICKER_BASE");
  19515. const {
  19516. arrowControl,
  19517. disabledHours,
  19518. disabledMinutes,
  19519. disabledSeconds,
  19520. defaultValue
  19521. } = pickerBase.props;
  19522. const startContainerKls = vue.computed(() => [
  19523. nsTime.be("range-picker", "body"),
  19524. nsTime.be("panel", "content"),
  19525. nsTime.is("arrow", arrowControl),
  19526. showSeconds.value ? "has-seconds" : ""
  19527. ]);
  19528. const endContainerKls = vue.computed(() => [
  19529. nsTime.be("range-picker", "body"),
  19530. nsTime.be("panel", "content"),
  19531. nsTime.is("arrow", arrowControl),
  19532. showSeconds.value ? "has-seconds" : ""
  19533. ]);
  19534. const startTime = vue.computed(() => props.parsedValue[0]);
  19535. const endTime = vue.computed(() => props.parsedValue[1]);
  19536. const oldValue = useOldValue(props);
  19537. const handleCancel = () => {
  19538. emit("pick", oldValue.value, false);
  19539. };
  19540. const showSeconds = vue.computed(() => {
  19541. return props.format.includes("ss");
  19542. });
  19543. const amPmMode = vue.computed(() => {
  19544. if (props.format.includes("A"))
  19545. return "A";
  19546. if (props.format.includes("a"))
  19547. return "a";
  19548. return "";
  19549. });
  19550. const handleConfirm = (visible = false) => {
  19551. emit("pick", [startTime.value, endTime.value], visible);
  19552. };
  19553. const handleMinChange = (date) => {
  19554. handleChange(date.millisecond(0), endTime.value);
  19555. };
  19556. const handleMaxChange = (date) => {
  19557. handleChange(startTime.value, date.millisecond(0));
  19558. };
  19559. const isValidValue = (_date) => {
  19560. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  19561. const result = getRangeAvailableTime(parsedDate);
  19562. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  19563. };
  19564. const handleChange = (start, end) => {
  19565. if (!props.visible) {
  19566. return;
  19567. }
  19568. emit("pick", [start, end], true);
  19569. };
  19570. const btnConfirmDisabled = vue.computed(() => {
  19571. return startTime.value > endTime.value;
  19572. });
  19573. const selectionRange = vue.ref([0, 2]);
  19574. const setMinSelectionRange = (start, end) => {
  19575. emit("select-range", start, end, "min");
  19576. selectionRange.value = [start, end];
  19577. };
  19578. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  19579. const setMaxSelectionRange = (start, end) => {
  19580. emit("select-range", start, end, "max");
  19581. const _offset = vue.unref(offset);
  19582. selectionRange.value = [start + _offset, end + _offset];
  19583. };
  19584. const changeSelectionRange = (step) => {
  19585. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  19586. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19587. const index = list.indexOf(selectionRange.value[0]);
  19588. const next = (index + step + list.length) % list.length;
  19589. const half = list.length / 2;
  19590. if (next < half) {
  19591. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19592. } else {
  19593. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  19594. }
  19595. };
  19596. const handleKeydown = (event) => {
  19597. const code = event.code;
  19598. const { left, right, up, down } = EVENT_CODE;
  19599. if ([left, right].includes(code)) {
  19600. const step = code === left ? -1 : 1;
  19601. changeSelectionRange(step);
  19602. event.preventDefault();
  19603. return;
  19604. }
  19605. if ([up, down].includes(code)) {
  19606. const step = code === up ? -1 : 1;
  19607. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  19608. timePickerOptions[`${role}_scrollDown`](step);
  19609. event.preventDefault();
  19610. return;
  19611. }
  19612. };
  19613. const disabledHours_ = (role, compare) => {
  19614. const defaultDisable = disabledHours ? disabledHours(role) : [];
  19615. const isStart = role === "start";
  19616. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19617. const compareHour = compareDate.hour();
  19618. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  19619. return union(defaultDisable, nextDisable);
  19620. };
  19621. const disabledMinutes_ = (hour, role, compare) => {
  19622. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  19623. const isStart = role === "start";
  19624. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19625. const compareHour = compareDate.hour();
  19626. if (hour !== compareHour) {
  19627. return defaultDisable;
  19628. }
  19629. const compareMinute = compareDate.minute();
  19630. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  19631. return union(defaultDisable, nextDisable);
  19632. };
  19633. const disabledSeconds_ = (hour, minute, role, compare) => {
  19634. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  19635. const isStart = role === "start";
  19636. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19637. const compareHour = compareDate.hour();
  19638. const compareMinute = compareDate.minute();
  19639. if (hour !== compareHour || minute !== compareMinute) {
  19640. return defaultDisable;
  19641. }
  19642. const compareSecond = compareDate.second();
  19643. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  19644. return union(defaultDisable, nextDisable);
  19645. };
  19646. const getRangeAvailableTime = ([start, end]) => {
  19647. return [
  19648. getAvailableTime(start, "start", true, end),
  19649. getAvailableTime(end, "end", false, start)
  19650. ];
  19651. };
  19652. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  19653. const {
  19654. timePickerOptions,
  19655. getAvailableTime,
  19656. onSetOption
  19657. } = useTimePanel({
  19658. getAvailableHours,
  19659. getAvailableMinutes,
  19660. getAvailableSeconds
  19661. });
  19662. const parseUserInput = (days) => {
  19663. if (!days)
  19664. return null;
  19665. if (isArray$1(days)) {
  19666. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  19667. }
  19668. return dayjs(days, props.format).locale(lang.value);
  19669. };
  19670. const formatToString = (days) => {
  19671. if (!days)
  19672. return null;
  19673. if (isArray$1(days)) {
  19674. return days.map((d) => d.format(props.format));
  19675. }
  19676. return days.format(props.format);
  19677. };
  19678. const getDefaultValue = () => {
  19679. if (isArray$1(defaultValue)) {
  19680. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  19681. }
  19682. const defaultDay = dayjs(defaultValue).locale(lang.value);
  19683. return [defaultDay, defaultDay.add(60, "m")];
  19684. };
  19685. emit("set-picker-option", ["formatToString", formatToString]);
  19686. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19687. emit("set-picker-option", ["isValidValue", isValidValue]);
  19688. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19689. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19690. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19691. return (_ctx, _cache) => {
  19692. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  19693. key: 0,
  19694. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  19695. }, [
  19696. vue.createElementVNode("div", {
  19697. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  19698. }, [
  19699. vue.createElementVNode("div", {
  19700. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19701. }, [
  19702. vue.createElementVNode("div", {
  19703. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19704. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  19705. vue.createElementVNode("div", {
  19706. class: vue.normalizeClass(vue.unref(startContainerKls))
  19707. }, [
  19708. vue.createVNode(TimeSpinner, {
  19709. ref: "minSpinner",
  19710. role: "start",
  19711. "show-seconds": vue.unref(showSeconds),
  19712. "am-pm-mode": vue.unref(amPmMode),
  19713. "arrow-control": vue.unref(arrowControl),
  19714. "spinner-date": vue.unref(startTime),
  19715. "disabled-hours": disabledHours_,
  19716. "disabled-minutes": disabledMinutes_,
  19717. "disabled-seconds": disabledSeconds_,
  19718. onChange: handleMinChange,
  19719. onSetOption: vue.unref(onSetOption),
  19720. onSelectRange: setMinSelectionRange
  19721. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19722. ], 2)
  19723. ], 2),
  19724. vue.createElementVNode("div", {
  19725. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19726. }, [
  19727. vue.createElementVNode("div", {
  19728. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19729. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  19730. vue.createElementVNode("div", {
  19731. class: vue.normalizeClass(vue.unref(endContainerKls))
  19732. }, [
  19733. vue.createVNode(TimeSpinner, {
  19734. ref: "maxSpinner",
  19735. role: "end",
  19736. "show-seconds": vue.unref(showSeconds),
  19737. "am-pm-mode": vue.unref(amPmMode),
  19738. "arrow-control": vue.unref(arrowControl),
  19739. "spinner-date": vue.unref(endTime),
  19740. "disabled-hours": disabledHours_,
  19741. "disabled-minutes": disabledMinutes_,
  19742. "disabled-seconds": disabledSeconds_,
  19743. onChange: handleMaxChange,
  19744. onSetOption: vue.unref(onSetOption),
  19745. onSelectRange: setMaxSelectionRange
  19746. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19747. ], 2)
  19748. ], 2)
  19749. ], 2),
  19750. vue.createElementVNode("div", {
  19751. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  19752. }, [
  19753. vue.createElementVNode("button", {
  19754. type: "button",
  19755. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  19756. onClick: ($event) => handleCancel()
  19757. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
  19758. vue.createElementVNode("button", {
  19759. type: "button",
  19760. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  19761. disabled: vue.unref(btnConfirmDisabled),
  19762. onClick: ($event) => handleConfirm()
  19763. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
  19764. ], 2)
  19765. ], 2)) : vue.createCommentVNode("v-if", true);
  19766. };
  19767. }
  19768. });
  19769. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "panel-time-range.vue"]]);
  19770. dayjs.extend(customParseFormat);
  19771. var TimePicker = vue.defineComponent({
  19772. name: "ElTimePicker",
  19773. install: null,
  19774. props: {
  19775. ...timePickerDefaultProps,
  19776. isRange: {
  19777. type: Boolean,
  19778. default: false
  19779. }
  19780. },
  19781. emits: [UPDATE_MODEL_EVENT],
  19782. setup(props, ctx) {
  19783. const commonPicker = vue.ref();
  19784. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  19785. const modelUpdater = (value) => ctx.emit(UPDATE_MODEL_EVENT, value);
  19786. vue.provide("ElPopperOptions", props.popperOptions);
  19787. ctx.expose({
  19788. focus: () => {
  19789. var _a;
  19790. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  19791. },
  19792. blur: () => {
  19793. var _a;
  19794. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  19795. },
  19796. handleOpen: () => {
  19797. var _a;
  19798. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  19799. },
  19800. handleClose: () => {
  19801. var _a;
  19802. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  19803. }
  19804. });
  19805. return () => {
  19806. var _a;
  19807. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  19808. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  19809. "ref": commonPicker,
  19810. "type": type,
  19811. "format": format,
  19812. "onUpdate:modelValue": modelUpdater
  19813. }), {
  19814. default: (props2) => vue.createVNode(Panel, props2, null)
  19815. });
  19816. };
  19817. }
  19818. });
  19819. const ElTimePicker = withInstall(TimePicker);
  19820. const getPrevMonthLastDays = (date, count) => {
  19821. const lastDay = date.subtract(1, "month").endOf("month").date();
  19822. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19823. };
  19824. const getMonthDays = (date) => {
  19825. const days = date.daysInMonth();
  19826. return rangeArr(days).map((_, index) => index + 1);
  19827. };
  19828. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19829. const start = index * 7;
  19830. return days.slice(start, start + 7);
  19831. });
  19832. const dateTableProps = buildProps({
  19833. selectedDay: {
  19834. type: definePropType(Object)
  19835. },
  19836. range: {
  19837. type: definePropType(Array)
  19838. },
  19839. date: {
  19840. type: definePropType(Object),
  19841. required: true
  19842. },
  19843. hideHeader: {
  19844. type: Boolean
  19845. }
  19846. });
  19847. const dateTableEmits = {
  19848. pick: (value) => isObject$1(value)
  19849. };
  19850. var localeData$1 = {exports: {}};
  19851. (function(module, exports) {
  19852. !function(n, e) {
  19853. module.exports = e() ;
  19854. }(commonjsGlobal, function() {
  19855. return function(n, e, t) {
  19856. var r = e.prototype, o = function(n2) {
  19857. return n2 && (n2.indexOf ? n2 : n2.s);
  19858. }, u = function(n2, e2, t2, r2, u2) {
  19859. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  19860. return n3.slice(0, r2);
  19861. });
  19862. if (!u2)
  19863. return f;
  19864. var d = i2.weekStart;
  19865. return f.map(function(n3, e3) {
  19866. return f[(e3 + (d || 0)) % 7];
  19867. });
  19868. }, i = function() {
  19869. return t.Ls[t.locale()];
  19870. }, a = function(n2, e2) {
  19871. return n2.formats[e2] || function(n3) {
  19872. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  19873. return e3 || t2.slice(1);
  19874. });
  19875. }(n2.formats[e2.toUpperCase()]);
  19876. }, s = function() {
  19877. var n2 = this;
  19878. return { months: function(e2) {
  19879. return e2 ? e2.format("MMMM") : u(n2, "months");
  19880. }, monthsShort: function(e2) {
  19881. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  19882. }, firstDayOfWeek: function() {
  19883. return n2.$locale().weekStart || 0;
  19884. }, weekdays: function(e2) {
  19885. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  19886. }, weekdaysMin: function(e2) {
  19887. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  19888. }, weekdaysShort: function(e2) {
  19889. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  19890. }, longDateFormat: function(e2) {
  19891. return a(n2.$locale(), e2);
  19892. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  19893. };
  19894. r.localeData = function() {
  19895. return s.bind(this)();
  19896. }, t.localeData = function() {
  19897. var n2 = i();
  19898. return { firstDayOfWeek: function() {
  19899. return n2.weekStart || 0;
  19900. }, weekdays: function() {
  19901. return t.weekdays();
  19902. }, weekdaysShort: function() {
  19903. return t.weekdaysShort();
  19904. }, weekdaysMin: function() {
  19905. return t.weekdaysMin();
  19906. }, months: function() {
  19907. return t.months();
  19908. }, monthsShort: function() {
  19909. return t.monthsShort();
  19910. }, longDateFormat: function(e2) {
  19911. return a(n2, e2);
  19912. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  19913. }, t.months = function() {
  19914. return u(i(), "months");
  19915. }, t.monthsShort = function() {
  19916. return u(i(), "monthsShort", "months", 3);
  19917. }, t.weekdays = function(n2) {
  19918. return u(i(), "weekdays", null, null, n2);
  19919. }, t.weekdaysShort = function(n2) {
  19920. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  19921. }, t.weekdaysMin = function(n2) {
  19922. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  19923. };
  19924. };
  19925. });
  19926. })(localeData$1);
  19927. var localeData = localeData$1.exports;
  19928. const useDateTable = (props, emit) => {
  19929. dayjs.extend(localeData);
  19930. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  19931. const { t, lang } = useLocale();
  19932. const now = dayjs().locale(lang.value);
  19933. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  19934. const rows = vue.computed(() => {
  19935. let days = [];
  19936. if (isInRange.value) {
  19937. const [start, end] = props.range;
  19938. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19939. text: start.date() + index,
  19940. type: "current"
  19941. }));
  19942. let remaining = currentMonthRange.length % 7;
  19943. remaining = remaining === 0 ? 0 : 7 - remaining;
  19944. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19945. text: index + 1,
  19946. type: "next"
  19947. }));
  19948. days = currentMonthRange.concat(nextMonthRange);
  19949. } else {
  19950. const firstDay = props.date.startOf("month").day();
  19951. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19952. text: day,
  19953. type: "prev"
  19954. }));
  19955. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19956. text: day,
  19957. type: "current"
  19958. }));
  19959. days = [...prevMonthDays, ...currentMonthDays];
  19960. const remaining = 7 - (days.length % 7 || 7);
  19961. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  19962. text: index + 1,
  19963. type: "next"
  19964. }));
  19965. days = days.concat(nextMonthDays);
  19966. }
  19967. return toNestedArr(days);
  19968. });
  19969. const weekDays = vue.computed(() => {
  19970. const start = firstDayOfWeek;
  19971. if (start === 0) {
  19972. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19973. } else {
  19974. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19975. }
  19976. });
  19977. const getFormattedDate = (day, type) => {
  19978. switch (type) {
  19979. case "prev":
  19980. return props.date.startOf("month").subtract(1, "month").date(day);
  19981. case "next":
  19982. return props.date.startOf("month").add(1, "month").date(day);
  19983. case "current":
  19984. return props.date.date(day);
  19985. }
  19986. };
  19987. const handlePickDay = ({ text, type }) => {
  19988. const date = getFormattedDate(text, type);
  19989. emit("pick", date);
  19990. };
  19991. const getSlotData = ({ text, type }) => {
  19992. const day = getFormattedDate(text, type);
  19993. return {
  19994. isSelected: day.isSame(props.selectedDay),
  19995. type: `${type}-month`,
  19996. day: day.format("YYYY-MM-DD"),
  19997. date: day.toDate()
  19998. };
  19999. };
  20000. return {
  20001. now,
  20002. isInRange,
  20003. rows,
  20004. weekDays,
  20005. getFormattedDate,
  20006. handlePickDay,
  20007. getSlotData
  20008. };
  20009. };
  20010. const __default__$1w = vue.defineComponent({
  20011. name: "DateTable"
  20012. });
  20013. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  20014. ...__default__$1w,
  20015. props: dateTableProps,
  20016. emits: dateTableEmits,
  20017. setup(__props, { expose, emit }) {
  20018. const props = __props;
  20019. const {
  20020. isInRange,
  20021. now,
  20022. rows,
  20023. weekDays,
  20024. getFormattedDate,
  20025. handlePickDay,
  20026. getSlotData
  20027. } = useDateTable(props, emit);
  20028. const nsTable = useNamespace("calendar-table");
  20029. const nsDay = useNamespace("calendar-day");
  20030. const getCellClass = ({ text, type }) => {
  20031. const classes = [type];
  20032. if (type === "current") {
  20033. const date = getFormattedDate(text, type);
  20034. if (date.isSame(props.selectedDay, "day")) {
  20035. classes.push(nsDay.is("selected"));
  20036. }
  20037. if (date.isSame(now, "day")) {
  20038. classes.push(nsDay.is("today"));
  20039. }
  20040. }
  20041. return classes;
  20042. };
  20043. expose({
  20044. getFormattedDate
  20045. });
  20046. return (_ctx, _cache) => {
  20047. return vue.openBlock(), vue.createElementBlock("table", {
  20048. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  20049. cellspacing: "0",
  20050. cellpadding: "0"
  20051. }, [
  20052. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", { key: 0 }, [
  20053. vue.createElementVNode("tr", null, [
  20054. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  20055. return vue.openBlock(), vue.createElementBlock("th", {
  20056. key: day,
  20057. scope: "col"
  20058. }, vue.toDisplayString(day), 1);
  20059. }), 128))
  20060. ])
  20061. ])) : vue.createCommentVNode("v-if", true),
  20062. vue.createElementVNode("tbody", null, [
  20063. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  20064. return vue.openBlock(), vue.createElementBlock("tr", {
  20065. key: index,
  20066. class: vue.normalizeClass({
  20067. [vue.unref(nsTable).e("row")]: true,
  20068. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  20069. })
  20070. }, [
  20071. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  20072. return vue.openBlock(), vue.createElementBlock("td", {
  20073. key,
  20074. class: vue.normalizeClass(getCellClass(cell)),
  20075. onClick: ($event) => vue.unref(handlePickDay)(cell)
  20076. }, [
  20077. vue.createElementVNode("div", {
  20078. class: vue.normalizeClass(vue.unref(nsDay).b())
  20079. }, [
  20080. vue.renderSlot(_ctx.$slots, "date-cell", {
  20081. data: vue.unref(getSlotData)(cell)
  20082. }, () => [
  20083. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  20084. ])
  20085. ], 2)
  20086. ], 10, ["onClick"]);
  20087. }), 128))
  20088. ], 2);
  20089. }), 128))
  20090. ])
  20091. ], 2);
  20092. };
  20093. }
  20094. });
  20095. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "date-table.vue"]]);
  20096. const adjacentMonth = (start, end) => {
  20097. const firstMonthLastDay = start.endOf("month");
  20098. const lastMonthFirstDay = end.startOf("month");
  20099. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  20100. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20101. return [
  20102. [start, firstMonthLastDay],
  20103. [lastMonthStartDay.startOf("week"), end]
  20104. ];
  20105. };
  20106. const threeConsecutiveMonth = (start, end) => {
  20107. const firstMonthLastDay = start.endOf("month");
  20108. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  20109. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  20110. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  20111. const lastMonthFirstDay = end.startOf("month");
  20112. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20113. return [
  20114. [start, firstMonthLastDay],
  20115. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  20116. [lastMonthStartDay.startOf("week"), end]
  20117. ];
  20118. };
  20119. const useCalendar = (props, emit, componentName) => {
  20120. const { lang } = useLocale();
  20121. const selectedDay = vue.ref();
  20122. const now = dayjs().locale(lang.value);
  20123. const realSelectedDay = vue.computed({
  20124. get() {
  20125. if (!props.modelValue)
  20126. return selectedDay.value;
  20127. return date.value;
  20128. },
  20129. set(val) {
  20130. if (!val)
  20131. return;
  20132. selectedDay.value = val;
  20133. const result = val.toDate();
  20134. emit(INPUT_EVENT, result);
  20135. emit(UPDATE_MODEL_EVENT, result);
  20136. }
  20137. });
  20138. const validatedRange = vue.computed(() => {
  20139. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate$1(item)))
  20140. return [];
  20141. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  20142. const [startDayjs, endDayjs] = rangeArrDayjs;
  20143. if (startDayjs.isAfter(endDayjs)) {
  20144. return [];
  20145. }
  20146. if (startDayjs.isSame(endDayjs, "month")) {
  20147. return calculateValidatedDateRange(startDayjs, endDayjs);
  20148. } else {
  20149. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  20150. return [];
  20151. }
  20152. return calculateValidatedDateRange(startDayjs, endDayjs);
  20153. }
  20154. });
  20155. const date = vue.computed(() => {
  20156. if (!props.modelValue) {
  20157. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  20158. } else {
  20159. return dayjs(props.modelValue).locale(lang.value);
  20160. }
  20161. });
  20162. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  20163. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  20164. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  20165. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  20166. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  20167. const firstDay = startDayjs.startOf("week");
  20168. const lastDay = endDayjs.endOf("week");
  20169. const firstMonth = firstDay.get("month");
  20170. const lastMonth = lastDay.get("month");
  20171. if (firstMonth === lastMonth) {
  20172. return [[firstDay, lastDay]];
  20173. } else if ((firstMonth + 1) % 12 === lastMonth) {
  20174. return adjacentMonth(firstDay, lastDay);
  20175. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  20176. return threeConsecutiveMonth(firstDay, lastDay);
  20177. } else {
  20178. return [];
  20179. }
  20180. };
  20181. const pickDay = (day) => {
  20182. realSelectedDay.value = day;
  20183. };
  20184. const selectDate = (type) => {
  20185. const dateMap = {
  20186. "prev-month": prevMonthDayjs.value,
  20187. "next-month": nextMonthDayjs.value,
  20188. "prev-year": prevYearDayjs.value,
  20189. "next-year": nextYearDayjs.value,
  20190. today: now
  20191. };
  20192. const day = dateMap[type];
  20193. if (!day.isSame(date.value, "day")) {
  20194. pickDay(day);
  20195. }
  20196. };
  20197. return {
  20198. calculateValidatedDateRange,
  20199. date,
  20200. realSelectedDay,
  20201. pickDay,
  20202. selectDate,
  20203. validatedRange
  20204. };
  20205. };
  20206. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  20207. const calendarProps = buildProps({
  20208. modelValue: {
  20209. type: Date
  20210. },
  20211. range: {
  20212. type: definePropType(Array),
  20213. validator: isValidRange$1
  20214. }
  20215. });
  20216. const calendarEmits = {
  20217. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  20218. [INPUT_EVENT]: (value) => isDate$1(value)
  20219. };
  20220. const COMPONENT_NAME$h = "ElCalendar";
  20221. const __default__$1v = vue.defineComponent({
  20222. name: COMPONENT_NAME$h
  20223. });
  20224. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  20225. ...__default__$1v,
  20226. props: calendarProps,
  20227. emits: calendarEmits,
  20228. setup(__props, { expose, emit }) {
  20229. const props = __props;
  20230. const ns = useNamespace("calendar");
  20231. const {
  20232. calculateValidatedDateRange,
  20233. date,
  20234. pickDay,
  20235. realSelectedDay,
  20236. selectDate,
  20237. validatedRange
  20238. } = useCalendar(props, emit);
  20239. const { t } = useLocale();
  20240. const i18nDate = vue.computed(() => {
  20241. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  20242. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  20243. });
  20244. expose({
  20245. selectedDay: realSelectedDay,
  20246. pickDay,
  20247. selectDate,
  20248. calculateValidatedDateRange
  20249. });
  20250. return (_ctx, _cache) => {
  20251. return vue.openBlock(), vue.createElementBlock("div", {
  20252. class: vue.normalizeClass(vue.unref(ns).b())
  20253. }, [
  20254. vue.createElementVNode("div", {
  20255. class: vue.normalizeClass(vue.unref(ns).e("header"))
  20256. }, [
  20257. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  20258. vue.createElementVNode("div", {
  20259. class: vue.normalizeClass(vue.unref(ns).e("title"))
  20260. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  20261. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  20262. key: 0,
  20263. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  20264. }, [
  20265. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  20266. default: vue.withCtx(() => [
  20267. vue.createVNode(vue.unref(ElButton), {
  20268. size: "small",
  20269. onClick: ($event) => vue.unref(selectDate)("prev-month")
  20270. }, {
  20271. default: vue.withCtx(() => [
  20272. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  20273. ]),
  20274. _: 1
  20275. }, 8, ["onClick"]),
  20276. vue.createVNode(vue.unref(ElButton), {
  20277. size: "small",
  20278. onClick: ($event) => vue.unref(selectDate)("today")
  20279. }, {
  20280. default: vue.withCtx(() => [
  20281. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  20282. ]),
  20283. _: 1
  20284. }, 8, ["onClick"]),
  20285. vue.createVNode(vue.unref(ElButton), {
  20286. size: "small",
  20287. onClick: ($event) => vue.unref(selectDate)("next-month")
  20288. }, {
  20289. default: vue.withCtx(() => [
  20290. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  20291. ]),
  20292. _: 1
  20293. }, 8, ["onClick"])
  20294. ]),
  20295. _: 1
  20296. })
  20297. ], 2)) : vue.createCommentVNode("v-if", true)
  20298. ])
  20299. ], 2),
  20300. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  20301. key: 0,
  20302. class: vue.normalizeClass(vue.unref(ns).e("body"))
  20303. }, [
  20304. vue.createVNode(DateTable$1, {
  20305. date: vue.unref(date),
  20306. "selected-day": vue.unref(realSelectedDay),
  20307. onPick: vue.unref(pickDay)
  20308. }, vue.createSlots({
  20309. _: 2
  20310. }, [
  20311. _ctx.$slots["date-cell"] ? {
  20312. name: "date-cell",
  20313. fn: vue.withCtx((data) => [
  20314. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  20315. ])
  20316. } : void 0
  20317. ]), 1032, ["date", "selected-day", "onPick"])
  20318. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  20319. key: 1,
  20320. class: vue.normalizeClass(vue.unref(ns).e("body"))
  20321. }, [
  20322. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  20323. return vue.openBlock(), vue.createBlock(DateTable$1, {
  20324. key: index,
  20325. date: range_[0],
  20326. "selected-day": vue.unref(realSelectedDay),
  20327. range: range_,
  20328. "hide-header": index !== 0,
  20329. onPick: vue.unref(pickDay)
  20330. }, vue.createSlots({
  20331. _: 2
  20332. }, [
  20333. _ctx.$slots["date-cell"] ? {
  20334. name: "date-cell",
  20335. fn: vue.withCtx((data) => [
  20336. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  20337. ])
  20338. } : void 0
  20339. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  20340. }), 128))
  20341. ], 2))
  20342. ], 2);
  20343. };
  20344. }
  20345. });
  20346. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "calendar.vue"]]);
  20347. const ElCalendar = withInstall(Calendar);
  20348. const cardProps = buildProps({
  20349. header: {
  20350. type: String,
  20351. default: ""
  20352. },
  20353. footer: {
  20354. type: String,
  20355. default: ""
  20356. },
  20357. bodyStyle: {
  20358. type: definePropType([String, Object, Array]),
  20359. default: ""
  20360. },
  20361. headerClass: String,
  20362. bodyClass: String,
  20363. footerClass: String,
  20364. shadow: {
  20365. type: String,
  20366. values: ["always", "hover", "never"],
  20367. default: "always"
  20368. }
  20369. });
  20370. const __default__$1u = vue.defineComponent({
  20371. name: "ElCard"
  20372. });
  20373. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  20374. ...__default__$1u,
  20375. props: cardProps,
  20376. setup(__props) {
  20377. const ns = useNamespace("card");
  20378. return (_ctx, _cache) => {
  20379. return vue.openBlock(), vue.createElementBlock("div", {
  20380. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)])
  20381. }, [
  20382. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  20383. key: 0,
  20384. class: vue.normalizeClass([vue.unref(ns).e("header"), _ctx.headerClass])
  20385. }, [
  20386. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  20387. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  20388. ])
  20389. ], 2)) : vue.createCommentVNode("v-if", true),
  20390. vue.createElementVNode("div", {
  20391. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass]),
  20392. style: vue.normalizeStyle(_ctx.bodyStyle)
  20393. }, [
  20394. vue.renderSlot(_ctx.$slots, "default")
  20395. ], 6),
  20396. _ctx.$slots.footer || _ctx.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  20397. key: 1,
  20398. class: vue.normalizeClass([vue.unref(ns).e("footer"), _ctx.footerClass])
  20399. }, [
  20400. vue.renderSlot(_ctx.$slots, "footer", {}, () => [
  20401. vue.createTextVNode(vue.toDisplayString(_ctx.footer), 1)
  20402. ])
  20403. ], 2)) : vue.createCommentVNode("v-if", true)
  20404. ], 2);
  20405. };
  20406. }
  20407. });
  20408. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "card.vue"]]);
  20409. const ElCard = withInstall(Card);
  20410. const carouselProps = buildProps({
  20411. initialIndex: {
  20412. type: Number,
  20413. default: 0
  20414. },
  20415. height: {
  20416. type: String,
  20417. default: ""
  20418. },
  20419. trigger: {
  20420. type: String,
  20421. values: ["hover", "click"],
  20422. default: "hover"
  20423. },
  20424. autoplay: {
  20425. type: Boolean,
  20426. default: true
  20427. },
  20428. interval: {
  20429. type: Number,
  20430. default: 3e3
  20431. },
  20432. indicatorPosition: {
  20433. type: String,
  20434. values: ["", "none", "outside"],
  20435. default: ""
  20436. },
  20437. arrow: {
  20438. type: String,
  20439. values: ["always", "hover", "never"],
  20440. default: "hover"
  20441. },
  20442. type: {
  20443. type: String,
  20444. values: ["", "card"],
  20445. default: ""
  20446. },
  20447. cardScale: {
  20448. type: Number,
  20449. default: 0.83
  20450. },
  20451. loop: {
  20452. type: Boolean,
  20453. default: true
  20454. },
  20455. direction: {
  20456. type: String,
  20457. values: ["horizontal", "vertical"],
  20458. default: "horizontal"
  20459. },
  20460. pauseOnHover: {
  20461. type: Boolean,
  20462. default: true
  20463. },
  20464. motionBlur: Boolean
  20465. });
  20466. const carouselEmits = {
  20467. change: (current, prev) => [current, prev].every(isNumber)
  20468. };
  20469. const carouselContextKey = Symbol("carouselContextKey");
  20470. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  20471. const THROTTLE_TIME = 300;
  20472. const useCarousel = (props, emit, componentName) => {
  20473. const {
  20474. children: items,
  20475. addChild: addItem,
  20476. removeChild: removeItem
  20477. } = useOrderedChildren(vue.getCurrentInstance(), CAROUSEL_ITEM_NAME);
  20478. const slots = vue.useSlots();
  20479. const activeIndex = vue.ref(-1);
  20480. const timer = vue.ref(null);
  20481. const hover = vue.ref(false);
  20482. const root = vue.ref();
  20483. const containerHeight = vue.ref(0);
  20484. const isItemsTwoLength = vue.ref(true);
  20485. const isFirstCall = vue.ref(true);
  20486. const isTransitioning = vue.ref(false);
  20487. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  20488. const hasLabel = vue.computed(() => {
  20489. return items.value.some((item) => item.props.label.toString().length > 0);
  20490. });
  20491. const isCardType = vue.computed(() => props.type === "card");
  20492. const isVertical = vue.computed(() => props.direction === "vertical");
  20493. const containerStyle = vue.computed(() => {
  20494. if (props.height !== "auto") {
  20495. return {
  20496. height: props.height
  20497. };
  20498. }
  20499. return {
  20500. height: `${containerHeight.value}px`,
  20501. overflow: "hidden"
  20502. };
  20503. });
  20504. const throttledArrowClick = throttle((index) => {
  20505. setActiveItem(index);
  20506. }, THROTTLE_TIME, { trailing: true });
  20507. const throttledIndicatorHover = throttle((index) => {
  20508. handleIndicatorHover(index);
  20509. }, THROTTLE_TIME);
  20510. const isTwoLengthShow = (index) => {
  20511. if (!isItemsTwoLength.value)
  20512. return true;
  20513. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  20514. };
  20515. function pauseTimer() {
  20516. if (timer.value) {
  20517. clearInterval(timer.value);
  20518. timer.value = null;
  20519. }
  20520. }
  20521. function startTimer() {
  20522. if (props.interval <= 0 || !props.autoplay || timer.value)
  20523. return;
  20524. timer.value = setInterval(() => playSlides(), props.interval);
  20525. }
  20526. const playSlides = () => {
  20527. if (!isFirstCall.value) {
  20528. isTransitioning.value = true;
  20529. }
  20530. isFirstCall.value = false;
  20531. if (activeIndex.value < items.value.length - 1) {
  20532. activeIndex.value = activeIndex.value + 1;
  20533. } else if (props.loop) {
  20534. activeIndex.value = 0;
  20535. } else {
  20536. isTransitioning.value = false;
  20537. }
  20538. };
  20539. function setActiveItem(index) {
  20540. if (!isFirstCall.value) {
  20541. isTransitioning.value = true;
  20542. }
  20543. isFirstCall.value = false;
  20544. if (isString$1(index)) {
  20545. const filteredItems = items.value.filter((item) => item.props.name === index);
  20546. if (filteredItems.length > 0) {
  20547. index = items.value.indexOf(filteredItems[0]);
  20548. }
  20549. }
  20550. index = Number(index);
  20551. if (Number.isNaN(index) || index !== Math.floor(index)) {
  20552. return;
  20553. }
  20554. const itemCount = items.value.length;
  20555. const oldIndex = activeIndex.value;
  20556. if (index < 0) {
  20557. activeIndex.value = props.loop ? itemCount - 1 : 0;
  20558. } else if (index >= itemCount) {
  20559. activeIndex.value = props.loop ? 0 : itemCount - 1;
  20560. } else {
  20561. activeIndex.value = index;
  20562. }
  20563. if (oldIndex === activeIndex.value) {
  20564. resetItemPosition(oldIndex);
  20565. }
  20566. resetTimer();
  20567. }
  20568. function resetItemPosition(oldIndex) {
  20569. items.value.forEach((item, index) => {
  20570. item.translateItem(index, activeIndex.value, oldIndex);
  20571. });
  20572. }
  20573. function itemInStage(item, index) {
  20574. var _a, _b, _c, _d;
  20575. const _items = vue.unref(items);
  20576. const itemCount = _items.length;
  20577. if (itemCount === 0 || !item.states.inStage)
  20578. return false;
  20579. const nextItemIndex = index + 1;
  20580. const prevItemIndex = index - 1;
  20581. const lastItemIndex = itemCount - 1;
  20582. const isLastItemActive = _items[lastItemIndex].states.active;
  20583. const isFirstItemActive = _items[0].states.active;
  20584. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  20585. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  20586. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  20587. return "left";
  20588. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  20589. return "right";
  20590. }
  20591. return false;
  20592. }
  20593. function handleMouseEnter() {
  20594. hover.value = true;
  20595. if (props.pauseOnHover) {
  20596. pauseTimer();
  20597. }
  20598. }
  20599. function handleMouseLeave() {
  20600. hover.value = false;
  20601. startTimer();
  20602. }
  20603. function handleTransitionEnd() {
  20604. isTransitioning.value = false;
  20605. }
  20606. function handleButtonEnter(arrow) {
  20607. if (vue.unref(isVertical))
  20608. return;
  20609. items.value.forEach((item, index) => {
  20610. if (arrow === itemInStage(item, index)) {
  20611. item.states.hover = true;
  20612. }
  20613. });
  20614. }
  20615. function handleButtonLeave() {
  20616. if (vue.unref(isVertical))
  20617. return;
  20618. items.value.forEach((item) => {
  20619. item.states.hover = false;
  20620. });
  20621. }
  20622. function handleIndicatorClick(index) {
  20623. if (index !== activeIndex.value) {
  20624. if (!isFirstCall.value) {
  20625. isTransitioning.value = true;
  20626. }
  20627. }
  20628. activeIndex.value = index;
  20629. }
  20630. function handleIndicatorHover(index) {
  20631. if (props.trigger === "hover" && index !== activeIndex.value) {
  20632. activeIndex.value = index;
  20633. if (!isFirstCall.value) {
  20634. isTransitioning.value = true;
  20635. }
  20636. }
  20637. }
  20638. function prev() {
  20639. setActiveItem(activeIndex.value - 1);
  20640. }
  20641. function next() {
  20642. setActiveItem(activeIndex.value + 1);
  20643. }
  20644. function resetTimer() {
  20645. pauseTimer();
  20646. if (!props.pauseOnHover)
  20647. startTimer();
  20648. }
  20649. function setContainerHeight(height) {
  20650. if (props.height !== "auto")
  20651. return;
  20652. containerHeight.value = height;
  20653. }
  20654. function PlaceholderItem() {
  20655. var _a;
  20656. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  20657. if (!defaultSlots)
  20658. return null;
  20659. const flatSlots = flattedChildren(defaultSlots);
  20660. const normalizeSlots = flatSlots.filter((slot) => {
  20661. return vue.isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  20662. });
  20663. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  20664. isItemsTwoLength.value = true;
  20665. return normalizeSlots;
  20666. }
  20667. isItemsTwoLength.value = false;
  20668. return null;
  20669. }
  20670. vue.watch(() => activeIndex.value, (current, prev2) => {
  20671. resetItemPosition(prev2);
  20672. if (isItemsTwoLength.value) {
  20673. current = current % 2;
  20674. prev2 = prev2 % 2;
  20675. }
  20676. if (prev2 > -1) {
  20677. emit(CHANGE_EVENT, current, prev2);
  20678. }
  20679. });
  20680. vue.watch(() => props.autoplay, (autoplay) => {
  20681. autoplay ? startTimer() : pauseTimer();
  20682. });
  20683. vue.watch(() => props.loop, () => {
  20684. setActiveItem(activeIndex.value);
  20685. });
  20686. vue.watch(() => props.interval, () => {
  20687. resetTimer();
  20688. });
  20689. const resizeObserver = vue.shallowRef();
  20690. vue.onMounted(() => {
  20691. vue.watch(() => items.value, () => {
  20692. if (items.value.length > 0)
  20693. setActiveItem(props.initialIndex);
  20694. }, {
  20695. immediate: true
  20696. });
  20697. resizeObserver.value = useResizeObserver(root.value, () => {
  20698. resetItemPosition();
  20699. });
  20700. startTimer();
  20701. });
  20702. vue.onBeforeUnmount(() => {
  20703. pauseTimer();
  20704. if (root.value && resizeObserver.value)
  20705. resizeObserver.value.stop();
  20706. });
  20707. vue.provide(carouselContextKey, {
  20708. root,
  20709. isCardType,
  20710. isVertical,
  20711. items,
  20712. loop: props.loop,
  20713. cardScale: props.cardScale,
  20714. addItem,
  20715. removeItem,
  20716. setActiveItem,
  20717. setContainerHeight
  20718. });
  20719. return {
  20720. root,
  20721. activeIndex,
  20722. arrowDisplay,
  20723. hasLabel,
  20724. hover,
  20725. isCardType,
  20726. isTransitioning,
  20727. items,
  20728. isVertical,
  20729. containerStyle,
  20730. isItemsTwoLength,
  20731. handleButtonEnter,
  20732. handleTransitionEnd,
  20733. handleButtonLeave,
  20734. handleIndicatorClick,
  20735. handleMouseEnter,
  20736. handleMouseLeave,
  20737. setActiveItem,
  20738. prev,
  20739. next,
  20740. PlaceholderItem,
  20741. isTwoLengthShow,
  20742. throttledArrowClick,
  20743. throttledIndicatorHover
  20744. };
  20745. };
  20746. const COMPONENT_NAME$g = "ElCarousel";
  20747. const __default__$1t = vue.defineComponent({
  20748. name: COMPONENT_NAME$g
  20749. });
  20750. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  20751. ...__default__$1t,
  20752. props: carouselProps,
  20753. emits: carouselEmits,
  20754. setup(__props, { expose, emit }) {
  20755. const props = __props;
  20756. const {
  20757. root,
  20758. activeIndex,
  20759. arrowDisplay,
  20760. hasLabel,
  20761. hover,
  20762. isCardType,
  20763. items,
  20764. isVertical,
  20765. containerStyle,
  20766. handleButtonEnter,
  20767. handleButtonLeave,
  20768. isTransitioning,
  20769. handleIndicatorClick,
  20770. handleMouseEnter,
  20771. handleMouseLeave,
  20772. handleTransitionEnd,
  20773. setActiveItem,
  20774. prev,
  20775. next,
  20776. PlaceholderItem,
  20777. isTwoLengthShow,
  20778. throttledArrowClick,
  20779. throttledIndicatorHover
  20780. } = useCarousel(props, emit);
  20781. const ns = useNamespace("carousel");
  20782. const { t } = useLocale();
  20783. const carouselClasses = vue.computed(() => {
  20784. const classes = [ns.b(), ns.m(props.direction)];
  20785. if (vue.unref(isCardType)) {
  20786. classes.push(ns.m("card"));
  20787. }
  20788. return classes;
  20789. });
  20790. const carouselContainer = vue.computed(() => {
  20791. const classes = [ns.e("container")];
  20792. if (props.motionBlur && vue.unref(isTransitioning) && items.value.length > 1) {
  20793. classes.push(vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);
  20794. }
  20795. return classes;
  20796. });
  20797. const indicatorsClasses = vue.computed(() => {
  20798. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  20799. if (vue.unref(hasLabel)) {
  20800. classes.push(ns.em("indicators", "labels"));
  20801. }
  20802. if (props.indicatorPosition === "outside") {
  20803. classes.push(ns.em("indicators", "outside"));
  20804. }
  20805. if (vue.unref(isVertical)) {
  20806. classes.push(ns.em("indicators", "right"));
  20807. }
  20808. return classes;
  20809. });
  20810. expose({
  20811. activeIndex,
  20812. setActiveItem,
  20813. prev,
  20814. next
  20815. });
  20816. return (_ctx, _cache) => {
  20817. return vue.openBlock(), vue.createElementBlock("div", {
  20818. ref_key: "root",
  20819. ref: root,
  20820. class: vue.normalizeClass(vue.unref(carouselClasses)),
  20821. onMouseenter: vue.withModifiers(vue.unref(handleMouseEnter), ["stop"]),
  20822. onMouseleave: vue.withModifiers(vue.unref(handleMouseLeave), ["stop"])
  20823. }, [
  20824. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20825. key: 0,
  20826. name: "carousel-arrow-left",
  20827. persisted: ""
  20828. }, {
  20829. default: vue.withCtx(() => [
  20830. vue.withDirectives(vue.createElementVNode("button", {
  20831. type: "button",
  20832. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  20833. "aria-label": vue.unref(t)("el.carousel.leftArrow"),
  20834. onMouseenter: ($event) => vue.unref(handleButtonEnter)("left"),
  20835. onMouseleave: vue.unref(handleButtonLeave),
  20836. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"])
  20837. }, [
  20838. vue.createVNode(vue.unref(ElIcon), null, {
  20839. default: vue.withCtx(() => [
  20840. vue.createVNode(vue.unref(arrow_left_default))
  20841. ]),
  20842. _: 1
  20843. })
  20844. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20845. [
  20846. vue.vShow,
  20847. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
  20848. ]
  20849. ])
  20850. ]),
  20851. _: 1
  20852. })) : vue.createCommentVNode("v-if", true),
  20853. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20854. key: 1,
  20855. name: "carousel-arrow-right",
  20856. persisted: ""
  20857. }, {
  20858. default: vue.withCtx(() => [
  20859. vue.withDirectives(vue.createElementVNode("button", {
  20860. type: "button",
  20861. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  20862. "aria-label": vue.unref(t)("el.carousel.rightArrow"),
  20863. onMouseenter: ($event) => vue.unref(handleButtonEnter)("right"),
  20864. onMouseleave: vue.unref(handleButtonLeave),
  20865. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"])
  20866. }, [
  20867. vue.createVNode(vue.unref(ElIcon), null, {
  20868. default: vue.withCtx(() => [
  20869. vue.createVNode(vue.unref(arrow_right_default))
  20870. ]),
  20871. _: 1
  20872. })
  20873. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20874. [
  20875. vue.vShow,
  20876. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  20877. ]
  20878. ])
  20879. ]),
  20880. _: 1
  20881. })) : vue.createCommentVNode("v-if", true),
  20882. vue.createElementVNode("div", {
  20883. class: vue.normalizeClass(vue.unref(carouselContainer)),
  20884. style: vue.normalizeStyle(vue.unref(containerStyle)),
  20885. onTransitionend: vue.unref(handleTransitionEnd)
  20886. }, [
  20887. vue.createVNode(vue.unref(PlaceholderItem)),
  20888. vue.renderSlot(_ctx.$slots, "default")
  20889. ], 46, ["onTransitionend"]),
  20890. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  20891. key: 2,
  20892. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  20893. }, [
  20894. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  20895. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  20896. key: index,
  20897. class: vue.normalizeClass([
  20898. vue.unref(ns).e("indicator"),
  20899. vue.unref(ns).em("indicator", _ctx.direction),
  20900. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  20901. ]),
  20902. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  20903. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  20904. }, [
  20905. vue.createElementVNode("button", {
  20906. class: vue.normalizeClass(vue.unref(ns).e("button")),
  20907. "aria-label": vue.unref(t)("el.carousel.indicator", { index: index + 1 })
  20908. }, [
  20909. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  20910. ], 10, ["aria-label"])
  20911. ], 42, ["onMouseenter", "onClick"])), [
  20912. [vue.vShow, vue.unref(isTwoLengthShow)(index)]
  20913. ]);
  20914. }), 128))
  20915. ], 2)) : vue.createCommentVNode("v-if", true),
  20916. props.motionBlur ? (vue.openBlock(), vue.createElementBlock("svg", {
  20917. key: 3,
  20918. xmlns: "http://www.w3.org/2000/svg",
  20919. version: "1.1",
  20920. style: { "display": "none" }
  20921. }, [
  20922. vue.createElementVNode("defs", null, [
  20923. vue.createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  20924. vue.createElementVNode("feGaussianBlur", {
  20925. in: "SourceGraphic",
  20926. stdDeviation: "12,0"
  20927. })
  20928. ]),
  20929. vue.createElementVNode("filter", { id: "elCarouselVertical" }, [
  20930. vue.createElementVNode("feGaussianBlur", {
  20931. in: "SourceGraphic",
  20932. stdDeviation: "0,10"
  20933. })
  20934. ])
  20935. ])
  20936. ])) : vue.createCommentVNode("v-if", true)
  20937. ], 42, ["onMouseenter", "onMouseleave"]);
  20938. };
  20939. }
  20940. });
  20941. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "carousel.vue"]]);
  20942. const carouselItemProps = buildProps({
  20943. name: { type: String, default: "" },
  20944. label: {
  20945. type: [String, Number],
  20946. default: ""
  20947. }
  20948. });
  20949. const useCarouselItem = (props) => {
  20950. const carouselContext = vue.inject(carouselContextKey);
  20951. const instance = vue.getCurrentInstance();
  20952. const carouselItemRef = vue.ref();
  20953. const hover = vue.ref(false);
  20954. const translate = vue.ref(0);
  20955. const scale = vue.ref(1);
  20956. const active = vue.ref(false);
  20957. const ready = vue.ref(false);
  20958. const inStage = vue.ref(false);
  20959. const animating = vue.ref(false);
  20960. const { isCardType, isVertical, cardScale } = carouselContext;
  20961. function processIndex(index, activeIndex, length) {
  20962. const lastItemIndex = length - 1;
  20963. const prevItemIndex = activeIndex - 1;
  20964. const nextItemIndex = activeIndex + 1;
  20965. const halfItemIndex = length / 2;
  20966. if (activeIndex === 0 && index === lastItemIndex) {
  20967. return -1;
  20968. } else if (activeIndex === lastItemIndex && index === 0) {
  20969. return length;
  20970. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  20971. return length + 1;
  20972. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  20973. return -2;
  20974. }
  20975. return index;
  20976. }
  20977. function calcCardTranslate(index, activeIndex) {
  20978. var _a, _b;
  20979. const parentWidth = vue.unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
  20980. if (inStage.value) {
  20981. return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  20982. } else if (index < activeIndex) {
  20983. return -(1 + cardScale) * parentWidth / 4;
  20984. } else {
  20985. return (3 + cardScale) * parentWidth / 4;
  20986. }
  20987. }
  20988. function calcTranslate(index, activeIndex, isVertical2) {
  20989. const rootEl = carouselContext.root.value;
  20990. if (!rootEl)
  20991. return 0;
  20992. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  20993. return distance * (index - activeIndex);
  20994. }
  20995. const translateItem = (index, activeIndex, oldIndex) => {
  20996. var _a;
  20997. const _isCardType = vue.unref(isCardType);
  20998. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  20999. const isActive = index === activeIndex;
  21000. if (!_isCardType && !isUndefined(oldIndex)) {
  21001. animating.value = isActive || index === oldIndex;
  21002. }
  21003. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  21004. index = processIndex(index, activeIndex, carouselItemLength);
  21005. }
  21006. const _isVertical = vue.unref(isVertical);
  21007. active.value = isActive;
  21008. if (_isCardType) {
  21009. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  21010. translate.value = calcCardTranslate(index, activeIndex);
  21011. scale.value = vue.unref(active) ? 1 : cardScale;
  21012. } else {
  21013. translate.value = calcTranslate(index, activeIndex, _isVertical);
  21014. }
  21015. ready.value = true;
  21016. if (isActive && carouselItemRef.value) {
  21017. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  21018. }
  21019. };
  21020. function handleItemClick() {
  21021. if (carouselContext && vue.unref(isCardType)) {
  21022. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  21023. carouselContext.setActiveItem(index);
  21024. }
  21025. }
  21026. vue.onMounted(() => {
  21027. carouselContext.addItem({
  21028. props,
  21029. states: vue.reactive({
  21030. hover,
  21031. translate,
  21032. scale,
  21033. active,
  21034. ready,
  21035. inStage,
  21036. animating
  21037. }),
  21038. uid: instance.uid,
  21039. translateItem
  21040. });
  21041. });
  21042. vue.onUnmounted(() => {
  21043. carouselContext.removeItem(instance.uid);
  21044. });
  21045. return {
  21046. carouselItemRef,
  21047. active,
  21048. animating,
  21049. hover,
  21050. inStage,
  21051. isVertical,
  21052. translate,
  21053. isCardType,
  21054. scale,
  21055. ready,
  21056. handleItemClick
  21057. };
  21058. };
  21059. const __default__$1s = vue.defineComponent({
  21060. name: CAROUSEL_ITEM_NAME
  21061. });
  21062. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  21063. ...__default__$1s,
  21064. props: carouselItemProps,
  21065. setup(__props) {
  21066. const props = __props;
  21067. const ns = useNamespace("carousel");
  21068. const {
  21069. carouselItemRef,
  21070. active,
  21071. animating,
  21072. hover,
  21073. inStage,
  21074. isVertical,
  21075. translate,
  21076. isCardType,
  21077. scale,
  21078. ready,
  21079. handleItemClick
  21080. } = useCarouselItem(props);
  21081. const itemKls = vue.computed(() => [
  21082. ns.e("item"),
  21083. ns.is("active", active.value),
  21084. ns.is("in-stage", inStage.value),
  21085. ns.is("hover", hover.value),
  21086. ns.is("animating", animating.value),
  21087. {
  21088. [ns.em("item", "card")]: isCardType.value,
  21089. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  21090. }
  21091. ]);
  21092. const itemStyle = vue.computed(() => {
  21093. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  21094. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  21095. const _scale = `scale(${vue.unref(scale)})`;
  21096. const transform = [_translate, _scale].join(" ");
  21097. return {
  21098. transform
  21099. };
  21100. });
  21101. return (_ctx, _cache) => {
  21102. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  21103. ref_key: "carouselItemRef",
  21104. ref: carouselItemRef,
  21105. class: vue.normalizeClass(vue.unref(itemKls)),
  21106. style: vue.normalizeStyle(vue.unref(itemStyle)),
  21107. onClick: vue.unref(handleItemClick)
  21108. }, [
  21109. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  21110. key: 0,
  21111. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  21112. }, null, 2)), [
  21113. [vue.vShow, !vue.unref(active)]
  21114. ]) : vue.createCommentVNode("v-if", true),
  21115. vue.renderSlot(_ctx.$slots, "default")
  21116. ], 14, ["onClick"])), [
  21117. [vue.vShow, vue.unref(ready)]
  21118. ]);
  21119. };
  21120. }
  21121. });
  21122. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "carousel-item.vue"]]);
  21123. const ElCarousel = withInstall(Carousel, {
  21124. CarouselItem
  21125. });
  21126. const ElCarouselItem = withNoopInstall(CarouselItem);
  21127. const checkboxProps = {
  21128. modelValue: {
  21129. type: [Number, String, Boolean],
  21130. default: void 0
  21131. },
  21132. label: {
  21133. type: [String, Boolean, Number, Object],
  21134. default: void 0
  21135. },
  21136. value: {
  21137. type: [String, Boolean, Number, Object],
  21138. default: void 0
  21139. },
  21140. indeterminate: Boolean,
  21141. disabled: Boolean,
  21142. checked: Boolean,
  21143. name: {
  21144. type: String,
  21145. default: void 0
  21146. },
  21147. trueValue: {
  21148. type: [String, Number],
  21149. default: void 0
  21150. },
  21151. falseValue: {
  21152. type: [String, Number],
  21153. default: void 0
  21154. },
  21155. trueLabel: {
  21156. type: [String, Number],
  21157. default: void 0
  21158. },
  21159. falseLabel: {
  21160. type: [String, Number],
  21161. default: void 0
  21162. },
  21163. id: {
  21164. type: String,
  21165. default: void 0
  21166. },
  21167. border: Boolean,
  21168. size: useSizeProp,
  21169. tabindex: [String, Number],
  21170. validateEvent: {
  21171. type: Boolean,
  21172. default: true
  21173. },
  21174. ...useAriaProps(["ariaControls"])
  21175. };
  21176. const checkboxEmits = {
  21177. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21178. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21179. };
  21180. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  21181. const useCheckboxDisabled = ({
  21182. model,
  21183. isChecked
  21184. }) => {
  21185. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21186. const isLimitDisabled = vue.computed(() => {
  21187. var _a, _b;
  21188. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  21189. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  21190. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  21191. });
  21192. const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  21193. return {
  21194. isDisabled,
  21195. isLimitDisabled
  21196. };
  21197. };
  21198. const useCheckboxEvent = (props, {
  21199. model,
  21200. isLimitExceeded,
  21201. hasOwnLabel,
  21202. isDisabled,
  21203. isLabeledByFormItem
  21204. }) => {
  21205. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21206. const { formItem } = useFormItem();
  21207. const { emit } = vue.getCurrentInstance();
  21208. function getLabeledValue(value) {
  21209. var _a, _b, _c, _d;
  21210. return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
  21211. }
  21212. function emitChangeEvent(checked, e) {
  21213. emit(CHANGE_EVENT, getLabeledValue(checked), e);
  21214. }
  21215. function handleChange(e) {
  21216. if (isLimitExceeded.value)
  21217. return;
  21218. const target = e.target;
  21219. emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
  21220. }
  21221. async function onClickRoot(e) {
  21222. if (isLimitExceeded.value)
  21223. return;
  21224. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  21225. const eventTargets = e.composedPath();
  21226. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  21227. if (!hasLabel) {
  21228. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  21229. await vue.nextTick();
  21230. emitChangeEvent(model.value, e);
  21231. }
  21232. }
  21233. }
  21234. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  21235. vue.watch(() => props.modelValue, () => {
  21236. if (validateEvent.value) {
  21237. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21238. }
  21239. });
  21240. return {
  21241. handleChange,
  21242. onClickRoot
  21243. };
  21244. };
  21245. const useCheckboxModel = (props) => {
  21246. const selfModel = vue.ref(false);
  21247. const { emit } = vue.getCurrentInstance();
  21248. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21249. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  21250. const isLimitExceeded = vue.ref(false);
  21251. const model = vue.computed({
  21252. get() {
  21253. var _a, _b;
  21254. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  21255. },
  21256. set(val) {
  21257. var _a, _b;
  21258. if (isGroup.value && isArray$1(val)) {
  21259. isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
  21260. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  21261. } else {
  21262. emit(UPDATE_MODEL_EVENT, val);
  21263. selfModel.value = val;
  21264. }
  21265. }
  21266. });
  21267. return {
  21268. model,
  21269. isGroup,
  21270. isLimitExceeded
  21271. };
  21272. };
  21273. const useCheckboxStatus = (props, slots, { model }) => {
  21274. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21275. const isFocused = vue.ref(false);
  21276. const actualValue = vue.computed(() => {
  21277. if (!isPropAbsent(props.value)) {
  21278. return props.value;
  21279. }
  21280. return props.label;
  21281. });
  21282. const isChecked = vue.computed(() => {
  21283. const value = model.value;
  21284. if (isBoolean(value)) {
  21285. return value;
  21286. } else if (isArray$1(value)) {
  21287. if (isObject$1(actualValue.value)) {
  21288. return value.map(vue.toRaw).some((o) => isEqual$1(o, actualValue.value));
  21289. } else {
  21290. return value.map(vue.toRaw).includes(actualValue.value);
  21291. }
  21292. } else if (value !== null && value !== void 0) {
  21293. return value === props.trueValue || value === props.trueLabel;
  21294. } else {
  21295. return !!value;
  21296. }
  21297. });
  21298. const checkboxButtonSize = useFormSize(vue.computed(() => {
  21299. var _a;
  21300. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21301. }), {
  21302. prop: true
  21303. });
  21304. const checkboxSize = useFormSize(vue.computed(() => {
  21305. var _a;
  21306. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21307. }));
  21308. const hasOwnLabel = vue.computed(() => {
  21309. return !!slots.default || !isPropAbsent(actualValue.value);
  21310. });
  21311. return {
  21312. checkboxButtonSize,
  21313. isChecked,
  21314. isFocused,
  21315. checkboxSize,
  21316. hasOwnLabel,
  21317. actualValue
  21318. };
  21319. };
  21320. const useCheckbox = (props, slots) => {
  21321. const { formItem: elFormItem } = useFormItem();
  21322. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  21323. const {
  21324. isFocused,
  21325. isChecked,
  21326. checkboxButtonSize,
  21327. checkboxSize,
  21328. hasOwnLabel,
  21329. actualValue
  21330. } = useCheckboxStatus(props, slots, { model });
  21331. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  21332. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  21333. formItemContext: elFormItem,
  21334. disableIdGeneration: hasOwnLabel,
  21335. disableIdManagement: isGroup
  21336. });
  21337. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  21338. model,
  21339. isLimitExceeded,
  21340. hasOwnLabel,
  21341. isDisabled,
  21342. isLabeledByFormItem
  21343. });
  21344. const setStoreValue = () => {
  21345. function addToStore() {
  21346. var _a, _b;
  21347. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  21348. model.value.push(actualValue.value);
  21349. } else {
  21350. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  21351. }
  21352. }
  21353. props.checked && addToStore();
  21354. };
  21355. setStoreValue();
  21356. useDeprecated({
  21357. from: "label act as value",
  21358. replacement: "value",
  21359. version: "3.0.0",
  21360. scope: "el-checkbox",
  21361. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21362. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21363. useDeprecated({
  21364. from: "true-label",
  21365. replacement: "true-value",
  21366. version: "3.0.0",
  21367. scope: "el-checkbox",
  21368. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21369. }, vue.computed(() => !!props.trueLabel));
  21370. useDeprecated({
  21371. from: "false-label",
  21372. replacement: "false-value",
  21373. version: "3.0.0",
  21374. scope: "el-checkbox",
  21375. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21376. }, vue.computed(() => !!props.falseLabel));
  21377. return {
  21378. inputId,
  21379. isLabeledByFormItem,
  21380. isChecked,
  21381. isDisabled,
  21382. isFocused,
  21383. checkboxButtonSize,
  21384. checkboxSize,
  21385. hasOwnLabel,
  21386. model,
  21387. actualValue,
  21388. handleChange,
  21389. onClickRoot
  21390. };
  21391. };
  21392. const __default__$1r = vue.defineComponent({
  21393. name: "ElCheckbox"
  21394. });
  21395. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  21396. ...__default__$1r,
  21397. props: checkboxProps,
  21398. emits: checkboxEmits,
  21399. setup(__props) {
  21400. const props = __props;
  21401. const slots = vue.useSlots();
  21402. const {
  21403. inputId,
  21404. isLabeledByFormItem,
  21405. isChecked,
  21406. isDisabled,
  21407. isFocused,
  21408. checkboxSize,
  21409. hasOwnLabel,
  21410. model,
  21411. actualValue,
  21412. handleChange,
  21413. onClickRoot
  21414. } = useCheckbox(props, slots);
  21415. const ns = useNamespace("checkbox");
  21416. const compKls = vue.computed(() => {
  21417. return [
  21418. ns.b(),
  21419. ns.m(checkboxSize.value),
  21420. ns.is("disabled", isDisabled.value),
  21421. ns.is("bordered", props.border),
  21422. ns.is("checked", isChecked.value)
  21423. ];
  21424. });
  21425. const spanKls = vue.computed(() => {
  21426. return [
  21427. ns.e("input"),
  21428. ns.is("disabled", isDisabled.value),
  21429. ns.is("checked", isChecked.value),
  21430. ns.is("indeterminate", props.indeterminate),
  21431. ns.is("focus", isFocused.value)
  21432. ];
  21433. });
  21434. return (_ctx, _cache) => {
  21435. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  21436. class: vue.normalizeClass(vue.unref(compKls)),
  21437. "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
  21438. onClick: vue.unref(onClickRoot)
  21439. }, {
  21440. default: vue.withCtx(() => {
  21441. var _a, _b, _c, _d;
  21442. return [
  21443. vue.createElementVNode("span", {
  21444. class: vue.normalizeClass(vue.unref(spanKls))
  21445. }, [
  21446. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21447. key: 0,
  21448. id: vue.unref(inputId),
  21449. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21450. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21451. type: "checkbox",
  21452. indeterminate: _ctx.indeterminate,
  21453. name: _ctx.name,
  21454. tabindex: _ctx.tabindex,
  21455. disabled: vue.unref(isDisabled),
  21456. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21457. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21458. onChange: vue.unref(handleChange),
  21459. onFocus: ($event) => isFocused.value = true,
  21460. onBlur: ($event) => isFocused.value = false,
  21461. onClick: vue.withModifiers(() => {
  21462. }, ["stop"])
  21463. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21464. [vue.vModelCheckbox, vue.unref(model)]
  21465. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21466. key: 1,
  21467. id: vue.unref(inputId),
  21468. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21469. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21470. type: "checkbox",
  21471. indeterminate: _ctx.indeterminate,
  21472. disabled: vue.unref(isDisabled),
  21473. value: vue.unref(actualValue),
  21474. name: _ctx.name,
  21475. tabindex: _ctx.tabindex,
  21476. onChange: vue.unref(handleChange),
  21477. onFocus: ($event) => isFocused.value = true,
  21478. onBlur: ($event) => isFocused.value = false,
  21479. onClick: vue.withModifiers(() => {
  21480. }, ["stop"])
  21481. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
  21482. [vue.vModelCheckbox, vue.unref(model)]
  21483. ]),
  21484. vue.createElementVNode("span", {
  21485. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21486. }, null, 2)
  21487. ], 2),
  21488. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  21489. key: 0,
  21490. class: vue.normalizeClass(vue.unref(ns).e("label"))
  21491. }, [
  21492. vue.renderSlot(_ctx.$slots, "default"),
  21493. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  21494. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21495. ], 64)) : vue.createCommentVNode("v-if", true)
  21496. ], 2)) : vue.createCommentVNode("v-if", true)
  21497. ];
  21498. }),
  21499. _: 3
  21500. }, 8, ["class", "aria-controls", "onClick"]);
  21501. };
  21502. }
  21503. });
  21504. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "checkbox.vue"]]);
  21505. const __default__$1q = vue.defineComponent({
  21506. name: "ElCheckboxButton"
  21507. });
  21508. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  21509. ...__default__$1q,
  21510. props: checkboxProps,
  21511. emits: checkboxEmits,
  21512. setup(__props) {
  21513. const props = __props;
  21514. const slots = vue.useSlots();
  21515. const {
  21516. isFocused,
  21517. isChecked,
  21518. isDisabled,
  21519. checkboxButtonSize,
  21520. model,
  21521. actualValue,
  21522. handleChange
  21523. } = useCheckbox(props, slots);
  21524. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21525. const ns = useNamespace("checkbox");
  21526. const activeStyle = vue.computed(() => {
  21527. var _a, _b, _c, _d;
  21528. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  21529. return {
  21530. backgroundColor: fillValue,
  21531. borderColor: fillValue,
  21532. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  21533. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  21534. };
  21535. });
  21536. const labelKls = vue.computed(() => {
  21537. return [
  21538. ns.b("button"),
  21539. ns.bm("button", checkboxButtonSize.value),
  21540. ns.is("disabled", isDisabled.value),
  21541. ns.is("checked", isChecked.value),
  21542. ns.is("focus", isFocused.value)
  21543. ];
  21544. });
  21545. return (_ctx, _cache) => {
  21546. var _a, _b, _c, _d;
  21547. return vue.openBlock(), vue.createElementBlock("label", {
  21548. class: vue.normalizeClass(vue.unref(labelKls))
  21549. }, [
  21550. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21551. key: 0,
  21552. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21553. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21554. type: "checkbox",
  21555. name: _ctx.name,
  21556. tabindex: _ctx.tabindex,
  21557. disabled: vue.unref(isDisabled),
  21558. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21559. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21560. onChange: vue.unref(handleChange),
  21561. onFocus: ($event) => isFocused.value = true,
  21562. onBlur: ($event) => isFocused.value = false,
  21563. onClick: vue.withModifiers(() => {
  21564. }, ["stop"])
  21565. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21566. [vue.vModelCheckbox, vue.unref(model)]
  21567. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21568. key: 1,
  21569. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21570. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21571. type: "checkbox",
  21572. name: _ctx.name,
  21573. tabindex: _ctx.tabindex,
  21574. disabled: vue.unref(isDisabled),
  21575. value: vue.unref(actualValue),
  21576. onChange: vue.unref(handleChange),
  21577. onFocus: ($event) => isFocused.value = true,
  21578. onBlur: ($event) => isFocused.value = false,
  21579. onClick: vue.withModifiers(() => {
  21580. }, ["stop"])
  21581. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21582. [vue.vModelCheckbox, vue.unref(model)]
  21583. ]),
  21584. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  21585. key: 2,
  21586. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21587. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  21588. }, [
  21589. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21590. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21591. ])
  21592. ], 6)) : vue.createCommentVNode("v-if", true)
  21593. ], 2);
  21594. };
  21595. }
  21596. });
  21597. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "checkbox-button.vue"]]);
  21598. const checkboxGroupProps = buildProps({
  21599. modelValue: {
  21600. type: definePropType(Array),
  21601. default: () => []
  21602. },
  21603. disabled: Boolean,
  21604. min: Number,
  21605. max: Number,
  21606. size: useSizeProp,
  21607. fill: String,
  21608. textColor: String,
  21609. tag: {
  21610. type: String,
  21611. default: "div"
  21612. },
  21613. validateEvent: {
  21614. type: Boolean,
  21615. default: true
  21616. },
  21617. ...useAriaProps(["ariaLabel"])
  21618. });
  21619. const checkboxGroupEmits = {
  21620. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  21621. change: (val) => isArray$1(val)
  21622. };
  21623. const __default__$1p = vue.defineComponent({
  21624. name: "ElCheckboxGroup"
  21625. });
  21626. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  21627. ...__default__$1p,
  21628. props: checkboxGroupProps,
  21629. emits: checkboxGroupEmits,
  21630. setup(__props, { emit }) {
  21631. const props = __props;
  21632. const ns = useNamespace("checkbox");
  21633. const { formItem } = useFormItem();
  21634. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21635. formItemContext: formItem
  21636. });
  21637. const changeEvent = async (value) => {
  21638. emit(UPDATE_MODEL_EVENT, value);
  21639. await vue.nextTick();
  21640. emit(CHANGE_EVENT, value);
  21641. };
  21642. const modelValue = vue.computed({
  21643. get() {
  21644. return props.modelValue;
  21645. },
  21646. set(val) {
  21647. changeEvent(val);
  21648. }
  21649. });
  21650. vue.provide(checkboxGroupContextKey, {
  21651. ...pick(vue.toRefs(props), [
  21652. "size",
  21653. "min",
  21654. "max",
  21655. "disabled",
  21656. "validateEvent",
  21657. "fill",
  21658. "textColor"
  21659. ]),
  21660. modelValue,
  21661. changeEvent
  21662. });
  21663. vue.watch(() => props.modelValue, () => {
  21664. if (props.validateEvent) {
  21665. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21666. }
  21667. });
  21668. return (_ctx, _cache) => {
  21669. var _a;
  21670. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  21671. id: vue.unref(groupId),
  21672. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21673. role: "group",
  21674. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
  21675. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  21676. }, {
  21677. default: vue.withCtx(() => [
  21678. vue.renderSlot(_ctx.$slots, "default")
  21679. ]),
  21680. _: 3
  21681. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  21682. };
  21683. }
  21684. });
  21685. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "checkbox-group.vue"]]);
  21686. const ElCheckbox = withInstall(Checkbox, {
  21687. CheckboxButton,
  21688. CheckboxGroup
  21689. });
  21690. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  21691. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  21692. const radioPropsBase = buildProps({
  21693. modelValue: {
  21694. type: [String, Number, Boolean],
  21695. default: void 0
  21696. },
  21697. size: useSizeProp,
  21698. disabled: Boolean,
  21699. label: {
  21700. type: [String, Number, Boolean],
  21701. default: void 0
  21702. },
  21703. value: {
  21704. type: [String, Number, Boolean],
  21705. default: void 0
  21706. },
  21707. name: {
  21708. type: String,
  21709. default: void 0
  21710. }
  21711. });
  21712. const radioProps = buildProps({
  21713. ...radioPropsBase,
  21714. border: Boolean
  21715. });
  21716. const radioEmits = {
  21717. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21718. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21719. };
  21720. const radioGroupKey = Symbol("radioGroupKey");
  21721. const useRadio = (props, emit) => {
  21722. const radioRef = vue.ref();
  21723. const radioGroup = vue.inject(radioGroupKey, void 0);
  21724. const isGroup = vue.computed(() => !!radioGroup);
  21725. const actualValue = vue.computed(() => {
  21726. if (!isPropAbsent(props.value)) {
  21727. return props.value;
  21728. }
  21729. return props.label;
  21730. });
  21731. const modelValue = vue.computed({
  21732. get() {
  21733. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21734. },
  21735. set(val) {
  21736. if (isGroup.value) {
  21737. radioGroup.changeEvent(val);
  21738. } else {
  21739. emit && emit(UPDATE_MODEL_EVENT, val);
  21740. }
  21741. radioRef.value.checked = props.modelValue === actualValue.value;
  21742. }
  21743. });
  21744. const size = useFormSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  21745. const disabled = useFormDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21746. const focus = vue.ref(false);
  21747. const tabIndex = vue.computed(() => {
  21748. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  21749. });
  21750. useDeprecated({
  21751. from: "label act as value",
  21752. replacement: "value",
  21753. version: "3.0.0",
  21754. scope: "el-radio",
  21755. ref: "https://element-plus.org/en-US/component/radio.html"
  21756. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21757. return {
  21758. radioRef,
  21759. isGroup,
  21760. radioGroup,
  21761. focus,
  21762. size,
  21763. disabled,
  21764. tabIndex,
  21765. modelValue,
  21766. actualValue
  21767. };
  21768. };
  21769. const __default__$1o = vue.defineComponent({
  21770. name: "ElRadio"
  21771. });
  21772. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  21773. ...__default__$1o,
  21774. props: radioProps,
  21775. emits: radioEmits,
  21776. setup(__props, { emit }) {
  21777. const props = __props;
  21778. const ns = useNamespace("radio");
  21779. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  21780. function handleChange() {
  21781. vue.nextTick(() => emit(CHANGE_EVENT, modelValue.value));
  21782. }
  21783. return (_ctx, _cache) => {
  21784. var _a;
  21785. return vue.openBlock(), vue.createElementBlock("label", {
  21786. class: vue.normalizeClass([
  21787. vue.unref(ns).b(),
  21788. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21789. vue.unref(ns).is("focus", vue.unref(focus)),
  21790. vue.unref(ns).is("bordered", _ctx.border),
  21791. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue)),
  21792. vue.unref(ns).m(vue.unref(size))
  21793. ])
  21794. }, [
  21795. vue.createElementVNode("span", {
  21796. class: vue.normalizeClass([
  21797. vue.unref(ns).e("input"),
  21798. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21799. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue))
  21800. ])
  21801. }, [
  21802. vue.withDirectives(vue.createElementVNode("input", {
  21803. ref_key: "radioRef",
  21804. ref: radioRef,
  21805. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  21806. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21807. value: vue.unref(actualValue),
  21808. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21809. disabled: vue.unref(disabled),
  21810. checked: vue.unref(modelValue) === vue.unref(actualValue),
  21811. type: "radio",
  21812. onFocus: ($event) => focus.value = true,
  21813. onBlur: ($event) => focus.value = false,
  21814. onChange: handleChange,
  21815. onClick: vue.withModifiers(() => {
  21816. }, ["stop"])
  21817. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  21818. [vue.vModelRadio, vue.unref(modelValue)]
  21819. ]),
  21820. vue.createElementVNode("span", {
  21821. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21822. }, null, 2)
  21823. ], 2),
  21824. vue.createElementVNode("span", {
  21825. class: vue.normalizeClass(vue.unref(ns).e("label")),
  21826. onKeydown: vue.withModifiers(() => {
  21827. }, ["stop"])
  21828. }, [
  21829. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21830. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21831. ])
  21832. ], 42, ["onKeydown"])
  21833. ], 2);
  21834. };
  21835. }
  21836. });
  21837. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "radio.vue"]]);
  21838. const radioButtonProps = buildProps({
  21839. ...radioPropsBase
  21840. });
  21841. const __default__$1n = vue.defineComponent({
  21842. name: "ElRadioButton"
  21843. });
  21844. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  21845. ...__default__$1n,
  21846. props: radioButtonProps,
  21847. setup(__props) {
  21848. const props = __props;
  21849. const ns = useNamespace("radio");
  21850. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  21851. const activeStyle = vue.computed(() => {
  21852. return {
  21853. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21854. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21855. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21856. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  21857. };
  21858. });
  21859. return (_ctx, _cache) => {
  21860. var _a;
  21861. return vue.openBlock(), vue.createElementBlock("label", {
  21862. class: vue.normalizeClass([
  21863. vue.unref(ns).b("button"),
  21864. vue.unref(ns).is("active", vue.unref(modelValue) === vue.unref(actualValue)),
  21865. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21866. vue.unref(ns).is("focus", vue.unref(focus)),
  21867. vue.unref(ns).bm("button", vue.unref(size))
  21868. ])
  21869. }, [
  21870. vue.withDirectives(vue.createElementVNode("input", {
  21871. ref_key: "radioRef",
  21872. ref: radioRef,
  21873. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  21874. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  21875. value: vue.unref(actualValue),
  21876. type: "radio",
  21877. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21878. disabled: vue.unref(disabled),
  21879. onFocus: ($event) => focus.value = true,
  21880. onBlur: ($event) => focus.value = false,
  21881. onClick: vue.withModifiers(() => {
  21882. }, ["stop"])
  21883. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
  21884. [vue.vModelRadio, vue.unref(modelValue)]
  21885. ]),
  21886. vue.createElementVNode("span", {
  21887. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21888. style: vue.normalizeStyle(vue.unref(modelValue) === vue.unref(actualValue) ? vue.unref(activeStyle) : {}),
  21889. onKeydown: vue.withModifiers(() => {
  21890. }, ["stop"])
  21891. }, [
  21892. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21893. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21894. ])
  21895. ], 46, ["onKeydown"])
  21896. ], 2);
  21897. };
  21898. }
  21899. });
  21900. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "radio-button.vue"]]);
  21901. const radioGroupProps = buildProps({
  21902. id: {
  21903. type: String,
  21904. default: void 0
  21905. },
  21906. size: useSizeProp,
  21907. disabled: Boolean,
  21908. modelValue: {
  21909. type: [String, Number, Boolean],
  21910. default: void 0
  21911. },
  21912. fill: {
  21913. type: String,
  21914. default: ""
  21915. },
  21916. textColor: {
  21917. type: String,
  21918. default: ""
  21919. },
  21920. name: {
  21921. type: String,
  21922. default: void 0
  21923. },
  21924. validateEvent: {
  21925. type: Boolean,
  21926. default: true
  21927. },
  21928. ...useAriaProps(["ariaLabel"])
  21929. });
  21930. const radioGroupEmits = radioEmits;
  21931. const __default__$1m = vue.defineComponent({
  21932. name: "ElRadioGroup"
  21933. });
  21934. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  21935. ...__default__$1m,
  21936. props: radioGroupProps,
  21937. emits: radioGroupEmits,
  21938. setup(__props, { emit }) {
  21939. const props = __props;
  21940. const ns = useNamespace("radio");
  21941. const radioId = useId();
  21942. const radioGroupRef = vue.ref();
  21943. const { formItem } = useFormItem();
  21944. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21945. formItemContext: formItem
  21946. });
  21947. const changeEvent = (value) => {
  21948. emit(UPDATE_MODEL_EVENT, value);
  21949. vue.nextTick(() => emit(CHANGE_EVENT, value));
  21950. };
  21951. vue.onMounted(() => {
  21952. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  21953. const firstLabel = radios[0];
  21954. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  21955. firstLabel.tabIndex = 0;
  21956. }
  21957. });
  21958. const name = vue.computed(() => {
  21959. return props.name || radioId.value;
  21960. });
  21961. vue.provide(radioGroupKey, vue.reactive({
  21962. ...vue.toRefs(props),
  21963. changeEvent,
  21964. name
  21965. }));
  21966. vue.watch(() => props.modelValue, () => {
  21967. if (props.validateEvent) {
  21968. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21969. }
  21970. });
  21971. return (_ctx, _cache) => {
  21972. return vue.openBlock(), vue.createElementBlock("div", {
  21973. id: vue.unref(groupId),
  21974. ref_key: "radioGroupRef",
  21975. ref: radioGroupRef,
  21976. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21977. role: "radiogroup",
  21978. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
  21979. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  21980. }, [
  21981. vue.renderSlot(_ctx.$slots, "default")
  21982. ], 10, ["id", "aria-label", "aria-labelledby"]);
  21983. };
  21984. }
  21985. });
  21986. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "radio-group.vue"]]);
  21987. const ElRadio = withInstall(Radio, {
  21988. RadioButton,
  21989. RadioGroup
  21990. });
  21991. const ElRadioGroup = withNoopInstall(RadioGroup);
  21992. const ElRadioButton = withNoopInstall(RadioButton);
  21993. var NodeContent$1 = vue.defineComponent({
  21994. name: "NodeContent",
  21995. setup() {
  21996. const ns = useNamespace("cascader-node");
  21997. return {
  21998. ns
  21999. };
  22000. },
  22001. render() {
  22002. const { ns } = this;
  22003. const { node, panel } = this.$parent;
  22004. const { data, label } = node;
  22005. const { renderLabelFn } = panel;
  22006. return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  22007. }
  22008. });
  22009. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  22010. const _sfc_main$1T = vue.defineComponent({
  22011. name: "ElCascaderNode",
  22012. components: {
  22013. ElCheckbox,
  22014. ElRadio,
  22015. NodeContent: NodeContent$1,
  22016. ElIcon,
  22017. Check: check_default,
  22018. Loading: loading_default,
  22019. ArrowRight: arrow_right_default
  22020. },
  22021. props: {
  22022. node: {
  22023. type: Object,
  22024. required: true
  22025. },
  22026. menuId: String
  22027. },
  22028. emits: ["expand"],
  22029. setup(props, { emit }) {
  22030. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  22031. const ns = useNamespace("cascader-node");
  22032. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  22033. const multiple = vue.computed(() => panel.config.multiple);
  22034. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  22035. const checkedNodeId = vue.computed(() => {
  22036. var _a;
  22037. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  22038. });
  22039. const isDisabled = vue.computed(() => props.node.isDisabled);
  22040. const isLeaf = vue.computed(() => props.node.isLeaf);
  22041. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  22042. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  22043. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  22044. const isInPath = (node) => {
  22045. var _a;
  22046. const { level, uid } = props.node;
  22047. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  22048. };
  22049. const doExpand = () => {
  22050. if (inExpandingPath.value)
  22051. return;
  22052. panel.expandNode(props.node);
  22053. };
  22054. const doCheck = (checked) => {
  22055. const { node } = props;
  22056. if (checked === node.checked)
  22057. return;
  22058. panel.handleCheckChange(node, checked);
  22059. };
  22060. const doLoad = () => {
  22061. panel.lazyLoad(props.node, () => {
  22062. if (!isLeaf.value)
  22063. doExpand();
  22064. });
  22065. };
  22066. const handleHoverExpand = (e) => {
  22067. if (!isHoverMenu.value)
  22068. return;
  22069. handleExpand();
  22070. !isLeaf.value && emit("expand", e);
  22071. };
  22072. const handleExpand = () => {
  22073. const { node } = props;
  22074. if (!expandable.value || node.loading)
  22075. return;
  22076. node.loaded ? doExpand() : doLoad();
  22077. };
  22078. const handleClick = () => {
  22079. if (isHoverMenu.value && !isLeaf.value)
  22080. return;
  22081. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  22082. handleCheck(true);
  22083. } else {
  22084. handleExpand();
  22085. }
  22086. };
  22087. const handleSelectCheck = (checked) => {
  22088. if (checkStrictly.value) {
  22089. doCheck(checked);
  22090. if (props.node.loaded) {
  22091. doExpand();
  22092. }
  22093. } else {
  22094. handleCheck(checked);
  22095. }
  22096. };
  22097. const handleCheck = (checked) => {
  22098. if (!props.node.loaded) {
  22099. doLoad();
  22100. } else {
  22101. doCheck(checked);
  22102. !checkStrictly.value && doExpand();
  22103. }
  22104. };
  22105. return {
  22106. panel,
  22107. isHoverMenu,
  22108. multiple,
  22109. checkStrictly,
  22110. checkedNodeId,
  22111. isDisabled,
  22112. isLeaf,
  22113. expandable,
  22114. inExpandingPath,
  22115. inCheckedPath,
  22116. ns,
  22117. handleHoverExpand,
  22118. handleExpand,
  22119. handleClick,
  22120. handleCheck,
  22121. handleSelectCheck
  22122. };
  22123. }
  22124. });
  22125. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  22126. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  22127. const _component_el_radio = vue.resolveComponent("el-radio");
  22128. const _component_check = vue.resolveComponent("check");
  22129. const _component_el_icon = vue.resolveComponent("el-icon");
  22130. const _component_node_content = vue.resolveComponent("node-content");
  22131. const _component_loading = vue.resolveComponent("loading");
  22132. const _component_arrow_right = vue.resolveComponent("arrow-right");
  22133. return vue.openBlock(), vue.createElementBlock("li", {
  22134. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  22135. role: "menuitem",
  22136. "aria-haspopup": !_ctx.isLeaf,
  22137. "aria-owns": _ctx.isLeaf ? void 0 : _ctx.menuId,
  22138. "aria-expanded": _ctx.inExpandingPath,
  22139. tabindex: _ctx.expandable ? -1 : void 0,
  22140. class: vue.normalizeClass([
  22141. _ctx.ns.b(),
  22142. _ctx.ns.is("selectable", _ctx.checkStrictly),
  22143. _ctx.ns.is("active", _ctx.node.checked),
  22144. _ctx.ns.is("disabled", !_ctx.expandable),
  22145. _ctx.inExpandingPath && "in-active-path",
  22146. _ctx.inCheckedPath && "in-checked-path"
  22147. ]),
  22148. onMouseenter: _ctx.handleHoverExpand,
  22149. onFocus: _ctx.handleHoverExpand,
  22150. onClick: _ctx.handleClick
  22151. }, [
  22152. vue.createCommentVNode(" prefix "),
  22153. _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  22154. key: 0,
  22155. "model-value": _ctx.node.checked,
  22156. indeterminate: _ctx.node.indeterminate,
  22157. disabled: _ctx.isDisabled,
  22158. onClick: vue.withModifiers(() => {
  22159. }, ["stop"]),
  22160. "onUpdate:modelValue": _ctx.handleSelectCheck
  22161. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, {
  22162. key: 1,
  22163. "model-value": _ctx.checkedNodeId,
  22164. label: _ctx.node.uid,
  22165. disabled: _ctx.isDisabled,
  22166. "onUpdate:modelValue": _ctx.handleSelectCheck,
  22167. onClick: vue.withModifiers(() => {
  22168. }, ["stop"])
  22169. }, {
  22170. default: vue.withCtx(() => [
  22171. vue.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 "),
  22172. vue.createElementVNode("span")
  22173. ]),
  22174. _: 1
  22175. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue", "onClick"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  22176. key: 2,
  22177. class: vue.normalizeClass(_ctx.ns.e("prefix"))
  22178. }, {
  22179. default: vue.withCtx(() => [
  22180. vue.createVNode(_component_check)
  22181. ]),
  22182. _: 1
  22183. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  22184. vue.createCommentVNode(" content "),
  22185. vue.createVNode(_component_node_content),
  22186. vue.createCommentVNode(" postfix "),
  22187. !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  22188. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  22189. key: 0,
  22190. class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  22191. }, {
  22192. default: vue.withCtx(() => [
  22193. vue.createVNode(_component_loading)
  22194. ]),
  22195. _: 1
  22196. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  22197. key: 1,
  22198. class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  22199. }, {
  22200. default: vue.withCtx(() => [
  22201. vue.createVNode(_component_arrow_right)
  22202. ]),
  22203. _: 1
  22204. }, 8, ["class"]))
  22205. ], 64)) : vue.createCommentVNode("v-if", true)
  22206. ], 42, ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex", "onMouseenter", "onFocus", "onClick"]);
  22207. }
  22208. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["render", _sfc_render$q], ["__file", "node.vue"]]);
  22209. const _sfc_main$1S = vue.defineComponent({
  22210. name: "ElCascaderMenu",
  22211. components: {
  22212. Loading: loading_default,
  22213. ElIcon,
  22214. ElScrollbar,
  22215. ElCascaderNode
  22216. },
  22217. props: {
  22218. nodes: {
  22219. type: Array,
  22220. required: true
  22221. },
  22222. index: {
  22223. type: Number,
  22224. required: true
  22225. }
  22226. },
  22227. setup(props) {
  22228. const instance = vue.getCurrentInstance();
  22229. const ns = useNamespace("cascader-menu");
  22230. const { t } = useLocale();
  22231. const id = useId();
  22232. let activeNode = null;
  22233. let hoverTimer = null;
  22234. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  22235. const hoverZone = vue.ref(null);
  22236. const isEmpty = vue.computed(() => !props.nodes.length);
  22237. const isLoading = vue.computed(() => !panel.initialLoaded);
  22238. const menuId = vue.computed(() => `${id.value}-${props.index}`);
  22239. const handleExpand = (e) => {
  22240. activeNode = e.target;
  22241. };
  22242. const handleMouseMove = (e) => {
  22243. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  22244. return;
  22245. if (activeNode.contains(e.target)) {
  22246. clearHoverTimer();
  22247. const el = instance.vnode.el;
  22248. const { left } = el.getBoundingClientRect();
  22249. const { offsetWidth, offsetHeight } = el;
  22250. const startX = e.clientX - left;
  22251. const top = activeNode.offsetTop;
  22252. const bottom = top + activeNode.offsetHeight;
  22253. hoverZone.value.innerHTML = `
  22254. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  22255. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  22256. `;
  22257. } else if (!hoverTimer) {
  22258. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  22259. }
  22260. };
  22261. const clearHoverTimer = () => {
  22262. if (!hoverTimer)
  22263. return;
  22264. clearTimeout(hoverTimer);
  22265. hoverTimer = null;
  22266. };
  22267. const clearHoverZone = () => {
  22268. if (!hoverZone.value)
  22269. return;
  22270. hoverZone.value.innerHTML = "";
  22271. clearHoverTimer();
  22272. };
  22273. return {
  22274. ns,
  22275. panel,
  22276. hoverZone,
  22277. isEmpty,
  22278. isLoading,
  22279. menuId,
  22280. t,
  22281. handleExpand,
  22282. handleMouseMove,
  22283. clearHoverZone
  22284. };
  22285. }
  22286. });
  22287. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  22288. const _component_el_cascader_node = vue.resolveComponent("el-cascader-node");
  22289. const _component_loading = vue.resolveComponent("loading");
  22290. const _component_el_icon = vue.resolveComponent("el-icon");
  22291. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  22292. return vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  22293. key: _ctx.menuId,
  22294. tag: "ul",
  22295. role: "menu",
  22296. class: vue.normalizeClass(_ctx.ns.b()),
  22297. "wrap-class": _ctx.ns.e("wrap"),
  22298. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  22299. onMousemove: _ctx.handleMouseMove,
  22300. onMouseleave: _ctx.clearHoverZone
  22301. }, {
  22302. default: vue.withCtx(() => {
  22303. var _a;
  22304. return [
  22305. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => {
  22306. return vue.openBlock(), vue.createBlock(_component_el_cascader_node, {
  22307. key: node.uid,
  22308. node,
  22309. "menu-id": _ctx.menuId,
  22310. onExpand: _ctx.handleExpand
  22311. }, null, 8, ["node", "menu-id", "onExpand"]);
  22312. }), 128)),
  22313. _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", {
  22314. key: 0,
  22315. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22316. }, [
  22317. vue.createVNode(_component_el_icon, {
  22318. size: "14",
  22319. class: vue.normalizeClass(_ctx.ns.is("loading"))
  22320. }, {
  22321. default: vue.withCtx(() => [
  22322. vue.createVNode(_component_loading)
  22323. ]),
  22324. _: 1
  22325. }, 8, ["class"]),
  22326. vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1)
  22327. ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  22328. key: 1,
  22329. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22330. }, [
  22331. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  22332. vue.createTextVNode(vue.toDisplayString(_ctx.t("el.cascader.noData")), 1)
  22333. ])
  22334. ], 2)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  22335. vue.createCommentVNode(" eslint-disable-next-line vue/html-self-closing "),
  22336. (vue.openBlock(), vue.createElementBlock("svg", {
  22337. ref: "hoverZone",
  22338. class: vue.normalizeClass(_ctx.ns.e("hover-zone"))
  22339. }, null, 2))
  22340. ], 2112)) : vue.createCommentVNode("v-if", true)
  22341. ];
  22342. }),
  22343. _: 3
  22344. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  22345. }
  22346. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["render", _sfc_render$p], ["__file", "menu.vue"]]);
  22347. let uid = 0;
  22348. const calculatePathNodes = (node) => {
  22349. const nodes = [node];
  22350. let { parent } = node;
  22351. while (parent) {
  22352. nodes.unshift(parent);
  22353. parent = parent.parent;
  22354. }
  22355. return nodes;
  22356. };
  22357. class Node$2 {
  22358. constructor(data, config, parent, root = false) {
  22359. this.data = data;
  22360. this.config = config;
  22361. this.parent = parent;
  22362. this.root = root;
  22363. this.uid = uid++;
  22364. this.checked = false;
  22365. this.indeterminate = false;
  22366. this.loading = false;
  22367. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  22368. const childrenData = data[childrenKey];
  22369. const pathNodes = calculatePathNodes(this);
  22370. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  22371. this.value = data[valueKey];
  22372. this.label = data[labelKey];
  22373. this.pathNodes = pathNodes;
  22374. this.pathValues = pathNodes.map((node) => node.value);
  22375. this.pathLabels = pathNodes.map((node) => node.label);
  22376. this.childrenData = childrenData;
  22377. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  22378. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  22379. }
  22380. get isDisabled() {
  22381. const { data, parent, config } = this;
  22382. const { disabled, checkStrictly } = config;
  22383. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  22384. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  22385. }
  22386. get isLeaf() {
  22387. const { data, config, childrenData, loaded } = this;
  22388. const { lazy, leaf } = config;
  22389. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  22390. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  22391. }
  22392. get valueByOption() {
  22393. return this.config.emitPath ? this.pathValues : this.value;
  22394. }
  22395. appendChild(childData) {
  22396. const { childrenData, children } = this;
  22397. const node = new Node$2(childData, this.config, this);
  22398. if (isArray$1(childrenData)) {
  22399. childrenData.push(childData);
  22400. } else {
  22401. this.childrenData = [childData];
  22402. }
  22403. children.push(node);
  22404. return node;
  22405. }
  22406. calcText(allLevels, separator) {
  22407. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  22408. this.text = text;
  22409. return text;
  22410. }
  22411. broadcast(event, ...args) {
  22412. const handlerName = `onParent${capitalize(event)}`;
  22413. this.children.forEach((child) => {
  22414. if (child) {
  22415. child.broadcast(event, ...args);
  22416. child[handlerName] && child[handlerName](...args);
  22417. }
  22418. });
  22419. }
  22420. emit(event, ...args) {
  22421. const { parent } = this;
  22422. const handlerName = `onChild${capitalize(event)}`;
  22423. if (parent) {
  22424. parent[handlerName] && parent[handlerName](...args);
  22425. parent.emit(event, ...args);
  22426. }
  22427. }
  22428. onParentCheck(checked) {
  22429. if (!this.isDisabled) {
  22430. this.setCheckState(checked);
  22431. }
  22432. }
  22433. onChildCheck() {
  22434. const { children } = this;
  22435. const validChildren = children.filter((child) => !child.isDisabled);
  22436. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  22437. this.setCheckState(checked);
  22438. }
  22439. setCheckState(checked) {
  22440. const totalNum = this.children.length;
  22441. const checkedNum = this.children.reduce((c, p) => {
  22442. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  22443. return c + num;
  22444. }, 0);
  22445. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  22446. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  22447. }
  22448. doCheck(checked) {
  22449. if (this.checked === checked)
  22450. return;
  22451. const { checkStrictly, multiple } = this.config;
  22452. if (checkStrictly || !multiple) {
  22453. this.checked = checked;
  22454. } else {
  22455. this.broadcast("check", checked);
  22456. this.setCheckState(checked);
  22457. this.emit("check");
  22458. }
  22459. }
  22460. }
  22461. var Node$3 = Node$2;
  22462. const flatNodes = (nodes, leafOnly) => {
  22463. return nodes.reduce((res, node) => {
  22464. if (node.isLeaf) {
  22465. res.push(node);
  22466. } else {
  22467. !leafOnly && res.push(node);
  22468. res = res.concat(flatNodes(node.children, leafOnly));
  22469. }
  22470. return res;
  22471. }, []);
  22472. };
  22473. class Store {
  22474. constructor(data, config) {
  22475. this.config = config;
  22476. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  22477. this.nodes = nodes;
  22478. this.allNodes = flatNodes(nodes, false);
  22479. this.leafNodes = flatNodes(nodes, true);
  22480. }
  22481. getNodes() {
  22482. return this.nodes;
  22483. }
  22484. getFlattedNodes(leafOnly) {
  22485. return leafOnly ? this.leafNodes : this.allNodes;
  22486. }
  22487. appendNode(nodeData, parentNode) {
  22488. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  22489. if (!parentNode)
  22490. this.nodes.push(node);
  22491. this.appendAllNodesAndLeafNodes(node);
  22492. }
  22493. appendNodes(nodeDataList, parentNode) {
  22494. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  22495. }
  22496. appendAllNodesAndLeafNodes(node) {
  22497. this.allNodes.push(node);
  22498. node.isLeaf && this.leafNodes.push(node);
  22499. if (node.children) {
  22500. node.children.forEach((subNode) => {
  22501. this.appendAllNodesAndLeafNodes(subNode);
  22502. });
  22503. }
  22504. }
  22505. getNodeByValue(value, leafOnly = false) {
  22506. if (!value && value !== 0)
  22507. return null;
  22508. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  22509. return node || null;
  22510. }
  22511. getSameNode(node) {
  22512. if (!node)
  22513. return null;
  22514. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  22515. return node_ || null;
  22516. }
  22517. }
  22518. const CommonProps = buildProps({
  22519. modelValue: {
  22520. type: definePropType([Number, String, Array])
  22521. },
  22522. options: {
  22523. type: definePropType(Array),
  22524. default: () => []
  22525. },
  22526. props: {
  22527. type: definePropType(Object),
  22528. default: () => ({})
  22529. }
  22530. });
  22531. const DefaultProps = {
  22532. expandTrigger: "click",
  22533. multiple: false,
  22534. checkStrictly: false,
  22535. emitPath: true,
  22536. lazy: false,
  22537. lazyLoad: NOOP,
  22538. value: "value",
  22539. label: "label",
  22540. children: "children",
  22541. leaf: "leaf",
  22542. disabled: "disabled",
  22543. hoverThreshold: 500
  22544. };
  22545. const useCascaderConfig = (props) => {
  22546. return vue.computed(() => ({
  22547. ...DefaultProps,
  22548. ...props.props
  22549. }));
  22550. };
  22551. const getMenuIndex = (el) => {
  22552. if (!el)
  22553. return 0;
  22554. const pieces = el.id.split("-");
  22555. return Number(pieces[pieces.length - 2]);
  22556. };
  22557. const checkNode = (el) => {
  22558. if (!el)
  22559. return;
  22560. const input = el.querySelector("input");
  22561. if (input) {
  22562. input.click();
  22563. } else if (isLeaf(el)) {
  22564. el.click();
  22565. }
  22566. };
  22567. const sortByOriginalOrder = (oldNodes, newNodes) => {
  22568. const newNodesCopy = newNodes.slice(0);
  22569. const newIds = newNodesCopy.map((node) => node.uid);
  22570. const res = oldNodes.reduce((acc, item) => {
  22571. const index = newIds.indexOf(item.uid);
  22572. if (index > -1) {
  22573. acc.push(item);
  22574. newNodesCopy.splice(index, 1);
  22575. newIds.splice(index, 1);
  22576. }
  22577. return acc;
  22578. }, []);
  22579. res.push(...newNodesCopy);
  22580. return res;
  22581. };
  22582. const _sfc_main$1R = vue.defineComponent({
  22583. name: "ElCascaderPanel",
  22584. components: {
  22585. ElCascaderMenu
  22586. },
  22587. props: {
  22588. ...CommonProps,
  22589. border: {
  22590. type: Boolean,
  22591. default: true
  22592. },
  22593. renderLabel: Function
  22594. },
  22595. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  22596. setup(props, { emit, slots }) {
  22597. let manualChecked = false;
  22598. const ns = useNamespace("cascader");
  22599. const config = useCascaderConfig(props);
  22600. let store = null;
  22601. const initialLoaded = vue.ref(true);
  22602. const menuList = vue.ref([]);
  22603. const checkedValue = vue.ref(null);
  22604. const menus = vue.ref([]);
  22605. const expandingNode = vue.ref(null);
  22606. const checkedNodes = vue.ref([]);
  22607. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  22608. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  22609. const initStore = () => {
  22610. const { options } = props;
  22611. const cfg = config.value;
  22612. manualChecked = false;
  22613. store = new Store(options, cfg);
  22614. menus.value = [store.getNodes()];
  22615. if (cfg.lazy && isEmpty(props.options)) {
  22616. initialLoaded.value = false;
  22617. lazyLoad(void 0, (list) => {
  22618. if (list) {
  22619. store = new Store(list, cfg);
  22620. menus.value = [store.getNodes()];
  22621. }
  22622. initialLoaded.value = true;
  22623. syncCheckedValue(false, true);
  22624. });
  22625. } else {
  22626. syncCheckedValue(false, true);
  22627. }
  22628. };
  22629. const lazyLoad = (node, cb) => {
  22630. const cfg = config.value;
  22631. node = node || new Node$3({}, cfg, void 0, true);
  22632. node.loading = true;
  22633. const resolve = (dataList) => {
  22634. const _node = node;
  22635. const parent = _node.root ? null : _node;
  22636. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  22637. _node.loading = false;
  22638. _node.loaded = true;
  22639. _node.childrenData = _node.childrenData || [];
  22640. cb && cb(dataList);
  22641. };
  22642. cfg.lazyLoad(node, resolve);
  22643. };
  22644. const expandNode = (node, silent) => {
  22645. var _a;
  22646. const { level } = node;
  22647. const newMenus = menus.value.slice(0, level);
  22648. let newExpandingNode;
  22649. if (node.isLeaf) {
  22650. newExpandingNode = node.pathNodes[level - 2];
  22651. } else {
  22652. newExpandingNode = node;
  22653. newMenus.push(node.children);
  22654. }
  22655. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  22656. expandingNode.value = node;
  22657. menus.value = newMenus;
  22658. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  22659. }
  22660. };
  22661. const handleCheckChange = (node, checked, emitClose = true) => {
  22662. const { checkStrictly, multiple } = config.value;
  22663. const oldNode = checkedNodes.value[0];
  22664. manualChecked = true;
  22665. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  22666. node.doCheck(checked);
  22667. calculateCheckedValue();
  22668. emitClose && !multiple && !checkStrictly && emit("close");
  22669. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  22670. };
  22671. const expandParentNode = (node) => {
  22672. if (!node)
  22673. return;
  22674. node = node.parent;
  22675. expandParentNode(node);
  22676. node && expandNode(node);
  22677. };
  22678. const getFlattedNodes = (leafOnly) => {
  22679. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  22680. };
  22681. const getCheckedNodes = (leafOnly) => {
  22682. var _a;
  22683. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  22684. };
  22685. const clearCheckedNodes = () => {
  22686. checkedNodes.value.forEach((node) => node.doCheck(false));
  22687. calculateCheckedValue();
  22688. menus.value = menus.value.slice(0, 1);
  22689. expandingNode.value = null;
  22690. emit("expand-change", []);
  22691. };
  22692. const calculateCheckedValue = () => {
  22693. var _a;
  22694. const { checkStrictly, multiple } = config.value;
  22695. const oldNodes = checkedNodes.value;
  22696. const newNodes = getCheckedNodes(!checkStrictly);
  22697. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  22698. const values = nodes.map((node) => node.valueByOption);
  22699. checkedNodes.value = nodes;
  22700. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  22701. };
  22702. const syncCheckedValue = (loaded = false, forced = false) => {
  22703. const { modelValue } = props;
  22704. const { lazy, multiple, checkStrictly } = config.value;
  22705. const leafOnly = !checkStrictly;
  22706. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  22707. return;
  22708. if (lazy && !loaded) {
  22709. const values = unique(flattenDeep(castArray(modelValue)));
  22710. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  22711. if (nodes.length) {
  22712. nodes.forEach((node) => {
  22713. lazyLoad(node, () => syncCheckedValue(false, forced));
  22714. });
  22715. } else {
  22716. syncCheckedValue(true, forced);
  22717. }
  22718. } else {
  22719. const values = multiple ? castArray(modelValue) : [modelValue];
  22720. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  22721. syncMenuState(nodes, forced);
  22722. checkedValue.value = cloneDeep(modelValue);
  22723. }
  22724. };
  22725. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  22726. const { checkStrictly } = config.value;
  22727. const oldNodes = checkedNodes.value;
  22728. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  22729. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  22730. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  22731. if (newExpandingNode) {
  22732. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  22733. } else {
  22734. expandingNode.value = null;
  22735. }
  22736. oldNodes.forEach((node) => node.doCheck(false));
  22737. vue.reactive(newNodes).forEach((node) => node.doCheck(true));
  22738. checkedNodes.value = newNodes;
  22739. vue.nextTick(scrollToExpandingNode);
  22740. };
  22741. const scrollToExpandingNode = () => {
  22742. if (!isClient)
  22743. return;
  22744. menuList.value.forEach((menu) => {
  22745. const menuElement = menu == null ? void 0 : menu.$el;
  22746. if (menuElement) {
  22747. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  22748. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  22749. scrollIntoView(container, activeNode);
  22750. }
  22751. });
  22752. };
  22753. const handleKeyDown = (e) => {
  22754. const target = e.target;
  22755. const { code } = e;
  22756. switch (code) {
  22757. case EVENT_CODE.up:
  22758. case EVENT_CODE.down: {
  22759. e.preventDefault();
  22760. const distance = code === EVENT_CODE.up ? -1 : 1;
  22761. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  22762. break;
  22763. }
  22764. case EVENT_CODE.left: {
  22765. e.preventDefault();
  22766. const preMenu = menuList.value[getMenuIndex(target) - 1];
  22767. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  22768. focusNode(expandedNode);
  22769. break;
  22770. }
  22771. case EVENT_CODE.right: {
  22772. e.preventDefault();
  22773. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  22774. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  22775. focusNode(firstNode);
  22776. break;
  22777. }
  22778. case EVENT_CODE.enter:
  22779. case EVENT_CODE.numpadEnter:
  22780. checkNode(target);
  22781. break;
  22782. }
  22783. };
  22784. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  22785. config,
  22786. expandingNode,
  22787. checkedNodes,
  22788. isHoverMenu,
  22789. initialLoaded,
  22790. renderLabelFn,
  22791. lazyLoad,
  22792. expandNode,
  22793. handleCheckChange
  22794. }));
  22795. vue.watch([config, () => props.options], initStore, {
  22796. deep: true,
  22797. immediate: true
  22798. });
  22799. vue.watch(() => props.modelValue, () => {
  22800. manualChecked = false;
  22801. syncCheckedValue();
  22802. }, {
  22803. deep: true
  22804. });
  22805. vue.watch(() => checkedValue.value, (val) => {
  22806. if (!isEqual$1(val, props.modelValue)) {
  22807. emit(UPDATE_MODEL_EVENT, val);
  22808. emit(CHANGE_EVENT, val);
  22809. }
  22810. });
  22811. vue.onBeforeUpdate(() => menuList.value = []);
  22812. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  22813. return {
  22814. ns,
  22815. menuList,
  22816. menus,
  22817. checkedNodes,
  22818. handleKeyDown,
  22819. handleCheckChange,
  22820. getFlattedNodes,
  22821. getCheckedNodes,
  22822. clearCheckedNodes,
  22823. calculateCheckedValue,
  22824. scrollToExpandingNode
  22825. };
  22826. }
  22827. });
  22828. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  22829. const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu");
  22830. return vue.openBlock(), vue.createElementBlock("div", {
  22831. class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  22832. onKeydown: _ctx.handleKeyDown
  22833. }, [
  22834. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => {
  22835. return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, {
  22836. key: index,
  22837. ref_for: true,
  22838. ref: (item) => _ctx.menuList[index] = item,
  22839. index,
  22840. nodes: [...menu]
  22841. }, {
  22842. empty: vue.withCtx(() => [
  22843. vue.renderSlot(_ctx.$slots, "empty")
  22844. ]),
  22845. _: 2
  22846. }, 1032, ["index", "nodes"]);
  22847. }), 128))
  22848. ], 42, ["onKeydown"]);
  22849. }
  22850. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["render", _sfc_render$o], ["__file", "index.vue"]]);
  22851. const ElCascaderPanel = withInstall(CascaderPanel);
  22852. const tagProps = buildProps({
  22853. type: {
  22854. type: String,
  22855. values: ["primary", "success", "info", "warning", "danger"],
  22856. default: "primary"
  22857. },
  22858. closable: Boolean,
  22859. disableTransitions: Boolean,
  22860. hit: Boolean,
  22861. color: String,
  22862. size: {
  22863. type: String,
  22864. values: componentSizes
  22865. },
  22866. effect: {
  22867. type: String,
  22868. values: ["dark", "light", "plain"],
  22869. default: "light"
  22870. },
  22871. round: Boolean
  22872. });
  22873. const tagEmits = {
  22874. close: (evt) => evt instanceof MouseEvent,
  22875. click: (evt) => evt instanceof MouseEvent
  22876. };
  22877. const __default__$1l = vue.defineComponent({
  22878. name: "ElTag"
  22879. });
  22880. const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
  22881. ...__default__$1l,
  22882. props: tagProps,
  22883. emits: tagEmits,
  22884. setup(__props, { emit }) {
  22885. const props = __props;
  22886. const tagSize = useFormSize();
  22887. const ns = useNamespace("tag");
  22888. const containerKls = vue.computed(() => {
  22889. const { type, hit, effect, closable, round } = props;
  22890. return [
  22891. ns.b(),
  22892. ns.is("closable", closable),
  22893. ns.m(type || "primary"),
  22894. ns.m(tagSize.value),
  22895. ns.m(effect),
  22896. ns.is("hit", hit),
  22897. ns.is("round", round)
  22898. ];
  22899. });
  22900. const handleClose = (event) => {
  22901. emit("close", event);
  22902. };
  22903. const handleClick = (event) => {
  22904. emit("click", event);
  22905. };
  22906. const handleVNodeMounted = (vnode) => {
  22907. var _a, _b, _c;
  22908. if ((_c = (_b = (_a = vnode == null ? void 0 : vnode.component) == null ? void 0 : _a.subTree) == null ? void 0 : _b.component) == null ? void 0 : _c.bum) {
  22909. vnode.component.subTree.component.bum = null;
  22910. }
  22911. };
  22912. return (_ctx, _cache) => {
  22913. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  22914. key: 0,
  22915. class: vue.normalizeClass(vue.unref(containerKls)),
  22916. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22917. onClick: handleClick
  22918. }, [
  22919. vue.createElementVNode("span", {
  22920. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22921. }, [
  22922. vue.renderSlot(_ctx.$slots, "default")
  22923. ], 2),
  22924. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22925. key: 0,
  22926. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22927. onClick: vue.withModifiers(handleClose, ["stop"])
  22928. }, {
  22929. default: vue.withCtx(() => [
  22930. vue.createVNode(vue.unref(close_default))
  22931. ]),
  22932. _: 1
  22933. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22934. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  22935. key: 1,
  22936. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  22937. appear: "",
  22938. onVnodeMounted: handleVNodeMounted
  22939. }, {
  22940. default: vue.withCtx(() => [
  22941. vue.createElementVNode("span", {
  22942. class: vue.normalizeClass(vue.unref(containerKls)),
  22943. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22944. onClick: handleClick
  22945. }, [
  22946. vue.createElementVNode("span", {
  22947. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22948. }, [
  22949. vue.renderSlot(_ctx.$slots, "default")
  22950. ], 2),
  22951. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22952. key: 0,
  22953. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22954. onClick: vue.withModifiers(handleClose, ["stop"])
  22955. }, {
  22956. default: vue.withCtx(() => [
  22957. vue.createVNode(vue.unref(close_default))
  22958. ]),
  22959. _: 1
  22960. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22961. ], 6)
  22962. ]),
  22963. _: 3
  22964. }, 8, ["name"]));
  22965. };
  22966. }
  22967. });
  22968. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "tag.vue"]]);
  22969. const ElTag = withInstall(Tag);
  22970. const cascaderProps = buildProps({
  22971. ...CommonProps,
  22972. size: useSizeProp,
  22973. placeholder: String,
  22974. disabled: Boolean,
  22975. clearable: Boolean,
  22976. filterable: Boolean,
  22977. filterMethod: {
  22978. type: definePropType(Function),
  22979. default: (node, keyword) => node.text.includes(keyword)
  22980. },
  22981. separator: {
  22982. type: String,
  22983. default: " / "
  22984. },
  22985. showAllLevels: {
  22986. type: Boolean,
  22987. default: true
  22988. },
  22989. collapseTags: Boolean,
  22990. maxCollapseTags: {
  22991. type: Number,
  22992. default: 1
  22993. },
  22994. collapseTagsTooltip: {
  22995. type: Boolean,
  22996. default: false
  22997. },
  22998. debounce: {
  22999. type: Number,
  23000. default: 300
  23001. },
  23002. beforeFilter: {
  23003. type: definePropType(Function),
  23004. default: () => true
  23005. },
  23006. placement: {
  23007. type: definePropType(String),
  23008. values: Ee,
  23009. default: "bottom-start"
  23010. },
  23011. fallbackPlacements: {
  23012. type: definePropType(Array),
  23013. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  23014. },
  23015. popperClass: {
  23016. type: String,
  23017. default: ""
  23018. },
  23019. teleported: useTooltipContentProps.teleported,
  23020. tagType: { ...tagProps.type, default: "info" },
  23021. tagEffect: { ...tagProps.effect, default: "light" },
  23022. validateEvent: {
  23023. type: Boolean,
  23024. default: true
  23025. },
  23026. persistent: {
  23027. type: Boolean,
  23028. default: true
  23029. },
  23030. ...useEmptyValuesProps
  23031. });
  23032. const cascaderEmits = {
  23033. [UPDATE_MODEL_EVENT]: (_) => true,
  23034. [CHANGE_EVENT]: (_) => true,
  23035. focus: (evt) => evt instanceof FocusEvent,
  23036. blur: (evt) => evt instanceof FocusEvent,
  23037. clear: () => true,
  23038. visibleChange: (val) => isBoolean(val),
  23039. expandChange: (val) => !!val,
  23040. removeTag: (val) => !!val
  23041. };
  23042. const COMPONENT_NAME$f = "ElCascader";
  23043. const __default__$1k = vue.defineComponent({
  23044. name: COMPONENT_NAME$f
  23045. });
  23046. const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
  23047. ...__default__$1k,
  23048. props: cascaderProps,
  23049. emits: cascaderEmits,
  23050. setup(__props, { expose, emit }) {
  23051. const props = __props;
  23052. const popperOptions = {
  23053. modifiers: [
  23054. {
  23055. name: "arrowPosition",
  23056. enabled: true,
  23057. phase: "main",
  23058. fn: ({ state }) => {
  23059. const { modifiersData, placement } = state;
  23060. if (["right", "left", "bottom", "top"].includes(placement))
  23061. return;
  23062. modifiersData.arrow.x = 35;
  23063. },
  23064. requires: ["arrow"]
  23065. }
  23066. ]
  23067. };
  23068. const attrs = vue.useAttrs();
  23069. let inputInitialHeight = 0;
  23070. let pressDeleteCount = 0;
  23071. const nsCascader = useNamespace("cascader");
  23072. const nsInput = useNamespace("input");
  23073. const { t } = useLocale();
  23074. const { form, formItem } = useFormItem();
  23075. const { valueOnClear } = useEmptyValues(props);
  23076. const { isComposing, handleComposition } = useComposition({
  23077. afterComposition(event) {
  23078. var _a;
  23079. const text = (_a = event.target) == null ? void 0 : _a.value;
  23080. handleInput(text);
  23081. }
  23082. });
  23083. const tooltipRef = vue.ref(null);
  23084. const input = vue.ref(null);
  23085. const tagWrapper = vue.ref(null);
  23086. const cascaderPanelRef = vue.ref(null);
  23087. const suggestionPanel = vue.ref(null);
  23088. const popperVisible = vue.ref(false);
  23089. const inputHover = vue.ref(false);
  23090. const filtering = vue.ref(false);
  23091. const filterFocus = vue.ref(false);
  23092. const inputValue = vue.ref("");
  23093. const searchInputValue = vue.ref("");
  23094. const presentTags = vue.ref([]);
  23095. const allPresentTags = vue.ref([]);
  23096. const suggestions = vue.ref([]);
  23097. const cascaderStyle = vue.computed(() => {
  23098. return attrs.style;
  23099. });
  23100. const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  23101. const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder"));
  23102. const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  23103. const realSize = useFormSize();
  23104. const tagSize = vue.computed(() => realSize.value === "small" ? "small" : "default");
  23105. const multiple = vue.computed(() => !!props.props.multiple);
  23106. const readonly = vue.computed(() => !props.filterable || multiple.value);
  23107. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  23108. const checkedNodes = vue.computed(() => {
  23109. var _a;
  23110. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  23111. });
  23112. const clearBtnVisible = vue.computed(() => {
  23113. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  23114. return false;
  23115. return !!checkedNodes.value.length;
  23116. });
  23117. const presentText = vue.computed(() => {
  23118. const { showAllLevels, separator } = props;
  23119. const nodes = checkedNodes.value;
  23120. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  23121. });
  23122. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  23123. const checkedValue = vue.computed({
  23124. get() {
  23125. return cloneDeep(props.modelValue);
  23126. },
  23127. set(val) {
  23128. const value = val != null ? val : valueOnClear.value;
  23129. emit(UPDATE_MODEL_EVENT, value);
  23130. emit(CHANGE_EVENT, value);
  23131. if (props.validateEvent) {
  23132. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23133. }
  23134. }
  23135. });
  23136. const cascaderKls = vue.computed(() => {
  23137. return [
  23138. nsCascader.b(),
  23139. nsCascader.m(realSize.value),
  23140. nsCascader.is("disabled", isDisabled.value),
  23141. attrs.class
  23142. ];
  23143. });
  23144. const cascaderIconKls = vue.computed(() => {
  23145. return [
  23146. nsInput.e("icon"),
  23147. "icon-arrow-down",
  23148. nsCascader.is("reverse", popperVisible.value)
  23149. ];
  23150. });
  23151. const inputClass = vue.computed(() => {
  23152. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  23153. });
  23154. const contentRef = vue.computed(() => {
  23155. var _a, _b;
  23156. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  23157. });
  23158. const togglePopperVisible = (visible) => {
  23159. var _a, _b, _c;
  23160. if (isDisabled.value)
  23161. return;
  23162. visible = visible != null ? visible : !popperVisible.value;
  23163. if (visible !== popperVisible.value) {
  23164. popperVisible.value = visible;
  23165. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  23166. if (visible) {
  23167. updatePopperPosition();
  23168. vue.nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  23169. } else if (props.filterable) {
  23170. syncPresentTextValue();
  23171. }
  23172. emit("visibleChange", visible);
  23173. }
  23174. };
  23175. const updatePopperPosition = () => {
  23176. vue.nextTick(() => {
  23177. var _a;
  23178. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  23179. });
  23180. };
  23181. const hideSuggestionPanel = () => {
  23182. filtering.value = false;
  23183. };
  23184. const genTag = (node) => {
  23185. const { showAllLevels, separator } = props;
  23186. return {
  23187. node,
  23188. key: node.uid,
  23189. text: node.calcText(showAllLevels, separator),
  23190. hitState: false,
  23191. closable: !isDisabled.value && !node.isDisabled,
  23192. isCollapseTag: false
  23193. };
  23194. };
  23195. const deleteTag = (tag) => {
  23196. var _a;
  23197. const node = tag.node;
  23198. node.doCheck(false);
  23199. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  23200. emit("removeTag", node.valueByOption);
  23201. };
  23202. const calculatePresentTags = () => {
  23203. if (!multiple.value)
  23204. return;
  23205. const nodes = checkedNodes.value;
  23206. const tags = [];
  23207. const allTags = [];
  23208. nodes.forEach((node) => allTags.push(genTag(node)));
  23209. allPresentTags.value = allTags;
  23210. if (nodes.length) {
  23211. nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag(node)));
  23212. const rest = nodes.slice(props.maxCollapseTags);
  23213. const restCount = rest.length;
  23214. if (restCount) {
  23215. if (props.collapseTags) {
  23216. tags.push({
  23217. key: -1,
  23218. text: `+ ${restCount}`,
  23219. closable: false,
  23220. isCollapseTag: true
  23221. });
  23222. } else {
  23223. rest.forEach((node) => tags.push(genTag(node)));
  23224. }
  23225. }
  23226. }
  23227. presentTags.value = tags;
  23228. };
  23229. const calculateSuggestions = () => {
  23230. var _a, _b;
  23231. const { filterMethod, showAllLevels, separator } = props;
  23232. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  23233. if (node.isDisabled)
  23234. return false;
  23235. node.calcText(showAllLevels, separator);
  23236. return filterMethod(node, searchKeyword.value);
  23237. });
  23238. if (multiple.value) {
  23239. presentTags.value.forEach((tag) => {
  23240. tag.hitState = false;
  23241. });
  23242. allPresentTags.value.forEach((tag) => {
  23243. tag.hitState = false;
  23244. });
  23245. }
  23246. filtering.value = true;
  23247. suggestions.value = res;
  23248. updatePopperPosition();
  23249. };
  23250. const focusFirstNode = () => {
  23251. var _a;
  23252. let firstNode;
  23253. if (filtering.value && suggestionPanel.value) {
  23254. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  23255. } else {
  23256. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  23257. }
  23258. if (firstNode) {
  23259. firstNode.focus();
  23260. !filtering.value && firstNode.click();
  23261. }
  23262. };
  23263. const updateStyle = () => {
  23264. var _a, _b;
  23265. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  23266. const tagWrapperEl = tagWrapper.value;
  23267. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  23268. if (!isClient || !inputInner)
  23269. return;
  23270. if (suggestionPanelEl) {
  23271. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  23272. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  23273. }
  23274. if (tagWrapperEl) {
  23275. const { offsetHeight } = tagWrapperEl;
  23276. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  23277. inputInner.style.height = height;
  23278. updatePopperPosition();
  23279. }
  23280. };
  23281. const getCheckedNodes = (leafOnly) => {
  23282. var _a;
  23283. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  23284. };
  23285. const handleExpandChange = (value) => {
  23286. updatePopperPosition();
  23287. emit("expandChange", value);
  23288. };
  23289. const handleKeyDown = (e) => {
  23290. if (isComposing.value)
  23291. return;
  23292. switch (e.code) {
  23293. case EVENT_CODE.enter:
  23294. case EVENT_CODE.numpadEnter:
  23295. togglePopperVisible();
  23296. break;
  23297. case EVENT_CODE.down:
  23298. togglePopperVisible(true);
  23299. vue.nextTick(focusFirstNode);
  23300. e.preventDefault();
  23301. break;
  23302. case EVENT_CODE.esc:
  23303. if (popperVisible.value === true) {
  23304. e.preventDefault();
  23305. e.stopPropagation();
  23306. togglePopperVisible(false);
  23307. }
  23308. break;
  23309. case EVENT_CODE.tab:
  23310. togglePopperVisible(false);
  23311. break;
  23312. }
  23313. };
  23314. const handleClear = () => {
  23315. var _a;
  23316. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  23317. if (!popperVisible.value && props.filterable) {
  23318. syncPresentTextValue();
  23319. }
  23320. togglePopperVisible(false);
  23321. emit("clear");
  23322. };
  23323. const syncPresentTextValue = () => {
  23324. const { value } = presentText;
  23325. inputValue.value = value;
  23326. searchInputValue.value = value;
  23327. };
  23328. const handleSuggestionClick = (node) => {
  23329. var _a, _b;
  23330. const { checked } = node;
  23331. if (multiple.value) {
  23332. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  23333. } else {
  23334. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  23335. togglePopperVisible(false);
  23336. }
  23337. };
  23338. const handleSuggestionKeyDown = (e) => {
  23339. const target = e.target;
  23340. const { code } = e;
  23341. switch (code) {
  23342. case EVENT_CODE.up:
  23343. case EVENT_CODE.down: {
  23344. e.preventDefault();
  23345. const distance = code === EVENT_CODE.up ? -1 : 1;
  23346. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  23347. break;
  23348. }
  23349. case EVENT_CODE.enter:
  23350. case EVENT_CODE.numpadEnter:
  23351. target.click();
  23352. break;
  23353. }
  23354. };
  23355. const handleDelete = () => {
  23356. const tags = presentTags.value;
  23357. const lastTag = tags[tags.length - 1];
  23358. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  23359. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  23360. return;
  23361. if (lastTag.hitState) {
  23362. deleteTag(lastTag);
  23363. } else {
  23364. lastTag.hitState = true;
  23365. }
  23366. };
  23367. const handleFocus = (e) => {
  23368. const el = e.target;
  23369. const name = nsCascader.e("search-input");
  23370. if (el.className === name) {
  23371. filterFocus.value = true;
  23372. }
  23373. emit("focus", e);
  23374. };
  23375. const handleBlur = (e) => {
  23376. filterFocus.value = false;
  23377. emit("blur", e);
  23378. };
  23379. const handleFilter = debounce(() => {
  23380. const { value } = searchKeyword;
  23381. if (!value)
  23382. return;
  23383. const passed = props.beforeFilter(value);
  23384. if (isPromise(passed)) {
  23385. passed.then(calculateSuggestions).catch(() => {
  23386. });
  23387. } else if (passed !== false) {
  23388. calculateSuggestions();
  23389. } else {
  23390. hideSuggestionPanel();
  23391. }
  23392. }, props.debounce);
  23393. const handleInput = (val, e) => {
  23394. !popperVisible.value && togglePopperVisible(true);
  23395. if (e == null ? void 0 : e.isComposing)
  23396. return;
  23397. val ? handleFilter() : hideSuggestionPanel();
  23398. };
  23399. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  23400. vue.watch(filtering, updatePopperPosition);
  23401. vue.watch([checkedNodes, isDisabled, () => props.collapseTags], calculatePresentTags);
  23402. vue.watch(presentTags, () => {
  23403. vue.nextTick(() => updateStyle());
  23404. });
  23405. vue.watch(realSize, async () => {
  23406. await vue.nextTick();
  23407. const inputInner = input.value.input;
  23408. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  23409. updateStyle();
  23410. });
  23411. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  23412. vue.onMounted(() => {
  23413. const inputInner = input.value.input;
  23414. const inputInnerHeight = getInputInnerHeight(inputInner);
  23415. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  23416. useResizeObserver(inputInner, updateStyle);
  23417. });
  23418. expose({
  23419. getCheckedNodes,
  23420. cascaderPanelRef,
  23421. togglePopperVisible,
  23422. contentRef,
  23423. presentText
  23424. });
  23425. return (_ctx, _cache) => {
  23426. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23427. ref_key: "tooltipRef",
  23428. ref: tooltipRef,
  23429. visible: popperVisible.value,
  23430. teleported: _ctx.teleported,
  23431. "popper-class": [vue.unref(nsCascader).e("dropdown"), _ctx.popperClass],
  23432. "popper-options": popperOptions,
  23433. "fallback-placements": _ctx.fallbackPlacements,
  23434. "stop-popper-mouse-event": false,
  23435. "gpu-acceleration": false,
  23436. placement: _ctx.placement,
  23437. transition: `${vue.unref(nsCascader).namespace.value}-zoom-in-top`,
  23438. effect: "light",
  23439. pure: "",
  23440. persistent: _ctx.persistent,
  23441. onHide: hideSuggestionPanel
  23442. }, {
  23443. default: vue.withCtx(() => [
  23444. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  23445. class: vue.normalizeClass(vue.unref(cascaderKls)),
  23446. style: vue.normalizeStyle(vue.unref(cascaderStyle)),
  23447. onClick: () => togglePopperVisible(vue.unref(readonly) ? void 0 : true),
  23448. onKeydown: handleKeyDown,
  23449. onMouseenter: ($event) => inputHover.value = true,
  23450. onMouseleave: ($event) => inputHover.value = false
  23451. }, [
  23452. vue.createVNode(vue.unref(ElInput), {
  23453. ref_key: "input",
  23454. ref: input,
  23455. modelValue: inputValue.value,
  23456. "onUpdate:modelValue": ($event) => inputValue.value = $event,
  23457. placeholder: vue.unref(currentPlaceholder),
  23458. readonly: vue.unref(readonly),
  23459. disabled: vue.unref(isDisabled),
  23460. "validate-event": false,
  23461. size: vue.unref(realSize),
  23462. class: vue.normalizeClass(vue.unref(inputClass)),
  23463. tabindex: vue.unref(multiple) && _ctx.filterable && !vue.unref(isDisabled) ? -1 : void 0,
  23464. onCompositionstart: vue.unref(handleComposition),
  23465. onCompositionupdate: vue.unref(handleComposition),
  23466. onCompositionend: vue.unref(handleComposition),
  23467. onFocus: handleFocus,
  23468. onBlur: handleBlur,
  23469. onInput: handleInput
  23470. }, vue.createSlots({
  23471. suffix: vue.withCtx(() => [
  23472. vue.unref(clearBtnVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23473. key: "clear",
  23474. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), "icon-circle-close"]),
  23475. onClick: vue.withModifiers(handleClear, ["stop"])
  23476. }, {
  23477. default: vue.withCtx(() => [
  23478. vue.createVNode(vue.unref(circle_close_default))
  23479. ]),
  23480. _: 1
  23481. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23482. key: "arrow-down",
  23483. class: vue.normalizeClass(vue.unref(cascaderIconKls)),
  23484. onClick: vue.withModifiers(($event) => togglePopperVisible(), ["stop"])
  23485. }, {
  23486. default: vue.withCtx(() => [
  23487. vue.createVNode(vue.unref(arrow_down_default))
  23488. ]),
  23489. _: 1
  23490. }, 8, ["class", "onClick"]))
  23491. ]),
  23492. _: 2
  23493. }, [
  23494. _ctx.$slots.prefix ? {
  23495. name: "prefix",
  23496. fn: vue.withCtx(() => [
  23497. vue.renderSlot(_ctx.$slots, "prefix")
  23498. ])
  23499. } : void 0
  23500. ]), 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  23501. vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", {
  23502. key: 0,
  23503. ref_key: "tagWrapper",
  23504. ref: tagWrapper,
  23505. class: vue.normalizeClass([
  23506. vue.unref(nsCascader).e("tags"),
  23507. vue.unref(nsCascader).is("validate", Boolean(vue.unref(validateState)))
  23508. ])
  23509. }, [
  23510. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(presentTags.value, (tag) => {
  23511. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23512. key: tag.key,
  23513. type: _ctx.tagType,
  23514. size: vue.unref(tagSize),
  23515. effect: _ctx.tagEffect,
  23516. hit: tag.hitState,
  23517. closable: tag.closable,
  23518. "disable-transitions": "",
  23519. onClose: ($event) => deleteTag(tag)
  23520. }, {
  23521. default: vue.withCtx(() => [
  23522. tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23523. key: 1,
  23524. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  23525. "fallback-placements": ["bottom", "top", "right", "left"],
  23526. placement: "bottom",
  23527. effect: "light"
  23528. }, {
  23529. default: vue.withCtx(() => [
  23530. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  23531. ]),
  23532. content: vue.withCtx(() => [
  23533. vue.createElementVNode("div", {
  23534. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tags"))
  23535. }, [
  23536. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
  23537. return vue.openBlock(), vue.createElementBlock("div", {
  23538. key: idx,
  23539. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tag"))
  23540. }, [
  23541. (vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23542. key: tag2.key,
  23543. class: "in-tooltip",
  23544. type: _ctx.tagType,
  23545. size: vue.unref(tagSize),
  23546. effect: _ctx.tagEffect,
  23547. hit: tag2.hitState,
  23548. closable: tag2.closable,
  23549. "disable-transitions": "",
  23550. onClose: ($event) => deleteTag(tag2)
  23551. }, {
  23552. default: vue.withCtx(() => [
  23553. vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1)
  23554. ]),
  23555. _: 2
  23556. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
  23557. ], 2);
  23558. }), 128))
  23559. ], 2)
  23560. ]),
  23561. _: 2
  23562. }, 1032, ["disabled"]))
  23563. ]),
  23564. _: 2
  23565. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
  23566. }), 128)),
  23567. _ctx.filterable && !vue.unref(isDisabled) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  23568. key: 0,
  23569. "onUpdate:modelValue": ($event) => searchInputValue.value = $event,
  23570. type: "text",
  23571. class: vue.normalizeClass(vue.unref(nsCascader).e("search-input")),
  23572. placeholder: vue.unref(presentText) ? "" : vue.unref(inputPlaceholder),
  23573. onInput: (e) => handleInput(searchInputValue.value, e),
  23574. onClick: vue.withModifiers(($event) => togglePopperVisible(true), ["stop"]),
  23575. onKeydown: vue.withKeys(handleDelete, ["delete"]),
  23576. onCompositionstart: vue.unref(handleComposition),
  23577. onCompositionupdate: vue.unref(handleComposition),
  23578. onCompositionend: vue.unref(handleComposition),
  23579. onFocus: handleFocus,
  23580. onBlur: handleBlur
  23581. }, null, 42, ["onUpdate:modelValue", "placeholder", "onInput", "onClick", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend"])), [
  23582. [vue.vModelText, searchInputValue.value]
  23583. ]) : vue.createCommentVNode("v-if", true)
  23584. ], 2)) : vue.createCommentVNode("v-if", true)
  23585. ], 46, ["onClick", "onMouseenter", "onMouseleave"])), [
  23586. [vue.unref(ClickOutside), () => togglePopperVisible(false), vue.unref(contentRef)]
  23587. ])
  23588. ]),
  23589. content: vue.withCtx(() => [
  23590. vue.withDirectives(vue.createVNode(vue.unref(ElCascaderPanel), {
  23591. ref_key: "cascaderPanelRef",
  23592. ref: cascaderPanelRef,
  23593. modelValue: vue.unref(checkedValue),
  23594. "onUpdate:modelValue": ($event) => vue.isRef(checkedValue) ? checkedValue.value = $event : null,
  23595. options: _ctx.options,
  23596. props: props.props,
  23597. border: false,
  23598. "render-label": _ctx.$slots.default,
  23599. onExpandChange: handleExpandChange,
  23600. onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
  23601. }, {
  23602. empty: vue.withCtx(() => [
  23603. vue.renderSlot(_ctx.$slots, "empty")
  23604. ]),
  23605. _: 3
  23606. }, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "render-label", "onClose"]), [
  23607. [vue.vShow, !filtering.value]
  23608. ]),
  23609. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  23610. key: 0,
  23611. ref_key: "suggestionPanel",
  23612. ref: suggestionPanel,
  23613. tag: "ul",
  23614. class: vue.normalizeClass(vue.unref(nsCascader).e("suggestion-panel")),
  23615. "view-class": vue.unref(nsCascader).e("suggestion-list"),
  23616. onKeydown: handleSuggestionKeyDown
  23617. }, {
  23618. default: vue.withCtx(() => [
  23619. suggestions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(suggestions.value, (item) => {
  23620. return vue.openBlock(), vue.createElementBlock("li", {
  23621. key: item.uid,
  23622. class: vue.normalizeClass([
  23623. vue.unref(nsCascader).e("suggestion-item"),
  23624. vue.unref(nsCascader).is("checked", item.checked)
  23625. ]),
  23626. tabindex: -1,
  23627. onClick: ($event) => handleSuggestionClick(item)
  23628. }, [
  23629. vue.renderSlot(_ctx.$slots, "suggestion-item", { item }, () => [
  23630. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  23631. item.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  23632. default: vue.withCtx(() => [
  23633. vue.createVNode(vue.unref(check_default))
  23634. ]),
  23635. _: 1
  23636. })) : vue.createCommentVNode("v-if", true)
  23637. ])
  23638. ], 10, ["onClick"]);
  23639. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  23640. vue.createElementVNode("li", {
  23641. class: vue.normalizeClass(vue.unref(nsCascader).e("empty-text"))
  23642. }, vue.toDisplayString(vue.unref(t)("el.cascader.noMatch")), 3)
  23643. ])
  23644. ]),
  23645. _: 3
  23646. }, 8, ["class", "view-class"])), [
  23647. [vue.vShow, filtering.value]
  23648. ]) : vue.createCommentVNode("v-if", true)
  23649. ]),
  23650. _: 3
  23651. }, 8, ["visible", "teleported", "popper-class", "fallback-placements", "placement", "transition", "persistent"]);
  23652. };
  23653. }
  23654. });
  23655. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "cascader.vue"]]);
  23656. const ElCascader = withInstall(Cascader);
  23657. const checkTagProps = buildProps({
  23658. checked: Boolean,
  23659. disabled: Boolean,
  23660. type: {
  23661. type: String,
  23662. values: ["primary", "success", "info", "warning", "danger"],
  23663. default: "primary"
  23664. }
  23665. });
  23666. const checkTagEmits = {
  23667. "update:checked": (value) => isBoolean(value),
  23668. [CHANGE_EVENT]: (value) => isBoolean(value)
  23669. };
  23670. const __default__$1j = vue.defineComponent({
  23671. name: "ElCheckTag"
  23672. });
  23673. const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
  23674. ...__default__$1j,
  23675. props: checkTagProps,
  23676. emits: checkTagEmits,
  23677. setup(__props, { emit }) {
  23678. const props = __props;
  23679. const ns = useNamespace("check-tag");
  23680. const isDisabled = vue.computed(() => props.disabled);
  23681. const containerKls = vue.computed(() => [
  23682. ns.b(),
  23683. ns.is("checked", props.checked),
  23684. ns.is("disabled", isDisabled.value),
  23685. ns.m(props.type || "primary")
  23686. ]);
  23687. const handleChange = () => {
  23688. if (isDisabled.value)
  23689. return;
  23690. const checked = !props.checked;
  23691. emit(CHANGE_EVENT, checked);
  23692. emit("update:checked", checked);
  23693. };
  23694. return (_ctx, _cache) => {
  23695. return vue.openBlock(), vue.createElementBlock("span", {
  23696. class: vue.normalizeClass(vue.unref(containerKls)),
  23697. onClick: handleChange
  23698. }, [
  23699. vue.renderSlot(_ctx.$slots, "default")
  23700. ], 2);
  23701. };
  23702. }
  23703. });
  23704. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "check-tag.vue"]]);
  23705. const ElCheckTag = withInstall(CheckTag);
  23706. const rowContextKey = Symbol("rowContextKey");
  23707. const RowJustify = [
  23708. "start",
  23709. "center",
  23710. "end",
  23711. "space-around",
  23712. "space-between",
  23713. "space-evenly"
  23714. ];
  23715. const RowAlign = ["top", "middle", "bottom"];
  23716. const rowProps = buildProps({
  23717. tag: {
  23718. type: String,
  23719. default: "div"
  23720. },
  23721. gutter: {
  23722. type: Number,
  23723. default: 0
  23724. },
  23725. justify: {
  23726. type: String,
  23727. values: RowJustify,
  23728. default: "start"
  23729. },
  23730. align: {
  23731. type: String,
  23732. values: RowAlign
  23733. }
  23734. });
  23735. const __default__$1i = vue.defineComponent({
  23736. name: "ElRow"
  23737. });
  23738. const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
  23739. ...__default__$1i,
  23740. props: rowProps,
  23741. setup(__props) {
  23742. const props = __props;
  23743. const ns = useNamespace("row");
  23744. const gutter = vue.computed(() => props.gutter);
  23745. vue.provide(rowContextKey, {
  23746. gutter
  23747. });
  23748. const style = vue.computed(() => {
  23749. const styles = {};
  23750. if (!props.gutter) {
  23751. return styles;
  23752. }
  23753. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  23754. return styles;
  23755. });
  23756. const rowKls = vue.computed(() => [
  23757. ns.b(),
  23758. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  23759. ns.is(`align-${props.align}`, !!props.align)
  23760. ]);
  23761. return (_ctx, _cache) => {
  23762. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23763. class: vue.normalizeClass(vue.unref(rowKls)),
  23764. style: vue.normalizeStyle(vue.unref(style))
  23765. }, {
  23766. default: vue.withCtx(() => [
  23767. vue.renderSlot(_ctx.$slots, "default")
  23768. ]),
  23769. _: 3
  23770. }, 8, ["class", "style"]);
  23771. };
  23772. }
  23773. });
  23774. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "row.vue"]]);
  23775. const ElRow = withInstall(Row$1);
  23776. const colProps = buildProps({
  23777. tag: {
  23778. type: String,
  23779. default: "div"
  23780. },
  23781. span: {
  23782. type: Number,
  23783. default: 24
  23784. },
  23785. offset: {
  23786. type: Number,
  23787. default: 0
  23788. },
  23789. pull: {
  23790. type: Number,
  23791. default: 0
  23792. },
  23793. push: {
  23794. type: Number,
  23795. default: 0
  23796. },
  23797. xs: {
  23798. type: definePropType([Number, Object]),
  23799. default: () => mutable({})
  23800. },
  23801. sm: {
  23802. type: definePropType([Number, Object]),
  23803. default: () => mutable({})
  23804. },
  23805. md: {
  23806. type: definePropType([Number, Object]),
  23807. default: () => mutable({})
  23808. },
  23809. lg: {
  23810. type: definePropType([Number, Object]),
  23811. default: () => mutable({})
  23812. },
  23813. xl: {
  23814. type: definePropType([Number, Object]),
  23815. default: () => mutable({})
  23816. }
  23817. });
  23818. const __default__$1h = vue.defineComponent({
  23819. name: "ElCol"
  23820. });
  23821. const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({
  23822. ...__default__$1h,
  23823. props: colProps,
  23824. setup(__props) {
  23825. const props = __props;
  23826. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  23827. const ns = useNamespace("col");
  23828. const style = vue.computed(() => {
  23829. const styles = {};
  23830. if (gutter.value) {
  23831. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  23832. }
  23833. return styles;
  23834. });
  23835. const colKls = vue.computed(() => {
  23836. const classes = [];
  23837. const pos = ["span", "offset", "pull", "push"];
  23838. pos.forEach((prop) => {
  23839. const size = props[prop];
  23840. if (isNumber(size)) {
  23841. if (prop === "span")
  23842. classes.push(ns.b(`${props[prop]}`));
  23843. else if (size > 0)
  23844. classes.push(ns.b(`${prop}-${props[prop]}`));
  23845. }
  23846. });
  23847. const sizes = ["xs", "sm", "md", "lg", "xl"];
  23848. sizes.forEach((size) => {
  23849. if (isNumber(props[size])) {
  23850. classes.push(ns.b(`${size}-${props[size]}`));
  23851. } else if (isObject$1(props[size])) {
  23852. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  23853. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  23854. });
  23855. }
  23856. });
  23857. if (gutter.value) {
  23858. classes.push(ns.is("guttered"));
  23859. }
  23860. return [ns.b(), classes];
  23861. });
  23862. return (_ctx, _cache) => {
  23863. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23864. class: vue.normalizeClass(vue.unref(colKls)),
  23865. style: vue.normalizeStyle(vue.unref(style))
  23866. }, {
  23867. default: vue.withCtx(() => [
  23868. vue.renderSlot(_ctx.$slots, "default")
  23869. ]),
  23870. _: 3
  23871. }, 8, ["class", "style"]);
  23872. };
  23873. }
  23874. });
  23875. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "col.vue"]]);
  23876. const ElCol = withInstall(Col);
  23877. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  23878. const collapseProps = buildProps({
  23879. accordion: Boolean,
  23880. modelValue: {
  23881. type: definePropType([Array, String, Number]),
  23882. default: () => mutable([])
  23883. }
  23884. });
  23885. const collapseEmits = {
  23886. [UPDATE_MODEL_EVENT]: emitChangeFn,
  23887. [CHANGE_EVENT]: emitChangeFn
  23888. };
  23889. const collapseContextKey = Symbol("collapseContextKey");
  23890. const useCollapse = (props, emit) => {
  23891. const activeNames = vue.ref(castArray$1(props.modelValue));
  23892. const setActiveNames = (_activeNames) => {
  23893. activeNames.value = _activeNames;
  23894. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  23895. emit(UPDATE_MODEL_EVENT, value);
  23896. emit(CHANGE_EVENT, value);
  23897. };
  23898. const handleItemClick = (name) => {
  23899. if (props.accordion) {
  23900. setActiveNames([activeNames.value[0] === name ? "" : name]);
  23901. } else {
  23902. const _activeNames = [...activeNames.value];
  23903. const index = _activeNames.indexOf(name);
  23904. if (index > -1) {
  23905. _activeNames.splice(index, 1);
  23906. } else {
  23907. _activeNames.push(name);
  23908. }
  23909. setActiveNames(_activeNames);
  23910. }
  23911. };
  23912. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  23913. vue.provide(collapseContextKey, {
  23914. activeNames,
  23915. handleItemClick
  23916. });
  23917. return {
  23918. activeNames,
  23919. setActiveNames
  23920. };
  23921. };
  23922. const useCollapseDOM = () => {
  23923. const ns = useNamespace("collapse");
  23924. const rootKls = vue.computed(() => ns.b());
  23925. return {
  23926. rootKls
  23927. };
  23928. };
  23929. const __default__$1g = vue.defineComponent({
  23930. name: "ElCollapse"
  23931. });
  23932. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  23933. ...__default__$1g,
  23934. props: collapseProps,
  23935. emits: collapseEmits,
  23936. setup(__props, { expose, emit }) {
  23937. const props = __props;
  23938. const { activeNames, setActiveNames } = useCollapse(props, emit);
  23939. const { rootKls } = useCollapseDOM();
  23940. expose({
  23941. activeNames,
  23942. setActiveNames
  23943. });
  23944. return (_ctx, _cache) => {
  23945. return vue.openBlock(), vue.createElementBlock("div", {
  23946. class: vue.normalizeClass(vue.unref(rootKls))
  23947. }, [
  23948. vue.renderSlot(_ctx.$slots, "default")
  23949. ], 2);
  23950. };
  23951. }
  23952. });
  23953. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "collapse.vue"]]);
  23954. const __default__$1f = vue.defineComponent({
  23955. name: "ElCollapseTransition"
  23956. });
  23957. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  23958. ...__default__$1f,
  23959. setup(__props) {
  23960. const ns = useNamespace("collapse-transition");
  23961. const reset = (el) => {
  23962. el.style.maxHeight = "";
  23963. el.style.overflow = el.dataset.oldOverflow;
  23964. el.style.paddingTop = el.dataset.oldPaddingTop;
  23965. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23966. };
  23967. const on = {
  23968. beforeEnter(el) {
  23969. if (!el.dataset)
  23970. el.dataset = {};
  23971. el.dataset.oldPaddingTop = el.style.paddingTop;
  23972. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23973. if (el.style.height)
  23974. el.dataset.elExistsHeight = el.style.height;
  23975. el.style.maxHeight = 0;
  23976. el.style.paddingTop = 0;
  23977. el.style.paddingBottom = 0;
  23978. },
  23979. enter(el) {
  23980. requestAnimationFrame(() => {
  23981. el.dataset.oldOverflow = el.style.overflow;
  23982. if (el.dataset.elExistsHeight) {
  23983. el.style.maxHeight = el.dataset.elExistsHeight;
  23984. } else if (el.scrollHeight !== 0) {
  23985. el.style.maxHeight = `${el.scrollHeight}px`;
  23986. } else {
  23987. el.style.maxHeight = 0;
  23988. }
  23989. el.style.paddingTop = el.dataset.oldPaddingTop;
  23990. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23991. el.style.overflow = "hidden";
  23992. });
  23993. },
  23994. afterEnter(el) {
  23995. el.style.maxHeight = "";
  23996. el.style.overflow = el.dataset.oldOverflow;
  23997. },
  23998. enterCancelled(el) {
  23999. reset(el);
  24000. },
  24001. beforeLeave(el) {
  24002. if (!el.dataset)
  24003. el.dataset = {};
  24004. el.dataset.oldPaddingTop = el.style.paddingTop;
  24005. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  24006. el.dataset.oldOverflow = el.style.overflow;
  24007. el.style.maxHeight = `${el.scrollHeight}px`;
  24008. el.style.overflow = "hidden";
  24009. },
  24010. leave(el) {
  24011. if (el.scrollHeight !== 0) {
  24012. el.style.maxHeight = 0;
  24013. el.style.paddingTop = 0;
  24014. el.style.paddingBottom = 0;
  24015. }
  24016. },
  24017. afterLeave(el) {
  24018. reset(el);
  24019. },
  24020. leaveCancelled(el) {
  24021. reset(el);
  24022. }
  24023. };
  24024. return (_ctx, _cache) => {
  24025. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  24026. name: vue.unref(ns).b()
  24027. }, vue.toHandlers(on)), {
  24028. default: vue.withCtx(() => [
  24029. vue.renderSlot(_ctx.$slots, "default")
  24030. ]),
  24031. _: 3
  24032. }, 16, ["name"]);
  24033. };
  24034. }
  24035. });
  24036. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "collapse-transition.vue"]]);
  24037. const ElCollapseTransition = withInstall(CollapseTransition);
  24038. const collapseItemProps = buildProps({
  24039. title: {
  24040. type: String,
  24041. default: ""
  24042. },
  24043. name: {
  24044. type: definePropType([String, Number]),
  24045. default: void 0
  24046. },
  24047. icon: {
  24048. type: iconPropType,
  24049. default: arrow_right_default
  24050. },
  24051. disabled: Boolean
  24052. });
  24053. const useCollapseItem = (props) => {
  24054. const collapse = vue.inject(collapseContextKey);
  24055. const { namespace } = useNamespace("collapse");
  24056. const focusing = vue.ref(false);
  24057. const isClick = vue.ref(false);
  24058. const idInjection = useIdInjection();
  24059. const id = vue.computed(() => idInjection.current++);
  24060. const name = vue.computed(() => {
  24061. var _a;
  24062. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${vue.unref(id)}`;
  24063. });
  24064. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(vue.unref(name)));
  24065. const handleFocus = () => {
  24066. setTimeout(() => {
  24067. if (!isClick.value) {
  24068. focusing.value = true;
  24069. } else {
  24070. isClick.value = false;
  24071. }
  24072. }, 50);
  24073. };
  24074. const handleHeaderClick = () => {
  24075. if (props.disabled)
  24076. return;
  24077. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  24078. focusing.value = false;
  24079. isClick.value = true;
  24080. };
  24081. const handleEnterClick = () => {
  24082. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  24083. };
  24084. return {
  24085. focusing,
  24086. id,
  24087. isActive,
  24088. handleFocus,
  24089. handleHeaderClick,
  24090. handleEnterClick
  24091. };
  24092. };
  24093. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  24094. const ns = useNamespace("collapse");
  24095. const rootKls = vue.computed(() => [
  24096. ns.b("item"),
  24097. ns.is("active", vue.unref(isActive)),
  24098. ns.is("disabled", props.disabled)
  24099. ]);
  24100. const headKls = vue.computed(() => [
  24101. ns.be("item", "header"),
  24102. ns.is("active", vue.unref(isActive)),
  24103. { focusing: vue.unref(focusing) && !props.disabled }
  24104. ]);
  24105. const arrowKls = vue.computed(() => [
  24106. ns.be("item", "arrow"),
  24107. ns.is("active", vue.unref(isActive))
  24108. ]);
  24109. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  24110. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  24111. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  24112. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  24113. return {
  24114. arrowKls,
  24115. headKls,
  24116. rootKls,
  24117. itemWrapperKls,
  24118. itemContentKls,
  24119. scopedContentId,
  24120. scopedHeadId
  24121. };
  24122. };
  24123. const __default__$1e = vue.defineComponent({
  24124. name: "ElCollapseItem"
  24125. });
  24126. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  24127. ...__default__$1e,
  24128. props: collapseItemProps,
  24129. setup(__props, { expose }) {
  24130. const props = __props;
  24131. const {
  24132. focusing,
  24133. id,
  24134. isActive,
  24135. handleFocus,
  24136. handleHeaderClick,
  24137. handleEnterClick
  24138. } = useCollapseItem(props);
  24139. const {
  24140. arrowKls,
  24141. headKls,
  24142. rootKls,
  24143. itemWrapperKls,
  24144. itemContentKls,
  24145. scopedContentId,
  24146. scopedHeadId
  24147. } = useCollapseItemDOM(props, { focusing, isActive, id });
  24148. expose({
  24149. isActive
  24150. });
  24151. return (_ctx, _cache) => {
  24152. return vue.openBlock(), vue.createElementBlock("div", {
  24153. class: vue.normalizeClass(vue.unref(rootKls))
  24154. }, [
  24155. vue.createElementVNode("button", {
  24156. id: vue.unref(scopedHeadId),
  24157. class: vue.normalizeClass(vue.unref(headKls)),
  24158. "aria-expanded": vue.unref(isActive),
  24159. "aria-controls": vue.unref(scopedContentId),
  24160. "aria-describedby": vue.unref(scopedContentId),
  24161. tabindex: _ctx.disabled ? -1 : 0,
  24162. type: "button",
  24163. onClick: vue.unref(handleHeaderClick),
  24164. onKeydown: vue.withKeys(vue.withModifiers(vue.unref(handleEnterClick), ["stop", "prevent"]), ["space", "enter"]),
  24165. onFocus: vue.unref(handleFocus),
  24166. onBlur: ($event) => focusing.value = false
  24167. }, [
  24168. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  24169. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  24170. ]),
  24171. vue.renderSlot(_ctx.$slots, "icon", { isActive: vue.unref(isActive) }, () => [
  24172. vue.createVNode(vue.unref(ElIcon), {
  24173. class: vue.normalizeClass(vue.unref(arrowKls))
  24174. }, {
  24175. default: vue.withCtx(() => [
  24176. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  24177. ]),
  24178. _: 1
  24179. }, 8, ["class"])
  24180. ])
  24181. ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
  24182. vue.createVNode(vue.unref(ElCollapseTransition), null, {
  24183. default: vue.withCtx(() => [
  24184. vue.withDirectives(vue.createElementVNode("div", {
  24185. id: vue.unref(scopedContentId),
  24186. role: "region",
  24187. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  24188. "aria-hidden": !vue.unref(isActive),
  24189. "aria-labelledby": vue.unref(scopedHeadId)
  24190. }, [
  24191. vue.createElementVNode("div", {
  24192. class: vue.normalizeClass(vue.unref(itemContentKls))
  24193. }, [
  24194. vue.renderSlot(_ctx.$slots, "default")
  24195. ], 2)
  24196. ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
  24197. [vue.vShow, vue.unref(isActive)]
  24198. ])
  24199. ]),
  24200. _: 3
  24201. })
  24202. ], 2);
  24203. };
  24204. }
  24205. });
  24206. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "collapse-item.vue"]]);
  24207. const ElCollapse = withInstall(Collapse, {
  24208. CollapseItem
  24209. });
  24210. const ElCollapseItem = withNoopInstall(CollapseItem);
  24211. const alphaSliderProps = buildProps({
  24212. color: {
  24213. type: definePropType(Object),
  24214. required: true
  24215. },
  24216. vertical: {
  24217. type: Boolean,
  24218. default: false
  24219. }
  24220. });
  24221. let isDragging = false;
  24222. function draggable(element, options) {
  24223. if (!isClient)
  24224. return;
  24225. const moveFn = function(event) {
  24226. var _a;
  24227. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  24228. };
  24229. const upFn = function(event) {
  24230. var _a;
  24231. document.removeEventListener("mousemove", moveFn);
  24232. document.removeEventListener("mouseup", upFn);
  24233. document.removeEventListener("touchmove", moveFn);
  24234. document.removeEventListener("touchend", upFn);
  24235. document.onselectstart = null;
  24236. document.ondragstart = null;
  24237. isDragging = false;
  24238. (_a = options.end) == null ? void 0 : _a.call(options, event);
  24239. };
  24240. const downFn = function(event) {
  24241. var _a;
  24242. if (isDragging)
  24243. return;
  24244. event.preventDefault();
  24245. document.onselectstart = () => false;
  24246. document.ondragstart = () => false;
  24247. document.addEventListener("mousemove", moveFn);
  24248. document.addEventListener("mouseup", upFn);
  24249. document.addEventListener("touchmove", moveFn);
  24250. document.addEventListener("touchend", upFn);
  24251. isDragging = true;
  24252. (_a = options.start) == null ? void 0 : _a.call(options, event);
  24253. };
  24254. element.addEventListener("mousedown", downFn);
  24255. element.addEventListener("touchstart", downFn, { passive: false });
  24256. }
  24257. const useAlphaSlider = (props) => {
  24258. const instance = vue.getCurrentInstance();
  24259. const { t } = useLocale();
  24260. const thumb = vue.shallowRef();
  24261. const bar = vue.shallowRef();
  24262. const alpha = vue.computed(() => props.color.get("alpha"));
  24263. const alphaLabel = vue.computed(() => t("el.colorpicker.alphaLabel"));
  24264. function handleClick(event) {
  24265. var _a;
  24266. const target = event.target;
  24267. if (target !== thumb.value) {
  24268. handleDrag(event);
  24269. }
  24270. (_a = thumb.value) == null ? void 0 : _a.focus();
  24271. }
  24272. function handleDrag(event) {
  24273. if (!bar.value || !thumb.value)
  24274. return;
  24275. const el = instance.vnode.el;
  24276. const rect = el.getBoundingClientRect();
  24277. const { clientX, clientY } = getClientXY(event);
  24278. if (!props.vertical) {
  24279. let left = clientX - rect.left;
  24280. left = Math.max(thumb.value.offsetWidth / 2, left);
  24281. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24282. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  24283. } else {
  24284. let top = clientY - rect.top;
  24285. top = Math.max(thumb.value.offsetHeight / 2, top);
  24286. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24287. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  24288. }
  24289. }
  24290. function handleKeydown(event) {
  24291. const { code, shiftKey } = event;
  24292. const step = shiftKey ? 10 : 1;
  24293. switch (code) {
  24294. case EVENT_CODE.left:
  24295. case EVENT_CODE.down:
  24296. event.preventDefault();
  24297. event.stopPropagation();
  24298. incrementPosition(-step);
  24299. break;
  24300. case EVENT_CODE.right:
  24301. case EVENT_CODE.up:
  24302. event.preventDefault();
  24303. event.stopPropagation();
  24304. incrementPosition(step);
  24305. break;
  24306. }
  24307. }
  24308. function incrementPosition(step) {
  24309. let next = alpha.value + step;
  24310. next = next < 0 ? 0 : next > 100 ? 100 : next;
  24311. props.color.set("alpha", next);
  24312. }
  24313. return {
  24314. thumb,
  24315. bar,
  24316. alpha,
  24317. alphaLabel,
  24318. handleDrag,
  24319. handleClick,
  24320. handleKeydown
  24321. };
  24322. };
  24323. const useAlphaSliderDOM = (props, {
  24324. bar,
  24325. thumb,
  24326. handleDrag
  24327. }) => {
  24328. const instance = vue.getCurrentInstance();
  24329. const ns = useNamespace("color-alpha-slider");
  24330. const thumbLeft = vue.ref(0);
  24331. const thumbTop = vue.ref(0);
  24332. const background = vue.ref();
  24333. function getThumbLeft() {
  24334. if (!thumb.value)
  24335. return 0;
  24336. if (props.vertical)
  24337. return 0;
  24338. const el = instance.vnode.el;
  24339. const alpha = props.color.get("alpha");
  24340. if (!el)
  24341. return 0;
  24342. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  24343. }
  24344. function getThumbTop() {
  24345. if (!thumb.value)
  24346. return 0;
  24347. const el = instance.vnode.el;
  24348. if (!props.vertical)
  24349. return 0;
  24350. const alpha = props.color.get("alpha");
  24351. if (!el)
  24352. return 0;
  24353. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  24354. }
  24355. function getBackground() {
  24356. if (props.color && props.color.value) {
  24357. const { r, g, b } = props.color.toRgb();
  24358. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  24359. }
  24360. return "";
  24361. }
  24362. function update() {
  24363. thumbLeft.value = getThumbLeft();
  24364. thumbTop.value = getThumbTop();
  24365. background.value = getBackground();
  24366. }
  24367. vue.onMounted(() => {
  24368. if (!bar.value || !thumb.value)
  24369. return;
  24370. const dragConfig = {
  24371. drag: (event) => {
  24372. handleDrag(event);
  24373. },
  24374. end: (event) => {
  24375. handleDrag(event);
  24376. }
  24377. };
  24378. draggable(bar.value, dragConfig);
  24379. draggable(thumb.value, dragConfig);
  24380. update();
  24381. });
  24382. vue.watch(() => props.color.get("alpha"), () => update());
  24383. vue.watch(() => props.color.value, () => update());
  24384. const rootKls = vue.computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  24385. const barKls = vue.computed(() => ns.e("bar"));
  24386. const thumbKls = vue.computed(() => ns.e("thumb"));
  24387. const barStyle = vue.computed(() => ({ background: background.value }));
  24388. const thumbStyle = vue.computed(() => ({
  24389. left: addUnit(thumbLeft.value),
  24390. top: addUnit(thumbTop.value)
  24391. }));
  24392. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  24393. };
  24394. const COMPONENT_NAME$e = "ElColorAlphaSlider";
  24395. const __default__$1d = vue.defineComponent({
  24396. name: COMPONENT_NAME$e
  24397. });
  24398. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  24399. ...__default__$1d,
  24400. props: alphaSliderProps,
  24401. setup(__props, { expose }) {
  24402. const props = __props;
  24403. const {
  24404. alpha,
  24405. alphaLabel,
  24406. bar,
  24407. thumb,
  24408. handleDrag,
  24409. handleClick,
  24410. handleKeydown
  24411. } = useAlphaSlider(props);
  24412. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  24413. bar,
  24414. thumb,
  24415. handleDrag
  24416. });
  24417. expose({
  24418. update,
  24419. bar,
  24420. thumb
  24421. });
  24422. return (_ctx, _cache) => {
  24423. return vue.openBlock(), vue.createElementBlock("div", {
  24424. class: vue.normalizeClass(vue.unref(rootKls))
  24425. }, [
  24426. vue.createElementVNode("div", {
  24427. ref_key: "bar",
  24428. ref: bar,
  24429. class: vue.normalizeClass(vue.unref(barKls)),
  24430. style: vue.normalizeStyle(vue.unref(barStyle)),
  24431. onClick: vue.unref(handleClick)
  24432. }, null, 14, ["onClick"]),
  24433. vue.createElementVNode("div", {
  24434. ref_key: "thumb",
  24435. ref: thumb,
  24436. class: vue.normalizeClass(vue.unref(thumbKls)),
  24437. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  24438. "aria-label": vue.unref(alphaLabel),
  24439. "aria-valuenow": vue.unref(alpha),
  24440. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  24441. "aria-valuemin": "0",
  24442. "aria-valuemax": "100",
  24443. role: "slider",
  24444. tabindex: "0",
  24445. onKeydown: vue.unref(handleKeydown)
  24446. }, null, 46, ["aria-label", "aria-valuenow", "aria-orientation", "onKeydown"])
  24447. ], 2);
  24448. };
  24449. }
  24450. });
  24451. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "alpha-slider.vue"]]);
  24452. const _sfc_main$1H = vue.defineComponent({
  24453. name: "ElColorHueSlider",
  24454. props: {
  24455. color: {
  24456. type: Object,
  24457. required: true
  24458. },
  24459. vertical: Boolean
  24460. },
  24461. setup(props) {
  24462. const ns = useNamespace("color-hue-slider");
  24463. const instance = vue.getCurrentInstance();
  24464. const thumb = vue.ref();
  24465. const bar = vue.ref();
  24466. const thumbLeft = vue.ref(0);
  24467. const thumbTop = vue.ref(0);
  24468. const hueValue = vue.computed(() => {
  24469. return props.color.get("hue");
  24470. });
  24471. vue.watch(() => hueValue.value, () => {
  24472. update();
  24473. });
  24474. function handleClick(event) {
  24475. const target = event.target;
  24476. if (target !== thumb.value) {
  24477. handleDrag(event);
  24478. }
  24479. }
  24480. function handleDrag(event) {
  24481. if (!bar.value || !thumb.value)
  24482. return;
  24483. const el = instance.vnode.el;
  24484. const rect = el.getBoundingClientRect();
  24485. const { clientX, clientY } = getClientXY(event);
  24486. let hue;
  24487. if (!props.vertical) {
  24488. let left = clientX - rect.left;
  24489. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24490. left = Math.max(thumb.value.offsetWidth / 2, left);
  24491. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  24492. } else {
  24493. let top = clientY - rect.top;
  24494. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24495. top = Math.max(thumb.value.offsetHeight / 2, top);
  24496. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  24497. }
  24498. props.color.set("hue", hue);
  24499. }
  24500. function getThumbLeft() {
  24501. if (!thumb.value)
  24502. return 0;
  24503. const el = instance.vnode.el;
  24504. if (props.vertical)
  24505. return 0;
  24506. const hue = props.color.get("hue");
  24507. if (!el)
  24508. return 0;
  24509. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  24510. }
  24511. function getThumbTop() {
  24512. if (!thumb.value)
  24513. return 0;
  24514. const el = instance.vnode.el;
  24515. if (!props.vertical)
  24516. return 0;
  24517. const hue = props.color.get("hue");
  24518. if (!el)
  24519. return 0;
  24520. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  24521. }
  24522. function update() {
  24523. thumbLeft.value = getThumbLeft();
  24524. thumbTop.value = getThumbTop();
  24525. }
  24526. vue.onMounted(() => {
  24527. if (!bar.value || !thumb.value)
  24528. return;
  24529. const dragConfig = {
  24530. drag: (event) => {
  24531. handleDrag(event);
  24532. },
  24533. end: (event) => {
  24534. handleDrag(event);
  24535. }
  24536. };
  24537. draggable(bar.value, dragConfig);
  24538. draggable(thumb.value, dragConfig);
  24539. update();
  24540. });
  24541. return {
  24542. bar,
  24543. thumb,
  24544. thumbLeft,
  24545. thumbTop,
  24546. hueValue,
  24547. handleClick,
  24548. update,
  24549. ns
  24550. };
  24551. }
  24552. });
  24553. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  24554. return vue.openBlock(), vue.createElementBlock("div", {
  24555. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  24556. }, [
  24557. vue.createElementVNode("div", {
  24558. ref: "bar",
  24559. class: vue.normalizeClass(_ctx.ns.e("bar")),
  24560. onClick: _ctx.handleClick
  24561. }, null, 10, ["onClick"]),
  24562. vue.createElementVNode("div", {
  24563. ref: "thumb",
  24564. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  24565. style: vue.normalizeStyle({
  24566. left: _ctx.thumbLeft + "px",
  24567. top: _ctx.thumbTop + "px"
  24568. })
  24569. }, null, 6)
  24570. ], 2);
  24571. }
  24572. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["render", _sfc_render$n], ["__file", "hue-slider.vue"]]);
  24573. const colorPickerProps = buildProps({
  24574. modelValue: String,
  24575. id: String,
  24576. showAlpha: Boolean,
  24577. colorFormat: String,
  24578. disabled: Boolean,
  24579. size: useSizeProp,
  24580. popperClass: {
  24581. type: String,
  24582. default: ""
  24583. },
  24584. tabindex: {
  24585. type: [String, Number],
  24586. default: 0
  24587. },
  24588. teleported: useTooltipContentProps.teleported,
  24589. predefine: {
  24590. type: definePropType(Array)
  24591. },
  24592. validateEvent: {
  24593. type: Boolean,
  24594. default: true
  24595. },
  24596. ...useAriaProps(["ariaLabel"])
  24597. });
  24598. const colorPickerEmits = {
  24599. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  24600. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  24601. activeChange: (val) => isString$1(val) || isNil(val),
  24602. focus: (evt) => evt instanceof FocusEvent,
  24603. blur: (evt) => evt instanceof FocusEvent
  24604. };
  24605. const colorPickerContextKey = Symbol("colorPickerContextKey");
  24606. const hsv2hsl = function(hue, sat, val) {
  24607. return [
  24608. hue,
  24609. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  24610. hue / 2
  24611. ];
  24612. };
  24613. const isOnePointZero = function(n) {
  24614. return isString$1(n) && n.includes(".") && Number.parseFloat(n) === 1;
  24615. };
  24616. const isPercentage = function(n) {
  24617. return isString$1(n) && n.includes("%");
  24618. };
  24619. const bound01 = function(value, max) {
  24620. if (isOnePointZero(value))
  24621. value = "100%";
  24622. const processPercent = isPercentage(value);
  24623. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  24624. if (processPercent) {
  24625. value = Number.parseInt(`${value * max}`, 10) / 100;
  24626. }
  24627. if (Math.abs(value - max) < 1e-6) {
  24628. return 1;
  24629. }
  24630. return value % max / Number.parseFloat(max);
  24631. };
  24632. const INT_HEX_MAP = {
  24633. 10: "A",
  24634. 11: "B",
  24635. 12: "C",
  24636. 13: "D",
  24637. 14: "E",
  24638. 15: "F"
  24639. };
  24640. const hexOne = (value) => {
  24641. value = Math.min(Math.round(value), 255);
  24642. const high = Math.floor(value / 16);
  24643. const low = value % 16;
  24644. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  24645. };
  24646. const toHex = function({ r, g, b }) {
  24647. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  24648. return "";
  24649. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  24650. };
  24651. const HEX_INT_MAP = {
  24652. A: 10,
  24653. B: 11,
  24654. C: 12,
  24655. D: 13,
  24656. E: 14,
  24657. F: 15
  24658. };
  24659. const parseHexChannel = function(hex) {
  24660. if (hex.length === 2) {
  24661. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  24662. }
  24663. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  24664. };
  24665. const hsl2hsv = function(hue, sat, light) {
  24666. sat = sat / 100;
  24667. light = light / 100;
  24668. let smin = sat;
  24669. const lmin = Math.max(light, 0.01);
  24670. light *= 2;
  24671. sat *= light <= 1 ? light : 2 - light;
  24672. smin *= lmin <= 1 ? lmin : 2 - lmin;
  24673. const v = (light + sat) / 2;
  24674. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  24675. return {
  24676. h: hue,
  24677. s: sv * 100,
  24678. v: v * 100
  24679. };
  24680. };
  24681. const rgb2hsv = (r, g, b) => {
  24682. r = bound01(r, 255);
  24683. g = bound01(g, 255);
  24684. b = bound01(b, 255);
  24685. const max = Math.max(r, g, b);
  24686. const min = Math.min(r, g, b);
  24687. let h;
  24688. const v = max;
  24689. const d = max - min;
  24690. const s = max === 0 ? 0 : d / max;
  24691. if (max === min) {
  24692. h = 0;
  24693. } else {
  24694. switch (max) {
  24695. case r: {
  24696. h = (g - b) / d + (g < b ? 6 : 0);
  24697. break;
  24698. }
  24699. case g: {
  24700. h = (b - r) / d + 2;
  24701. break;
  24702. }
  24703. case b: {
  24704. h = (r - g) / d + 4;
  24705. break;
  24706. }
  24707. }
  24708. h /= 6;
  24709. }
  24710. return { h: h * 360, s: s * 100, v: v * 100 };
  24711. };
  24712. const hsv2rgb = function(h, s, v) {
  24713. h = bound01(h, 360) * 6;
  24714. s = bound01(s, 100);
  24715. v = bound01(v, 100);
  24716. const i = Math.floor(h);
  24717. const f = h - i;
  24718. const p = v * (1 - s);
  24719. const q = v * (1 - f * s);
  24720. const t = v * (1 - (1 - f) * s);
  24721. const mod = i % 6;
  24722. const r = [v, q, p, p, t, v][mod];
  24723. const g = [t, v, v, q, p, p][mod];
  24724. const b = [p, p, t, v, v, q][mod];
  24725. return {
  24726. r: Math.round(r * 255),
  24727. g: Math.round(g * 255),
  24728. b: Math.round(b * 255)
  24729. };
  24730. };
  24731. class Color {
  24732. constructor(options = {}) {
  24733. this._hue = 0;
  24734. this._saturation = 100;
  24735. this._value = 100;
  24736. this._alpha = 100;
  24737. this.enableAlpha = false;
  24738. this.format = "hex";
  24739. this.value = "";
  24740. for (const option in options) {
  24741. if (hasOwn(options, option)) {
  24742. this[option] = options[option];
  24743. }
  24744. }
  24745. if (options.value) {
  24746. this.fromString(options.value);
  24747. } else {
  24748. this.doOnChange();
  24749. }
  24750. }
  24751. set(prop, value) {
  24752. if (arguments.length === 1 && typeof prop === "object") {
  24753. for (const p in prop) {
  24754. if (hasOwn(prop, p)) {
  24755. this.set(p, prop[p]);
  24756. }
  24757. }
  24758. return;
  24759. }
  24760. this[`_${prop}`] = value;
  24761. this.doOnChange();
  24762. }
  24763. get(prop) {
  24764. if (prop === "alpha") {
  24765. return Math.floor(this[`_${prop}`]);
  24766. }
  24767. return this[`_${prop}`];
  24768. }
  24769. toRgb() {
  24770. return hsv2rgb(this._hue, this._saturation, this._value);
  24771. }
  24772. fromString(value) {
  24773. if (!value) {
  24774. this._hue = 0;
  24775. this._saturation = 100;
  24776. this._value = 100;
  24777. this.doOnChange();
  24778. return;
  24779. }
  24780. const fromHSV = (h, s, v) => {
  24781. this._hue = Math.max(0, Math.min(360, h));
  24782. this._saturation = Math.max(0, Math.min(100, s));
  24783. this._value = Math.max(0, Math.min(100, v));
  24784. this.doOnChange();
  24785. };
  24786. if (value.includes("hsl")) {
  24787. const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24788. if (parts.length === 4) {
  24789. this._alpha = Number.parseFloat(parts[3]) * 100;
  24790. } else if (parts.length === 3) {
  24791. this._alpha = 100;
  24792. }
  24793. if (parts.length >= 3) {
  24794. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  24795. fromHSV(h, s, v);
  24796. }
  24797. } else if (value.includes("hsv")) {
  24798. const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24799. if (parts.length === 4) {
  24800. this._alpha = Number.parseFloat(parts[3]) * 100;
  24801. } else if (parts.length === 3) {
  24802. this._alpha = 100;
  24803. }
  24804. if (parts.length >= 3) {
  24805. fromHSV(parts[0], parts[1], parts[2]);
  24806. }
  24807. } else if (value.includes("rgb")) {
  24808. const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24809. if (parts.length === 4) {
  24810. this._alpha = Number.parseFloat(parts[3]) * 100;
  24811. } else if (parts.length === 3) {
  24812. this._alpha = 100;
  24813. }
  24814. if (parts.length >= 3) {
  24815. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  24816. fromHSV(h, s, v);
  24817. }
  24818. } else if (value.includes("#")) {
  24819. const hex = value.replace("#", "").trim();
  24820. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  24821. return;
  24822. let r, g, b;
  24823. if (hex.length === 3) {
  24824. r = parseHexChannel(hex[0] + hex[0]);
  24825. g = parseHexChannel(hex[1] + hex[1]);
  24826. b = parseHexChannel(hex[2] + hex[2]);
  24827. } else if (hex.length === 6 || hex.length === 8) {
  24828. r = parseHexChannel(hex.slice(0, 2));
  24829. g = parseHexChannel(hex.slice(2, 4));
  24830. b = parseHexChannel(hex.slice(4, 6));
  24831. }
  24832. if (hex.length === 8) {
  24833. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  24834. } else if (hex.length === 3 || hex.length === 6) {
  24835. this._alpha = 100;
  24836. }
  24837. const { h, s, v } = rgb2hsv(r, g, b);
  24838. fromHSV(h, s, v);
  24839. }
  24840. }
  24841. compare(color) {
  24842. 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;
  24843. }
  24844. doOnChange() {
  24845. const { _hue, _saturation, _value, _alpha, format } = this;
  24846. if (this.enableAlpha) {
  24847. switch (format) {
  24848. case "hsl": {
  24849. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24850. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  24851. break;
  24852. }
  24853. case "hsv": {
  24854. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  24855. break;
  24856. }
  24857. case "hex": {
  24858. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  24859. break;
  24860. }
  24861. default: {
  24862. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24863. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  24864. }
  24865. }
  24866. } else {
  24867. switch (format) {
  24868. case "hsl": {
  24869. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24870. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  24871. break;
  24872. }
  24873. case "hsv": {
  24874. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  24875. break;
  24876. }
  24877. case "rgb": {
  24878. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24879. this.value = `rgb(${r}, ${g}, ${b})`;
  24880. break;
  24881. }
  24882. default: {
  24883. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  24884. }
  24885. }
  24886. }
  24887. }
  24888. }
  24889. const _sfc_main$1G = vue.defineComponent({
  24890. props: {
  24891. colors: {
  24892. type: Array,
  24893. required: true
  24894. },
  24895. color: {
  24896. type: Object,
  24897. required: true
  24898. },
  24899. enableAlpha: {
  24900. type: Boolean,
  24901. required: true
  24902. }
  24903. },
  24904. setup(props) {
  24905. const ns = useNamespace("color-predefine");
  24906. const { currentColor } = vue.inject(colorPickerContextKey);
  24907. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  24908. vue.watch(() => currentColor.value, (val) => {
  24909. const color = new Color();
  24910. color.fromString(val);
  24911. rgbaColors.value.forEach((item) => {
  24912. item.selected = color.compare(item);
  24913. });
  24914. });
  24915. vue.watchEffect(() => {
  24916. rgbaColors.value = parseColors(props.colors, props.color);
  24917. });
  24918. function handleSelect(index) {
  24919. props.color.fromString(props.colors[index]);
  24920. }
  24921. function parseColors(colors, color) {
  24922. return colors.map((value) => {
  24923. const c = new Color();
  24924. c.enableAlpha = props.enableAlpha;
  24925. c.format = "rgba";
  24926. c.fromString(value);
  24927. c.selected = c.value === color.value;
  24928. return c;
  24929. });
  24930. }
  24931. return {
  24932. rgbaColors,
  24933. handleSelect,
  24934. ns
  24935. };
  24936. }
  24937. });
  24938. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  24939. return vue.openBlock(), vue.createElementBlock("div", {
  24940. class: vue.normalizeClass(_ctx.ns.b())
  24941. }, [
  24942. vue.createElementVNode("div", {
  24943. class: vue.normalizeClass(_ctx.ns.e("colors"))
  24944. }, [
  24945. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => {
  24946. return vue.openBlock(), vue.createElementBlock("div", {
  24947. key: _ctx.colors[index],
  24948. class: vue.normalizeClass([
  24949. _ctx.ns.e("color-selector"),
  24950. _ctx.ns.is("alpha", item._alpha < 100),
  24951. { selected: item.selected }
  24952. ]),
  24953. onClick: ($event) => _ctx.handleSelect(index)
  24954. }, [
  24955. vue.createElementVNode("div", {
  24956. style: vue.normalizeStyle({ backgroundColor: item.value })
  24957. }, null, 4)
  24958. ], 10, ["onClick"]);
  24959. }), 128))
  24960. ], 2)
  24961. ], 2);
  24962. }
  24963. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["render", _sfc_render$m], ["__file", "predefine.vue"]]);
  24964. const _sfc_main$1F = vue.defineComponent({
  24965. name: "ElSlPanel",
  24966. props: {
  24967. color: {
  24968. type: Object,
  24969. required: true
  24970. }
  24971. },
  24972. setup(props) {
  24973. const ns = useNamespace("color-svpanel");
  24974. const instance = vue.getCurrentInstance();
  24975. const cursorTop = vue.ref(0);
  24976. const cursorLeft = vue.ref(0);
  24977. const background = vue.ref("hsl(0, 100%, 50%)");
  24978. const colorValue = vue.computed(() => {
  24979. const hue = props.color.get("hue");
  24980. const value = props.color.get("value");
  24981. return { hue, value };
  24982. });
  24983. function update() {
  24984. const saturation = props.color.get("saturation");
  24985. const value = props.color.get("value");
  24986. const el = instance.vnode.el;
  24987. const { clientWidth: width, clientHeight: height } = el;
  24988. cursorLeft.value = saturation * width / 100;
  24989. cursorTop.value = (100 - value) * height / 100;
  24990. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  24991. }
  24992. function handleDrag(event) {
  24993. const el = instance.vnode.el;
  24994. const rect = el.getBoundingClientRect();
  24995. const { clientX, clientY } = getClientXY(event);
  24996. let left = clientX - rect.left;
  24997. let top = clientY - rect.top;
  24998. left = Math.max(0, left);
  24999. left = Math.min(left, rect.width);
  25000. top = Math.max(0, top);
  25001. top = Math.min(top, rect.height);
  25002. cursorLeft.value = left;
  25003. cursorTop.value = top;
  25004. props.color.set({
  25005. saturation: left / rect.width * 100,
  25006. value: 100 - top / rect.height * 100
  25007. });
  25008. }
  25009. vue.watch(() => colorValue.value, () => {
  25010. update();
  25011. });
  25012. vue.onMounted(() => {
  25013. draggable(instance.vnode.el, {
  25014. drag: (event) => {
  25015. handleDrag(event);
  25016. },
  25017. end: (event) => {
  25018. handleDrag(event);
  25019. }
  25020. });
  25021. update();
  25022. });
  25023. return {
  25024. cursorTop,
  25025. cursorLeft,
  25026. background,
  25027. colorValue,
  25028. handleDrag,
  25029. update,
  25030. ns
  25031. };
  25032. }
  25033. });
  25034. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  25035. return vue.openBlock(), vue.createElementBlock("div", {
  25036. class: vue.normalizeClass(_ctx.ns.b()),
  25037. style: vue.normalizeStyle({
  25038. backgroundColor: _ctx.background
  25039. })
  25040. }, [
  25041. vue.createElementVNode("div", {
  25042. class: vue.normalizeClass(_ctx.ns.e("white"))
  25043. }, null, 2),
  25044. vue.createElementVNode("div", {
  25045. class: vue.normalizeClass(_ctx.ns.e("black"))
  25046. }, null, 2),
  25047. vue.createElementVNode("div", {
  25048. class: vue.normalizeClass(_ctx.ns.e("cursor")),
  25049. style: vue.normalizeStyle({
  25050. top: _ctx.cursorTop + "px",
  25051. left: _ctx.cursorLeft + "px"
  25052. })
  25053. }, [
  25054. vue.createElementVNode("div")
  25055. ], 6)
  25056. ], 6);
  25057. }
  25058. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$l], ["__file", "sv-panel.vue"]]);
  25059. const __default__$1c = vue.defineComponent({
  25060. name: "ElColorPicker"
  25061. });
  25062. const _sfc_main$1E = /* @__PURE__ */ vue.defineComponent({
  25063. ...__default__$1c,
  25064. props: colorPickerProps,
  25065. emits: colorPickerEmits,
  25066. setup(__props, { expose, emit }) {
  25067. const props = __props;
  25068. const { t } = useLocale();
  25069. const ns = useNamespace("color");
  25070. const { formItem } = useFormItem();
  25071. const colorSize = useFormSize();
  25072. const colorDisabled = useFormDisabled();
  25073. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  25074. formItemContext: formItem
  25075. });
  25076. const hue = vue.ref();
  25077. const sv = vue.ref();
  25078. const alpha = vue.ref();
  25079. const popper = vue.ref();
  25080. const triggerRef = vue.ref();
  25081. const inputRef = vue.ref();
  25082. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  25083. beforeFocus() {
  25084. return colorDisabled.value;
  25085. },
  25086. beforeBlur(event) {
  25087. var _a;
  25088. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  25089. },
  25090. afterBlur() {
  25091. setShowPicker(false);
  25092. resetColor();
  25093. }
  25094. });
  25095. let shouldActiveChange = true;
  25096. const color = vue.reactive(new Color({
  25097. enableAlpha: props.showAlpha,
  25098. format: props.colorFormat || "",
  25099. value: props.modelValue
  25100. }));
  25101. const showPicker = vue.ref(false);
  25102. const showPanelColor = vue.ref(false);
  25103. const customInput = vue.ref("");
  25104. const displayedColor = vue.computed(() => {
  25105. if (!props.modelValue && !showPanelColor.value) {
  25106. return "transparent";
  25107. }
  25108. return displayedRgb(color, props.showAlpha);
  25109. });
  25110. const currentColor = vue.computed(() => {
  25111. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  25112. });
  25113. const buttonAriaLabel = vue.computed(() => {
  25114. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  25115. });
  25116. const buttonAriaLabelledby = vue.computed(() => {
  25117. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  25118. });
  25119. const btnKls = vue.computed(() => {
  25120. return [
  25121. ns.b("picker"),
  25122. ns.is("disabled", colorDisabled.value),
  25123. ns.bm("picker", colorSize.value),
  25124. ns.is("focused", isFocused.value)
  25125. ];
  25126. });
  25127. function displayedRgb(color2, showAlpha) {
  25128. if (!(color2 instanceof Color)) {
  25129. throw new TypeError("color should be instance of _color Class");
  25130. }
  25131. const { r, g, b } = color2.toRgb();
  25132. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  25133. }
  25134. function setShowPicker(value) {
  25135. showPicker.value = value;
  25136. }
  25137. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  25138. function show() {
  25139. if (colorDisabled.value)
  25140. return;
  25141. setShowPicker(true);
  25142. }
  25143. function hide() {
  25144. debounceSetShowPicker(false);
  25145. resetColor();
  25146. }
  25147. function resetColor() {
  25148. vue.nextTick(() => {
  25149. if (props.modelValue) {
  25150. color.fromString(props.modelValue);
  25151. } else {
  25152. color.value = "";
  25153. vue.nextTick(() => {
  25154. showPanelColor.value = false;
  25155. });
  25156. }
  25157. });
  25158. }
  25159. function handleTrigger() {
  25160. if (colorDisabled.value)
  25161. return;
  25162. if (showPicker.value) {
  25163. resetColor();
  25164. }
  25165. debounceSetShowPicker(!showPicker.value);
  25166. }
  25167. function handleConfirm() {
  25168. color.fromString(customInput.value);
  25169. }
  25170. function confirmValue() {
  25171. const value = color.value;
  25172. emit(UPDATE_MODEL_EVENT, value);
  25173. emit(CHANGE_EVENT, value);
  25174. if (props.validateEvent) {
  25175. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25176. }
  25177. debounceSetShowPicker(false);
  25178. vue.nextTick(() => {
  25179. const newColor = new Color({
  25180. enableAlpha: props.showAlpha,
  25181. format: props.colorFormat || "",
  25182. value: props.modelValue
  25183. });
  25184. if (!color.compare(newColor)) {
  25185. resetColor();
  25186. }
  25187. });
  25188. }
  25189. function clear() {
  25190. debounceSetShowPicker(false);
  25191. emit(UPDATE_MODEL_EVENT, null);
  25192. emit(CHANGE_EVENT, null);
  25193. if (props.modelValue !== null && props.validateEvent) {
  25194. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25195. }
  25196. resetColor();
  25197. }
  25198. function handleClickOutside() {
  25199. if (!showPicker.value)
  25200. return;
  25201. hide();
  25202. isFocused.value && focus();
  25203. }
  25204. function handleEsc(event) {
  25205. event.preventDefault();
  25206. event.stopPropagation();
  25207. setShowPicker(false);
  25208. resetColor();
  25209. }
  25210. function handleKeyDown(event) {
  25211. switch (event.code) {
  25212. case EVENT_CODE.enter:
  25213. case EVENT_CODE.numpadEnter:
  25214. case EVENT_CODE.space:
  25215. event.preventDefault();
  25216. event.stopPropagation();
  25217. show();
  25218. inputRef.value.focus();
  25219. break;
  25220. case EVENT_CODE.esc:
  25221. handleEsc(event);
  25222. break;
  25223. }
  25224. }
  25225. function focus() {
  25226. triggerRef.value.focus();
  25227. }
  25228. function blur() {
  25229. triggerRef.value.blur();
  25230. }
  25231. vue.onMounted(() => {
  25232. if (props.modelValue) {
  25233. customInput.value = currentColor.value;
  25234. }
  25235. });
  25236. vue.watch(() => props.modelValue, (newVal) => {
  25237. if (!newVal) {
  25238. showPanelColor.value = false;
  25239. } else if (newVal && newVal !== color.value) {
  25240. shouldActiveChange = false;
  25241. color.fromString(newVal);
  25242. }
  25243. });
  25244. vue.watch(() => [props.colorFormat, props.showAlpha], () => {
  25245. color.enableAlpha = props.showAlpha;
  25246. color.format = props.colorFormat || color.format;
  25247. color.doOnChange();
  25248. emit(UPDATE_MODEL_EVENT, color.value);
  25249. });
  25250. vue.watch(() => currentColor.value, (val) => {
  25251. customInput.value = val;
  25252. shouldActiveChange && emit("activeChange", val);
  25253. shouldActiveChange = true;
  25254. });
  25255. vue.watch(() => color.value, () => {
  25256. if (!props.modelValue && !showPanelColor.value) {
  25257. showPanelColor.value = true;
  25258. }
  25259. });
  25260. vue.watch(() => showPicker.value, () => {
  25261. vue.nextTick(() => {
  25262. var _a, _b, _c;
  25263. (_a = hue.value) == null ? void 0 : _a.update();
  25264. (_b = sv.value) == null ? void 0 : _b.update();
  25265. (_c = alpha.value) == null ? void 0 : _c.update();
  25266. });
  25267. });
  25268. vue.provide(colorPickerContextKey, {
  25269. currentColor
  25270. });
  25271. expose({
  25272. color,
  25273. show,
  25274. hide,
  25275. focus,
  25276. blur
  25277. });
  25278. return (_ctx, _cache) => {
  25279. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  25280. ref_key: "popper",
  25281. ref: popper,
  25282. visible: showPicker.value,
  25283. "show-arrow": false,
  25284. "fallback-placements": ["bottom", "top", "right", "left"],
  25285. offset: 0,
  25286. "gpu-acceleration": false,
  25287. "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass],
  25288. "stop-popper-mouse-event": false,
  25289. effect: "light",
  25290. trigger: "click",
  25291. teleported: _ctx.teleported,
  25292. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  25293. persistent: "",
  25294. onHide: ($event) => setShowPicker(false)
  25295. }, {
  25296. content: vue.withCtx(() => [
  25297. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  25298. onKeydown: vue.withKeys(handleEsc, ["esc"])
  25299. }, [
  25300. vue.createElementVNode("div", {
  25301. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper"))
  25302. }, [
  25303. vue.createVNode(HueSlider, {
  25304. ref_key: "hue",
  25305. ref: hue,
  25306. class: "hue-slider",
  25307. color: vue.unref(color),
  25308. vertical: ""
  25309. }, null, 8, ["color"]),
  25310. vue.createVNode(SvPanel, {
  25311. ref_key: "sv",
  25312. ref: sv,
  25313. color: vue.unref(color)
  25314. }, null, 8, ["color"])
  25315. ], 2),
  25316. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  25317. key: 0,
  25318. ref_key: "alpha",
  25319. ref: alpha,
  25320. color: vue.unref(color)
  25321. }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
  25322. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  25323. key: 1,
  25324. ref: "predefine",
  25325. "enable-alpha": _ctx.showAlpha,
  25326. color: vue.unref(color),
  25327. colors: _ctx.predefine
  25328. }, null, 8, ["enable-alpha", "color", "colors"])) : vue.createCommentVNode("v-if", true),
  25329. vue.createElementVNode("div", {
  25330. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns"))
  25331. }, [
  25332. vue.createElementVNode("span", {
  25333. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value"))
  25334. }, [
  25335. vue.createVNode(vue.unref(ElInput), {
  25336. ref_key: "inputRef",
  25337. ref: inputRef,
  25338. modelValue: customInput.value,
  25339. "onUpdate:modelValue": ($event) => customInput.value = $event,
  25340. "validate-event": false,
  25341. size: "small",
  25342. onKeyup: vue.withKeys(handleConfirm, ["enter"]),
  25343. onBlur: handleConfirm
  25344. }, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup"])
  25345. ], 2),
  25346. vue.createVNode(vue.unref(ElButton), {
  25347. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")),
  25348. text: "",
  25349. size: "small",
  25350. onClick: clear
  25351. }, {
  25352. default: vue.withCtx(() => [
  25353. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  25354. ]),
  25355. _: 1
  25356. }, 8, ["class"]),
  25357. vue.createVNode(vue.unref(ElButton), {
  25358. plain: "",
  25359. size: "small",
  25360. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")),
  25361. onClick: confirmValue
  25362. }, {
  25363. default: vue.withCtx(() => [
  25364. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  25365. ]),
  25366. _: 1
  25367. }, 8, ["class"])
  25368. ], 2)
  25369. ], 40, ["onKeydown"])), [
  25370. [vue.unref(ClickOutside), handleClickOutside, triggerRef.value]
  25371. ])
  25372. ]),
  25373. default: vue.withCtx(() => [
  25374. vue.createElementVNode("div", vue.mergeProps({
  25375. id: vue.unref(buttonId),
  25376. ref_key: "triggerRef",
  25377. ref: triggerRef
  25378. }, _ctx.$attrs, {
  25379. class: vue.unref(btnKls),
  25380. role: "button",
  25381. "aria-label": vue.unref(buttonAriaLabel),
  25382. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  25383. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  25384. "aria-disabled": vue.unref(colorDisabled),
  25385. tabindex: vue.unref(colorDisabled) ? void 0 : _ctx.tabindex,
  25386. onKeydown: handleKeyDown,
  25387. onFocus: vue.unref(handleFocus),
  25388. onBlur: vue.unref(handleBlur)
  25389. }), [
  25390. vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", {
  25391. key: 0,
  25392. class: vue.normalizeClass(vue.unref(ns).be("picker", "mask"))
  25393. }, null, 2)) : vue.createCommentVNode("v-if", true),
  25394. vue.createElementVNode("div", {
  25395. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  25396. onClick: handleTrigger
  25397. }, [
  25398. vue.createElementVNode("span", {
  25399. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  25400. }, [
  25401. vue.createElementVNode("span", {
  25402. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  25403. style: vue.normalizeStyle({
  25404. backgroundColor: vue.unref(displayedColor)
  25405. })
  25406. }, [
  25407. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25408. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  25409. }, {
  25410. default: vue.withCtx(() => [
  25411. vue.createVNode(vue.unref(arrow_down_default))
  25412. ]),
  25413. _: 1
  25414. }, 8, ["class"]), [
  25415. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  25416. ]),
  25417. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25418. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  25419. }, {
  25420. default: vue.withCtx(() => [
  25421. vue.createVNode(vue.unref(close_default))
  25422. ]),
  25423. _: 1
  25424. }, 8, ["class"]), [
  25425. [vue.vShow, !_ctx.modelValue && !showPanelColor.value]
  25426. ])
  25427. ], 6)
  25428. ], 2)
  25429. ], 2)
  25430. ], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
  25431. ]),
  25432. _: 1
  25433. }, 8, ["visible", "popper-class", "teleported", "transition", "onHide"]);
  25434. };
  25435. }
  25436. });
  25437. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__file", "color-picker.vue"]]);
  25438. const ElColorPicker = withInstall(ColorPicker);
  25439. const __default__$1b = vue.defineComponent({
  25440. name: "ElContainer"
  25441. });
  25442. const _sfc_main$1D = /* @__PURE__ */ vue.defineComponent({
  25443. ...__default__$1b,
  25444. props: {
  25445. direction: {
  25446. type: String
  25447. }
  25448. },
  25449. setup(__props) {
  25450. const props = __props;
  25451. const slots = vue.useSlots();
  25452. const ns = useNamespace("container");
  25453. const isVertical = vue.computed(() => {
  25454. if (props.direction === "vertical") {
  25455. return true;
  25456. } else if (props.direction === "horizontal") {
  25457. return false;
  25458. }
  25459. if (slots && slots.default) {
  25460. const vNodes = slots.default();
  25461. return vNodes.some((vNode) => {
  25462. const tag = vNode.type.name;
  25463. return tag === "ElHeader" || tag === "ElFooter";
  25464. });
  25465. } else {
  25466. return false;
  25467. }
  25468. });
  25469. return (_ctx, _cache) => {
  25470. return vue.openBlock(), vue.createElementBlock("section", {
  25471. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  25472. }, [
  25473. vue.renderSlot(_ctx.$slots, "default")
  25474. ], 2);
  25475. };
  25476. }
  25477. });
  25478. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "container.vue"]]);
  25479. const __default__$1a = vue.defineComponent({
  25480. name: "ElAside"
  25481. });
  25482. const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({
  25483. ...__default__$1a,
  25484. props: {
  25485. width: {
  25486. type: String,
  25487. default: null
  25488. }
  25489. },
  25490. setup(__props) {
  25491. const props = __props;
  25492. const ns = useNamespace("aside");
  25493. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  25494. return (_ctx, _cache) => {
  25495. return vue.openBlock(), vue.createElementBlock("aside", {
  25496. class: vue.normalizeClass(vue.unref(ns).b()),
  25497. style: vue.normalizeStyle(vue.unref(style))
  25498. }, [
  25499. vue.renderSlot(_ctx.$slots, "default")
  25500. ], 6);
  25501. };
  25502. }
  25503. });
  25504. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "aside.vue"]]);
  25505. const __default__$19 = vue.defineComponent({
  25506. name: "ElFooter"
  25507. });
  25508. const _sfc_main$1B = /* @__PURE__ */ vue.defineComponent({
  25509. ...__default__$19,
  25510. props: {
  25511. height: {
  25512. type: String,
  25513. default: null
  25514. }
  25515. },
  25516. setup(__props) {
  25517. const props = __props;
  25518. const ns = useNamespace("footer");
  25519. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  25520. return (_ctx, _cache) => {
  25521. return vue.openBlock(), vue.createElementBlock("footer", {
  25522. class: vue.normalizeClass(vue.unref(ns).b()),
  25523. style: vue.normalizeStyle(vue.unref(style))
  25524. }, [
  25525. vue.renderSlot(_ctx.$slots, "default")
  25526. ], 6);
  25527. };
  25528. }
  25529. });
  25530. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "footer.vue"]]);
  25531. const __default__$18 = vue.defineComponent({
  25532. name: "ElHeader"
  25533. });
  25534. const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({
  25535. ...__default__$18,
  25536. props: {
  25537. height: {
  25538. type: String,
  25539. default: null
  25540. }
  25541. },
  25542. setup(__props) {
  25543. const props = __props;
  25544. const ns = useNamespace("header");
  25545. const style = vue.computed(() => {
  25546. return props.height ? ns.cssVarBlock({
  25547. height: props.height
  25548. }) : {};
  25549. });
  25550. return (_ctx, _cache) => {
  25551. return vue.openBlock(), vue.createElementBlock("header", {
  25552. class: vue.normalizeClass(vue.unref(ns).b()),
  25553. style: vue.normalizeStyle(vue.unref(style))
  25554. }, [
  25555. vue.renderSlot(_ctx.$slots, "default")
  25556. ], 6);
  25557. };
  25558. }
  25559. });
  25560. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "header.vue"]]);
  25561. const __default__$17 = vue.defineComponent({
  25562. name: "ElMain"
  25563. });
  25564. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  25565. ...__default__$17,
  25566. setup(__props) {
  25567. const ns = useNamespace("main");
  25568. return (_ctx, _cache) => {
  25569. return vue.openBlock(), vue.createElementBlock("main", {
  25570. class: vue.normalizeClass(vue.unref(ns).b())
  25571. }, [
  25572. vue.renderSlot(_ctx.$slots, "default")
  25573. ], 2);
  25574. };
  25575. }
  25576. });
  25577. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "main.vue"]]);
  25578. const ElContainer = withInstall(Container, {
  25579. Aside,
  25580. Footer: Footer$2,
  25581. Header: Header$1,
  25582. Main
  25583. });
  25584. const ElAside = withNoopInstall(Aside);
  25585. const ElFooter = withNoopInstall(Footer$2);
  25586. const ElHeader = withNoopInstall(Header$1);
  25587. const ElMain = withNoopInstall(Main);
  25588. var advancedFormat$1 = {exports: {}};
  25589. (function(module, exports) {
  25590. !function(e, t) {
  25591. module.exports = t() ;
  25592. }(commonjsGlobal, function() {
  25593. return function(e, t) {
  25594. var r = t.prototype, n = r.format;
  25595. r.format = function(e2) {
  25596. var t2 = this, r2 = this.$locale();
  25597. if (!this.isValid())
  25598. return n.bind(this)(e2);
  25599. var s = this.$utils(), a = (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) {
  25600. switch (e3) {
  25601. case "Q":
  25602. return Math.ceil((t2.$M + 1) / 3);
  25603. case "Do":
  25604. return r2.ordinal(t2.$D);
  25605. case "gggg":
  25606. return t2.weekYear();
  25607. case "GGGG":
  25608. return t2.isoWeekYear();
  25609. case "wo":
  25610. return r2.ordinal(t2.week(), "W");
  25611. case "w":
  25612. case "ww":
  25613. return s.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  25614. case "W":
  25615. case "WW":
  25616. return s.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  25617. case "k":
  25618. case "kk":
  25619. return s.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  25620. case "X":
  25621. return Math.floor(t2.$d.getTime() / 1e3);
  25622. case "x":
  25623. return t2.$d.getTime();
  25624. case "z":
  25625. return "[" + t2.offsetName() + "]";
  25626. case "zzz":
  25627. return "[" + t2.offsetName("long") + "]";
  25628. default:
  25629. return e3;
  25630. }
  25631. });
  25632. return n.bind(this)(a);
  25633. };
  25634. };
  25635. });
  25636. })(advancedFormat$1);
  25637. var advancedFormat = advancedFormat$1.exports;
  25638. var weekOfYear$1 = {exports: {}};
  25639. (function(module, exports) {
  25640. !function(e, t) {
  25641. module.exports = t() ;
  25642. }(commonjsGlobal, function() {
  25643. var e = "week", t = "year";
  25644. return function(i, n, r) {
  25645. var f = n.prototype;
  25646. f.week = function(i2) {
  25647. if (i2 === void 0 && (i2 = null), i2 !== null)
  25648. return this.add(7 * (i2 - this.week()), "day");
  25649. var n2 = this.$locale().yearStart || 1;
  25650. if (this.month() === 11 && this.date() > 25) {
  25651. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  25652. if (f2.isBefore(s))
  25653. return 1;
  25654. }
  25655. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  25656. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  25657. }, f.weeks = function(e2) {
  25658. return e2 === void 0 && (e2 = null), this.week(e2);
  25659. };
  25660. };
  25661. });
  25662. })(weekOfYear$1);
  25663. var weekOfYear = weekOfYear$1.exports;
  25664. var weekYear$1 = {exports: {}};
  25665. (function(module, exports) {
  25666. !function(e, t) {
  25667. module.exports = t() ;
  25668. }(commonjsGlobal, function() {
  25669. return function(e, t) {
  25670. t.prototype.weekYear = function() {
  25671. var e2 = this.month(), t2 = this.week(), n = this.year();
  25672. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  25673. };
  25674. };
  25675. });
  25676. })(weekYear$1);
  25677. var weekYear = weekYear$1.exports;
  25678. var dayOfYear$1 = {exports: {}};
  25679. (function(module, exports) {
  25680. !function(e, t) {
  25681. module.exports = t() ;
  25682. }(commonjsGlobal, function() {
  25683. return function(e, t, n) {
  25684. t.prototype.dayOfYear = function(e2) {
  25685. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  25686. return e2 == null ? t2 : this.add(e2 - t2, "day");
  25687. };
  25688. };
  25689. });
  25690. })(dayOfYear$1);
  25691. var dayOfYear = dayOfYear$1.exports;
  25692. var isSameOrAfter$1 = {exports: {}};
  25693. (function(module, exports) {
  25694. !function(e, t) {
  25695. module.exports = t() ;
  25696. }(commonjsGlobal, function() {
  25697. return function(e, t) {
  25698. t.prototype.isSameOrAfter = function(e2, t2) {
  25699. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  25700. };
  25701. };
  25702. });
  25703. })(isSameOrAfter$1);
  25704. var isSameOrAfter = isSameOrAfter$1.exports;
  25705. var isSameOrBefore$1 = {exports: {}};
  25706. (function(module, exports) {
  25707. !function(e, i) {
  25708. module.exports = i() ;
  25709. }(commonjsGlobal, function() {
  25710. return function(e, i) {
  25711. i.prototype.isSameOrBefore = function(e2, i2) {
  25712. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  25713. };
  25714. };
  25715. });
  25716. })(isSameOrBefore$1);
  25717. var isSameOrBefore = isSameOrBefore$1.exports;
  25718. const ROOT_PICKER_INJECTION_KEY = Symbol();
  25719. const datePickerProps = buildProps({
  25720. ...timePickerDefaultProps,
  25721. type: {
  25722. type: definePropType(String),
  25723. default: "date"
  25724. }
  25725. });
  25726. const selectionModes = [
  25727. "date",
  25728. "dates",
  25729. "year",
  25730. "years",
  25731. "month",
  25732. "months",
  25733. "week",
  25734. "range"
  25735. ];
  25736. const datePickerSharedProps = buildProps({
  25737. disabledDate: {
  25738. type: definePropType(Function)
  25739. },
  25740. date: {
  25741. type: definePropType(Object),
  25742. required: true
  25743. },
  25744. minDate: {
  25745. type: definePropType(Object)
  25746. },
  25747. maxDate: {
  25748. type: definePropType(Object)
  25749. },
  25750. parsedValue: {
  25751. type: definePropType([Object, Array])
  25752. },
  25753. rangeState: {
  25754. type: definePropType(Object),
  25755. default: () => ({
  25756. endDate: null,
  25757. selecting: false
  25758. })
  25759. }
  25760. });
  25761. const panelSharedProps = buildProps({
  25762. type: {
  25763. type: definePropType(String),
  25764. required: true,
  25765. values: datePickTypes
  25766. },
  25767. dateFormat: String,
  25768. timeFormat: String,
  25769. showNow: {
  25770. type: Boolean,
  25771. default: true
  25772. }
  25773. });
  25774. const panelRangeSharedProps = buildProps({
  25775. unlinkPanels: Boolean,
  25776. parsedValue: {
  25777. type: definePropType(Array)
  25778. }
  25779. });
  25780. const selectionModeWithDefault = (mode) => {
  25781. return {
  25782. type: String,
  25783. values: selectionModes,
  25784. default: mode
  25785. };
  25786. };
  25787. const panelDatePickProps = buildProps({
  25788. ...panelSharedProps,
  25789. parsedValue: {
  25790. type: definePropType([Object, Array])
  25791. },
  25792. visible: {
  25793. type: Boolean
  25794. },
  25795. format: {
  25796. type: String,
  25797. default: ""
  25798. }
  25799. });
  25800. const isValidRange = (range) => {
  25801. if (!isArray$1(range))
  25802. return false;
  25803. const [left, right] = range;
  25804. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && dayjs(left).isValid() && dayjs(right).isValid() && left.isSameOrBefore(right);
  25805. };
  25806. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  25807. let start;
  25808. if (isArray$1(defaultValue)) {
  25809. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  25810. if (!unlinkPanels) {
  25811. right = left.add(1, unit);
  25812. }
  25813. return [left, right];
  25814. } else if (defaultValue) {
  25815. start = dayjs(defaultValue);
  25816. } else {
  25817. start = dayjs();
  25818. }
  25819. start = start.locale(lang);
  25820. return [start, start.add(1, unit)];
  25821. };
  25822. const buildPickerTable = (dimension, rows, {
  25823. columnIndexOffset,
  25824. startDate,
  25825. nextEndDate,
  25826. now,
  25827. unit,
  25828. relativeDateGetter,
  25829. setCellMetadata,
  25830. setRowMetadata
  25831. }) => {
  25832. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  25833. const row = rows[rowIndex];
  25834. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  25835. let cell = row[columnIndex + columnIndexOffset];
  25836. if (!cell) {
  25837. cell = {
  25838. row: rowIndex,
  25839. column: columnIndex,
  25840. type: "normal",
  25841. inRange: false,
  25842. start: false,
  25843. end: false
  25844. };
  25845. }
  25846. const index = rowIndex * dimension.column + columnIndex;
  25847. const nextStartDate = relativeDateGetter(index);
  25848. cell.dayjs = nextStartDate;
  25849. cell.date = nextStartDate.toDate();
  25850. cell.timestamp = nextStartDate.valueOf();
  25851. cell.type = "normal";
  25852. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  25853. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  25854. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25855. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  25856. } else {
  25857. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  25858. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25859. }
  25860. const isToday = nextStartDate.isSame(now, unit);
  25861. if (isToday) {
  25862. cell.type = "today";
  25863. }
  25864. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  25865. row[columnIndex + columnIndexOffset] = cell;
  25866. }
  25867. setRowMetadata == null ? void 0 : setRowMetadata(row);
  25868. }
  25869. };
  25870. const datesInMonth = (year, month, lang) => {
  25871. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  25872. const numOfDays = firstDay.daysInMonth();
  25873. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25874. };
  25875. const getValidDateOfMonth = (year, month, lang, disabledDate) => {
  25876. const _value = dayjs().year(year).month(month).startOf("month");
  25877. const _date = datesInMonth(year, month, lang).find((date) => {
  25878. return !(disabledDate == null ? void 0 : disabledDate(date));
  25879. });
  25880. if (_date) {
  25881. return dayjs(_date).locale(lang);
  25882. }
  25883. return _value.locale(lang);
  25884. };
  25885. const getValidDateOfYear = (value, lang, disabledDate) => {
  25886. const year = value.year();
  25887. if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
  25888. return value.locale(lang);
  25889. }
  25890. const month = value.month();
  25891. if (!datesInMonth(year, month, lang).every(disabledDate)) {
  25892. return getValidDateOfMonth(year, month, lang, disabledDate);
  25893. }
  25894. for (let i = 0; i < 12; i++) {
  25895. if (!datesInMonth(year, i, lang).every(disabledDate)) {
  25896. return getValidDateOfMonth(year, i, lang, disabledDate);
  25897. }
  25898. }
  25899. return value;
  25900. };
  25901. const correctlyParseUserInput = (value, format, lang, defaultFormat) => {
  25902. if (isArray$1(value)) {
  25903. return value.map((v) => correctlyParseUserInput(v, format, lang, defaultFormat));
  25904. }
  25905. if (isString$1(value)) {
  25906. const dayjsValue = defaultFormat.value ? dayjs(value) : dayjs(value, format);
  25907. if (!dayjsValue.isValid()) {
  25908. return dayjsValue;
  25909. }
  25910. }
  25911. return dayjs(value, format).locale(lang);
  25912. };
  25913. const basicDateTableProps = buildProps({
  25914. ...datePickerSharedProps,
  25915. cellClassName: {
  25916. type: definePropType(Function)
  25917. },
  25918. showWeekNumber: Boolean,
  25919. selectionMode: selectionModeWithDefault("date")
  25920. });
  25921. const basicDateTableEmits = ["changerange", "pick", "select"];
  25922. const isNormalDay = (type = "") => {
  25923. return ["normal", "today"].includes(type);
  25924. };
  25925. const useBasicDateTable = (props, emit) => {
  25926. const { lang } = useLocale();
  25927. const tbodyRef = vue.ref();
  25928. const currentCellRef = vue.ref();
  25929. const lastRow = vue.ref();
  25930. const lastColumn = vue.ref();
  25931. const tableRows = vue.ref([[], [], [], [], [], []]);
  25932. let focusWithClick = false;
  25933. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  25934. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  25935. const offsetDay = vue.computed(() => {
  25936. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  25937. });
  25938. const startDate = vue.computed(() => {
  25939. const startDayOfMonth = props.date.startOf("month");
  25940. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  25941. });
  25942. const WEEKS = vue.computed(() => {
  25943. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  25944. });
  25945. const hasCurrent = vue.computed(() => {
  25946. return flatten(vue.unref(rows)).some((row) => {
  25947. return row.isCurrent;
  25948. });
  25949. });
  25950. const days = vue.computed(() => {
  25951. const startOfMonth = props.date.startOf("month");
  25952. const startOfMonthDay = startOfMonth.day() || 7;
  25953. const dateCountOfMonth = startOfMonth.daysInMonth();
  25954. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  25955. return {
  25956. startOfMonthDay,
  25957. dateCountOfMonth,
  25958. dateCountOfLastMonth
  25959. };
  25960. });
  25961. const selectedDate = vue.computed(() => {
  25962. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  25963. });
  25964. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  25965. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  25966. const offset = vue.unref(offsetDay);
  25967. if (rowIndex >= 0 && rowIndex <= 1) {
  25968. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  25969. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  25970. cell.text = count;
  25971. return true;
  25972. } else {
  25973. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  25974. cell.type = "prev-month";
  25975. }
  25976. } else {
  25977. if (count <= dateCountOfMonth) {
  25978. cell.text = count;
  25979. } else {
  25980. cell.text = count - dateCountOfMonth;
  25981. cell.type = "next-month";
  25982. }
  25983. return true;
  25984. }
  25985. return false;
  25986. };
  25987. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  25988. const { disabledDate, cellClassName } = props;
  25989. const _selectedDate = vue.unref(selectedDate);
  25990. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  25991. const cellDate = cell.dayjs.toDate();
  25992. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  25993. cell.isSelected = !!cell.selected;
  25994. cell.isCurrent = isCurrent(cell);
  25995. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  25996. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  25997. return shouldIncrement;
  25998. };
  25999. const setRowMetadata = (row) => {
  26000. if (props.selectionMode === "week") {
  26001. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  26002. const isActive = isWeekActive(row[start + 1]);
  26003. row[start].inRange = isActive;
  26004. row[start].start = isActive;
  26005. row[end].inRange = isActive;
  26006. row[end].end = isActive;
  26007. }
  26008. };
  26009. const rows = vue.computed(() => {
  26010. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  26011. const offset = vue.unref(offsetDay);
  26012. const rows_ = vue.unref(tableRows);
  26013. const dateUnit = "day";
  26014. let count = 1;
  26015. if (showWeekNumber) {
  26016. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  26017. if (!rows_[rowIndex][0]) {
  26018. rows_[rowIndex][0] = {
  26019. type: "week",
  26020. text: vue.unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
  26021. };
  26022. }
  26023. }
  26024. }
  26025. buildPickerTable({ row: 6, column: 7 }, rows_, {
  26026. startDate: minDate,
  26027. columnIndexOffset: showWeekNumber ? 1 : 0,
  26028. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  26029. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  26030. unit: dateUnit,
  26031. relativeDateGetter: (idx) => vue.unref(startDate).add(idx - offset, dateUnit),
  26032. setCellMetadata: (...args) => {
  26033. if (setCellMetadata(...args, count)) {
  26034. count += 1;
  26035. }
  26036. },
  26037. setRowMetadata
  26038. });
  26039. return rows_;
  26040. });
  26041. vue.watch(() => props.date, async () => {
  26042. var _a;
  26043. if ((_a = vue.unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  26044. await vue.nextTick();
  26045. await focus();
  26046. }
  26047. });
  26048. const focus = async () => {
  26049. var _a;
  26050. return (_a = vue.unref(currentCellRef)) == null ? void 0 : _a.focus();
  26051. };
  26052. const isCurrent = (cell) => {
  26053. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  26054. };
  26055. const cellMatchesDate = (cell, date) => {
  26056. if (!date)
  26057. return false;
  26058. return dayjs(date).locale(vue.unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  26059. };
  26060. const getDateOfCell = (row, column) => {
  26061. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - vue.unref(offsetDay);
  26062. return vue.unref(startDate).add(offsetFromStart, "day");
  26063. };
  26064. const handleMouseMove = (event) => {
  26065. var _a;
  26066. if (!props.rangeState.selecting)
  26067. return;
  26068. let target = event.target;
  26069. if (target.tagName === "SPAN") {
  26070. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26071. }
  26072. if (target.tagName === "DIV") {
  26073. target = target.parentNode;
  26074. }
  26075. if (target.tagName !== "TD")
  26076. return;
  26077. const row = target.parentNode.rowIndex - 1;
  26078. const column = target.cellIndex;
  26079. if (vue.unref(rows)[row][column].disabled)
  26080. return;
  26081. if (row !== vue.unref(lastRow) || column !== vue.unref(lastColumn)) {
  26082. lastRow.value = row;
  26083. lastColumn.value = column;
  26084. emit("changerange", {
  26085. selecting: true,
  26086. endDate: getDateOfCell(row, column)
  26087. });
  26088. }
  26089. };
  26090. const isSelectedCell = (cell) => {
  26091. return !vue.unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  26092. };
  26093. const handleFocus = (event) => {
  26094. if (focusWithClick || vue.unref(hasCurrent) || props.selectionMode !== "date")
  26095. return;
  26096. handlePickDate(event, true);
  26097. };
  26098. const handleMouseDown = (event) => {
  26099. const target = event.target.closest("td");
  26100. if (!target)
  26101. return;
  26102. focusWithClick = true;
  26103. };
  26104. const handleMouseUp = (event) => {
  26105. const target = event.target.closest("td");
  26106. if (!target)
  26107. return;
  26108. focusWithClick = false;
  26109. };
  26110. const handleRangePick = (newDate) => {
  26111. if (!props.rangeState.selecting || !props.minDate) {
  26112. emit("pick", { minDate: newDate, maxDate: null });
  26113. emit("select", true);
  26114. } else {
  26115. if (newDate >= props.minDate) {
  26116. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26117. } else {
  26118. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26119. }
  26120. emit("select", false);
  26121. }
  26122. };
  26123. const handleWeekPick = (newDate) => {
  26124. const weekNumber = newDate.week();
  26125. const value = `${newDate.year()}w${weekNumber}`;
  26126. emit("pick", {
  26127. year: newDate.year(),
  26128. week: weekNumber,
  26129. value,
  26130. date: newDate.startOf("week")
  26131. });
  26132. };
  26133. const handleDatesPick = (newDate, selected) => {
  26134. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  26135. emit("pick", newValue);
  26136. };
  26137. const handlePickDate = (event, isKeyboardMovement = false) => {
  26138. const target = event.target.closest("td");
  26139. if (!target)
  26140. return;
  26141. const row = target.parentNode.rowIndex - 1;
  26142. const column = target.cellIndex;
  26143. const cell = vue.unref(rows)[row][column];
  26144. if (cell.disabled || cell.type === "week")
  26145. return;
  26146. const newDate = getDateOfCell(row, column);
  26147. switch (props.selectionMode) {
  26148. case "range": {
  26149. handleRangePick(newDate);
  26150. break;
  26151. }
  26152. case "date": {
  26153. emit("pick", newDate, isKeyboardMovement);
  26154. break;
  26155. }
  26156. case "week": {
  26157. handleWeekPick(newDate);
  26158. break;
  26159. }
  26160. case "dates": {
  26161. handleDatesPick(newDate, !!cell.selected);
  26162. break;
  26163. }
  26164. }
  26165. };
  26166. const isWeekActive = (cell) => {
  26167. if (props.selectionMode !== "week")
  26168. return false;
  26169. let newDate = props.date.startOf("day");
  26170. if (cell.type === "prev-month") {
  26171. newDate = newDate.subtract(1, "month");
  26172. }
  26173. if (cell.type === "next-month") {
  26174. newDate = newDate.add(1, "month");
  26175. }
  26176. newDate = newDate.date(Number.parseInt(cell.text, 10));
  26177. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  26178. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  26179. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  26180. return weekDate.isSame(newDate, "day");
  26181. }
  26182. return false;
  26183. };
  26184. return {
  26185. WEEKS,
  26186. rows,
  26187. tbodyRef,
  26188. currentCellRef,
  26189. focus,
  26190. isCurrent,
  26191. isWeekActive,
  26192. isSelectedCell,
  26193. handlePickDate,
  26194. handleMouseUp,
  26195. handleMouseDown,
  26196. handleMouseMove,
  26197. handleFocus
  26198. };
  26199. };
  26200. const useBasicDateTableDOM = (props, {
  26201. isCurrent,
  26202. isWeekActive
  26203. }) => {
  26204. const ns = useNamespace("date-table");
  26205. const { t } = useLocale();
  26206. const tableKls = vue.computed(() => [
  26207. ns.b(),
  26208. { "is-week-mode": props.selectionMode === "week" }
  26209. ]);
  26210. const tableLabel = vue.computed(() => t("el.datepicker.dateTablePrompt"));
  26211. const weekLabel = vue.computed(() => t("el.datepicker.week"));
  26212. const getCellClasses = (cell) => {
  26213. const classes = [];
  26214. if (isNormalDay(cell.type) && !cell.disabled) {
  26215. classes.push("available");
  26216. if (cell.type === "today") {
  26217. classes.push("today");
  26218. }
  26219. } else {
  26220. classes.push(cell.type);
  26221. }
  26222. if (isCurrent(cell)) {
  26223. classes.push("current");
  26224. }
  26225. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  26226. classes.push("in-range");
  26227. if (cell.start) {
  26228. classes.push("start-date");
  26229. }
  26230. if (cell.end) {
  26231. classes.push("end-date");
  26232. }
  26233. }
  26234. if (cell.disabled) {
  26235. classes.push("disabled");
  26236. }
  26237. if (cell.selected) {
  26238. classes.push("selected");
  26239. }
  26240. if (cell.customClass) {
  26241. classes.push(cell.customClass);
  26242. }
  26243. return classes.join(" ");
  26244. };
  26245. const getRowKls = (cell) => [
  26246. ns.e("row"),
  26247. { current: isWeekActive(cell) }
  26248. ];
  26249. return {
  26250. tableKls,
  26251. tableLabel,
  26252. weekLabel,
  26253. getCellClasses,
  26254. getRowKls,
  26255. t
  26256. };
  26257. };
  26258. const basicCellProps = buildProps({
  26259. cell: {
  26260. type: definePropType(Object)
  26261. }
  26262. });
  26263. var ElDatePickerCell = vue.defineComponent({
  26264. name: "ElDatePickerCell",
  26265. props: basicCellProps,
  26266. setup(props) {
  26267. const ns = useNamespace("date-table-cell");
  26268. const {
  26269. slots
  26270. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  26271. return () => {
  26272. const {
  26273. cell
  26274. } = props;
  26275. return vue.renderSlot(slots, "default", {
  26276. ...cell
  26277. }, () => {
  26278. var _a;
  26279. return [vue.createVNode("div", {
  26280. "class": ns.b()
  26281. }, [vue.createVNode("span", {
  26282. "class": ns.e("text")
  26283. }, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
  26284. });
  26285. };
  26286. }
  26287. });
  26288. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  26289. __name: "basic-date-table",
  26290. props: basicDateTableProps,
  26291. emits: basicDateTableEmits,
  26292. setup(__props, { expose, emit }) {
  26293. const props = __props;
  26294. const {
  26295. WEEKS,
  26296. rows,
  26297. tbodyRef,
  26298. currentCellRef,
  26299. focus,
  26300. isCurrent,
  26301. isWeekActive,
  26302. isSelectedCell,
  26303. handlePickDate,
  26304. handleMouseUp,
  26305. handleMouseDown,
  26306. handleMouseMove,
  26307. handleFocus
  26308. } = useBasicDateTable(props, emit);
  26309. const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
  26310. isCurrent,
  26311. isWeekActive
  26312. });
  26313. let isUnmounting = false;
  26314. vue.onBeforeUnmount(() => {
  26315. isUnmounting = true;
  26316. });
  26317. expose({
  26318. focus
  26319. });
  26320. return (_ctx, _cache) => {
  26321. return vue.openBlock(), vue.createElementBlock("table", {
  26322. "aria-label": vue.unref(tableLabel),
  26323. class: vue.normalizeClass(vue.unref(tableKls)),
  26324. cellspacing: "0",
  26325. cellpadding: "0",
  26326. role: "grid",
  26327. onClick: vue.unref(handlePickDate),
  26328. onMousemove: vue.unref(handleMouseMove),
  26329. onMousedown: vue.withModifiers(vue.unref(handleMouseDown), ["prevent"]),
  26330. onMouseup: vue.unref(handleMouseUp)
  26331. }, [
  26332. vue.createElementVNode("tbody", {
  26333. ref_key: "tbodyRef",
  26334. ref: tbodyRef
  26335. }, [
  26336. vue.createElementVNode("tr", null, [
  26337. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", {
  26338. key: 0,
  26339. scope: "col"
  26340. }, vue.toDisplayString(vue.unref(weekLabel)), 1)) : vue.createCommentVNode("v-if", true),
  26341. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  26342. return vue.openBlock(), vue.createElementBlock("th", {
  26343. key,
  26344. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week),
  26345. scope: "col"
  26346. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
  26347. }), 128))
  26348. ]),
  26349. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  26350. return vue.openBlock(), vue.createElementBlock("tr", {
  26351. key: rowKey,
  26352. class: vue.normalizeClass(vue.unref(getRowKls)(row[1]))
  26353. }, [
  26354. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  26355. return vue.openBlock(), vue.createElementBlock("td", {
  26356. key: `${rowKey}.${columnKey}`,
  26357. ref_for: true,
  26358. ref: (el) => !vue.unref(isUnmounting) && vue.unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  26359. class: vue.normalizeClass(vue.unref(getCellClasses)(cell)),
  26360. "aria-current": cell.isCurrent ? "date" : void 0,
  26361. "aria-selected": cell.isCurrent,
  26362. tabindex: vue.unref(isSelectedCell)(cell) ? 0 : -1,
  26363. onFocus: vue.unref(handleFocus)
  26364. }, [
  26365. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26366. ], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
  26367. }), 128))
  26368. ], 2);
  26369. }), 128))
  26370. ], 512)
  26371. ], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
  26372. };
  26373. }
  26374. });
  26375. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "basic-date-table.vue"]]);
  26376. const basicMonthTableProps = buildProps({
  26377. ...datePickerSharedProps,
  26378. selectionMode: selectionModeWithDefault("month")
  26379. });
  26380. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  26381. __name: "basic-month-table",
  26382. props: basicMonthTableProps,
  26383. emits: ["changerange", "pick", "select"],
  26384. setup(__props, { expose, emit }) {
  26385. const props = __props;
  26386. const ns = useNamespace("month-table");
  26387. const { t, lang } = useLocale();
  26388. const tbodyRef = vue.ref();
  26389. const currentCellRef = vue.ref();
  26390. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  26391. const tableRows = vue.ref([
  26392. [],
  26393. [],
  26394. []
  26395. ]);
  26396. const lastRow = vue.ref();
  26397. const lastColumn = vue.ref();
  26398. const rows = vue.computed(() => {
  26399. var _a, _b;
  26400. const rows2 = tableRows.value;
  26401. const now = dayjs().locale(lang.value).startOf("month");
  26402. for (let i = 0; i < 3; i++) {
  26403. const row = rows2[i];
  26404. for (let j = 0; j < 4; j++) {
  26405. const cell = row[j] || (row[j] = {
  26406. row: i,
  26407. column: j,
  26408. type: "normal",
  26409. inRange: false,
  26410. start: false,
  26411. end: false,
  26412. text: -1,
  26413. disabled: false
  26414. });
  26415. cell.type = "normal";
  26416. const index = i * 4 + j;
  26417. const calTime = props.date.startOf("year").month(index);
  26418. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26419. 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"));
  26420. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26421. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26422. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  26423. } else {
  26424. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  26425. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26426. }
  26427. const isToday = now.isSame(calTime);
  26428. if (isToday) {
  26429. cell.type = "today";
  26430. }
  26431. cell.text = index;
  26432. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  26433. }
  26434. }
  26435. return rows2;
  26436. });
  26437. const focus = () => {
  26438. var _a;
  26439. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26440. };
  26441. const getCellStyle = (cell) => {
  26442. const style = {};
  26443. const year = props.date.year();
  26444. const today = /* @__PURE__ */ new Date();
  26445. const month = cell.text;
  26446. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  26447. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  26448. style.today = today.getFullYear() === year && today.getMonth() === month;
  26449. if (cell.inRange) {
  26450. style["in-range"] = true;
  26451. if (cell.start) {
  26452. style["start-date"] = true;
  26453. }
  26454. if (cell.end) {
  26455. style["end-date"] = true;
  26456. }
  26457. }
  26458. return style;
  26459. };
  26460. const isSelectedCell = (cell) => {
  26461. const year = props.date.year();
  26462. const month = cell.text;
  26463. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  26464. };
  26465. const handleMouseMove = (event) => {
  26466. var _a;
  26467. if (!props.rangeState.selecting)
  26468. return;
  26469. let target = event.target;
  26470. if (target.tagName === "SPAN") {
  26471. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26472. }
  26473. if (target.tagName === "DIV") {
  26474. target = target.parentNode;
  26475. }
  26476. if (target.tagName !== "TD")
  26477. return;
  26478. const row = target.parentNode.rowIndex;
  26479. const column = target.cellIndex;
  26480. if (rows.value[row][column].disabled)
  26481. return;
  26482. if (row !== lastRow.value || column !== lastColumn.value) {
  26483. lastRow.value = row;
  26484. lastColumn.value = column;
  26485. emit("changerange", {
  26486. selecting: true,
  26487. endDate: props.date.startOf("year").month(row * 4 + column)
  26488. });
  26489. }
  26490. };
  26491. const handleMonthTableClick = (event) => {
  26492. var _a;
  26493. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26494. if ((target == null ? void 0 : target.tagName) !== "TD")
  26495. return;
  26496. if (hasClass(target, "disabled"))
  26497. return;
  26498. const column = target.cellIndex;
  26499. const row = target.parentNode.rowIndex;
  26500. const month = row * 4 + column;
  26501. const newDate = props.date.startOf("year").month(month);
  26502. if (props.selectionMode === "months") {
  26503. if (event.type === "keydown") {
  26504. emit("pick", castArray(props.parsedValue), false);
  26505. return;
  26506. }
  26507. const newMonth = getValidDateOfMonth(props.date.year(), month, lang.value, props.disabledDate);
  26508. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== newMonth.year() || (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([dayjs(newMonth)]);
  26509. emit("pick", newValue);
  26510. } else if (props.selectionMode === "range") {
  26511. if (!props.rangeState.selecting) {
  26512. emit("pick", { minDate: newDate, maxDate: null });
  26513. emit("select", true);
  26514. } else {
  26515. if (props.minDate && newDate >= props.minDate) {
  26516. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26517. } else {
  26518. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26519. }
  26520. emit("select", false);
  26521. }
  26522. } else {
  26523. emit("pick", month);
  26524. }
  26525. };
  26526. vue.watch(() => props.date, async () => {
  26527. var _a, _b;
  26528. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26529. await vue.nextTick();
  26530. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26531. }
  26532. });
  26533. expose({
  26534. focus
  26535. });
  26536. return (_ctx, _cache) => {
  26537. return vue.openBlock(), vue.createElementBlock("table", {
  26538. role: "grid",
  26539. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  26540. class: vue.normalizeClass(vue.unref(ns).b()),
  26541. onClick: handleMonthTableClick,
  26542. onMousemove: handleMouseMove
  26543. }, [
  26544. vue.createElementVNode("tbody", {
  26545. ref_key: "tbodyRef",
  26546. ref: tbodyRef
  26547. }, [
  26548. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  26549. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  26550. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  26551. return vue.openBlock(), vue.createElementBlock("td", {
  26552. key: key_,
  26553. ref_for: true,
  26554. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26555. class: vue.normalizeClass(getCellStyle(cell)),
  26556. "aria-selected": `${isSelectedCell(cell)}`,
  26557. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  26558. tabindex: isSelectedCell(cell) ? 0 : -1,
  26559. onKeydown: [
  26560. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  26561. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  26562. ]
  26563. }, [
  26564. vue.createVNode(vue.unref(ElDatePickerCell), {
  26565. cell: {
  26566. ...cell,
  26567. renderText: vue.unref(t)("el.datepicker.months." + months.value[cell.text])
  26568. }
  26569. }, null, 8, ["cell"])
  26570. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26571. }), 128))
  26572. ]);
  26573. }), 128))
  26574. ], 512)
  26575. ], 42, ["aria-label"]);
  26576. };
  26577. }
  26578. });
  26579. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "basic-month-table.vue"]]);
  26580. const basicYearTableProps = buildProps({
  26581. ...datePickerSharedProps,
  26582. selectionMode: selectionModeWithDefault("year")
  26583. });
  26584. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  26585. __name: "basic-year-table",
  26586. props: basicYearTableProps,
  26587. emits: ["changerange", "pick", "select"],
  26588. setup(__props, { expose, emit }) {
  26589. const props = __props;
  26590. const datesInYear = (year, lang2) => {
  26591. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  26592. const lastDay = firstDay.endOf("year");
  26593. const numOfDays = lastDay.dayOfYear();
  26594. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  26595. };
  26596. const ns = useNamespace("year-table");
  26597. const { t, lang } = useLocale();
  26598. const tbodyRef = vue.ref();
  26599. const currentCellRef = vue.ref();
  26600. const startYear = vue.computed(() => {
  26601. return Math.floor(props.date.year() / 10) * 10;
  26602. });
  26603. const tableRows = vue.ref([[], [], []]);
  26604. const lastRow = vue.ref();
  26605. const lastColumn = vue.ref();
  26606. const rows = vue.computed(() => {
  26607. var _a;
  26608. const rows2 = tableRows.value;
  26609. const now = dayjs().locale(lang.value).startOf("year");
  26610. for (let i = 0; i < 3; i++) {
  26611. const row = rows2[i];
  26612. for (let j = 0; j < 4; j++) {
  26613. if (i * 4 + j >= 10) {
  26614. break;
  26615. }
  26616. let cell = row[j];
  26617. if (!cell) {
  26618. cell = {
  26619. row: i,
  26620. column: j,
  26621. type: "normal",
  26622. inRange: false,
  26623. start: false,
  26624. end: false,
  26625. text: -1,
  26626. disabled: false
  26627. };
  26628. }
  26629. cell.type = "normal";
  26630. const index = i * 4 + j + startYear.value;
  26631. const calTime = dayjs().year(index);
  26632. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26633. cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "year") && calEndDate && calTime.isSameOrBefore(calEndDate, "year")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "year") && calEndDate && calTime.isSameOrAfter(calEndDate, "year"));
  26634. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26635. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26636. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26637. } else {
  26638. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26639. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26640. }
  26641. const isToday = now.isSame(calTime);
  26642. if (isToday) {
  26643. cell.type = "today";
  26644. }
  26645. cell.text = index;
  26646. const cellDate = calTime.toDate();
  26647. cell.disabled = props.disabledDate && props.disabledDate(cellDate) || false;
  26648. row[j] = cell;
  26649. }
  26650. }
  26651. return rows2;
  26652. });
  26653. const focus = () => {
  26654. var _a;
  26655. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26656. };
  26657. const getCellKls = (cell) => {
  26658. const kls = {};
  26659. const today = dayjs().locale(lang.value);
  26660. const year = cell.text;
  26661. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  26662. kls.today = today.year() === year;
  26663. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  26664. if (cell.inRange) {
  26665. kls["in-range"] = true;
  26666. if (cell.start) {
  26667. kls["start-date"] = true;
  26668. }
  26669. if (cell.end) {
  26670. kls["end-date"] = true;
  26671. }
  26672. }
  26673. return kls;
  26674. };
  26675. const isSelectedCell = (cell) => {
  26676. const year = cell.text;
  26677. return castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  26678. };
  26679. const handleYearTableClick = (event) => {
  26680. var _a;
  26681. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26682. if (!target || !target.textContent || hasClass(target, "disabled"))
  26683. return;
  26684. const column = target.cellIndex;
  26685. const row = target.parentNode.rowIndex;
  26686. const selectedYear = row * 4 + column + startYear.value;
  26687. const newDate = dayjs().year(selectedYear);
  26688. if (props.selectionMode === "range") {
  26689. if (!props.rangeState.selecting) {
  26690. emit("pick", { minDate: newDate, maxDate: null });
  26691. emit("select", true);
  26692. } else {
  26693. if (props.minDate && newDate >= props.minDate) {
  26694. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26695. } else {
  26696. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26697. }
  26698. emit("select", false);
  26699. }
  26700. } else if (props.selectionMode === "years") {
  26701. if (event.type === "keydown") {
  26702. emit("pick", castArray(props.parsedValue), false);
  26703. return;
  26704. }
  26705. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  26706. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
  26707. emit("pick", newValue);
  26708. } else {
  26709. emit("pick", selectedYear);
  26710. }
  26711. };
  26712. const handleMouseMove = (event) => {
  26713. var _a;
  26714. if (!props.rangeState.selecting)
  26715. return;
  26716. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26717. if (!target)
  26718. return;
  26719. const row = target.parentNode.rowIndex;
  26720. const column = target.cellIndex;
  26721. if (rows.value[row][column].disabled)
  26722. return;
  26723. if (row !== lastRow.value || column !== lastColumn.value) {
  26724. lastRow.value = row;
  26725. lastColumn.value = column;
  26726. emit("changerange", {
  26727. selecting: true,
  26728. endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
  26729. });
  26730. }
  26731. };
  26732. vue.watch(() => props.date, async () => {
  26733. var _a, _b;
  26734. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26735. await vue.nextTick();
  26736. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26737. }
  26738. });
  26739. expose({
  26740. focus
  26741. });
  26742. return (_ctx, _cache) => {
  26743. return vue.openBlock(), vue.createElementBlock("table", {
  26744. role: "grid",
  26745. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  26746. class: vue.normalizeClass(vue.unref(ns).b()),
  26747. onClick: handleYearTableClick,
  26748. onMousemove: handleMouseMove
  26749. }, [
  26750. vue.createElementVNode("tbody", {
  26751. ref_key: "tbodyRef",
  26752. ref: tbodyRef
  26753. }, [
  26754. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  26755. return vue.openBlock(), vue.createElementBlock("tr", { key: rowKey }, [
  26756. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, cellKey) => {
  26757. return vue.openBlock(), vue.createElementBlock("td", {
  26758. key: `${rowKey}_${cellKey}`,
  26759. ref_for: true,
  26760. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26761. class: vue.normalizeClass(["available", getCellKls(cell)]),
  26762. "aria-selected": isSelectedCell(cell),
  26763. "aria-label": String(cell.text),
  26764. tabindex: isSelectedCell(cell) ? 0 : -1,
  26765. onKeydown: [
  26766. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  26767. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  26768. ]
  26769. }, [
  26770. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26771. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26772. }), 128))
  26773. ]);
  26774. }), 128))
  26775. ], 512)
  26776. ], 42, ["aria-label"]);
  26777. };
  26778. }
  26779. });
  26780. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "basic-year-table.vue"]]);
  26781. const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({
  26782. __name: "panel-date-pick",
  26783. props: panelDatePickProps,
  26784. emits: ["pick", "set-picker-option", "panel-change"],
  26785. setup(__props, { emit: contextEmit }) {
  26786. const props = __props;
  26787. const timeWithinRange = (_, __, ___) => true;
  26788. const ppNs = useNamespace("picker-panel");
  26789. const dpNs = useNamespace("date-picker");
  26790. const attrs = vue.useAttrs();
  26791. const slots = vue.useSlots();
  26792. const { t, lang } = useLocale();
  26793. const pickerBase = vue.inject("EP_PICKER_BASE");
  26794. const isDefaultFormat = vue.inject("ElIsDefaultFormat");
  26795. const popper = vue.inject(TOOLTIP_INJECTION_KEY);
  26796. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  26797. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  26798. const currentViewRef = vue.ref();
  26799. const innerDate = vue.ref(dayjs().locale(lang.value));
  26800. const isChangeToNow = vue.ref(false);
  26801. let isShortcut = false;
  26802. const defaultTimeD = vue.computed(() => {
  26803. return dayjs(defaultTime).locale(lang.value);
  26804. });
  26805. const month = vue.computed(() => {
  26806. return innerDate.value.month();
  26807. });
  26808. const year = vue.computed(() => {
  26809. return innerDate.value.year();
  26810. });
  26811. const selectableRange = vue.ref([]);
  26812. const userInputDate = vue.ref(null);
  26813. const userInputTime = vue.ref(null);
  26814. const checkDateWithinRange = (date) => {
  26815. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  26816. };
  26817. const formatEmit = (emitDayjs) => {
  26818. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  26819. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  26820. }
  26821. if (showTime.value)
  26822. return emitDayjs.millisecond(0);
  26823. return emitDayjs.startOf("day");
  26824. };
  26825. const emit = (value, ...args) => {
  26826. if (!value) {
  26827. contextEmit("pick", value, ...args);
  26828. } else if (isArray$1(value)) {
  26829. const dates = value.map(formatEmit);
  26830. contextEmit("pick", dates, ...args);
  26831. } else {
  26832. contextEmit("pick", formatEmit(value), ...args);
  26833. }
  26834. userInputDate.value = null;
  26835. userInputTime.value = null;
  26836. isChangeToNow.value = false;
  26837. isShortcut = false;
  26838. };
  26839. const handleDatePick = async (value, keepOpen) => {
  26840. if (selectionMode.value === "date") {
  26841. value = value;
  26842. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  26843. if (!checkDateWithinRange(newDate)) {
  26844. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  26845. }
  26846. innerDate.value = newDate;
  26847. emit(newDate, showTime.value || keepOpen);
  26848. if (props.type === "datetime") {
  26849. await vue.nextTick();
  26850. handleFocusPicker();
  26851. }
  26852. } else if (selectionMode.value === "week") {
  26853. emit(value.date);
  26854. } else if (selectionMode.value === "dates") {
  26855. emit(value, true);
  26856. }
  26857. };
  26858. const moveByMonth = (forward) => {
  26859. const action = forward ? "add" : "subtract";
  26860. innerDate.value = innerDate.value[action](1, "month");
  26861. handlePanelChange("month");
  26862. };
  26863. const moveByYear = (forward) => {
  26864. const currentDate = innerDate.value;
  26865. const action = forward ? "add" : "subtract";
  26866. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  26867. handlePanelChange("year");
  26868. };
  26869. const currentView = vue.ref("date");
  26870. const yearLabel = vue.computed(() => {
  26871. const yearTranslation = t("el.datepicker.year");
  26872. if (currentView.value === "year") {
  26873. const startYear = Math.floor(year.value / 10) * 10;
  26874. if (yearTranslation) {
  26875. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  26876. }
  26877. return `${startYear} - ${startYear + 9}`;
  26878. }
  26879. return `${year.value} ${yearTranslation}`;
  26880. });
  26881. const handleShortcutClick = (shortcut) => {
  26882. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26883. if (shortcutValue) {
  26884. isShortcut = true;
  26885. emit(dayjs(shortcutValue).locale(lang.value));
  26886. return;
  26887. }
  26888. if (shortcut.onClick) {
  26889. shortcut.onClick({
  26890. attrs,
  26891. slots,
  26892. emit: contextEmit
  26893. });
  26894. }
  26895. };
  26896. const selectionMode = vue.computed(() => {
  26897. const { type } = props;
  26898. if (["week", "month", "months", "year", "years", "dates"].includes(type))
  26899. return type;
  26900. return "date";
  26901. });
  26902. const isMultipleType = vue.computed(() => {
  26903. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  26904. });
  26905. const keyboardMode = vue.computed(() => {
  26906. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  26907. });
  26908. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  26909. const handleMonthPick = async (month2, keepOpen) => {
  26910. if (selectionMode.value === "month") {
  26911. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26912. emit(innerDate.value, false);
  26913. } else if (selectionMode.value === "months") {
  26914. emit(month2, keepOpen != null ? keepOpen : true);
  26915. } else {
  26916. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26917. currentView.value = "date";
  26918. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26919. emit(innerDate.value, true);
  26920. await vue.nextTick();
  26921. handleFocusPicker();
  26922. }
  26923. }
  26924. handlePanelChange("month");
  26925. };
  26926. const handleYearPick = async (year2, keepOpen) => {
  26927. if (selectionMode.value === "year") {
  26928. const data = innerDate.value.startOf("year").year(year2);
  26929. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26930. emit(innerDate.value, false);
  26931. } else if (selectionMode.value === "years") {
  26932. emit(year2, keepOpen != null ? keepOpen : true);
  26933. } else {
  26934. const data = innerDate.value.year(year2);
  26935. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26936. currentView.value = "month";
  26937. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26938. emit(innerDate.value, true);
  26939. await vue.nextTick();
  26940. handleFocusPicker();
  26941. }
  26942. }
  26943. handlePanelChange("year");
  26944. };
  26945. const showPicker = async (view) => {
  26946. currentView.value = view;
  26947. await vue.nextTick();
  26948. handleFocusPicker();
  26949. };
  26950. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  26951. const footerVisible = vue.computed(() => {
  26952. const showDateFooter = showTime.value || selectionMode.value === "dates";
  26953. const showYearFooter = selectionMode.value === "years";
  26954. const showMonthFooter = selectionMode.value === "months";
  26955. const isDateView = currentView.value === "date";
  26956. const isYearView = currentView.value === "year";
  26957. const isMonthView = currentView.value === "month";
  26958. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  26959. });
  26960. const disabledConfirm = vue.computed(() => {
  26961. if (!disabledDate)
  26962. return false;
  26963. if (!props.parsedValue)
  26964. return true;
  26965. if (isArray$1(props.parsedValue)) {
  26966. return disabledDate(props.parsedValue[0].toDate());
  26967. }
  26968. return disabledDate(props.parsedValue.toDate());
  26969. });
  26970. const onConfirm = () => {
  26971. if (isMultipleType.value) {
  26972. emit(props.parsedValue);
  26973. } else {
  26974. let result = props.parsedValue;
  26975. if (!result) {
  26976. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  26977. const defaultValueD = getDefaultValue();
  26978. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  26979. }
  26980. innerDate.value = result;
  26981. emit(result);
  26982. }
  26983. };
  26984. const disabledNow = vue.computed(() => {
  26985. if (!disabledDate)
  26986. return false;
  26987. return disabledDate(dayjs().locale(lang.value).toDate());
  26988. });
  26989. const changeToNow = () => {
  26990. const now = dayjs().locale(lang.value);
  26991. const nowDate = now.toDate();
  26992. isChangeToNow.value = true;
  26993. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  26994. innerDate.value = dayjs().locale(lang.value);
  26995. emit(innerDate.value);
  26996. }
  26997. };
  26998. const timeFormat = vue.computed(() => {
  26999. return props.timeFormat || extractTimeFormat(props.format);
  27000. });
  27001. const dateFormat = vue.computed(() => {
  27002. return props.dateFormat || extractDateFormat(props.format);
  27003. });
  27004. const visibleTime = vue.computed(() => {
  27005. if (userInputTime.value)
  27006. return userInputTime.value;
  27007. if (!props.parsedValue && !defaultValue.value)
  27008. return;
  27009. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  27010. });
  27011. const visibleDate = vue.computed(() => {
  27012. if (userInputDate.value)
  27013. return userInputDate.value;
  27014. if (!props.parsedValue && !defaultValue.value)
  27015. return;
  27016. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  27017. });
  27018. const timePickerVisible = vue.ref(false);
  27019. const onTimePickerInputFocus = () => {
  27020. timePickerVisible.value = true;
  27021. };
  27022. const handleTimePickClose = () => {
  27023. timePickerVisible.value = false;
  27024. };
  27025. const getUnits = (date) => {
  27026. return {
  27027. hour: date.hour(),
  27028. minute: date.minute(),
  27029. second: date.second(),
  27030. year: date.year(),
  27031. month: date.month(),
  27032. date: date.date()
  27033. };
  27034. };
  27035. const handleTimePick = (value, visible, first) => {
  27036. const { hour, minute, second } = getUnits(value);
  27037. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  27038. innerDate.value = newDate;
  27039. emit(innerDate.value, true);
  27040. if (!first) {
  27041. timePickerVisible.value = visible;
  27042. }
  27043. };
  27044. const handleVisibleTimeChange = (value) => {
  27045. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  27046. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  27047. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  27048. innerDate.value = newDate.year(year2).month(month2).date(date);
  27049. userInputTime.value = null;
  27050. timePickerVisible.value = false;
  27051. emit(innerDate.value, true);
  27052. }
  27053. };
  27054. const handleVisibleDateChange = (value) => {
  27055. const newDate = correctlyParseUserInput(value, dateFormat.value, lang.value, isDefaultFormat);
  27056. if (newDate.isValid()) {
  27057. if (disabledDate && disabledDate(newDate.toDate())) {
  27058. return;
  27059. }
  27060. const { hour, minute, second } = getUnits(innerDate.value);
  27061. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  27062. userInputDate.value = null;
  27063. emit(innerDate.value, true);
  27064. }
  27065. };
  27066. const isValidValue = (date) => {
  27067. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  27068. };
  27069. const formatToString = (value) => {
  27070. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  27071. };
  27072. const parseUserInput = (value) => {
  27073. return correctlyParseUserInput(value, props.format, lang.value, isDefaultFormat);
  27074. };
  27075. const getDefaultValue = () => {
  27076. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  27077. if (!defaultValue.value) {
  27078. const defaultTimeDValue = defaultTimeD.value;
  27079. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  27080. }
  27081. return parseDate;
  27082. };
  27083. const handleFocusPicker = () => {
  27084. var _a;
  27085. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  27086. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  27087. }
  27088. };
  27089. const _handleFocusPicker = () => {
  27090. handleFocusPicker();
  27091. if (selectionMode.value === "week") {
  27092. handleKeyControl(EVENT_CODE.down);
  27093. }
  27094. };
  27095. const handleKeydownTable = (event) => {
  27096. const { code } = event;
  27097. const validCode = [
  27098. EVENT_CODE.up,
  27099. EVENT_CODE.down,
  27100. EVENT_CODE.left,
  27101. EVENT_CODE.right,
  27102. EVENT_CODE.home,
  27103. EVENT_CODE.end,
  27104. EVENT_CODE.pageUp,
  27105. EVENT_CODE.pageDown
  27106. ];
  27107. if (validCode.includes(code)) {
  27108. handleKeyControl(code);
  27109. event.stopPropagation();
  27110. event.preventDefault();
  27111. }
  27112. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  27113. event.preventDefault();
  27114. emit(innerDate.value, false);
  27115. }
  27116. };
  27117. const handleKeyControl = (code) => {
  27118. var _a;
  27119. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  27120. const mapping = {
  27121. year: {
  27122. [up]: -4,
  27123. [down]: 4,
  27124. [left]: -1,
  27125. [right]: 1,
  27126. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  27127. },
  27128. month: {
  27129. [up]: -4,
  27130. [down]: 4,
  27131. [left]: -1,
  27132. [right]: 1,
  27133. offset: (date, step) => date.setMonth(date.getMonth() + step)
  27134. },
  27135. week: {
  27136. [up]: -1,
  27137. [down]: 1,
  27138. [left]: -1,
  27139. [right]: 1,
  27140. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  27141. },
  27142. date: {
  27143. [up]: -7,
  27144. [down]: 7,
  27145. [left]: -1,
  27146. [right]: 1,
  27147. [home]: (date) => -date.getDay(),
  27148. [end]: (date) => -date.getDay() + 6,
  27149. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  27150. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  27151. offset: (date, step) => date.setDate(date.getDate() + step)
  27152. }
  27153. };
  27154. const newDate = innerDate.value.toDate();
  27155. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  27156. const map = mapping[keyboardMode.value];
  27157. if (!map)
  27158. return;
  27159. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  27160. if (disabledDate && disabledDate(newDate)) {
  27161. break;
  27162. }
  27163. const result = dayjs(newDate).locale(lang.value);
  27164. innerDate.value = result;
  27165. contextEmit("pick", result, true);
  27166. break;
  27167. }
  27168. };
  27169. const handlePanelChange = (mode) => {
  27170. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  27171. };
  27172. vue.watch(() => selectionMode.value, (val) => {
  27173. if (["month", "year"].includes(val)) {
  27174. currentView.value = val;
  27175. return;
  27176. } else if (val === "years") {
  27177. currentView.value = "year";
  27178. return;
  27179. } else if (val === "months") {
  27180. currentView.value = "month";
  27181. return;
  27182. }
  27183. currentView.value = "date";
  27184. }, { immediate: true });
  27185. vue.watch(() => currentView.value, () => {
  27186. popper == null ? void 0 : popper.updatePopper();
  27187. });
  27188. vue.watch(() => defaultValue.value, (val) => {
  27189. if (val) {
  27190. innerDate.value = getDefaultValue();
  27191. }
  27192. }, { immediate: true });
  27193. vue.watch(() => props.parsedValue, (val) => {
  27194. if (val) {
  27195. if (isMultipleType.value)
  27196. return;
  27197. if (isArray$1(val))
  27198. return;
  27199. innerDate.value = val;
  27200. } else {
  27201. innerDate.value = getDefaultValue();
  27202. }
  27203. }, { immediate: true });
  27204. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  27205. contextEmit("set-picker-option", ["formatToString", formatToString]);
  27206. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  27207. contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
  27208. return (_ctx, _cache) => {
  27209. return vue.openBlock(), vue.createElementBlock("div", {
  27210. class: vue.normalizeClass([
  27211. vue.unref(ppNs).b(),
  27212. vue.unref(dpNs).b(),
  27213. {
  27214. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  27215. "has-time": vue.unref(showTime)
  27216. }
  27217. ])
  27218. }, [
  27219. vue.createElementVNode("div", {
  27220. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27221. }, [
  27222. vue.renderSlot(_ctx.$slots, "sidebar", {
  27223. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27224. }),
  27225. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27226. key: 0,
  27227. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27228. }, [
  27229. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27230. return vue.openBlock(), vue.createElementBlock("button", {
  27231. key,
  27232. type: "button",
  27233. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27234. onClick: ($event) => handleShortcutClick(shortcut)
  27235. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  27236. }), 128))
  27237. ], 2)) : vue.createCommentVNode("v-if", true),
  27238. vue.createElementVNode("div", {
  27239. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27240. }, [
  27241. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27242. key: 0,
  27243. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  27244. }, [
  27245. vue.createElementVNode("span", {
  27246. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  27247. }, [
  27248. vue.createVNode(vue.unref(ElInput), {
  27249. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  27250. "model-value": vue.unref(visibleDate),
  27251. size: "small",
  27252. "validate-event": false,
  27253. onInput: (val) => userInputDate.value = val,
  27254. onChange: handleVisibleDateChange
  27255. }, null, 8, ["placeholder", "model-value", "onInput"])
  27256. ], 2),
  27257. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27258. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  27259. }, [
  27260. vue.createVNode(vue.unref(ElInput), {
  27261. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  27262. "model-value": vue.unref(visibleTime),
  27263. size: "small",
  27264. "validate-event": false,
  27265. onFocus: onTimePickerInputFocus,
  27266. onInput: (val) => userInputTime.value = val,
  27267. onChange: handleVisibleTimeChange
  27268. }, null, 8, ["placeholder", "model-value", "onInput"]),
  27269. vue.createVNode(vue.unref(TimePickPanel), {
  27270. visible: timePickerVisible.value,
  27271. format: vue.unref(timeFormat),
  27272. "parsed-value": innerDate.value,
  27273. onPick: handleTimePick
  27274. }, null, 8, ["visible", "format", "parsed-value"])
  27275. ], 2)), [
  27276. [vue.unref(ClickOutside), handleTimePickClose]
  27277. ])
  27278. ], 2)) : vue.createCommentVNode("v-if", true),
  27279. vue.withDirectives(vue.createElementVNode("div", {
  27280. class: vue.normalizeClass([
  27281. vue.unref(dpNs).e("header"),
  27282. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered")
  27283. ])
  27284. }, [
  27285. vue.createElementVNode("span", {
  27286. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  27287. }, [
  27288. vue.createElementVNode("button", {
  27289. type: "button",
  27290. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  27291. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  27292. onClick: ($event) => moveByYear(false)
  27293. }, [
  27294. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27295. vue.createVNode(vue.unref(ElIcon), null, {
  27296. default: vue.withCtx(() => [
  27297. vue.createVNode(vue.unref(d_arrow_left_default))
  27298. ]),
  27299. _: 1
  27300. })
  27301. ])
  27302. ], 10, ["aria-label", "onClick"]),
  27303. vue.withDirectives(vue.createElementVNode("button", {
  27304. type: "button",
  27305. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  27306. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  27307. onClick: ($event) => moveByMonth(false)
  27308. }, [
  27309. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27310. vue.createVNode(vue.unref(ElIcon), null, {
  27311. default: vue.withCtx(() => [
  27312. vue.createVNode(vue.unref(arrow_left_default))
  27313. ]),
  27314. _: 1
  27315. })
  27316. ])
  27317. ], 10, ["aria-label", "onClick"]), [
  27318. [vue.vShow, currentView.value === "date"]
  27319. ])
  27320. ], 2),
  27321. vue.createElementVNode("span", {
  27322. role: "button",
  27323. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  27324. "aria-live": "polite",
  27325. tabindex: "0",
  27326. onKeydown: vue.withKeys(($event) => showPicker("year"), ["enter"]),
  27327. onClick: ($event) => showPicker("year")
  27328. }, vue.toDisplayString(vue.unref(yearLabel)), 43, ["onKeydown", "onClick"]),
  27329. vue.withDirectives(vue.createElementVNode("span", {
  27330. role: "button",
  27331. "aria-live": "polite",
  27332. tabindex: "0",
  27333. class: vue.normalizeClass([
  27334. vue.unref(dpNs).e("header-label"),
  27335. { active: currentView.value === "month" }
  27336. ]),
  27337. onKeydown: vue.withKeys(($event) => showPicker("month"), ["enter"]),
  27338. onClick: ($event) => showPicker("month")
  27339. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
  27340. [vue.vShow, currentView.value === "date"]
  27341. ]),
  27342. vue.createElementVNode("span", {
  27343. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  27344. }, [
  27345. vue.withDirectives(vue.createElementVNode("button", {
  27346. type: "button",
  27347. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  27348. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  27349. onClick: ($event) => moveByMonth(true)
  27350. }, [
  27351. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  27352. vue.createVNode(vue.unref(ElIcon), null, {
  27353. default: vue.withCtx(() => [
  27354. vue.createVNode(vue.unref(arrow_right_default))
  27355. ]),
  27356. _: 1
  27357. })
  27358. ])
  27359. ], 10, ["aria-label", "onClick"]), [
  27360. [vue.vShow, currentView.value === "date"]
  27361. ]),
  27362. vue.createElementVNode("button", {
  27363. type: "button",
  27364. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27365. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27366. onClick: ($event) => moveByYear(true)
  27367. }, [
  27368. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  27369. vue.createVNode(vue.unref(ElIcon), null, {
  27370. default: vue.withCtx(() => [
  27371. vue.createVNode(vue.unref(d_arrow_right_default))
  27372. ]),
  27373. _: 1
  27374. })
  27375. ])
  27376. ], 10, ["aria-label", "onClick"])
  27377. ], 2)
  27378. ], 2), [
  27379. [vue.vShow, currentView.value !== "time"]
  27380. ]),
  27381. vue.createElementVNode("div", {
  27382. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  27383. onKeydown: handleKeydownTable
  27384. }, [
  27385. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  27386. key: 0,
  27387. ref_key: "currentViewRef",
  27388. ref: currentViewRef,
  27389. "selection-mode": vue.unref(selectionMode),
  27390. date: innerDate.value,
  27391. "parsed-value": _ctx.parsedValue,
  27392. "disabled-date": vue.unref(disabledDate),
  27393. "cell-class-name": vue.unref(cellClassName),
  27394. onPick: handleDatePick
  27395. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  27396. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  27397. key: 1,
  27398. ref_key: "currentViewRef",
  27399. ref: currentViewRef,
  27400. "selection-mode": vue.unref(selectionMode),
  27401. date: innerDate.value,
  27402. "disabled-date": vue.unref(disabledDate),
  27403. "parsed-value": _ctx.parsedValue,
  27404. onPick: handleYearPick
  27405. }, null, 8, ["selection-mode", "date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true),
  27406. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  27407. key: 2,
  27408. ref_key: "currentViewRef",
  27409. ref: currentViewRef,
  27410. "selection-mode": vue.unref(selectionMode),
  27411. date: innerDate.value,
  27412. "parsed-value": _ctx.parsedValue,
  27413. "disabled-date": vue.unref(disabledDate),
  27414. onPick: handleMonthPick
  27415. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true)
  27416. ], 34)
  27417. ], 2)
  27418. ], 2),
  27419. vue.withDirectives(vue.createElementVNode("div", {
  27420. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  27421. }, [
  27422. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  27423. text: "",
  27424. size: "small",
  27425. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27426. disabled: vue.unref(disabledNow),
  27427. onClick: changeToNow
  27428. }, {
  27429. default: vue.withCtx(() => [
  27430. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  27431. ]),
  27432. _: 1
  27433. }, 8, ["class", "disabled"]), [
  27434. [vue.vShow, !vue.unref(isMultipleType) && _ctx.showNow]
  27435. ]),
  27436. vue.createVNode(vue.unref(ElButton), {
  27437. plain: "",
  27438. size: "small",
  27439. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27440. disabled: vue.unref(disabledConfirm),
  27441. onClick: onConfirm
  27442. }, {
  27443. default: vue.withCtx(() => [
  27444. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  27445. ]),
  27446. _: 1
  27447. }, 8, ["class", "disabled"])
  27448. ], 2), [
  27449. [vue.vShow, vue.unref(footerVisible)]
  27450. ])
  27451. ], 2);
  27452. };
  27453. }
  27454. });
  27455. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "panel-date-pick.vue"]]);
  27456. const panelDateRangeProps = buildProps({
  27457. ...panelSharedProps,
  27458. ...panelRangeSharedProps,
  27459. visible: Boolean
  27460. });
  27461. const useShortcut = (lang) => {
  27462. const { emit } = vue.getCurrentInstance();
  27463. const attrs = vue.useAttrs();
  27464. const slots = vue.useSlots();
  27465. const handleShortcutClick = (shortcut) => {
  27466. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  27467. if (shortcutValues) {
  27468. emit("pick", [
  27469. dayjs(shortcutValues[0]).locale(lang.value),
  27470. dayjs(shortcutValues[1]).locale(lang.value)
  27471. ]);
  27472. return;
  27473. }
  27474. if (shortcut.onClick) {
  27475. shortcut.onClick({
  27476. attrs,
  27477. slots,
  27478. emit
  27479. });
  27480. }
  27481. };
  27482. return handleShortcutClick;
  27483. };
  27484. const useRangePicker = (props, {
  27485. defaultValue,
  27486. leftDate,
  27487. rightDate,
  27488. unit,
  27489. onParsedValueChanged
  27490. }) => {
  27491. const { emit } = vue.getCurrentInstance();
  27492. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  27493. const drpNs = useNamespace("date-range-picker");
  27494. const { t, lang } = useLocale();
  27495. const handleShortcutClick = useShortcut(lang);
  27496. const minDate = vue.ref();
  27497. const maxDate = vue.ref();
  27498. const rangeState = vue.ref({
  27499. endDate: null,
  27500. selecting: false
  27501. });
  27502. const handleChangeRange = (val) => {
  27503. rangeState.value = val;
  27504. };
  27505. const handleRangeConfirm = (visible = false) => {
  27506. const _minDate = vue.unref(minDate);
  27507. const _maxDate = vue.unref(maxDate);
  27508. if (isValidRange([_minDate, _maxDate])) {
  27509. emit("pick", [_minDate, _maxDate], visible);
  27510. }
  27511. };
  27512. const onSelect = (selecting) => {
  27513. rangeState.value.selecting = selecting;
  27514. if (!selecting) {
  27515. rangeState.value.endDate = null;
  27516. }
  27517. };
  27518. const onReset = (parsedValue) => {
  27519. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  27520. const [start, end] = parsedValue;
  27521. minDate.value = start;
  27522. leftDate.value = start;
  27523. maxDate.value = end;
  27524. onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate));
  27525. } else {
  27526. restoreDefault();
  27527. }
  27528. };
  27529. const restoreDefault = () => {
  27530. const [start, end] = getDefaultValue(vue.unref(defaultValue), {
  27531. lang: vue.unref(lang),
  27532. unit,
  27533. unlinkPanels: props.unlinkPanels
  27534. });
  27535. minDate.value = void 0;
  27536. maxDate.value = void 0;
  27537. leftDate.value = start;
  27538. rightDate.value = end;
  27539. };
  27540. vue.watch(defaultValue, (val) => {
  27541. if (val) {
  27542. restoreDefault();
  27543. }
  27544. }, { immediate: true });
  27545. vue.watch(() => props.parsedValue, onReset, { immediate: true });
  27546. return {
  27547. minDate,
  27548. maxDate,
  27549. rangeState,
  27550. lang,
  27551. ppNs: pickerNs,
  27552. drpNs,
  27553. handleChangeRange,
  27554. handleRangeConfirm,
  27555. handleShortcutClick,
  27556. onSelect,
  27557. onReset,
  27558. t
  27559. };
  27560. };
  27561. const unit$2 = "month";
  27562. const _sfc_main$1u = /* @__PURE__ */ vue.defineComponent({
  27563. __name: "panel-date-range",
  27564. props: panelDateRangeProps,
  27565. emits: [
  27566. "pick",
  27567. "set-picker-option",
  27568. "calendar-change",
  27569. "panel-change"
  27570. ],
  27571. setup(__props, { emit }) {
  27572. const props = __props;
  27573. const pickerBase = vue.inject("EP_PICKER_BASE");
  27574. const isDefaultFormat = vue.inject("ElIsDefaultFormat");
  27575. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  27576. const format = vue.toRef(pickerBase.props, "format");
  27577. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  27578. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  27579. const { lang } = useLocale();
  27580. const leftDate = vue.ref(dayjs().locale(lang.value));
  27581. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$2));
  27582. const {
  27583. minDate,
  27584. maxDate,
  27585. rangeState,
  27586. ppNs,
  27587. drpNs,
  27588. handleChangeRange,
  27589. handleRangeConfirm,
  27590. handleShortcutClick,
  27591. onSelect,
  27592. onReset,
  27593. t
  27594. } = useRangePicker(props, {
  27595. defaultValue,
  27596. leftDate,
  27597. rightDate,
  27598. unit: unit$2,
  27599. onParsedValueChanged
  27600. });
  27601. vue.watch(() => props.visible, (visible) => {
  27602. if (!visible && rangeState.value.selecting) {
  27603. onReset(props.parsedValue);
  27604. onSelect(false);
  27605. }
  27606. });
  27607. const dateUserInput = vue.ref({
  27608. min: null,
  27609. max: null
  27610. });
  27611. const timeUserInput = vue.ref({
  27612. min: null,
  27613. max: null
  27614. });
  27615. const leftLabel = vue.computed(() => {
  27616. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  27617. });
  27618. const rightLabel = vue.computed(() => {
  27619. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  27620. });
  27621. const leftYear = vue.computed(() => {
  27622. return leftDate.value.year();
  27623. });
  27624. const leftMonth = vue.computed(() => {
  27625. return leftDate.value.month();
  27626. });
  27627. const rightYear = vue.computed(() => {
  27628. return rightDate.value.year();
  27629. });
  27630. const rightMonth = vue.computed(() => {
  27631. return rightDate.value.month();
  27632. });
  27633. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  27634. const minVisibleDate = vue.computed(() => {
  27635. if (dateUserInput.value.min !== null)
  27636. return dateUserInput.value.min;
  27637. if (minDate.value)
  27638. return minDate.value.format(dateFormat.value);
  27639. return "";
  27640. });
  27641. const maxVisibleDate = vue.computed(() => {
  27642. if (dateUserInput.value.max !== null)
  27643. return dateUserInput.value.max;
  27644. if (maxDate.value || minDate.value)
  27645. return (maxDate.value || minDate.value).format(dateFormat.value);
  27646. return "";
  27647. });
  27648. const minVisibleTime = vue.computed(() => {
  27649. if (timeUserInput.value.min !== null)
  27650. return timeUserInput.value.min;
  27651. if (minDate.value)
  27652. return minDate.value.format(timeFormat.value);
  27653. return "";
  27654. });
  27655. const maxVisibleTime = vue.computed(() => {
  27656. if (timeUserInput.value.max !== null)
  27657. return timeUserInput.value.max;
  27658. if (maxDate.value || minDate.value)
  27659. return (maxDate.value || minDate.value).format(timeFormat.value);
  27660. return "";
  27661. });
  27662. const timeFormat = vue.computed(() => {
  27663. return props.timeFormat || extractTimeFormat(format.value);
  27664. });
  27665. const dateFormat = vue.computed(() => {
  27666. return props.dateFormat || extractDateFormat(format.value);
  27667. });
  27668. const isValidValue = (date) => {
  27669. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  27670. };
  27671. const leftPrevYear = () => {
  27672. leftDate.value = leftDate.value.subtract(1, "year");
  27673. if (!props.unlinkPanels) {
  27674. rightDate.value = leftDate.value.add(1, "month");
  27675. }
  27676. handlePanelChange("year");
  27677. };
  27678. const leftPrevMonth = () => {
  27679. leftDate.value = leftDate.value.subtract(1, "month");
  27680. if (!props.unlinkPanels) {
  27681. rightDate.value = leftDate.value.add(1, "month");
  27682. }
  27683. handlePanelChange("month");
  27684. };
  27685. const rightNextYear = () => {
  27686. if (!props.unlinkPanels) {
  27687. leftDate.value = leftDate.value.add(1, "year");
  27688. rightDate.value = leftDate.value.add(1, "month");
  27689. } else {
  27690. rightDate.value = rightDate.value.add(1, "year");
  27691. }
  27692. handlePanelChange("year");
  27693. };
  27694. const rightNextMonth = () => {
  27695. if (!props.unlinkPanels) {
  27696. leftDate.value = leftDate.value.add(1, "month");
  27697. rightDate.value = leftDate.value.add(1, "month");
  27698. } else {
  27699. rightDate.value = rightDate.value.add(1, "month");
  27700. }
  27701. handlePanelChange("month");
  27702. };
  27703. const leftNextYear = () => {
  27704. leftDate.value = leftDate.value.add(1, "year");
  27705. handlePanelChange("year");
  27706. };
  27707. const leftNextMonth = () => {
  27708. leftDate.value = leftDate.value.add(1, "month");
  27709. handlePanelChange("month");
  27710. };
  27711. const rightPrevYear = () => {
  27712. rightDate.value = rightDate.value.subtract(1, "year");
  27713. handlePanelChange("year");
  27714. };
  27715. const rightPrevMonth = () => {
  27716. rightDate.value = rightDate.value.subtract(1, "month");
  27717. handlePanelChange("month");
  27718. };
  27719. const handlePanelChange = (mode) => {
  27720. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  27721. };
  27722. const enableMonthArrow = vue.computed(() => {
  27723. const nextMonth = (leftMonth.value + 1) % 12;
  27724. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  27725. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  27726. });
  27727. const enableYearArrow = vue.computed(() => {
  27728. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  27729. });
  27730. const btnDisabled = vue.computed(() => {
  27731. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  27732. });
  27733. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  27734. const formatEmit = (emitDayjs, index) => {
  27735. if (!emitDayjs)
  27736. return;
  27737. if (defaultTime) {
  27738. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  27739. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  27740. }
  27741. return emitDayjs;
  27742. };
  27743. const handleRangePick = (val, close = true) => {
  27744. const min_ = val.minDate;
  27745. const max_ = val.maxDate;
  27746. const minDate_ = formatEmit(min_, 0);
  27747. const maxDate_ = formatEmit(max_, 1);
  27748. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27749. return;
  27750. }
  27751. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  27752. maxDate.value = maxDate_;
  27753. minDate.value = minDate_;
  27754. if (!close || showTime.value)
  27755. return;
  27756. handleRangeConfirm();
  27757. };
  27758. const minTimePickerVisible = vue.ref(false);
  27759. const maxTimePickerVisible = vue.ref(false);
  27760. const handleMinTimeClose = () => {
  27761. minTimePickerVisible.value = false;
  27762. };
  27763. const handleMaxTimeClose = () => {
  27764. maxTimePickerVisible.value = false;
  27765. };
  27766. const handleDateInput = (value, type) => {
  27767. dateUserInput.value[type] = value;
  27768. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  27769. if (parsedValueD.isValid()) {
  27770. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  27771. return;
  27772. }
  27773. if (type === "min") {
  27774. leftDate.value = parsedValueD;
  27775. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27776. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  27777. rightDate.value = parsedValueD.add(1, "month");
  27778. maxDate.value = minDate.value.add(1, "month");
  27779. }
  27780. } else {
  27781. rightDate.value = parsedValueD;
  27782. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27783. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  27784. leftDate.value = parsedValueD.subtract(1, "month");
  27785. minDate.value = maxDate.value.subtract(1, "month");
  27786. }
  27787. }
  27788. }
  27789. };
  27790. const handleDateChange = (_, type) => {
  27791. dateUserInput.value[type] = null;
  27792. };
  27793. const handleTimeInput = (value, type) => {
  27794. timeUserInput.value[type] = value;
  27795. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  27796. if (parsedValueD.isValid()) {
  27797. if (type === "min") {
  27798. minTimePickerVisible.value = true;
  27799. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27800. } else {
  27801. maxTimePickerVisible.value = true;
  27802. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27803. rightDate.value = maxDate.value;
  27804. }
  27805. }
  27806. };
  27807. const handleTimeChange = (value, type) => {
  27808. timeUserInput.value[type] = null;
  27809. if (type === "min") {
  27810. leftDate.value = minDate.value;
  27811. minTimePickerVisible.value = false;
  27812. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27813. maxDate.value = minDate.value;
  27814. }
  27815. } else {
  27816. rightDate.value = maxDate.value;
  27817. maxTimePickerVisible.value = false;
  27818. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27819. minDate.value = maxDate.value;
  27820. }
  27821. }
  27822. };
  27823. const handleMinTimePick = (value, visible, first) => {
  27824. if (timeUserInput.value.min)
  27825. return;
  27826. if (value) {
  27827. leftDate.value = value;
  27828. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27829. }
  27830. if (!first) {
  27831. minTimePickerVisible.value = visible;
  27832. }
  27833. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27834. maxDate.value = minDate.value;
  27835. rightDate.value = value;
  27836. }
  27837. };
  27838. const handleMaxTimePick = (value, visible, first) => {
  27839. if (timeUserInput.value.max)
  27840. return;
  27841. if (value) {
  27842. rightDate.value = value;
  27843. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27844. }
  27845. if (!first) {
  27846. maxTimePickerVisible.value = visible;
  27847. }
  27848. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27849. minDate.value = maxDate.value;
  27850. }
  27851. };
  27852. const handleClear = () => {
  27853. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  27854. lang: vue.unref(lang),
  27855. unit: "month",
  27856. unlinkPanels: props.unlinkPanels
  27857. })[0];
  27858. rightDate.value = leftDate.value.add(1, "month");
  27859. maxDate.value = void 0;
  27860. minDate.value = void 0;
  27861. emit("pick", null);
  27862. };
  27863. const formatToString = (value) => {
  27864. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  27865. };
  27866. const parseUserInput = (value) => {
  27867. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  27868. };
  27869. function onParsedValueChanged(minDate2, maxDate2) {
  27870. if (props.unlinkPanels && maxDate2) {
  27871. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  27872. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  27873. const maxDateYear = maxDate2.year();
  27874. const maxDateMonth = maxDate2.month();
  27875. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
  27876. } else {
  27877. rightDate.value = leftDate.value.add(1, unit$2);
  27878. if (maxDate2) {
  27879. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  27880. }
  27881. }
  27882. }
  27883. emit("set-picker-option", ["isValidValue", isValidValue]);
  27884. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  27885. emit("set-picker-option", ["formatToString", formatToString]);
  27886. emit("set-picker-option", ["handleClear", handleClear]);
  27887. return (_ctx, _cache) => {
  27888. return vue.openBlock(), vue.createElementBlock("div", {
  27889. class: vue.normalizeClass([
  27890. vue.unref(ppNs).b(),
  27891. vue.unref(drpNs).b(),
  27892. {
  27893. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  27894. "has-time": vue.unref(showTime)
  27895. }
  27896. ])
  27897. }, [
  27898. vue.createElementVNode("div", {
  27899. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27900. }, [
  27901. vue.renderSlot(_ctx.$slots, "sidebar", {
  27902. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27903. }),
  27904. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27905. key: 0,
  27906. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27907. }, [
  27908. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27909. return vue.openBlock(), vue.createElementBlock("button", {
  27910. key,
  27911. type: "button",
  27912. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27913. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  27914. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  27915. }), 128))
  27916. ], 2)) : vue.createCommentVNode("v-if", true),
  27917. vue.createElementVNode("div", {
  27918. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27919. }, [
  27920. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27921. key: 0,
  27922. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  27923. }, [
  27924. vue.createElementVNode("span", {
  27925. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  27926. }, [
  27927. vue.createElementVNode("span", {
  27928. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27929. }, [
  27930. vue.createVNode(vue.unref(ElInput), {
  27931. size: "small",
  27932. disabled: vue.unref(rangeState).selecting,
  27933. placeholder: vue.unref(t)("el.datepicker.startDate"),
  27934. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27935. "model-value": vue.unref(minVisibleDate),
  27936. "validate-event": false,
  27937. onInput: (val) => handleDateInput(val, "min"),
  27938. onChange: (val) => handleDateChange(val, "min")
  27939. }, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
  27940. ], 2),
  27941. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27942. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27943. }, [
  27944. vue.createVNode(vue.unref(ElInput), {
  27945. size: "small",
  27946. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27947. disabled: vue.unref(rangeState).selecting,
  27948. placeholder: vue.unref(t)("el.datepicker.startTime"),
  27949. "model-value": vue.unref(minVisibleTime),
  27950. "validate-event": false,
  27951. onFocus: ($event) => minTimePickerVisible.value = true,
  27952. onInput: (val) => handleTimeInput(val, "min"),
  27953. onChange: (val) => handleTimeChange(val, "min")
  27954. }, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
  27955. vue.createVNode(vue.unref(TimePickPanel), {
  27956. visible: minTimePickerVisible.value,
  27957. format: vue.unref(timeFormat),
  27958. "datetime-role": "start",
  27959. "parsed-value": leftDate.value,
  27960. onPick: handleMinTimePick
  27961. }, null, 8, ["visible", "format", "parsed-value"])
  27962. ], 2)), [
  27963. [vue.unref(ClickOutside), handleMinTimeClose]
  27964. ])
  27965. ], 2),
  27966. vue.createElementVNode("span", null, [
  27967. vue.createVNode(vue.unref(ElIcon), null, {
  27968. default: vue.withCtx(() => [
  27969. vue.createVNode(vue.unref(arrow_right_default))
  27970. ]),
  27971. _: 1
  27972. })
  27973. ]),
  27974. vue.createElementVNode("span", {
  27975. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  27976. }, [
  27977. vue.createElementVNode("span", {
  27978. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27979. }, [
  27980. vue.createVNode(vue.unref(ElInput), {
  27981. size: "small",
  27982. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27983. disabled: vue.unref(rangeState).selecting,
  27984. placeholder: vue.unref(t)("el.datepicker.endDate"),
  27985. "model-value": vue.unref(maxVisibleDate),
  27986. readonly: !vue.unref(minDate),
  27987. "validate-event": false,
  27988. onInput: (val) => handleDateInput(val, "max"),
  27989. onChange: (val) => handleDateChange(val, "max")
  27990. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
  27991. ], 2),
  27992. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27993. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27994. }, [
  27995. vue.createVNode(vue.unref(ElInput), {
  27996. size: "small",
  27997. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27998. disabled: vue.unref(rangeState).selecting,
  27999. placeholder: vue.unref(t)("el.datepicker.endTime"),
  28000. "model-value": vue.unref(maxVisibleTime),
  28001. readonly: !vue.unref(minDate),
  28002. "validate-event": false,
  28003. onFocus: ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true),
  28004. onInput: (val) => handleTimeInput(val, "max"),
  28005. onChange: (val) => handleTimeChange(val, "max")
  28006. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
  28007. vue.createVNode(vue.unref(TimePickPanel), {
  28008. "datetime-role": "end",
  28009. visible: maxTimePickerVisible.value,
  28010. format: vue.unref(timeFormat),
  28011. "parsed-value": rightDate.value,
  28012. onPick: handleMaxTimePick
  28013. }, null, 8, ["visible", "format", "parsed-value"])
  28014. ], 2)), [
  28015. [vue.unref(ClickOutside), handleMaxTimeClose]
  28016. ])
  28017. ], 2)
  28018. ], 2)) : vue.createCommentVNode("v-if", true),
  28019. vue.createElementVNode("div", {
  28020. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  28021. }, [
  28022. vue.createElementVNode("div", {
  28023. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28024. }, [
  28025. vue.createElementVNode("button", {
  28026. type: "button",
  28027. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28028. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  28029. onClick: leftPrevYear
  28030. }, [
  28031. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28032. vue.createVNode(vue.unref(ElIcon), null, {
  28033. default: vue.withCtx(() => [
  28034. vue.createVNode(vue.unref(d_arrow_left_default))
  28035. ]),
  28036. _: 1
  28037. })
  28038. ])
  28039. ], 10, ["aria-label"]),
  28040. vue.createElementVNode("button", {
  28041. type: "button",
  28042. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  28043. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  28044. onClick: leftPrevMonth
  28045. }, [
  28046. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  28047. vue.createVNode(vue.unref(ElIcon), null, {
  28048. default: vue.withCtx(() => [
  28049. vue.createVNode(vue.unref(arrow_left_default))
  28050. ]),
  28051. _: 1
  28052. })
  28053. ])
  28054. ], 10, ["aria-label"]),
  28055. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28056. key: 0,
  28057. type: "button",
  28058. disabled: !vue.unref(enableYearArrow),
  28059. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]),
  28060. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  28061. onClick: leftNextYear
  28062. }, [
  28063. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28064. vue.createVNode(vue.unref(ElIcon), null, {
  28065. default: vue.withCtx(() => [
  28066. vue.createVNode(vue.unref(d_arrow_right_default))
  28067. ]),
  28068. _: 1
  28069. })
  28070. ])
  28071. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  28072. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28073. key: 1,
  28074. type: "button",
  28075. disabled: !vue.unref(enableMonthArrow),
  28076. class: vue.normalizeClass([[
  28077. vue.unref(ppNs).e("icon-btn"),
  28078. { "is-disabled": !vue.unref(enableMonthArrow) }
  28079. ], "arrow-right"]),
  28080. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  28081. onClick: leftNextMonth
  28082. }, [
  28083. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  28084. vue.createVNode(vue.unref(ElIcon), null, {
  28085. default: vue.withCtx(() => [
  28086. vue.createVNode(vue.unref(arrow_right_default))
  28087. ]),
  28088. _: 1
  28089. })
  28090. ])
  28091. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  28092. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  28093. ], 2),
  28094. vue.createVNode(DateTable, {
  28095. "selection-mode": "range",
  28096. date: leftDate.value,
  28097. "min-date": vue.unref(minDate),
  28098. "max-date": vue.unref(maxDate),
  28099. "range-state": vue.unref(rangeState),
  28100. "disabled-date": vue.unref(disabledDate),
  28101. "cell-class-name": vue.unref(cellClassName),
  28102. onChangerange: vue.unref(handleChangeRange),
  28103. onPick: handleRangePick,
  28104. onSelect: vue.unref(onSelect)
  28105. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28106. ], 2),
  28107. vue.createElementVNode("div", {
  28108. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  28109. }, [
  28110. vue.createElementVNode("div", {
  28111. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28112. }, [
  28113. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28114. key: 0,
  28115. type: "button",
  28116. disabled: !vue.unref(enableYearArrow),
  28117. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  28118. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  28119. onClick: rightPrevYear
  28120. }, [
  28121. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28122. vue.createVNode(vue.unref(ElIcon), null, {
  28123. default: vue.withCtx(() => [
  28124. vue.createVNode(vue.unref(d_arrow_left_default))
  28125. ]),
  28126. _: 1
  28127. })
  28128. ])
  28129. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  28130. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28131. key: 1,
  28132. type: "button",
  28133. disabled: !vue.unref(enableMonthArrow),
  28134. class: vue.normalizeClass([[
  28135. vue.unref(ppNs).e("icon-btn"),
  28136. { "is-disabled": !vue.unref(enableMonthArrow) }
  28137. ], "arrow-left"]),
  28138. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  28139. onClick: rightPrevMonth
  28140. }, [
  28141. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  28142. vue.createVNode(vue.unref(ElIcon), null, {
  28143. default: vue.withCtx(() => [
  28144. vue.createVNode(vue.unref(arrow_left_default))
  28145. ]),
  28146. _: 1
  28147. })
  28148. ])
  28149. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  28150. vue.createElementVNode("button", {
  28151. type: "button",
  28152. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  28153. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28154. onClick: rightNextYear
  28155. }, [
  28156. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28157. vue.createVNode(vue.unref(ElIcon), null, {
  28158. default: vue.withCtx(() => [
  28159. vue.createVNode(vue.unref(d_arrow_right_default))
  28160. ]),
  28161. _: 1
  28162. })
  28163. ])
  28164. ], 10, ["aria-label"]),
  28165. vue.createElementVNode("button", {
  28166. type: "button",
  28167. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  28168. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  28169. onClick: rightNextMonth
  28170. }, [
  28171. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  28172. vue.createVNode(vue.unref(ElIcon), null, {
  28173. default: vue.withCtx(() => [
  28174. vue.createVNode(vue.unref(arrow_right_default))
  28175. ]),
  28176. _: 1
  28177. })
  28178. ])
  28179. ], 10, ["aria-label"]),
  28180. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28181. ], 2),
  28182. vue.createVNode(DateTable, {
  28183. "selection-mode": "range",
  28184. date: rightDate.value,
  28185. "min-date": vue.unref(minDate),
  28186. "max-date": vue.unref(maxDate),
  28187. "range-state": vue.unref(rangeState),
  28188. "disabled-date": vue.unref(disabledDate),
  28189. "cell-class-name": vue.unref(cellClassName),
  28190. onChangerange: vue.unref(handleChangeRange),
  28191. onPick: handleRangePick,
  28192. onSelect: vue.unref(onSelect)
  28193. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28194. ], 2)
  28195. ], 2)
  28196. ], 2),
  28197. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  28198. key: 0,
  28199. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  28200. }, [
  28201. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  28202. key: 0,
  28203. text: "",
  28204. size: "small",
  28205. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  28206. onClick: handleClear
  28207. }, {
  28208. default: vue.withCtx(() => [
  28209. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  28210. ]),
  28211. _: 1
  28212. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  28213. vue.createVNode(vue.unref(ElButton), {
  28214. plain: "",
  28215. size: "small",
  28216. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  28217. disabled: vue.unref(btnDisabled),
  28218. onClick: ($event) => vue.unref(handleRangeConfirm)(false)
  28219. }, {
  28220. default: vue.withCtx(() => [
  28221. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  28222. ]),
  28223. _: 1
  28224. }, 8, ["class", "disabled", "onClick"])
  28225. ], 2)) : vue.createCommentVNode("v-if", true)
  28226. ], 2);
  28227. };
  28228. }
  28229. });
  28230. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "panel-date-range.vue"]]);
  28231. const panelMonthRangeProps = buildProps({
  28232. ...panelRangeSharedProps
  28233. });
  28234. const panelMonthRangeEmits = [
  28235. "pick",
  28236. "set-picker-option",
  28237. "calendar-change"
  28238. ];
  28239. const useMonthRangeHeader = ({
  28240. unlinkPanels,
  28241. leftDate,
  28242. rightDate
  28243. }) => {
  28244. const { t } = useLocale();
  28245. const leftPrevYear = () => {
  28246. leftDate.value = leftDate.value.subtract(1, "year");
  28247. if (!unlinkPanels.value) {
  28248. rightDate.value = rightDate.value.subtract(1, "year");
  28249. }
  28250. };
  28251. const rightNextYear = () => {
  28252. if (!unlinkPanels.value) {
  28253. leftDate.value = leftDate.value.add(1, "year");
  28254. }
  28255. rightDate.value = rightDate.value.add(1, "year");
  28256. };
  28257. const leftNextYear = () => {
  28258. leftDate.value = leftDate.value.add(1, "year");
  28259. };
  28260. const rightPrevYear = () => {
  28261. rightDate.value = rightDate.value.subtract(1, "year");
  28262. };
  28263. const leftLabel = vue.computed(() => {
  28264. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  28265. });
  28266. const rightLabel = vue.computed(() => {
  28267. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  28268. });
  28269. const leftYear = vue.computed(() => {
  28270. return leftDate.value.year();
  28271. });
  28272. const rightYear = vue.computed(() => {
  28273. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  28274. });
  28275. return {
  28276. leftPrevYear,
  28277. rightNextYear,
  28278. leftNextYear,
  28279. rightPrevYear,
  28280. leftLabel,
  28281. rightLabel,
  28282. leftYear,
  28283. rightYear
  28284. };
  28285. };
  28286. const unit$1 = "year";
  28287. const __default__$16 = vue.defineComponent({
  28288. name: "DatePickerMonthRange"
  28289. });
  28290. const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
  28291. ...__default__$16,
  28292. props: panelMonthRangeProps,
  28293. emits: panelMonthRangeEmits,
  28294. setup(__props, { emit }) {
  28295. const props = __props;
  28296. const { lang } = useLocale();
  28297. const pickerBase = vue.inject("EP_PICKER_BASE");
  28298. const isDefaultFormat = vue.inject("ElIsDefaultFormat");
  28299. const { shortcuts, disabledDate } = pickerBase.props;
  28300. const format = vue.toRef(pickerBase.props, "format");
  28301. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  28302. const leftDate = vue.ref(dayjs().locale(lang.value));
  28303. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  28304. const {
  28305. minDate,
  28306. maxDate,
  28307. rangeState,
  28308. ppNs,
  28309. drpNs,
  28310. handleChangeRange,
  28311. handleRangeConfirm,
  28312. handleShortcutClick,
  28313. onSelect
  28314. } = useRangePicker(props, {
  28315. defaultValue,
  28316. leftDate,
  28317. rightDate,
  28318. unit: unit$1,
  28319. onParsedValueChanged
  28320. });
  28321. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  28322. const {
  28323. leftPrevYear,
  28324. rightNextYear,
  28325. leftNextYear,
  28326. rightPrevYear,
  28327. leftLabel,
  28328. rightLabel,
  28329. leftYear,
  28330. rightYear
  28331. } = useMonthRangeHeader({
  28332. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  28333. leftDate,
  28334. rightDate
  28335. });
  28336. const enableYearArrow = vue.computed(() => {
  28337. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28338. });
  28339. const handleRangePick = (val, close = true) => {
  28340. const minDate_ = val.minDate;
  28341. const maxDate_ = val.maxDate;
  28342. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28343. return;
  28344. }
  28345. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28346. maxDate.value = maxDate_;
  28347. minDate.value = minDate_;
  28348. if (!close)
  28349. return;
  28350. handleRangeConfirm();
  28351. };
  28352. const handleClear = () => {
  28353. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  28354. lang: vue.unref(lang),
  28355. unit: "year",
  28356. unlinkPanels: props.unlinkPanels
  28357. })[0];
  28358. rightDate.value = leftDate.value.add(1, "year");
  28359. emit("pick", null);
  28360. };
  28361. const formatToString = (value) => {
  28362. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  28363. };
  28364. const parseUserInput = (value) => {
  28365. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  28366. };
  28367. function onParsedValueChanged(minDate2, maxDate2) {
  28368. if (props.unlinkPanels && maxDate2) {
  28369. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  28370. const maxDateYear = maxDate2.year();
  28371. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
  28372. } else {
  28373. rightDate.value = leftDate.value.add(1, unit$1);
  28374. }
  28375. }
  28376. emit("set-picker-option", ["isValidValue", isValidRange]);
  28377. emit("set-picker-option", ["formatToString", formatToString]);
  28378. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28379. emit("set-picker-option", ["handleClear", handleClear]);
  28380. return (_ctx, _cache) => {
  28381. return vue.openBlock(), vue.createElementBlock("div", {
  28382. class: vue.normalizeClass([
  28383. vue.unref(ppNs).b(),
  28384. vue.unref(drpNs).b(),
  28385. {
  28386. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  28387. }
  28388. ])
  28389. }, [
  28390. vue.createElementVNode("div", {
  28391. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  28392. }, [
  28393. vue.renderSlot(_ctx.$slots, "sidebar", {
  28394. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28395. }),
  28396. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  28397. key: 0,
  28398. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28399. }, [
  28400. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  28401. return vue.openBlock(), vue.createElementBlock("button", {
  28402. key,
  28403. type: "button",
  28404. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  28405. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  28406. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  28407. }), 128))
  28408. ], 2)) : vue.createCommentVNode("v-if", true),
  28409. vue.createElementVNode("div", {
  28410. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  28411. }, [
  28412. vue.createElementVNode("div", {
  28413. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  28414. }, [
  28415. vue.createElementVNode("div", {
  28416. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28417. }, [
  28418. vue.createElementVNode("button", {
  28419. type: "button",
  28420. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28421. onClick: vue.unref(leftPrevYear)
  28422. }, [
  28423. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28424. vue.createVNode(vue.unref(ElIcon), null, {
  28425. default: vue.withCtx(() => [
  28426. vue.createVNode(vue.unref(d_arrow_left_default))
  28427. ]),
  28428. _: 1
  28429. })
  28430. ])
  28431. ], 10, ["onClick"]),
  28432. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28433. key: 0,
  28434. type: "button",
  28435. disabled: !vue.unref(enableYearArrow),
  28436. class: vue.normalizeClass([[
  28437. vue.unref(ppNs).e("icon-btn"),
  28438. { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) }
  28439. ], "d-arrow-right"]),
  28440. onClick: vue.unref(leftNextYear)
  28441. }, [
  28442. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28443. vue.createVNode(vue.unref(ElIcon), null, {
  28444. default: vue.withCtx(() => [
  28445. vue.createVNode(vue.unref(d_arrow_right_default))
  28446. ]),
  28447. _: 1
  28448. })
  28449. ])
  28450. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28451. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  28452. ], 2),
  28453. vue.createVNode(MonthTable, {
  28454. "selection-mode": "range",
  28455. date: leftDate.value,
  28456. "min-date": vue.unref(minDate),
  28457. "max-date": vue.unref(maxDate),
  28458. "range-state": vue.unref(rangeState),
  28459. "disabled-date": vue.unref(disabledDate),
  28460. onChangerange: vue.unref(handleChangeRange),
  28461. onPick: handleRangePick,
  28462. onSelect: vue.unref(onSelect)
  28463. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28464. ], 2),
  28465. vue.createElementVNode("div", {
  28466. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  28467. }, [
  28468. vue.createElementVNode("div", {
  28469. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28470. }, [
  28471. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28472. key: 0,
  28473. type: "button",
  28474. disabled: !vue.unref(enableYearArrow),
  28475. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  28476. onClick: vue.unref(rightPrevYear)
  28477. }, [
  28478. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28479. vue.createVNode(vue.unref(ElIcon), null, {
  28480. default: vue.withCtx(() => [
  28481. vue.createVNode(vue.unref(d_arrow_left_default))
  28482. ]),
  28483. _: 1
  28484. })
  28485. ])
  28486. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28487. vue.createElementVNode("button", {
  28488. type: "button",
  28489. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28490. onClick: vue.unref(rightNextYear)
  28491. }, [
  28492. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28493. vue.createVNode(vue.unref(ElIcon), null, {
  28494. default: vue.withCtx(() => [
  28495. vue.createVNode(vue.unref(d_arrow_right_default))
  28496. ]),
  28497. _: 1
  28498. })
  28499. ])
  28500. ], 10, ["onClick"]),
  28501. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28502. ], 2),
  28503. vue.createVNode(MonthTable, {
  28504. "selection-mode": "range",
  28505. date: rightDate.value,
  28506. "min-date": vue.unref(minDate),
  28507. "max-date": vue.unref(maxDate),
  28508. "range-state": vue.unref(rangeState),
  28509. "disabled-date": vue.unref(disabledDate),
  28510. onChangerange: vue.unref(handleChangeRange),
  28511. onPick: handleRangePick,
  28512. onSelect: vue.unref(onSelect)
  28513. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28514. ], 2)
  28515. ], 2)
  28516. ], 2)
  28517. ], 2);
  28518. };
  28519. }
  28520. });
  28521. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "panel-month-range.vue"]]);
  28522. const panelYearRangeProps = buildProps({
  28523. ...panelRangeSharedProps
  28524. });
  28525. const panelYearRangeEmits = [
  28526. "pick",
  28527. "set-picker-option",
  28528. "calendar-change"
  28529. ];
  28530. const useYearRangeHeader = ({
  28531. unlinkPanels,
  28532. leftDate,
  28533. rightDate
  28534. }) => {
  28535. const leftPrevYear = () => {
  28536. leftDate.value = leftDate.value.subtract(10, "year");
  28537. if (!unlinkPanels.value) {
  28538. rightDate.value = rightDate.value.subtract(10, "year");
  28539. }
  28540. };
  28541. const rightNextYear = () => {
  28542. if (!unlinkPanels.value) {
  28543. leftDate.value = leftDate.value.add(10, "year");
  28544. }
  28545. rightDate.value = rightDate.value.add(10, "year");
  28546. };
  28547. const leftNextYear = () => {
  28548. leftDate.value = leftDate.value.add(10, "year");
  28549. };
  28550. const rightPrevYear = () => {
  28551. rightDate.value = rightDate.value.subtract(10, "year");
  28552. };
  28553. const leftLabel = vue.computed(() => {
  28554. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  28555. return `${leftStartDate}-${leftStartDate + 9}`;
  28556. });
  28557. const rightLabel = vue.computed(() => {
  28558. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28559. return `${rightStartDate}-${rightStartDate + 9}`;
  28560. });
  28561. const leftYear = vue.computed(() => {
  28562. const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
  28563. return leftEndDate;
  28564. });
  28565. const rightYear = vue.computed(() => {
  28566. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28567. return rightStartDate;
  28568. });
  28569. return {
  28570. leftPrevYear,
  28571. rightNextYear,
  28572. leftNextYear,
  28573. rightPrevYear,
  28574. leftLabel,
  28575. rightLabel,
  28576. leftYear,
  28577. rightYear
  28578. };
  28579. };
  28580. const unit = "year";
  28581. const __default__$15 = vue.defineComponent({
  28582. name: "DatePickerYearRange"
  28583. });
  28584. const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
  28585. ...__default__$15,
  28586. props: panelYearRangeProps,
  28587. emits: panelYearRangeEmits,
  28588. setup(__props, { emit }) {
  28589. const props = __props;
  28590. const { lang } = useLocale();
  28591. const leftDate = vue.ref(dayjs().locale(lang.value));
  28592. const rightDate = vue.ref(leftDate.value.add(10, "year"));
  28593. const { pickerNs: ppNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  28594. const drpNs = useNamespace("date-range-picker");
  28595. const isDefaultFormat = vue.inject("isDefaultFormat");
  28596. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  28597. const panelKls = vue.computed(() => [
  28598. ppNs.b(),
  28599. drpNs.b(),
  28600. {
  28601. "has-sidebar": Boolean(vue.useSlots().sidebar) || hasShortcuts.value
  28602. }
  28603. ]);
  28604. const leftPanelKls = vue.computed(() => {
  28605. return {
  28606. content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
  28607. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  28608. arrowRightBtn: [
  28609. ppNs.e("icon-btn"),
  28610. { [ppNs.is("disabled")]: !enableYearArrow.value },
  28611. "d-arrow-right"
  28612. ]
  28613. };
  28614. });
  28615. const rightPanelKls = vue.computed(() => {
  28616. return {
  28617. content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
  28618. arrowLeftBtn: [
  28619. ppNs.e("icon-btn"),
  28620. { "is-disabled": !enableYearArrow.value },
  28621. "d-arrow-left"
  28622. ],
  28623. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  28624. };
  28625. });
  28626. const handleShortcutClick = useShortcut(lang);
  28627. const {
  28628. leftPrevYear,
  28629. rightNextYear,
  28630. leftNextYear,
  28631. rightPrevYear,
  28632. leftLabel,
  28633. rightLabel,
  28634. leftYear,
  28635. rightYear
  28636. } = useYearRangeHeader({
  28637. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  28638. leftDate,
  28639. rightDate
  28640. });
  28641. const enableYearArrow = vue.computed(() => {
  28642. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28643. });
  28644. const minDate = vue.ref();
  28645. const maxDate = vue.ref();
  28646. const rangeState = vue.ref({
  28647. endDate: null,
  28648. selecting: false
  28649. });
  28650. const handleChangeRange = (val) => {
  28651. rangeState.value = val;
  28652. };
  28653. const handleRangePick = (val, close = true) => {
  28654. const minDate_ = val.minDate;
  28655. const maxDate_ = val.maxDate;
  28656. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28657. return;
  28658. }
  28659. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28660. maxDate.value = maxDate_;
  28661. minDate.value = minDate_;
  28662. if (!close)
  28663. return;
  28664. handleConfirm();
  28665. };
  28666. const handleConfirm = (visible = false) => {
  28667. if (isValidRange([minDate.value, maxDate.value])) {
  28668. emit("pick", [minDate.value, maxDate.value], visible);
  28669. }
  28670. };
  28671. const onSelect = (selecting) => {
  28672. rangeState.value.selecting = selecting;
  28673. if (!selecting) {
  28674. rangeState.value.endDate = null;
  28675. }
  28676. };
  28677. const pickerBase = vue.inject("EP_PICKER_BASE");
  28678. const { shortcuts, disabledDate } = pickerBase.props;
  28679. const format = vue.toRef(pickerBase.props, "format");
  28680. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  28681. const getDefaultValue = () => {
  28682. let start;
  28683. if (isArray$1(defaultValue.value)) {
  28684. const left = dayjs(defaultValue.value[0]);
  28685. let right = dayjs(defaultValue.value[1]);
  28686. if (!props.unlinkPanels) {
  28687. right = left.add(10, unit);
  28688. }
  28689. return [left, right];
  28690. } else if (defaultValue.value) {
  28691. start = dayjs(defaultValue.value);
  28692. } else {
  28693. start = dayjs();
  28694. }
  28695. start = start.locale(lang.value);
  28696. return [start, start.add(10, unit)];
  28697. };
  28698. vue.watch(() => defaultValue.value, (val) => {
  28699. if (val) {
  28700. const defaultArr = getDefaultValue();
  28701. leftDate.value = defaultArr[0];
  28702. rightDate.value = defaultArr[1];
  28703. }
  28704. }, { immediate: true });
  28705. vue.watch(() => props.parsedValue, (newVal) => {
  28706. if (newVal && newVal.length === 2) {
  28707. minDate.value = newVal[0];
  28708. maxDate.value = newVal[1];
  28709. leftDate.value = minDate.value;
  28710. if (props.unlinkPanels && maxDate.value) {
  28711. const minDateYear = minDate.value.year();
  28712. const maxDateYear = maxDate.value.year();
  28713. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(10, "year") : maxDate.value;
  28714. } else {
  28715. rightDate.value = leftDate.value.add(10, "year");
  28716. }
  28717. } else {
  28718. const defaultArr = getDefaultValue();
  28719. minDate.value = void 0;
  28720. maxDate.value = void 0;
  28721. leftDate.value = defaultArr[0];
  28722. rightDate.value = defaultArr[1];
  28723. }
  28724. }, { immediate: true });
  28725. const parseUserInput = (value) => {
  28726. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  28727. };
  28728. const formatToString = (value) => {
  28729. return isArray$1(value) ? value.map((day) => day.format(format.value)) : value.format(format.value);
  28730. };
  28731. const isValidValue = (date) => {
  28732. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  28733. };
  28734. const handleClear = () => {
  28735. const defaultArr = getDefaultValue();
  28736. leftDate.value = defaultArr[0];
  28737. rightDate.value = defaultArr[1];
  28738. maxDate.value = void 0;
  28739. minDate.value = void 0;
  28740. emit("pick", null);
  28741. };
  28742. emit("set-picker-option", ["isValidValue", isValidValue]);
  28743. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28744. emit("set-picker-option", ["formatToString", formatToString]);
  28745. emit("set-picker-option", ["handleClear", handleClear]);
  28746. return (_ctx, _cache) => {
  28747. return vue.openBlock(), vue.createElementBlock("div", {
  28748. class: vue.normalizeClass(vue.unref(panelKls))
  28749. }, [
  28750. vue.createElementVNode("div", {
  28751. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  28752. }, [
  28753. vue.renderSlot(_ctx.$slots, "sidebar", {
  28754. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28755. }),
  28756. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  28757. key: 0,
  28758. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28759. }, [
  28760. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  28761. return vue.openBlock(), vue.createElementBlock("button", {
  28762. key,
  28763. type: "button",
  28764. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  28765. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  28766. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  28767. }), 128))
  28768. ], 2)) : vue.createCommentVNode("v-if", true),
  28769. vue.createElementVNode("div", {
  28770. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  28771. }, [
  28772. vue.createElementVNode("div", {
  28773. class: vue.normalizeClass(vue.unref(leftPanelKls).content)
  28774. }, [
  28775. vue.createElementVNode("div", {
  28776. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28777. }, [
  28778. vue.createElementVNode("button", {
  28779. type: "button",
  28780. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowLeftBtn),
  28781. onClick: vue.unref(leftPrevYear)
  28782. }, [
  28783. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28784. vue.createVNode(vue.unref(ElIcon), null, {
  28785. default: vue.withCtx(() => [
  28786. vue.createVNode(vue.unref(d_arrow_left_default))
  28787. ]),
  28788. _: 1
  28789. })
  28790. ])
  28791. ], 10, ["onClick"]),
  28792. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28793. key: 0,
  28794. type: "button",
  28795. disabled: !vue.unref(enableYearArrow),
  28796. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowRightBtn),
  28797. onClick: vue.unref(leftNextYear)
  28798. }, [
  28799. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28800. vue.createVNode(vue.unref(ElIcon), null, {
  28801. default: vue.withCtx(() => [
  28802. vue.createVNode(vue.unref(d_arrow_right_default))
  28803. ]),
  28804. _: 1
  28805. })
  28806. ])
  28807. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28808. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  28809. ], 2),
  28810. vue.createVNode(YearTable, {
  28811. "selection-mode": "range",
  28812. date: leftDate.value,
  28813. "min-date": minDate.value,
  28814. "max-date": maxDate.value,
  28815. "range-state": rangeState.value,
  28816. "disabled-date": vue.unref(disabledDate),
  28817. onChangerange: handleChangeRange,
  28818. onPick: handleRangePick,
  28819. onSelect
  28820. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28821. ], 2),
  28822. vue.createElementVNode("div", {
  28823. class: vue.normalizeClass(vue.unref(rightPanelKls).content)
  28824. }, [
  28825. vue.createElementVNode("div", {
  28826. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28827. }, [
  28828. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28829. key: 0,
  28830. type: "button",
  28831. disabled: !vue.unref(enableYearArrow),
  28832. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowLeftBtn),
  28833. onClick: vue.unref(rightPrevYear)
  28834. }, [
  28835. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28836. vue.createVNode(vue.unref(ElIcon), null, {
  28837. default: vue.withCtx(() => [
  28838. vue.createVNode(vue.unref(d_arrow_left_default))
  28839. ]),
  28840. _: 1
  28841. })
  28842. ])
  28843. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28844. vue.createElementVNode("button", {
  28845. type: "button",
  28846. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowRightBtn),
  28847. onClick: vue.unref(rightNextYear)
  28848. }, [
  28849. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28850. vue.createVNode(vue.unref(ElIcon), null, {
  28851. default: vue.withCtx(() => [
  28852. vue.createVNode(vue.unref(d_arrow_right_default))
  28853. ]),
  28854. _: 1
  28855. })
  28856. ])
  28857. ], 10, ["onClick"]),
  28858. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28859. ], 2),
  28860. vue.createVNode(YearTable, {
  28861. "selection-mode": "range",
  28862. date: rightDate.value,
  28863. "min-date": minDate.value,
  28864. "max-date": maxDate.value,
  28865. "range-state": rangeState.value,
  28866. "disabled-date": vue.unref(disabledDate),
  28867. onChangerange: handleChangeRange,
  28868. onPick: handleRangePick,
  28869. onSelect
  28870. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28871. ], 2)
  28872. ], 2)
  28873. ], 2)
  28874. ], 2);
  28875. };
  28876. }
  28877. });
  28878. var YearRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "panel-year-range.vue"]]);
  28879. const getPanel = function(type) {
  28880. switch (type) {
  28881. case "daterange":
  28882. case "datetimerange": {
  28883. return DateRangePickPanel;
  28884. }
  28885. case "monthrange": {
  28886. return MonthRangePickPanel;
  28887. }
  28888. case "yearrange": {
  28889. return YearRangePickPanel;
  28890. }
  28891. default: {
  28892. return DatePickPanel;
  28893. }
  28894. }
  28895. };
  28896. dayjs.extend(localeData);
  28897. dayjs.extend(advancedFormat);
  28898. dayjs.extend(customParseFormat);
  28899. dayjs.extend(weekOfYear);
  28900. dayjs.extend(weekYear);
  28901. dayjs.extend(dayOfYear);
  28902. dayjs.extend(isSameOrAfter);
  28903. dayjs.extend(isSameOrBefore);
  28904. var DatePicker = vue.defineComponent({
  28905. name: "ElDatePicker",
  28906. install: null,
  28907. props: datePickerProps,
  28908. emits: [UPDATE_MODEL_EVENT],
  28909. setup(props, {
  28910. expose,
  28911. emit,
  28912. slots
  28913. }) {
  28914. const ns = useNamespace("picker-panel");
  28915. const isDefaultFormat = vue.computed(() => {
  28916. return !props.format;
  28917. });
  28918. vue.provide("ElIsDefaultFormat", isDefaultFormat);
  28919. vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions")));
  28920. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  28921. slots,
  28922. pickerNs: ns
  28923. });
  28924. const commonPicker = vue.ref();
  28925. const refProps = {
  28926. focus: () => {
  28927. var _a;
  28928. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  28929. },
  28930. blur: () => {
  28931. var _a;
  28932. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  28933. },
  28934. handleOpen: () => {
  28935. var _a;
  28936. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  28937. },
  28938. handleClose: () => {
  28939. var _a;
  28940. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  28941. }
  28942. };
  28943. expose(refProps);
  28944. const onModelValueUpdated = (val) => {
  28945. emit(UPDATE_MODEL_EVENT, val);
  28946. };
  28947. return () => {
  28948. var _a;
  28949. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  28950. const Component = getPanel(props.type);
  28951. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  28952. "format": format,
  28953. "type": props.type,
  28954. "ref": commonPicker,
  28955. "onUpdate:modelValue": onModelValueUpdated
  28956. }), {
  28957. default: (scopedProps) => vue.createVNode(Component, scopedProps, {
  28958. "prev-month": slots["prev-month"],
  28959. "next-month": slots["next-month"],
  28960. "prev-year": slots["prev-year"],
  28961. "next-year": slots["next-year"]
  28962. }),
  28963. "range-separator": slots["range-separator"]
  28964. });
  28965. };
  28966. }
  28967. });
  28968. const ElDatePicker = withInstall(DatePicker);
  28969. const descriptionsKey = Symbol("elDescriptions");
  28970. var ElDescriptionsCell = vue.defineComponent({
  28971. name: "ElDescriptionsCell",
  28972. props: {
  28973. cell: {
  28974. type: Object
  28975. },
  28976. tag: {
  28977. type: String,
  28978. default: "td"
  28979. },
  28980. type: {
  28981. type: String
  28982. }
  28983. },
  28984. setup() {
  28985. const descriptions = vue.inject(descriptionsKey, {});
  28986. return {
  28987. descriptions
  28988. };
  28989. },
  28990. render() {
  28991. var _a;
  28992. const item = getNormalizedProps(this.cell);
  28993. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  28994. const { dir, arg, modifiers, value } = dire;
  28995. return [dir, value, arg, modifiers];
  28996. });
  28997. const { border, direction } = this.descriptions;
  28998. const isVertical = direction === "vertical";
  28999. const renderLabel = () => {
  29000. var _a2, _b, _c;
  29001. return ((_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  29002. };
  29003. const renderContent = () => {
  29004. var _a2, _b, _c;
  29005. return (_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.default) == null ? void 0 : _c.call(_b);
  29006. };
  29007. const span = item.span;
  29008. const rowspan = item.rowspan;
  29009. const align = item.align ? `is-${item.align}` : "";
  29010. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  29011. const className = item.className;
  29012. const labelClassName = item.labelClassName;
  29013. const width = this.type === "label" ? item.labelWidth || this.descriptions.labelWidth || item.width : item.width;
  29014. const style = {
  29015. width: addUnit(width),
  29016. minWidth: addUnit(item.minWidth)
  29017. };
  29018. const ns = useNamespace("descriptions");
  29019. switch (this.type) {
  29020. case "label":
  29021. return vue.withDirectives(vue.h(this.tag, {
  29022. style,
  29023. class: [
  29024. ns.e("cell"),
  29025. ns.e("label"),
  29026. ns.is("bordered-label", border),
  29027. ns.is("vertical-label", isVertical),
  29028. labelAlign,
  29029. labelClassName
  29030. ],
  29031. colSpan: isVertical ? span : 1,
  29032. rowspan: isVertical ? 1 : rowspan
  29033. }, renderLabel()), directives);
  29034. case "content":
  29035. return vue.withDirectives(vue.h(this.tag, {
  29036. style,
  29037. class: [
  29038. ns.e("cell"),
  29039. ns.e("content"),
  29040. ns.is("bordered-content", border),
  29041. ns.is("vertical-content", isVertical),
  29042. align,
  29043. className
  29044. ],
  29045. colSpan: isVertical ? span : span * 2 - 1,
  29046. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  29047. }, renderContent()), directives);
  29048. default: {
  29049. const label = renderLabel();
  29050. const labelStyle = {};
  29051. const width2 = addUnit(item.labelWidth || this.descriptions.labelWidth);
  29052. if (width2) {
  29053. labelStyle.width = width2;
  29054. labelStyle.display = "inline-block";
  29055. }
  29056. return vue.withDirectives(vue.h("td", {
  29057. style,
  29058. class: [ns.e("cell"), align],
  29059. colSpan: span,
  29060. rowspan
  29061. }, [
  29062. !isNil(label) ? vue.h("span", {
  29063. style: labelStyle,
  29064. class: [ns.e("label"), labelClassName]
  29065. }, label) : void 0,
  29066. vue.h("span", {
  29067. class: [ns.e("content"), className]
  29068. }, renderContent())
  29069. ]), directives);
  29070. }
  29071. }
  29072. }
  29073. });
  29074. const descriptionsRowProps = buildProps({
  29075. row: {
  29076. type: definePropType(Array),
  29077. default: () => []
  29078. }
  29079. });
  29080. const __default__$14 = vue.defineComponent({
  29081. name: "ElDescriptionsRow"
  29082. });
  29083. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  29084. ...__default__$14,
  29085. props: descriptionsRowProps,
  29086. setup(__props) {
  29087. const descriptions = vue.inject(descriptionsKey, {});
  29088. return (_ctx, _cache) => {
  29089. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  29090. vue.createElementVNode("tr", null, [
  29091. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  29092. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  29093. key: `tr1-${_index}`,
  29094. cell,
  29095. tag: "th",
  29096. type: "label"
  29097. }, null, 8, ["cell"]);
  29098. }), 128))
  29099. ]),
  29100. vue.createElementVNode("tr", null, [
  29101. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  29102. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  29103. key: `tr2-${_index}`,
  29104. cell,
  29105. tag: "td",
  29106. type: "content"
  29107. }, null, 8, ["cell"]);
  29108. }), 128))
  29109. ])
  29110. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", { key: 1 }, [
  29111. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  29112. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  29113. key: `tr3-${_index}`
  29114. }, [
  29115. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  29116. vue.createVNode(vue.unref(ElDescriptionsCell), {
  29117. cell,
  29118. tag: "td",
  29119. type: "label"
  29120. }, null, 8, ["cell"]),
  29121. vue.createVNode(vue.unref(ElDescriptionsCell), {
  29122. cell,
  29123. tag: "td",
  29124. type: "content"
  29125. }, null, 8, ["cell"])
  29126. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  29127. key: 1,
  29128. cell,
  29129. tag: "td",
  29130. type: "both"
  29131. }, null, 8, ["cell"]))
  29132. ], 64);
  29133. }), 128))
  29134. ]));
  29135. };
  29136. }
  29137. });
  29138. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "descriptions-row.vue"]]);
  29139. const descriptionProps = buildProps({
  29140. border: Boolean,
  29141. column: {
  29142. type: Number,
  29143. default: 3
  29144. },
  29145. direction: {
  29146. type: String,
  29147. values: ["horizontal", "vertical"],
  29148. default: "horizontal"
  29149. },
  29150. size: useSizeProp,
  29151. title: {
  29152. type: String,
  29153. default: ""
  29154. },
  29155. extra: {
  29156. type: String,
  29157. default: ""
  29158. },
  29159. labelWidth: {
  29160. type: [String, Number],
  29161. default: ""
  29162. }
  29163. });
  29164. const COMPONENT_NAME$d = "ElDescriptionsItem";
  29165. const __default__$13 = vue.defineComponent({
  29166. name: "ElDescriptions"
  29167. });
  29168. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  29169. ...__default__$13,
  29170. props: descriptionProps,
  29171. setup(__props) {
  29172. const props = __props;
  29173. const ns = useNamespace("descriptions");
  29174. const descriptionsSize = useFormSize();
  29175. const slots = vue.useSlots();
  29176. vue.provide(descriptionsKey, props);
  29177. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  29178. const filledNode = (node, span, count, isLast = false) => {
  29179. if (!node.props) {
  29180. node.props = {};
  29181. }
  29182. if (span > count) {
  29183. node.props.span = count;
  29184. }
  29185. if (isLast) {
  29186. node.props.span = span;
  29187. }
  29188. return node;
  29189. };
  29190. const getRows = () => {
  29191. if (!slots.default)
  29192. return [];
  29193. const children = flattedChildren(slots.default()).filter((node) => {
  29194. var _a;
  29195. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === COMPONENT_NAME$d;
  29196. });
  29197. const rows = [];
  29198. let temp = [];
  29199. let count = props.column;
  29200. let totalSpan = 0;
  29201. const rowspanTemp = [];
  29202. children.forEach((node, index) => {
  29203. var _a, _b, _c;
  29204. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  29205. const rowspan = ((_b = node.props) == null ? void 0 : _b.rowspan) || 1;
  29206. const rowNo = rows.length;
  29207. rowspanTemp[rowNo] || (rowspanTemp[rowNo] = 0);
  29208. if (rowspan > 1) {
  29209. for (let i = 1; i < rowspan; i++) {
  29210. rowspanTemp[_c = rowNo + i] || (rowspanTemp[_c] = 0);
  29211. rowspanTemp[rowNo + i]++;
  29212. totalSpan++;
  29213. }
  29214. }
  29215. if (rowspanTemp[rowNo] > 0) {
  29216. count -= rowspanTemp[rowNo];
  29217. rowspanTemp[rowNo] = 0;
  29218. }
  29219. if (index < children.length - 1) {
  29220. totalSpan += span > count ? count : span;
  29221. }
  29222. if (index === children.length - 1) {
  29223. const lastSpan = props.column - totalSpan % props.column;
  29224. temp.push(filledNode(node, lastSpan, count, true));
  29225. rows.push(temp);
  29226. return;
  29227. }
  29228. if (span < count) {
  29229. count -= span;
  29230. temp.push(node);
  29231. } else {
  29232. temp.push(filledNode(node, span, count));
  29233. rows.push(temp);
  29234. count = props.column;
  29235. temp = [];
  29236. }
  29237. });
  29238. return rows;
  29239. };
  29240. return (_ctx, _cache) => {
  29241. return vue.openBlock(), vue.createElementBlock("div", {
  29242. class: vue.normalizeClass(vue.unref(descriptionKls))
  29243. }, [
  29244. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  29245. key: 0,
  29246. class: vue.normalizeClass(vue.unref(ns).e("header"))
  29247. }, [
  29248. vue.createElementVNode("div", {
  29249. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29250. }, [
  29251. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  29252. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  29253. ])
  29254. ], 2),
  29255. vue.createElementVNode("div", {
  29256. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  29257. }, [
  29258. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  29259. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  29260. ])
  29261. ], 2)
  29262. ], 2)) : vue.createCommentVNode("v-if", true),
  29263. vue.createElementVNode("div", {
  29264. class: vue.normalizeClass(vue.unref(ns).e("body"))
  29265. }, [
  29266. vue.createElementVNode("table", {
  29267. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  29268. }, [
  29269. vue.createElementVNode("tbody", null, [
  29270. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, _index) => {
  29271. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  29272. key: _index,
  29273. row
  29274. }, null, 8, ["row"]);
  29275. }), 128))
  29276. ])
  29277. ], 2)
  29278. ], 2)
  29279. ], 2);
  29280. };
  29281. }
  29282. });
  29283. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "description.vue"]]);
  29284. const descriptionItemProps = buildProps({
  29285. label: {
  29286. type: String,
  29287. default: ""
  29288. },
  29289. span: {
  29290. type: Number,
  29291. default: 1
  29292. },
  29293. rowspan: {
  29294. type: Number,
  29295. default: 1
  29296. },
  29297. width: {
  29298. type: [String, Number],
  29299. default: ""
  29300. },
  29301. minWidth: {
  29302. type: [String, Number],
  29303. default: ""
  29304. },
  29305. labelWidth: {
  29306. type: [String, Number],
  29307. default: ""
  29308. },
  29309. align: {
  29310. type: String,
  29311. default: "left"
  29312. },
  29313. labelAlign: {
  29314. type: String,
  29315. default: ""
  29316. },
  29317. className: {
  29318. type: String,
  29319. default: ""
  29320. },
  29321. labelClassName: {
  29322. type: String,
  29323. default: ""
  29324. }
  29325. });
  29326. const DescriptionItem = vue.defineComponent({
  29327. name: COMPONENT_NAME$d,
  29328. props: descriptionItemProps
  29329. });
  29330. const ElDescriptions = withInstall(Descriptions, {
  29331. DescriptionsItem: DescriptionItem
  29332. });
  29333. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  29334. const overlayProps = buildProps({
  29335. mask: {
  29336. type: Boolean,
  29337. default: true
  29338. },
  29339. customMaskEvent: Boolean,
  29340. overlayClass: {
  29341. type: definePropType([
  29342. String,
  29343. Array,
  29344. Object
  29345. ])
  29346. },
  29347. zIndex: {
  29348. type: definePropType([String, Number])
  29349. }
  29350. });
  29351. const overlayEmits = {
  29352. click: (evt) => evt instanceof MouseEvent
  29353. };
  29354. const BLOCK = "overlay";
  29355. var Overlay$1 = vue.defineComponent({
  29356. name: "ElOverlay",
  29357. props: overlayProps,
  29358. emits: overlayEmits,
  29359. setup(props, { slots, emit }) {
  29360. const ns = useNamespace(BLOCK);
  29361. const onMaskClick = (e) => {
  29362. emit("click", e);
  29363. };
  29364. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  29365. return () => {
  29366. return props.mask ? vue.createVNode("div", {
  29367. class: [ns.b(), props.overlayClass],
  29368. style: {
  29369. zIndex: props.zIndex
  29370. },
  29371. onClick,
  29372. onMousedown,
  29373. onMouseup
  29374. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  29375. class: props.overlayClass,
  29376. style: {
  29377. zIndex: props.zIndex,
  29378. position: "fixed",
  29379. top: "0px",
  29380. right: "0px",
  29381. bottom: "0px",
  29382. left: "0px"
  29383. }
  29384. }, [vue.renderSlot(slots, "default")]);
  29385. };
  29386. }
  29387. });
  29388. const ElOverlay = Overlay$1;
  29389. const dialogInjectionKey = Symbol("dialogInjectionKey");
  29390. const dialogContentProps = buildProps({
  29391. center: Boolean,
  29392. alignCenter: Boolean,
  29393. closeIcon: {
  29394. type: iconPropType
  29395. },
  29396. draggable: Boolean,
  29397. overflow: Boolean,
  29398. fullscreen: Boolean,
  29399. headerClass: String,
  29400. bodyClass: String,
  29401. footerClass: String,
  29402. showClose: {
  29403. type: Boolean,
  29404. default: true
  29405. },
  29406. title: {
  29407. type: String,
  29408. default: ""
  29409. },
  29410. ariaLevel: {
  29411. type: String,
  29412. default: "2"
  29413. }
  29414. });
  29415. const dialogContentEmits = {
  29416. close: () => true
  29417. };
  29418. const __default__$12 = vue.defineComponent({ name: "ElDialogContent" });
  29419. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  29420. ...__default__$12,
  29421. props: dialogContentProps,
  29422. emits: dialogContentEmits,
  29423. setup(__props, { expose }) {
  29424. const props = __props;
  29425. const { t } = useLocale();
  29426. const { Close } = CloseComponents;
  29427. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  29428. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  29429. const dialogKls = vue.computed(() => [
  29430. ns.b(),
  29431. ns.is("fullscreen", props.fullscreen),
  29432. ns.is("draggable", props.draggable),
  29433. ns.is("align-center", props.alignCenter),
  29434. { [ns.m("center")]: props.center }
  29435. ]);
  29436. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  29437. const draggable = vue.computed(() => props.draggable);
  29438. const overflow = vue.computed(() => props.overflow);
  29439. const { resetPosition } = useDraggable(dialogRef, headerRef, draggable, overflow);
  29440. expose({
  29441. resetPosition
  29442. });
  29443. return (_ctx, _cache) => {
  29444. return vue.openBlock(), vue.createElementBlock("div", {
  29445. ref: vue.unref(composedDialogRef),
  29446. class: vue.normalizeClass(vue.unref(dialogKls)),
  29447. style: vue.normalizeStyle(vue.unref(style)),
  29448. tabindex: "-1"
  29449. }, [
  29450. vue.createElementVNode("header", {
  29451. ref_key: "headerRef",
  29452. ref: headerRef,
  29453. class: vue.normalizeClass([vue.unref(ns).e("header"), _ctx.headerClass, { "show-close": _ctx.showClose }])
  29454. }, [
  29455. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  29456. vue.createElementVNode("span", {
  29457. role: "heading",
  29458. "aria-level": _ctx.ariaLevel,
  29459. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29460. }, vue.toDisplayString(_ctx.title), 11, ["aria-level"])
  29461. ]),
  29462. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  29463. key: 0,
  29464. "aria-label": vue.unref(t)("el.dialog.close"),
  29465. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  29466. type: "button",
  29467. onClick: ($event) => _ctx.$emit("close")
  29468. }, [
  29469. vue.createVNode(vue.unref(ElIcon), {
  29470. class: vue.normalizeClass(vue.unref(ns).e("close"))
  29471. }, {
  29472. default: vue.withCtx(() => [
  29473. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  29474. ]),
  29475. _: 1
  29476. }, 8, ["class"])
  29477. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  29478. ], 2),
  29479. vue.createElementVNode("div", {
  29480. id: vue.unref(bodyId),
  29481. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass])
  29482. }, [
  29483. vue.renderSlot(_ctx.$slots, "default")
  29484. ], 10, ["id"]),
  29485. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  29486. key: 0,
  29487. class: vue.normalizeClass([vue.unref(ns).e("footer"), _ctx.footerClass])
  29488. }, [
  29489. vue.renderSlot(_ctx.$slots, "footer")
  29490. ], 2)) : vue.createCommentVNode("v-if", true)
  29491. ], 6);
  29492. };
  29493. }
  29494. });
  29495. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "dialog-content.vue"]]);
  29496. const dialogProps = buildProps({
  29497. ...dialogContentProps,
  29498. appendToBody: Boolean,
  29499. appendTo: {
  29500. type: definePropType([String, Object]),
  29501. default: "body"
  29502. },
  29503. beforeClose: {
  29504. type: definePropType(Function)
  29505. },
  29506. destroyOnClose: Boolean,
  29507. closeOnClickModal: {
  29508. type: Boolean,
  29509. default: true
  29510. },
  29511. closeOnPressEscape: {
  29512. type: Boolean,
  29513. default: true
  29514. },
  29515. lockScroll: {
  29516. type: Boolean,
  29517. default: true
  29518. },
  29519. modal: {
  29520. type: Boolean,
  29521. default: true
  29522. },
  29523. openDelay: {
  29524. type: Number,
  29525. default: 0
  29526. },
  29527. closeDelay: {
  29528. type: Number,
  29529. default: 0
  29530. },
  29531. top: {
  29532. type: String
  29533. },
  29534. modelValue: Boolean,
  29535. modalClass: String,
  29536. headerClass: String,
  29537. bodyClass: String,
  29538. footerClass: String,
  29539. width: {
  29540. type: [String, Number]
  29541. },
  29542. zIndex: {
  29543. type: Number
  29544. },
  29545. trapFocus: Boolean,
  29546. headerAriaLevel: {
  29547. type: String,
  29548. default: "2"
  29549. }
  29550. });
  29551. const dialogEmits = {
  29552. open: () => true,
  29553. opened: () => true,
  29554. close: () => true,
  29555. closed: () => true,
  29556. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  29557. openAutoFocus: () => true,
  29558. closeAutoFocus: () => true
  29559. };
  29560. const useDialog = (props, targetRef) => {
  29561. var _a;
  29562. const instance = vue.getCurrentInstance();
  29563. const emit = instance.emit;
  29564. const { nextZIndex } = useZIndex();
  29565. let lastPosition = "";
  29566. const titleId = useId();
  29567. const bodyId = useId();
  29568. const visible = vue.ref(false);
  29569. const closed = vue.ref(false);
  29570. const rendered = vue.ref(false);
  29571. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  29572. let openTimer = void 0;
  29573. let closeTimer = void 0;
  29574. const namespace = useGlobalConfig("namespace", defaultNamespace);
  29575. const style = vue.computed(() => {
  29576. const style2 = {};
  29577. const varPrefix = `--${namespace.value}-dialog`;
  29578. if (!props.fullscreen) {
  29579. if (props.top) {
  29580. style2[`${varPrefix}-margin-top`] = props.top;
  29581. }
  29582. if (props.width) {
  29583. style2[`${varPrefix}-width`] = addUnit(props.width);
  29584. }
  29585. }
  29586. return style2;
  29587. });
  29588. const overlayDialogStyle = vue.computed(() => {
  29589. if (props.alignCenter) {
  29590. return { display: "flex" };
  29591. }
  29592. return {};
  29593. });
  29594. function afterEnter() {
  29595. emit("opened");
  29596. }
  29597. function afterLeave() {
  29598. emit("closed");
  29599. emit(UPDATE_MODEL_EVENT, false);
  29600. if (props.destroyOnClose) {
  29601. rendered.value = false;
  29602. }
  29603. }
  29604. function beforeLeave() {
  29605. emit("close");
  29606. }
  29607. function open() {
  29608. closeTimer == null ? void 0 : closeTimer();
  29609. openTimer == null ? void 0 : openTimer();
  29610. if (props.openDelay && props.openDelay > 0) {
  29611. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  29612. } else {
  29613. doOpen();
  29614. }
  29615. }
  29616. function close() {
  29617. openTimer == null ? void 0 : openTimer();
  29618. closeTimer == null ? void 0 : closeTimer();
  29619. if (props.closeDelay && props.closeDelay > 0) {
  29620. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  29621. } else {
  29622. doClose();
  29623. }
  29624. }
  29625. function handleClose() {
  29626. function hide(shouldCancel) {
  29627. if (shouldCancel)
  29628. return;
  29629. closed.value = true;
  29630. visible.value = false;
  29631. }
  29632. if (props.beforeClose) {
  29633. props.beforeClose(hide);
  29634. } else {
  29635. close();
  29636. }
  29637. }
  29638. function onModalClick() {
  29639. if (props.closeOnClickModal) {
  29640. handleClose();
  29641. }
  29642. }
  29643. function doOpen() {
  29644. if (!isClient)
  29645. return;
  29646. visible.value = true;
  29647. }
  29648. function doClose() {
  29649. visible.value = false;
  29650. }
  29651. function onOpenAutoFocus() {
  29652. emit("openAutoFocus");
  29653. }
  29654. function onCloseAutoFocus() {
  29655. emit("closeAutoFocus");
  29656. }
  29657. function onFocusoutPrevented(event) {
  29658. var _a2;
  29659. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  29660. event.preventDefault();
  29661. }
  29662. }
  29663. if (props.lockScroll) {
  29664. useLockscreen(visible);
  29665. }
  29666. function onCloseRequested() {
  29667. if (props.closeOnPressEscape) {
  29668. handleClose();
  29669. }
  29670. }
  29671. vue.watch(() => props.modelValue, (val) => {
  29672. if (val) {
  29673. closed.value = false;
  29674. open();
  29675. rendered.value = true;
  29676. zIndex.value = isUndefined$1(props.zIndex) ? nextZIndex() : zIndex.value++;
  29677. vue.nextTick(() => {
  29678. emit("open");
  29679. if (targetRef.value) {
  29680. targetRef.value.parentElement.scrollTop = 0;
  29681. targetRef.value.parentElement.scrollLeft = 0;
  29682. targetRef.value.scrollTop = 0;
  29683. }
  29684. });
  29685. } else {
  29686. if (visible.value) {
  29687. close();
  29688. }
  29689. }
  29690. });
  29691. vue.watch(() => props.fullscreen, (val) => {
  29692. if (!targetRef.value)
  29693. return;
  29694. if (val) {
  29695. lastPosition = targetRef.value.style.transform;
  29696. targetRef.value.style.transform = "";
  29697. } else {
  29698. targetRef.value.style.transform = lastPosition;
  29699. }
  29700. });
  29701. vue.onMounted(() => {
  29702. if (props.modelValue) {
  29703. visible.value = true;
  29704. rendered.value = true;
  29705. open();
  29706. }
  29707. });
  29708. return {
  29709. afterEnter,
  29710. afterLeave,
  29711. beforeLeave,
  29712. handleClose,
  29713. onModalClick,
  29714. close,
  29715. doClose,
  29716. onOpenAutoFocus,
  29717. onCloseAutoFocus,
  29718. onCloseRequested,
  29719. onFocusoutPrevented,
  29720. titleId,
  29721. bodyId,
  29722. closed,
  29723. style,
  29724. overlayDialogStyle,
  29725. rendered,
  29726. visible,
  29727. zIndex
  29728. };
  29729. };
  29730. const __default__$11 = vue.defineComponent({
  29731. name: "ElDialog",
  29732. inheritAttrs: false
  29733. });
  29734. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  29735. ...__default__$11,
  29736. props: dialogProps,
  29737. emits: dialogEmits,
  29738. setup(__props, { expose }) {
  29739. const props = __props;
  29740. const slots = vue.useSlots();
  29741. useDeprecated({
  29742. scope: "el-dialog",
  29743. from: "the title slot",
  29744. replacement: "the header slot",
  29745. version: "3.0.0",
  29746. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  29747. }, vue.computed(() => !!slots.title));
  29748. const ns = useNamespace("dialog");
  29749. const dialogRef = vue.ref();
  29750. const headerRef = vue.ref();
  29751. const dialogContentRef = vue.ref();
  29752. const {
  29753. visible,
  29754. titleId,
  29755. bodyId,
  29756. style,
  29757. overlayDialogStyle,
  29758. rendered,
  29759. zIndex,
  29760. afterEnter,
  29761. afterLeave,
  29762. beforeLeave,
  29763. handleClose,
  29764. onModalClick,
  29765. onOpenAutoFocus,
  29766. onCloseAutoFocus,
  29767. onCloseRequested,
  29768. onFocusoutPrevented
  29769. } = useDialog(props, dialogRef);
  29770. vue.provide(dialogInjectionKey, {
  29771. dialogRef,
  29772. headerRef,
  29773. bodyId,
  29774. ns,
  29775. rendered,
  29776. style
  29777. });
  29778. const overlayEvent = useSameTarget(onModalClick);
  29779. const draggable = vue.computed(() => props.draggable && !props.fullscreen);
  29780. const resetPosition = () => {
  29781. var _a;
  29782. (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();
  29783. };
  29784. expose({
  29785. visible,
  29786. dialogContentRef,
  29787. resetPosition,
  29788. handleClose
  29789. });
  29790. return (_ctx, _cache) => {
  29791. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  29792. to: _ctx.appendTo,
  29793. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29794. }, {
  29795. default: vue.withCtx(() => [
  29796. vue.createVNode(vue.Transition, {
  29797. name: "dialog-fade",
  29798. onAfterEnter: vue.unref(afterEnter),
  29799. onAfterLeave: vue.unref(afterLeave),
  29800. onBeforeLeave: vue.unref(beforeLeave),
  29801. persisted: ""
  29802. }, {
  29803. default: vue.withCtx(() => [
  29804. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  29805. "custom-mask-event": "",
  29806. mask: _ctx.modal,
  29807. "overlay-class": _ctx.modalClass,
  29808. "z-index": vue.unref(zIndex)
  29809. }, {
  29810. default: vue.withCtx(() => [
  29811. vue.createElementVNode("div", {
  29812. role: "dialog",
  29813. "aria-modal": "true",
  29814. "aria-label": _ctx.title || void 0,
  29815. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  29816. "aria-describedby": vue.unref(bodyId),
  29817. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  29818. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  29819. onClick: vue.unref(overlayEvent).onClick,
  29820. onMousedown: vue.unref(overlayEvent).onMousedown,
  29821. onMouseup: vue.unref(overlayEvent).onMouseup
  29822. }, [
  29823. vue.createVNode(vue.unref(ElFocusTrap), {
  29824. loop: "",
  29825. trapped: vue.unref(visible),
  29826. "focus-start-el": "container",
  29827. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  29828. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  29829. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  29830. onReleaseRequested: vue.unref(onCloseRequested)
  29831. }, {
  29832. default: vue.withCtx(() => [
  29833. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  29834. key: 0,
  29835. ref_key: "dialogContentRef",
  29836. ref: dialogContentRef
  29837. }, _ctx.$attrs, {
  29838. center: _ctx.center,
  29839. "align-center": _ctx.alignCenter,
  29840. "close-icon": _ctx.closeIcon,
  29841. draggable: vue.unref(draggable),
  29842. overflow: _ctx.overflow,
  29843. fullscreen: _ctx.fullscreen,
  29844. "header-class": _ctx.headerClass,
  29845. "body-class": _ctx.bodyClass,
  29846. "footer-class": _ctx.footerClass,
  29847. "show-close": _ctx.showClose,
  29848. title: _ctx.title,
  29849. "aria-level": _ctx.headerAriaLevel,
  29850. onClose: vue.unref(handleClose)
  29851. }), vue.createSlots({
  29852. header: vue.withCtx(() => [
  29853. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  29854. key: 0,
  29855. close: vue.unref(handleClose),
  29856. titleId: vue.unref(titleId),
  29857. titleClass: vue.unref(ns).e("title")
  29858. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  29859. ]),
  29860. default: vue.withCtx(() => [
  29861. vue.renderSlot(_ctx.$slots, "default")
  29862. ]),
  29863. _: 2
  29864. }, [
  29865. _ctx.$slots.footer ? {
  29866. name: "footer",
  29867. fn: vue.withCtx(() => [
  29868. vue.renderSlot(_ctx.$slots, "footer")
  29869. ])
  29870. } : void 0
  29871. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "header-class", "body-class", "footer-class", "show-close", "title", "aria-level", "onClose"])) : vue.createCommentVNode("v-if", true)
  29872. ]),
  29873. _: 3
  29874. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29875. ], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  29876. ]),
  29877. _: 3
  29878. }, 8, ["mask", "overlay-class", "z-index"]), [
  29879. [vue.vShow, vue.unref(visible)]
  29880. ])
  29881. ]),
  29882. _: 3
  29883. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29884. ]),
  29885. _: 3
  29886. }, 8, ["to", "disabled"]);
  29887. };
  29888. }
  29889. });
  29890. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "dialog.vue"]]);
  29891. const ElDialog = withInstall(Dialog);
  29892. const dividerProps = buildProps({
  29893. direction: {
  29894. type: String,
  29895. values: ["horizontal", "vertical"],
  29896. default: "horizontal"
  29897. },
  29898. contentPosition: {
  29899. type: String,
  29900. values: ["left", "center", "right"],
  29901. default: "center"
  29902. },
  29903. borderStyle: {
  29904. type: definePropType(String),
  29905. default: "solid"
  29906. }
  29907. });
  29908. const __default__$10 = vue.defineComponent({
  29909. name: "ElDivider"
  29910. });
  29911. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  29912. ...__default__$10,
  29913. props: dividerProps,
  29914. setup(__props) {
  29915. const props = __props;
  29916. const ns = useNamespace("divider");
  29917. const dividerStyle = vue.computed(() => {
  29918. return ns.cssVar({
  29919. "border-style": props.borderStyle
  29920. });
  29921. });
  29922. return (_ctx, _cache) => {
  29923. return vue.openBlock(), vue.createElementBlock("div", {
  29924. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  29925. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  29926. role: "separator"
  29927. }, [
  29928. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  29929. key: 0,
  29930. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  29931. }, [
  29932. vue.renderSlot(_ctx.$slots, "default")
  29933. ], 2)) : vue.createCommentVNode("v-if", true)
  29934. ], 6);
  29935. };
  29936. }
  29937. });
  29938. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "divider.vue"]]);
  29939. const ElDivider = withInstall(Divider);
  29940. const drawerProps = buildProps({
  29941. ...dialogProps,
  29942. direction: {
  29943. type: String,
  29944. default: "rtl",
  29945. values: ["ltr", "rtl", "ttb", "btt"]
  29946. },
  29947. size: {
  29948. type: [String, Number],
  29949. default: "30%"
  29950. },
  29951. withHeader: {
  29952. type: Boolean,
  29953. default: true
  29954. },
  29955. modalFade: {
  29956. type: Boolean,
  29957. default: true
  29958. },
  29959. headerAriaLevel: {
  29960. type: String,
  29961. default: "2"
  29962. }
  29963. });
  29964. const drawerEmits = dialogEmits;
  29965. const __default__$$ = vue.defineComponent({
  29966. name: "ElDrawer",
  29967. inheritAttrs: false
  29968. });
  29969. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  29970. ...__default__$$,
  29971. props: drawerProps,
  29972. emits: drawerEmits,
  29973. setup(__props, { expose }) {
  29974. const props = __props;
  29975. const slots = vue.useSlots();
  29976. useDeprecated({
  29977. scope: "el-drawer",
  29978. from: "the title slot",
  29979. replacement: "the header slot",
  29980. version: "3.0.0",
  29981. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  29982. }, vue.computed(() => !!slots.title));
  29983. const drawerRef = vue.ref();
  29984. const focusStartRef = vue.ref();
  29985. const ns = useNamespace("drawer");
  29986. const { t } = useLocale();
  29987. const {
  29988. afterEnter,
  29989. afterLeave,
  29990. beforeLeave,
  29991. visible,
  29992. rendered,
  29993. titleId,
  29994. bodyId,
  29995. zIndex,
  29996. onModalClick,
  29997. onOpenAutoFocus,
  29998. onCloseAutoFocus,
  29999. onFocusoutPrevented,
  30000. onCloseRequested,
  30001. handleClose
  30002. } = useDialog(props, drawerRef);
  30003. const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
  30004. const drawerSize = vue.computed(() => addUnit(props.size));
  30005. expose({
  30006. handleClose,
  30007. afterEnter,
  30008. afterLeave
  30009. });
  30010. return (_ctx, _cache) => {
  30011. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  30012. to: _ctx.appendTo,
  30013. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  30014. }, {
  30015. default: vue.withCtx(() => [
  30016. vue.createVNode(vue.Transition, {
  30017. name: vue.unref(ns).b("fade"),
  30018. onAfterEnter: vue.unref(afterEnter),
  30019. onAfterLeave: vue.unref(afterLeave),
  30020. onBeforeLeave: vue.unref(beforeLeave),
  30021. persisted: ""
  30022. }, {
  30023. default: vue.withCtx(() => [
  30024. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  30025. mask: _ctx.modal,
  30026. "overlay-class": _ctx.modalClass,
  30027. "z-index": vue.unref(zIndex),
  30028. onClick: vue.unref(onModalClick)
  30029. }, {
  30030. default: vue.withCtx(() => [
  30031. vue.createVNode(vue.unref(ElFocusTrap), {
  30032. loop: "",
  30033. trapped: vue.unref(visible),
  30034. "focus-trap-el": drawerRef.value,
  30035. "focus-start-el": focusStartRef.value,
  30036. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  30037. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  30038. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  30039. onReleaseRequested: vue.unref(onCloseRequested)
  30040. }, {
  30041. default: vue.withCtx(() => [
  30042. vue.createElementVNode("div", vue.mergeProps({
  30043. ref_key: "drawerRef",
  30044. ref: drawerRef,
  30045. "aria-modal": "true",
  30046. "aria-label": _ctx.title || void 0,
  30047. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  30048. "aria-describedby": vue.unref(bodyId)
  30049. }, _ctx.$attrs, {
  30050. class: [vue.unref(ns).b(), _ctx.direction, vue.unref(visible) && "open"],
  30051. style: vue.unref(isHorizontal) ? "width: " + vue.unref(drawerSize) : "height: " + vue.unref(drawerSize),
  30052. role: "dialog",
  30053. onClick: vue.withModifiers(() => {
  30054. }, ["stop"])
  30055. }), [
  30056. vue.createElementVNode("span", {
  30057. ref_key: "focusStartRef",
  30058. ref: focusStartRef,
  30059. class: vue.normalizeClass(vue.unref(ns).e("sr-focus")),
  30060. tabindex: "-1"
  30061. }, null, 2),
  30062. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  30063. key: 0,
  30064. class: vue.normalizeClass([vue.unref(ns).e("header"), _ctx.headerClass])
  30065. }, [
  30066. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  30067. key: 0,
  30068. close: vue.unref(handleClose),
  30069. titleId: vue.unref(titleId),
  30070. titleClass: vue.unref(ns).e("title")
  30071. }, () => [
  30072. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  30073. key: 0,
  30074. id: vue.unref(titleId),
  30075. role: "heading",
  30076. "aria-level": _ctx.headerAriaLevel,
  30077. class: vue.normalizeClass(vue.unref(ns).e("title"))
  30078. }, vue.toDisplayString(_ctx.title), 11, ["id", "aria-level"])) : vue.createCommentVNode("v-if", true)
  30079. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  30080. vue.createCommentVNode(" DEPRECATED SLOT ")
  30081. ]),
  30082. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  30083. key: 2,
  30084. "aria-label": vue.unref(t)("el.drawer.close"),
  30085. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  30086. type: "button",
  30087. onClick: vue.unref(handleClose)
  30088. }, [
  30089. vue.createVNode(vue.unref(ElIcon), {
  30090. class: vue.normalizeClass(vue.unref(ns).e("close"))
  30091. }, {
  30092. default: vue.withCtx(() => [
  30093. vue.createVNode(vue.unref(close_default))
  30094. ]),
  30095. _: 1
  30096. }, 8, ["class"])
  30097. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  30098. ], 2)) : vue.createCommentVNode("v-if", true),
  30099. vue.unref(rendered) ? (vue.openBlock(), vue.createElementBlock("div", {
  30100. key: 1,
  30101. id: vue.unref(bodyId),
  30102. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass])
  30103. }, [
  30104. vue.renderSlot(_ctx.$slots, "default")
  30105. ], 10, ["id"])) : vue.createCommentVNode("v-if", true),
  30106. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  30107. key: 2,
  30108. class: vue.normalizeClass([vue.unref(ns).e("footer"), _ctx.footerClass])
  30109. }, [
  30110. vue.renderSlot(_ctx.$slots, "footer")
  30111. ], 2)) : vue.createCommentVNode("v-if", true)
  30112. ], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
  30113. ]),
  30114. _: 3
  30115. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  30116. ]),
  30117. _: 3
  30118. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  30119. [vue.vShow, vue.unref(visible)]
  30120. ])
  30121. ]),
  30122. _: 3
  30123. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  30124. ]),
  30125. _: 3
  30126. }, 8, ["to", "disabled"]);
  30127. };
  30128. }
  30129. });
  30130. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "drawer.vue"]]);
  30131. const ElDrawer = withInstall(Drawer);
  30132. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  30133. inheritAttrs: false
  30134. });
  30135. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  30136. return vue.renderSlot(_ctx.$slots, "default");
  30137. }
  30138. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["render", _sfc_render$k], ["__file", "collection.vue"]]);
  30139. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  30140. name: "ElCollectionItem",
  30141. inheritAttrs: false
  30142. });
  30143. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  30144. return vue.renderSlot(_ctx.$slots, "default");
  30145. }
  30146. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["render", _sfc_render$j], ["__file", "collection-item.vue"]]);
  30147. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  30148. const createCollectionWithScope = (name) => {
  30149. const COLLECTION_NAME = `El${name}Collection`;
  30150. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  30151. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  30152. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  30153. const ElCollection = {
  30154. ...Collection,
  30155. name: COLLECTION_NAME,
  30156. setup() {
  30157. const collectionRef = vue.ref();
  30158. const itemMap = /* @__PURE__ */ new Map();
  30159. const getItems = () => {
  30160. const collectionEl = vue.unref(collectionRef);
  30161. if (!collectionEl)
  30162. return [];
  30163. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  30164. const items = [...itemMap.values()];
  30165. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  30166. };
  30167. vue.provide(COLLECTION_INJECTION_KEY, {
  30168. itemMap,
  30169. getItems,
  30170. collectionRef
  30171. });
  30172. }
  30173. };
  30174. const ElCollectionItem = {
  30175. ...CollectionItem,
  30176. name: COLLECTION_ITEM_NAME,
  30177. setup(_, { attrs }) {
  30178. const collectionItemRef = vue.ref();
  30179. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  30180. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  30181. collectionItemRef
  30182. });
  30183. vue.onMounted(() => {
  30184. const collectionItemEl = vue.unref(collectionItemRef);
  30185. if (collectionItemEl) {
  30186. collectionInjection.itemMap.set(collectionItemEl, {
  30187. ref: collectionItemEl,
  30188. ...attrs
  30189. });
  30190. }
  30191. });
  30192. vue.onBeforeUnmount(() => {
  30193. const collectionItemEl = vue.unref(collectionItemRef);
  30194. collectionInjection.itemMap.delete(collectionItemEl);
  30195. });
  30196. }
  30197. };
  30198. return {
  30199. COLLECTION_INJECTION_KEY,
  30200. COLLECTION_ITEM_INJECTION_KEY,
  30201. ElCollection,
  30202. ElCollectionItem
  30203. };
  30204. };
  30205. const rovingFocusGroupProps = buildProps({
  30206. style: { type: definePropType([String, Array, Object]) },
  30207. currentTabId: {
  30208. type: definePropType(String)
  30209. },
  30210. defaultCurrentTabId: String,
  30211. loop: Boolean,
  30212. dir: {
  30213. type: String,
  30214. values: ["ltr", "rtl"],
  30215. default: "ltr"
  30216. },
  30217. orientation: {
  30218. type: definePropType(String)
  30219. },
  30220. onBlur: Function,
  30221. onFocus: Function,
  30222. onMousedown: Function
  30223. });
  30224. const {
  30225. ElCollection: ElCollection$1,
  30226. ElCollectionItem: ElCollectionItem$1,
  30227. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  30228. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  30229. } = createCollectionWithScope("RovingFocusGroup");
  30230. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  30231. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  30232. const MAP_KEY_TO_FOCUS_INTENT = {
  30233. ArrowLeft: "prev",
  30234. ArrowUp: "prev",
  30235. ArrowRight: "next",
  30236. ArrowDown: "next",
  30237. PageUp: "first",
  30238. Home: "first",
  30239. PageDown: "last",
  30240. End: "last"
  30241. };
  30242. const getDirectionAwareKey = (key, dir) => {
  30243. if (dir !== "rtl")
  30244. return key;
  30245. switch (key) {
  30246. case EVENT_CODE.right:
  30247. return EVENT_CODE.left;
  30248. case EVENT_CODE.left:
  30249. return EVENT_CODE.right;
  30250. default:
  30251. return key;
  30252. }
  30253. };
  30254. const getFocusIntent = (event, orientation, dir) => {
  30255. const key = getDirectionAwareKey(event.code, dir);
  30256. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  30257. return void 0;
  30258. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  30259. return void 0;
  30260. return MAP_KEY_TO_FOCUS_INTENT[key];
  30261. };
  30262. const reorderArray = (array, atIdx) => {
  30263. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  30264. };
  30265. const focusFirst = (elements) => {
  30266. const { activeElement: prevActive } = document;
  30267. for (const element of elements) {
  30268. if (element === prevActive)
  30269. return;
  30270. element.focus();
  30271. if (prevActive !== document.activeElement)
  30272. return;
  30273. }
  30274. };
  30275. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  30276. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  30277. const EVT_OPTS = { bubbles: false, cancelable: true };
  30278. const _sfc_main$1j = vue.defineComponent({
  30279. name: "ElRovingFocusGroupImpl",
  30280. inheritAttrs: false,
  30281. props: rovingFocusGroupProps,
  30282. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  30283. setup(props, { emit }) {
  30284. var _a;
  30285. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  30286. const isBackingOut = vue.ref(false);
  30287. const isClickFocus = vue.ref(false);
  30288. const rovingFocusGroupRef = vue.ref();
  30289. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30290. const rovingFocusGroupRootStyle = vue.computed(() => {
  30291. return [
  30292. {
  30293. outline: "none"
  30294. },
  30295. props.style
  30296. ];
  30297. });
  30298. const onItemFocus = (tabbedId) => {
  30299. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  30300. };
  30301. const onItemShiftTab = () => {
  30302. isBackingOut.value = true;
  30303. };
  30304. const onMousedown = composeEventHandlers((e) => {
  30305. var _a2;
  30306. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  30307. }, () => {
  30308. isClickFocus.value = true;
  30309. });
  30310. const onFocus = composeEventHandlers((e) => {
  30311. var _a2;
  30312. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  30313. }, (e) => {
  30314. const isKeyboardFocus = !vue.unref(isClickFocus);
  30315. const { target, currentTarget } = e;
  30316. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  30317. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  30318. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  30319. if (!entryFocusEvt.defaultPrevented) {
  30320. const items = getItems().filter((item) => item.focusable);
  30321. const activeItem = items.find((item) => item.active);
  30322. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  30323. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  30324. const candidateNodes = candidates.map((item) => item.ref);
  30325. focusFirst(candidateNodes);
  30326. }
  30327. }
  30328. isClickFocus.value = false;
  30329. });
  30330. const onBlur = composeEventHandlers((e) => {
  30331. var _a2;
  30332. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  30333. }, () => {
  30334. isBackingOut.value = false;
  30335. });
  30336. const handleEntryFocus = (...args) => {
  30337. emit("entryFocus", ...args);
  30338. };
  30339. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  30340. currentTabbedId: vue.readonly(currentTabbedId),
  30341. loop: vue.toRef(props, "loop"),
  30342. tabIndex: vue.computed(() => {
  30343. return vue.unref(isBackingOut) ? -1 : 0;
  30344. }),
  30345. rovingFocusGroupRef,
  30346. rovingFocusGroupRootStyle,
  30347. orientation: vue.toRef(props, "orientation"),
  30348. dir: vue.toRef(props, "dir"),
  30349. onItemFocus,
  30350. onItemShiftTab,
  30351. onBlur,
  30352. onFocus,
  30353. onMousedown
  30354. });
  30355. vue.watch(() => props.currentTabId, (val) => {
  30356. currentTabbedId.value = val != null ? val : null;
  30357. });
  30358. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  30359. }
  30360. });
  30361. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  30362. return vue.renderSlot(_ctx.$slots, "default");
  30363. }
  30364. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["render", _sfc_render$i], ["__file", "roving-focus-group-impl.vue"]]);
  30365. const _sfc_main$1i = vue.defineComponent({
  30366. name: "ElRovingFocusGroup",
  30367. components: {
  30368. ElFocusGroupCollection: ElCollection$1,
  30369. ElRovingFocusGroupImpl
  30370. }
  30371. });
  30372. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  30373. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  30374. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  30375. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  30376. default: vue.withCtx(() => [
  30377. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  30378. default: vue.withCtx(() => [
  30379. vue.renderSlot(_ctx.$slots, "default")
  30380. ]),
  30381. _: 3
  30382. }, 16)
  30383. ]),
  30384. _: 3
  30385. });
  30386. }
  30387. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$h], ["__file", "roving-focus-group.vue"]]);
  30388. const _sfc_main$1h = vue.defineComponent({
  30389. components: {
  30390. ElRovingFocusCollectionItem: ElCollectionItem$1
  30391. },
  30392. props: {
  30393. focusable: {
  30394. type: Boolean,
  30395. default: true
  30396. },
  30397. active: {
  30398. type: Boolean,
  30399. default: false
  30400. }
  30401. },
  30402. emits: ["mousedown", "focus", "keydown"],
  30403. setup(props, { emit }) {
  30404. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30405. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30406. const id = useId();
  30407. const rovingFocusGroupItemRef = vue.ref();
  30408. const handleMousedown = composeEventHandlers((e) => {
  30409. emit("mousedown", e);
  30410. }, (e) => {
  30411. if (!props.focusable) {
  30412. e.preventDefault();
  30413. } else {
  30414. onItemFocus(vue.unref(id));
  30415. }
  30416. });
  30417. const handleFocus = composeEventHandlers((e) => {
  30418. emit("focus", e);
  30419. }, () => {
  30420. onItemFocus(vue.unref(id));
  30421. });
  30422. const handleKeydown = composeEventHandlers((e) => {
  30423. emit("keydown", e);
  30424. }, (e) => {
  30425. const { code, shiftKey, target, currentTarget } = e;
  30426. if (code === EVENT_CODE.tab && shiftKey) {
  30427. onItemShiftTab();
  30428. return;
  30429. }
  30430. if (target !== currentTarget)
  30431. return;
  30432. const focusIntent = getFocusIntent(e);
  30433. if (focusIntent) {
  30434. e.preventDefault();
  30435. const items = getItems().filter((item) => item.focusable);
  30436. let elements = items.map((item) => item.ref);
  30437. switch (focusIntent) {
  30438. case "last": {
  30439. elements.reverse();
  30440. break;
  30441. }
  30442. case "prev":
  30443. case "next": {
  30444. if (focusIntent === "prev") {
  30445. elements.reverse();
  30446. }
  30447. const currentIdx = elements.indexOf(currentTarget);
  30448. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  30449. break;
  30450. }
  30451. }
  30452. vue.nextTick(() => {
  30453. focusFirst(elements);
  30454. });
  30455. }
  30456. });
  30457. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  30458. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  30459. rovingFocusGroupItemRef,
  30460. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  30461. handleMousedown,
  30462. handleFocus,
  30463. handleKeydown
  30464. });
  30465. return {
  30466. id,
  30467. handleKeydown,
  30468. handleFocus,
  30469. handleMousedown
  30470. };
  30471. }
  30472. });
  30473. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  30474. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  30475. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  30476. id: _ctx.id,
  30477. focusable: _ctx.focusable,
  30478. active: _ctx.active
  30479. }, {
  30480. default: vue.withCtx(() => [
  30481. vue.renderSlot(_ctx.$slots, "default")
  30482. ]),
  30483. _: 3
  30484. }, 8, ["id", "focusable", "active"]);
  30485. }
  30486. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$g], ["__file", "roving-focus-item.vue"]]);
  30487. const dropdownProps = buildProps({
  30488. trigger: useTooltipTriggerProps.trigger,
  30489. triggerKeys: {
  30490. type: definePropType(Array),
  30491. default: () => [
  30492. EVENT_CODE.enter,
  30493. EVENT_CODE.numpadEnter,
  30494. EVENT_CODE.space,
  30495. EVENT_CODE.down
  30496. ]
  30497. },
  30498. effect: {
  30499. ...useTooltipContentProps.effect,
  30500. default: "light"
  30501. },
  30502. type: {
  30503. type: definePropType(String)
  30504. },
  30505. placement: {
  30506. type: definePropType(String),
  30507. default: "bottom"
  30508. },
  30509. popperOptions: {
  30510. type: definePropType(Object),
  30511. default: () => ({})
  30512. },
  30513. id: String,
  30514. size: {
  30515. type: String,
  30516. default: ""
  30517. },
  30518. splitButton: Boolean,
  30519. hideOnClick: {
  30520. type: Boolean,
  30521. default: true
  30522. },
  30523. loop: {
  30524. type: Boolean,
  30525. default: true
  30526. },
  30527. showTimeout: {
  30528. type: Number,
  30529. default: 150
  30530. },
  30531. hideTimeout: {
  30532. type: Number,
  30533. default: 150
  30534. },
  30535. tabindex: {
  30536. type: definePropType([Number, String]),
  30537. default: 0
  30538. },
  30539. maxHeight: {
  30540. type: definePropType([Number, String]),
  30541. default: ""
  30542. },
  30543. popperClass: {
  30544. type: String,
  30545. default: ""
  30546. },
  30547. disabled: Boolean,
  30548. role: {
  30549. type: String,
  30550. values: roleTypes,
  30551. default: "menu"
  30552. },
  30553. buttonProps: {
  30554. type: definePropType(Object)
  30555. },
  30556. teleported: useTooltipContentProps.teleported,
  30557. persistent: {
  30558. type: Boolean,
  30559. default: true
  30560. }
  30561. });
  30562. const dropdownItemProps = buildProps({
  30563. command: {
  30564. type: [Object, String, Number],
  30565. default: () => ({})
  30566. },
  30567. disabled: Boolean,
  30568. divided: Boolean,
  30569. textValue: String,
  30570. icon: {
  30571. type: iconPropType
  30572. }
  30573. });
  30574. const dropdownMenuProps = buildProps({
  30575. onKeydown: { type: definePropType(Function) }
  30576. });
  30577. const FIRST_KEYS = [
  30578. EVENT_CODE.down,
  30579. EVENT_CODE.pageDown,
  30580. EVENT_CODE.home
  30581. ];
  30582. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  30583. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  30584. const {
  30585. ElCollection,
  30586. ElCollectionItem,
  30587. COLLECTION_INJECTION_KEY,
  30588. COLLECTION_ITEM_INJECTION_KEY
  30589. } = createCollectionWithScope("Dropdown");
  30590. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  30591. const { ButtonGroup: ElButtonGroup } = ElButton;
  30592. const _sfc_main$1g = vue.defineComponent({
  30593. name: "ElDropdown",
  30594. components: {
  30595. ElButton,
  30596. ElButtonGroup,
  30597. ElScrollbar,
  30598. ElDropdownCollection: ElCollection,
  30599. ElTooltip,
  30600. ElRovingFocusGroup,
  30601. ElOnlyChild: OnlyChild,
  30602. ElIcon,
  30603. ArrowDown: arrow_down_default
  30604. },
  30605. props: dropdownProps,
  30606. emits: ["visible-change", "click", "command"],
  30607. setup(props, { emit }) {
  30608. const _instance = vue.getCurrentInstance();
  30609. const ns = useNamespace("dropdown");
  30610. const { t } = useLocale();
  30611. const triggeringElementRef = vue.ref();
  30612. const referenceElementRef = vue.ref();
  30613. const popperRef = vue.ref();
  30614. const contentRef = vue.ref();
  30615. const scrollbar = vue.ref(null);
  30616. const currentTabId = vue.ref(null);
  30617. const isUsingKeyboard = vue.ref(false);
  30618. const wrapStyle = vue.computed(() => ({
  30619. maxHeight: addUnit(props.maxHeight)
  30620. }));
  30621. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  30622. const trigger = vue.computed(() => castArray$1(props.trigger));
  30623. const defaultTriggerId = useId().value;
  30624. const triggerId = vue.computed(() => props.id || defaultTriggerId);
  30625. vue.watch([triggeringElementRef, trigger], ([triggeringElement, trigger2], [prevTriggeringElement]) => {
  30626. var _a, _b, _c;
  30627. if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) {
  30628. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30629. }
  30630. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  30631. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30632. }
  30633. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger2.includes("hover")) {
  30634. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  30635. }
  30636. }, { immediate: true });
  30637. vue.onBeforeUnmount(() => {
  30638. var _a, _b;
  30639. if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) {
  30640. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30641. }
  30642. });
  30643. function handleClick() {
  30644. handleClose();
  30645. }
  30646. function handleClose() {
  30647. var _a;
  30648. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  30649. }
  30650. function handleOpen() {
  30651. var _a;
  30652. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  30653. }
  30654. const dropdownSize = useFormSize();
  30655. function commandHandler(...args) {
  30656. emit("command", ...args);
  30657. }
  30658. function onAutofocusTriggerEnter() {
  30659. var _a, _b;
  30660. (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus();
  30661. }
  30662. function onItemEnter() {
  30663. }
  30664. function onItemLeave() {
  30665. const contentEl = vue.unref(contentRef);
  30666. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus());
  30667. currentTabId.value = null;
  30668. }
  30669. function handleCurrentTabIdChange(id) {
  30670. currentTabId.value = id;
  30671. }
  30672. function handleEntryFocus(e) {
  30673. if (!isUsingKeyboard.value) {
  30674. e.preventDefault();
  30675. e.stopImmediatePropagation();
  30676. }
  30677. }
  30678. function handleBeforeShowTooltip() {
  30679. emit("visible-change", true);
  30680. }
  30681. function handleShowTooltip(event) {
  30682. var _a;
  30683. if ((event == null ? void 0 : event.type) === "keydown") {
  30684. (_a = contentRef.value) == null ? void 0 : _a.focus();
  30685. }
  30686. }
  30687. function handleBeforeHideTooltip() {
  30688. emit("visible-change", false);
  30689. }
  30690. vue.provide(DROPDOWN_INJECTION_KEY, {
  30691. contentRef,
  30692. role: vue.computed(() => props.role),
  30693. triggerId,
  30694. isUsingKeyboard,
  30695. onItemEnter,
  30696. onItemLeave
  30697. });
  30698. vue.provide("elDropdown", {
  30699. instance: _instance,
  30700. dropdownSize,
  30701. handleClick,
  30702. commandHandler,
  30703. trigger: vue.toRef(props, "trigger"),
  30704. hideOnClick: vue.toRef(props, "hideOnClick")
  30705. });
  30706. const onFocusAfterTrapped = (e) => {
  30707. var _a, _b;
  30708. e.preventDefault();
  30709. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  30710. preventScroll: true
  30711. });
  30712. };
  30713. const handlerMainButtonClick = (event) => {
  30714. emit("click", event);
  30715. };
  30716. return {
  30717. t,
  30718. ns,
  30719. scrollbar,
  30720. wrapStyle,
  30721. dropdownTriggerKls,
  30722. dropdownSize,
  30723. triggerId,
  30724. currentTabId,
  30725. handleCurrentTabIdChange,
  30726. handlerMainButtonClick,
  30727. handleEntryFocus,
  30728. handleClose,
  30729. handleOpen,
  30730. handleBeforeShowTooltip,
  30731. handleShowTooltip,
  30732. handleBeforeHideTooltip,
  30733. onFocusAfterTrapped,
  30734. popperRef,
  30735. contentRef,
  30736. triggeringElementRef,
  30737. referenceElementRef
  30738. };
  30739. }
  30740. });
  30741. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  30742. var _a;
  30743. const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection");
  30744. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  30745. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  30746. const _component_el_only_child = vue.resolveComponent("el-only-child");
  30747. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  30748. const _component_el_button = vue.resolveComponent("el-button");
  30749. const _component_arrow_down = vue.resolveComponent("arrow-down");
  30750. const _component_el_icon = vue.resolveComponent("el-icon");
  30751. const _component_el_button_group = vue.resolveComponent("el-button-group");
  30752. return vue.openBlock(), vue.createElementBlock("div", {
  30753. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  30754. }, [
  30755. vue.createVNode(_component_el_tooltip, {
  30756. ref: "popperRef",
  30757. role: _ctx.role,
  30758. effect: _ctx.effect,
  30759. "fallback-placements": ["bottom", "top"],
  30760. "popper-options": _ctx.popperOptions,
  30761. "gpu-acceleration": false,
  30762. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  30763. "manual-mode": true,
  30764. placement: _ctx.placement,
  30765. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  30766. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  30767. trigger: _ctx.trigger,
  30768. "trigger-keys": _ctx.triggerKeys,
  30769. "trigger-target-el": _ctx.contentRef,
  30770. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  30771. "stop-popper-mouse-event": false,
  30772. "virtual-ref": _ctx.triggeringElementRef,
  30773. "virtual-triggering": _ctx.splitButton,
  30774. disabled: _ctx.disabled,
  30775. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  30776. teleported: _ctx.teleported,
  30777. pure: "",
  30778. persistent: _ctx.persistent,
  30779. onBeforeShow: _ctx.handleBeforeShowTooltip,
  30780. onShow: _ctx.handleShowTooltip,
  30781. onBeforeHide: _ctx.handleBeforeHideTooltip
  30782. }, vue.createSlots({
  30783. content: vue.withCtx(() => [
  30784. vue.createVNode(_component_el_scrollbar, {
  30785. ref: "scrollbar",
  30786. "wrap-style": _ctx.wrapStyle,
  30787. tag: "div",
  30788. "view-class": _ctx.ns.e("list")
  30789. }, {
  30790. default: vue.withCtx(() => [
  30791. vue.createVNode(_component_el_roving_focus_group, {
  30792. loop: _ctx.loop,
  30793. "current-tab-id": _ctx.currentTabId,
  30794. orientation: "horizontal",
  30795. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  30796. onEntryFocus: _ctx.handleEntryFocus
  30797. }, {
  30798. default: vue.withCtx(() => [
  30799. vue.createVNode(_component_el_dropdown_collection, null, {
  30800. default: vue.withCtx(() => [
  30801. vue.renderSlot(_ctx.$slots, "dropdown")
  30802. ]),
  30803. _: 3
  30804. })
  30805. ]),
  30806. _: 3
  30807. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  30808. ]),
  30809. _: 3
  30810. }, 8, ["wrap-style", "view-class"])
  30811. ]),
  30812. _: 2
  30813. }, [
  30814. !_ctx.splitButton ? {
  30815. name: "default",
  30816. fn: vue.withCtx(() => [
  30817. vue.createVNode(_component_el_only_child, {
  30818. id: _ctx.triggerId,
  30819. ref: "triggeringElementRef",
  30820. role: "button",
  30821. tabindex: _ctx.tabindex
  30822. }, {
  30823. default: vue.withCtx(() => [
  30824. vue.renderSlot(_ctx.$slots, "default")
  30825. ]),
  30826. _: 3
  30827. }, 8, ["id", "tabindex"])
  30828. ])
  30829. } : void 0
  30830. ]), 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", "persistent", "onBeforeShow", "onShow", "onBeforeHide"]),
  30831. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  30832. default: vue.withCtx(() => [
  30833. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  30834. size: _ctx.dropdownSize,
  30835. type: _ctx.type,
  30836. disabled: _ctx.disabled,
  30837. tabindex: _ctx.tabindex,
  30838. onClick: _ctx.handlerMainButtonClick
  30839. }), {
  30840. default: vue.withCtx(() => [
  30841. vue.renderSlot(_ctx.$slots, "default")
  30842. ]),
  30843. _: 3
  30844. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  30845. vue.createVNode(_component_el_button, vue.mergeProps({
  30846. id: _ctx.triggerId,
  30847. ref: "triggeringElementRef"
  30848. }, _ctx.buttonProps, {
  30849. role: "button",
  30850. size: _ctx.dropdownSize,
  30851. type: _ctx.type,
  30852. class: _ctx.ns.e("caret-button"),
  30853. disabled: _ctx.disabled,
  30854. tabindex: _ctx.tabindex,
  30855. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  30856. }), {
  30857. default: vue.withCtx(() => [
  30858. vue.createVNode(_component_el_icon, {
  30859. class: vue.normalizeClass(_ctx.ns.e("icon"))
  30860. }, {
  30861. default: vue.withCtx(() => [
  30862. vue.createVNode(_component_arrow_down)
  30863. ]),
  30864. _: 1
  30865. }, 8, ["class"])
  30866. ]),
  30867. _: 1
  30868. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  30869. ]),
  30870. _: 3
  30871. })) : vue.createCommentVNode("v-if", true)
  30872. ], 2);
  30873. }
  30874. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$f], ["__file", "dropdown.vue"]]);
  30875. const _sfc_main$1f = vue.defineComponent({
  30876. name: "DropdownItemImpl",
  30877. components: {
  30878. ElIcon
  30879. },
  30880. props: dropdownItemProps,
  30881. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  30882. setup(_, { emit }) {
  30883. const ns = useNamespace("dropdown");
  30884. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30885. const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  30886. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  30887. const {
  30888. rovingFocusGroupItemRef,
  30889. tabIndex,
  30890. handleFocus,
  30891. handleKeydown: handleItemKeydown,
  30892. handleMousedown
  30893. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  30894. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  30895. const role = vue.computed(() => {
  30896. if (menuRole.value === "menu") {
  30897. return "menuitem";
  30898. } else if (menuRole.value === "navigation") {
  30899. return "link";
  30900. }
  30901. return "button";
  30902. });
  30903. const handleKeydown = composeEventHandlers((e) => {
  30904. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(e.code)) {
  30905. e.preventDefault();
  30906. e.stopImmediatePropagation();
  30907. emit("clickimpl", e);
  30908. return true;
  30909. }
  30910. }, handleItemKeydown);
  30911. return {
  30912. ns,
  30913. itemRef,
  30914. dataset: {
  30915. [COLLECTION_ITEM_SIGN]: ""
  30916. },
  30917. role,
  30918. tabIndex,
  30919. handleFocus,
  30920. handleKeydown,
  30921. handleMousedown
  30922. };
  30923. }
  30924. });
  30925. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  30926. const _component_el_icon = vue.resolveComponent("el-icon");
  30927. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  30928. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", {
  30929. key: 0,
  30930. role: "separator",
  30931. class: vue.normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  30932. }, null, 2)) : vue.createCommentVNode("v-if", true),
  30933. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  30934. "aria-disabled": _ctx.disabled,
  30935. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  30936. tabindex: _ctx.tabIndex,
  30937. role: _ctx.role,
  30938. onClick: (e) => _ctx.$emit("clickimpl", e),
  30939. onFocus: _ctx.handleFocus,
  30940. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  30941. onMousedown: _ctx.handleMousedown,
  30942. onPointermove: (e) => _ctx.$emit("pointermove", e),
  30943. onPointerleave: (e) => _ctx.$emit("pointerleave", e)
  30944. }), [
  30945. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  30946. default: vue.withCtx(() => [
  30947. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  30948. ]),
  30949. _: 1
  30950. })) : vue.createCommentVNode("v-if", true),
  30951. vue.renderSlot(_ctx.$slots, "default")
  30952. ], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
  30953. ], 64);
  30954. }
  30955. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$e], ["__file", "dropdown-item-impl.vue"]]);
  30956. const useDropdown = () => {
  30957. const elDropdown = vue.inject("elDropdown", {});
  30958. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  30959. return {
  30960. elDropdown,
  30961. _elDropdownSize
  30962. };
  30963. };
  30964. const _sfc_main$1e = vue.defineComponent({
  30965. name: "ElDropdownItem",
  30966. components: {
  30967. ElDropdownCollectionItem: ElCollectionItem,
  30968. ElRovingFocusItem,
  30969. ElDropdownItemImpl
  30970. },
  30971. inheritAttrs: false,
  30972. props: dropdownItemProps,
  30973. emits: ["pointermove", "pointerleave", "click"],
  30974. setup(props, { emit, attrs }) {
  30975. const { elDropdown } = useDropdown();
  30976. const _instance = vue.getCurrentInstance();
  30977. const itemRef = vue.ref(null);
  30978. const textContent = vue.computed(() => {
  30979. var _a, _b;
  30980. return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  30981. });
  30982. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30983. const handlePointerMove = composeEventHandlers((e) => {
  30984. emit("pointermove", e);
  30985. return e.defaultPrevented;
  30986. }, whenMouse((e) => {
  30987. if (props.disabled) {
  30988. onItemLeave(e);
  30989. return;
  30990. }
  30991. const target = e.currentTarget;
  30992. if (target === document.activeElement || target.contains(document.activeElement)) {
  30993. return;
  30994. }
  30995. onItemEnter(e);
  30996. if (!e.defaultPrevented) {
  30997. target == null ? void 0 : target.focus();
  30998. }
  30999. }));
  31000. const handlePointerLeave = composeEventHandlers((e) => {
  31001. emit("pointerleave", e);
  31002. return e.defaultPrevented;
  31003. }, whenMouse(onItemLeave));
  31004. const handleClick = composeEventHandlers((e) => {
  31005. if (props.disabled) {
  31006. return;
  31007. }
  31008. emit("click", e);
  31009. return e.type !== "keydown" && e.defaultPrevented;
  31010. }, (e) => {
  31011. var _a, _b, _c;
  31012. if (props.disabled) {
  31013. e.stopImmediatePropagation();
  31014. return;
  31015. }
  31016. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  31017. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  31018. }
  31019. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  31020. });
  31021. const propsAndAttrs = vue.computed(() => ({ ...props, ...attrs }));
  31022. return {
  31023. handleClick,
  31024. handlePointerMove,
  31025. handlePointerLeave,
  31026. textContent,
  31027. propsAndAttrs
  31028. };
  31029. }
  31030. });
  31031. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  31032. var _a;
  31033. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  31034. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  31035. const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item");
  31036. return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, {
  31037. disabled: _ctx.disabled,
  31038. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  31039. }, {
  31040. default: vue.withCtx(() => [
  31041. vue.createVNode(_component_el_roving_focus_item, {
  31042. focusable: !_ctx.disabled
  31043. }, {
  31044. default: vue.withCtx(() => [
  31045. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  31046. onPointerleave: _ctx.handlePointerLeave,
  31047. onPointermove: _ctx.handlePointerMove,
  31048. onClickimpl: _ctx.handleClick
  31049. }), {
  31050. default: vue.withCtx(() => [
  31051. vue.renderSlot(_ctx.$slots, "default")
  31052. ]),
  31053. _: 3
  31054. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  31055. ]),
  31056. _: 3
  31057. }, 8, ["focusable"])
  31058. ]),
  31059. _: 3
  31060. }, 8, ["disabled", "text-value"]);
  31061. }
  31062. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$d], ["__file", "dropdown-item.vue"]]);
  31063. const _sfc_main$1d = vue.defineComponent({
  31064. name: "ElDropdownMenu",
  31065. props: dropdownMenuProps,
  31066. setup(props) {
  31067. const ns = useNamespace("dropdown");
  31068. const { _elDropdownSize } = useDropdown();
  31069. const size = _elDropdownSize.value;
  31070. const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  31071. const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  31072. const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  31073. const {
  31074. rovingFocusGroupRef,
  31075. rovingFocusGroupRootStyle,
  31076. tabIndex,
  31077. onBlur,
  31078. onFocus,
  31079. onMousedown
  31080. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  31081. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  31082. const dropdownKls = vue.computed(() => {
  31083. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  31084. });
  31085. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  31086. const composedKeydown = composeEventHandlers((e) => {
  31087. var _a;
  31088. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  31089. }, (e) => {
  31090. const { currentTarget, code, target } = e;
  31091. currentTarget.contains(target);
  31092. if (EVENT_CODE.tab === code) {
  31093. e.stopImmediatePropagation();
  31094. }
  31095. e.preventDefault();
  31096. if (target !== vue.unref(contentRef) || !FIRST_LAST_KEYS.includes(code))
  31097. return;
  31098. const items = getItems().filter((item) => !item.disabled);
  31099. const targets = items.map((item) => item.ref);
  31100. if (LAST_KEYS.includes(code)) {
  31101. targets.reverse();
  31102. }
  31103. focusFirst(targets);
  31104. });
  31105. const handleKeydown = (e) => {
  31106. composedKeydown(e);
  31107. onKeydown(e);
  31108. };
  31109. return {
  31110. size,
  31111. rovingFocusGroupRootStyle,
  31112. tabIndex,
  31113. dropdownKls,
  31114. role,
  31115. triggerId,
  31116. dropdownListWrapperRef,
  31117. handleKeydown,
  31118. onBlur,
  31119. onFocus,
  31120. onMousedown
  31121. };
  31122. }
  31123. });
  31124. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  31125. return vue.openBlock(), vue.createElementBlock("ul", {
  31126. ref: _ctx.dropdownListWrapperRef,
  31127. class: vue.normalizeClass(_ctx.dropdownKls),
  31128. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  31129. tabindex: -1,
  31130. role: _ctx.role,
  31131. "aria-labelledby": _ctx.triggerId,
  31132. onBlur: _ctx.onBlur,
  31133. onFocus: _ctx.onFocus,
  31134. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  31135. onMousedown: vue.withModifiers(_ctx.onMousedown, ["self"])
  31136. }, [
  31137. vue.renderSlot(_ctx.$slots, "default")
  31138. ], 46, ["role", "aria-labelledby", "onBlur", "onFocus", "onKeydown", "onMousedown"]);
  31139. }
  31140. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$c], ["__file", "dropdown-menu.vue"]]);
  31141. const ElDropdown = withInstall(Dropdown, {
  31142. DropdownItem,
  31143. DropdownMenu
  31144. });
  31145. const ElDropdownItem = withNoopInstall(DropdownItem);
  31146. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  31147. const __default__$_ = vue.defineComponent({
  31148. name: "ImgEmpty"
  31149. });
  31150. const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
  31151. ...__default__$_,
  31152. setup(__props) {
  31153. const ns = useNamespace("empty");
  31154. const id = useId();
  31155. return (_ctx, _cache) => {
  31156. return vue.openBlock(), vue.createElementBlock("svg", {
  31157. viewBox: "0 0 79 86",
  31158. version: "1.1",
  31159. xmlns: "http://www.w3.org/2000/svg",
  31160. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  31161. }, [
  31162. vue.createElementVNode("defs", null, [
  31163. vue.createElementVNode("linearGradient", {
  31164. id: `linearGradient-1-${vue.unref(id)}`,
  31165. x1: "38.8503086%",
  31166. y1: "0%",
  31167. x2: "61.1496914%",
  31168. y2: "100%"
  31169. }, [
  31170. vue.createElementVNode("stop", {
  31171. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  31172. offset: "0%"
  31173. }, null, 8, ["stop-color"]),
  31174. vue.createElementVNode("stop", {
  31175. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-4")})`,
  31176. offset: "100%"
  31177. }, null, 8, ["stop-color"])
  31178. ], 8, ["id"]),
  31179. vue.createElementVNode("linearGradient", {
  31180. id: `linearGradient-2-${vue.unref(id)}`,
  31181. x1: "0%",
  31182. y1: "9.5%",
  31183. x2: "100%",
  31184. y2: "90.5%"
  31185. }, [
  31186. vue.createElementVNode("stop", {
  31187. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  31188. offset: "0%"
  31189. }, null, 8, ["stop-color"]),
  31190. vue.createElementVNode("stop", {
  31191. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-6")})`,
  31192. offset: "100%"
  31193. }, null, 8, ["stop-color"])
  31194. ], 8, ["id"]),
  31195. vue.createElementVNode("rect", {
  31196. id: `path-3-${vue.unref(id)}`,
  31197. x: "0",
  31198. y: "0",
  31199. width: "17",
  31200. height: "36"
  31201. }, null, 8, ["id"])
  31202. ]),
  31203. vue.createElementVNode("g", {
  31204. stroke: "none",
  31205. "stroke-width": "1",
  31206. fill: "none",
  31207. "fill-rule": "evenodd"
  31208. }, [
  31209. vue.createElementVNode("g", { transform: "translate(-1268.000000, -535.000000)" }, [
  31210. vue.createElementVNode("g", { transform: "translate(1268.000000, 535.000000)" }, [
  31211. vue.createElementVNode("path", {
  31212. 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",
  31213. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-3")})`
  31214. }, null, 8, ["fill"]),
  31215. vue.createElementVNode("polygon", {
  31216. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  31217. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  31218. points: "13 58 53 58 42 45 2 45"
  31219. }, null, 8, ["fill"]),
  31220. vue.createElementVNode("g", { transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)" }, [
  31221. vue.createElementVNode("polygon", {
  31222. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  31223. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  31224. points: "2.84078316e-14 3 18 3 23 7 5 7"
  31225. }, null, 8, ["fill"]),
  31226. vue.createElementVNode("polygon", {
  31227. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-5")})`,
  31228. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  31229. }, null, 8, ["fill"]),
  31230. vue.createElementVNode("rect", {
  31231. fill: `url(#linearGradient-1-${vue.unref(id)})`,
  31232. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  31233. x: "38",
  31234. y: "7",
  31235. width: "17",
  31236. height: "36"
  31237. }, null, 8, ["fill"]),
  31238. vue.createElementVNode("polygon", {
  31239. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  31240. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  31241. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  31242. }, null, 8, ["fill"])
  31243. ]),
  31244. vue.createElementVNode("rect", {
  31245. fill: `url(#linearGradient-2-${vue.unref(id)})`,
  31246. x: "13",
  31247. y: "45",
  31248. width: "40",
  31249. height: "36"
  31250. }, null, 8, ["fill"]),
  31251. vue.createElementVNode("g", { transform: "translate(53.000000, 45.000000)" }, [
  31252. vue.createElementVNode("use", {
  31253. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-8")})`,
  31254. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  31255. "xlink:href": `#path-3-${vue.unref(id)}`
  31256. }, null, 8, ["fill", "xlink:href"]),
  31257. vue.createElementVNode("polygon", {
  31258. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-9")})`,
  31259. mask: `url(#mask-4-${vue.unref(id)})`,
  31260. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  31261. points: "7 0 24 0 20 18 7 16.5"
  31262. }, null, 8, ["fill", "mask"])
  31263. ]),
  31264. vue.createElementVNode("polygon", {
  31265. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  31266. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  31267. points: "62 45 79 45 70 58 53 58"
  31268. }, null, 8, ["fill"])
  31269. ])
  31270. ])
  31271. ])
  31272. ]);
  31273. };
  31274. }
  31275. });
  31276. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "img-empty.vue"]]);
  31277. const emptyProps = buildProps({
  31278. image: {
  31279. type: String,
  31280. default: ""
  31281. },
  31282. imageSize: Number,
  31283. description: {
  31284. type: String,
  31285. default: ""
  31286. }
  31287. });
  31288. const __default__$Z = vue.defineComponent({
  31289. name: "ElEmpty"
  31290. });
  31291. const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
  31292. ...__default__$Z,
  31293. props: emptyProps,
  31294. setup(__props) {
  31295. const props = __props;
  31296. const { t } = useLocale();
  31297. const ns = useNamespace("empty");
  31298. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  31299. const imageStyle = vue.computed(() => ({
  31300. width: addUnit(props.imageSize)
  31301. }));
  31302. return (_ctx, _cache) => {
  31303. return vue.openBlock(), vue.createElementBlock("div", {
  31304. class: vue.normalizeClass(vue.unref(ns).b())
  31305. }, [
  31306. vue.createElementVNode("div", {
  31307. class: vue.normalizeClass(vue.unref(ns).e("image")),
  31308. style: vue.normalizeStyle(vue.unref(imageStyle))
  31309. }, [
  31310. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  31311. key: 0,
  31312. src: _ctx.image,
  31313. ondragstart: "return false"
  31314. }, null, 8, ["src"])) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  31315. vue.createVNode(ImgEmpty)
  31316. ])
  31317. ], 6),
  31318. vue.createElementVNode("div", {
  31319. class: vue.normalizeClass(vue.unref(ns).e("description"))
  31320. }, [
  31321. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", { key: 1 }, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  31322. ], 2),
  31323. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  31324. key: 0,
  31325. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  31326. }, [
  31327. vue.renderSlot(_ctx.$slots, "default")
  31328. ], 2)) : vue.createCommentVNode("v-if", true)
  31329. ], 2);
  31330. };
  31331. }
  31332. });
  31333. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "empty.vue"]]);
  31334. const ElEmpty = withInstall(Empty);
  31335. const imageViewerProps = buildProps({
  31336. urlList: {
  31337. type: definePropType(Array),
  31338. default: () => mutable([])
  31339. },
  31340. zIndex: {
  31341. type: Number
  31342. },
  31343. initialIndex: {
  31344. type: Number,
  31345. default: 0
  31346. },
  31347. infinite: {
  31348. type: Boolean,
  31349. default: true
  31350. },
  31351. hideOnClickModal: Boolean,
  31352. teleported: Boolean,
  31353. closeOnPressEscape: {
  31354. type: Boolean,
  31355. default: true
  31356. },
  31357. zoomRate: {
  31358. type: Number,
  31359. default: 1.2
  31360. },
  31361. minScale: {
  31362. type: Number,
  31363. default: 0.2
  31364. },
  31365. maxScale: {
  31366. type: Number,
  31367. default: 7
  31368. },
  31369. showProgress: {
  31370. type: Boolean,
  31371. default: false
  31372. },
  31373. crossorigin: {
  31374. type: definePropType(String)
  31375. }
  31376. });
  31377. const imageViewerEmits = {
  31378. close: () => true,
  31379. switch: (index) => isNumber(index),
  31380. rotate: (deg) => isNumber(deg)
  31381. };
  31382. const __default__$Y = vue.defineComponent({
  31383. name: "ElImageViewer"
  31384. });
  31385. const _sfc_main$1a = /* @__PURE__ */ vue.defineComponent({
  31386. ...__default__$Y,
  31387. props: imageViewerProps,
  31388. emits: imageViewerEmits,
  31389. setup(__props, { expose, emit }) {
  31390. var _a;
  31391. const props = __props;
  31392. const modes = {
  31393. CONTAIN: {
  31394. name: "contain",
  31395. icon: vue.markRaw(full_screen_default)
  31396. },
  31397. ORIGINAL: {
  31398. name: "original",
  31399. icon: vue.markRaw(scale_to_original_default)
  31400. }
  31401. };
  31402. let stopWheelListener;
  31403. let prevOverflow = "";
  31404. const { t } = useLocale();
  31405. const ns = useNamespace("image-viewer");
  31406. const { nextZIndex } = useZIndex();
  31407. const wrapper = vue.ref();
  31408. const imgRefs = vue.ref([]);
  31409. const scopeEventListener = vue.effectScope();
  31410. const loading = vue.ref(true);
  31411. const activeIndex = vue.ref(props.initialIndex);
  31412. const mode = vue.shallowRef(modes.CONTAIN);
  31413. const transform = vue.ref({
  31414. scale: 1,
  31415. deg: 0,
  31416. offsetX: 0,
  31417. offsetY: 0,
  31418. enableTransition: false
  31419. });
  31420. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  31421. const isSingle = vue.computed(() => {
  31422. const { urlList } = props;
  31423. return urlList.length <= 1;
  31424. });
  31425. const isFirst = vue.computed(() => activeIndex.value === 0);
  31426. const isLast = vue.computed(() => activeIndex.value === props.urlList.length - 1);
  31427. const currentImg = vue.computed(() => props.urlList[activeIndex.value]);
  31428. const arrowPrevKls = vue.computed(() => [
  31429. ns.e("btn"),
  31430. ns.e("prev"),
  31431. ns.is("disabled", !props.infinite && isFirst.value)
  31432. ]);
  31433. const arrowNextKls = vue.computed(() => [
  31434. ns.e("btn"),
  31435. ns.e("next"),
  31436. ns.is("disabled", !props.infinite && isLast.value)
  31437. ]);
  31438. const imgStyle = vue.computed(() => {
  31439. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  31440. let translateX = offsetX / scale;
  31441. let translateY = offsetY / scale;
  31442. const radian = deg * Math.PI / 180;
  31443. const cosRadian = Math.cos(radian);
  31444. const sinRadian = Math.sin(radian);
  31445. translateX = translateX * cosRadian + translateY * sinRadian;
  31446. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  31447. const style = {
  31448. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  31449. transition: enableTransition ? "transform .3s" : ""
  31450. };
  31451. if (mode.value.name === modes.CONTAIN.name) {
  31452. style.maxWidth = style.maxHeight = "100%";
  31453. }
  31454. return style;
  31455. });
  31456. const progress = vue.computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
  31457. function hide() {
  31458. unregisterEventListener();
  31459. stopWheelListener == null ? void 0 : stopWheelListener();
  31460. document.body.style.overflow = prevOverflow;
  31461. emit("close");
  31462. }
  31463. function registerEventListener() {
  31464. const keydownHandler = throttle((e) => {
  31465. switch (e.code) {
  31466. case EVENT_CODE.esc:
  31467. props.closeOnPressEscape && hide();
  31468. break;
  31469. case EVENT_CODE.space:
  31470. toggleMode();
  31471. break;
  31472. case EVENT_CODE.left:
  31473. prev();
  31474. break;
  31475. case EVENT_CODE.up:
  31476. handleActions("zoomIn");
  31477. break;
  31478. case EVENT_CODE.right:
  31479. next();
  31480. break;
  31481. case EVENT_CODE.down:
  31482. handleActions("zoomOut");
  31483. break;
  31484. }
  31485. });
  31486. const mousewheelHandler = throttle((e) => {
  31487. const delta = e.deltaY || e.deltaX;
  31488. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  31489. zoomRate: props.zoomRate,
  31490. enableTransition: false
  31491. });
  31492. });
  31493. scopeEventListener.run(() => {
  31494. useEventListener(document, "keydown", keydownHandler);
  31495. useEventListener(document, "wheel", mousewheelHandler);
  31496. });
  31497. }
  31498. function unregisterEventListener() {
  31499. scopeEventListener.stop();
  31500. }
  31501. function handleImgLoad() {
  31502. loading.value = false;
  31503. }
  31504. function handleImgError(e) {
  31505. loading.value = false;
  31506. e.target.alt = t("el.image.error");
  31507. }
  31508. function handleMouseDown(e) {
  31509. if (loading.value || e.button !== 0 || !wrapper.value)
  31510. return;
  31511. transform.value.enableTransition = false;
  31512. const { offsetX, offsetY } = transform.value;
  31513. const startX = e.pageX;
  31514. const startY = e.pageY;
  31515. const dragHandler = throttle((ev) => {
  31516. transform.value = {
  31517. ...transform.value,
  31518. offsetX: offsetX + ev.pageX - startX,
  31519. offsetY: offsetY + ev.pageY - startY
  31520. };
  31521. });
  31522. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  31523. useEventListener(document, "mouseup", () => {
  31524. removeMousemove();
  31525. });
  31526. e.preventDefault();
  31527. }
  31528. function reset() {
  31529. transform.value = {
  31530. scale: 1,
  31531. deg: 0,
  31532. offsetX: 0,
  31533. offsetY: 0,
  31534. enableTransition: false
  31535. };
  31536. }
  31537. function toggleMode() {
  31538. if (loading.value)
  31539. return;
  31540. const modeNames = keysOf(modes);
  31541. const modeValues = Object.values(modes);
  31542. const currentMode = mode.value.name;
  31543. const index = modeValues.findIndex((i) => i.name === currentMode);
  31544. const nextIndex = (index + 1) % modeNames.length;
  31545. mode.value = modes[modeNames[nextIndex]];
  31546. reset();
  31547. }
  31548. function setActiveItem(index) {
  31549. const len = props.urlList.length;
  31550. activeIndex.value = (index + len) % len;
  31551. }
  31552. function prev() {
  31553. if (isFirst.value && !props.infinite)
  31554. return;
  31555. setActiveItem(activeIndex.value - 1);
  31556. }
  31557. function next() {
  31558. if (isLast.value && !props.infinite)
  31559. return;
  31560. setActiveItem(activeIndex.value + 1);
  31561. }
  31562. function handleActions(action, options = {}) {
  31563. if (loading.value)
  31564. return;
  31565. const { minScale, maxScale } = props;
  31566. const { zoomRate, rotateDeg, enableTransition } = {
  31567. zoomRate: props.zoomRate,
  31568. rotateDeg: 90,
  31569. enableTransition: true,
  31570. ...options
  31571. };
  31572. switch (action) {
  31573. case "zoomOut":
  31574. if (transform.value.scale > minScale) {
  31575. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  31576. }
  31577. break;
  31578. case "zoomIn":
  31579. if (transform.value.scale < maxScale) {
  31580. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  31581. }
  31582. break;
  31583. case "clockwise":
  31584. transform.value.deg += rotateDeg;
  31585. emit("rotate", transform.value.deg);
  31586. break;
  31587. case "anticlockwise":
  31588. transform.value.deg -= rotateDeg;
  31589. emit("rotate", transform.value.deg);
  31590. break;
  31591. }
  31592. transform.value.enableTransition = enableTransition;
  31593. }
  31594. function onFocusoutPrevented(event) {
  31595. var _a2;
  31596. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  31597. event.preventDefault();
  31598. }
  31599. }
  31600. function onCloseRequested() {
  31601. if (props.closeOnPressEscape) {
  31602. hide();
  31603. }
  31604. }
  31605. function wheelHandler(e) {
  31606. if (!e.ctrlKey)
  31607. return;
  31608. if (e.deltaY < 0) {
  31609. e.preventDefault();
  31610. return false;
  31611. } else if (e.deltaY > 0) {
  31612. e.preventDefault();
  31613. return false;
  31614. }
  31615. }
  31616. vue.watch(currentImg, () => {
  31617. vue.nextTick(() => {
  31618. const $img = imgRefs.value[0];
  31619. if (!($img == null ? void 0 : $img.complete)) {
  31620. loading.value = true;
  31621. }
  31622. });
  31623. });
  31624. vue.watch(activeIndex, (val) => {
  31625. reset();
  31626. emit("switch", val);
  31627. });
  31628. vue.onMounted(() => {
  31629. registerEventListener();
  31630. stopWheelListener = useEventListener("wheel", wheelHandler, {
  31631. passive: false
  31632. });
  31633. prevOverflow = document.body.style.overflow;
  31634. document.body.style.overflow = "hidden";
  31635. });
  31636. expose({
  31637. setActiveItem
  31638. });
  31639. return (_ctx, _cache) => {
  31640. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  31641. to: "body",
  31642. disabled: !_ctx.teleported
  31643. }, {
  31644. default: vue.withCtx(() => [
  31645. vue.createVNode(vue.Transition, {
  31646. name: "viewer-fade",
  31647. appear: ""
  31648. }, {
  31649. default: vue.withCtx(() => [
  31650. vue.createElementVNode("div", {
  31651. ref_key: "wrapper",
  31652. ref: wrapper,
  31653. tabindex: -1,
  31654. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  31655. style: vue.normalizeStyle({ zIndex: zIndex.value })
  31656. }, [
  31657. vue.createVNode(vue.unref(ElFocusTrap), {
  31658. loop: "",
  31659. trapped: "",
  31660. "focus-trap-el": wrapper.value,
  31661. "focus-start-el": "container",
  31662. onFocusoutPrevented,
  31663. onReleaseRequested: onCloseRequested
  31664. }, {
  31665. default: vue.withCtx(() => [
  31666. vue.createElementVNode("div", {
  31667. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  31668. onClick: vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
  31669. }, null, 10, ["onClick"]),
  31670. vue.createCommentVNode(" CLOSE "),
  31671. vue.createElementVNode("span", {
  31672. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  31673. onClick: hide
  31674. }, [
  31675. vue.createVNode(vue.unref(ElIcon), null, {
  31676. default: vue.withCtx(() => [
  31677. vue.createVNode(vue.unref(close_default))
  31678. ]),
  31679. _: 1
  31680. })
  31681. ], 2),
  31682. vue.createCommentVNode(" ARROW "),
  31683. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31684. vue.createElementVNode("span", {
  31685. class: vue.normalizeClass(vue.unref(arrowPrevKls)),
  31686. onClick: prev
  31687. }, [
  31688. vue.createVNode(vue.unref(ElIcon), null, {
  31689. default: vue.withCtx(() => [
  31690. vue.createVNode(vue.unref(arrow_left_default))
  31691. ]),
  31692. _: 1
  31693. })
  31694. ], 2),
  31695. vue.createElementVNode("span", {
  31696. class: vue.normalizeClass(vue.unref(arrowNextKls)),
  31697. onClick: next
  31698. }, [
  31699. vue.createVNode(vue.unref(ElIcon), null, {
  31700. default: vue.withCtx(() => [
  31701. vue.createVNode(vue.unref(arrow_right_default))
  31702. ]),
  31703. _: 1
  31704. })
  31705. ], 2)
  31706. ], 64)) : vue.createCommentVNode("v-if", true),
  31707. _ctx.$slots.progress || _ctx.showProgress ? (vue.openBlock(), vue.createElementBlock("div", {
  31708. key: 1,
  31709. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("progress")])
  31710. }, [
  31711. vue.renderSlot(_ctx.$slots, "progress", {
  31712. activeIndex: activeIndex.value,
  31713. total: _ctx.urlList.length
  31714. }, () => [
  31715. vue.createTextVNode(vue.toDisplayString(vue.unref(progress)), 1)
  31716. ])
  31717. ], 2)) : vue.createCommentVNode("v-if", true),
  31718. vue.createCommentVNode(" ACTIONS "),
  31719. vue.createElementVNode("div", {
  31720. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  31721. }, [
  31722. vue.createElementVNode("div", {
  31723. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  31724. }, [
  31725. vue.renderSlot(_ctx.$slots, "toolbar", {
  31726. actions: handleActions,
  31727. prev,
  31728. next,
  31729. reset: toggleMode,
  31730. activeIndex: activeIndex.value,
  31731. setActiveItem
  31732. }, () => [
  31733. vue.createVNode(vue.unref(ElIcon), {
  31734. onClick: ($event) => handleActions("zoomOut")
  31735. }, {
  31736. default: vue.withCtx(() => [
  31737. vue.createVNode(vue.unref(zoom_out_default))
  31738. ]),
  31739. _: 1
  31740. }, 8, ["onClick"]),
  31741. vue.createVNode(vue.unref(ElIcon), {
  31742. onClick: ($event) => handleActions("zoomIn")
  31743. }, {
  31744. default: vue.withCtx(() => [
  31745. vue.createVNode(vue.unref(zoom_in_default))
  31746. ]),
  31747. _: 1
  31748. }, 8, ["onClick"]),
  31749. vue.createElementVNode("i", {
  31750. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  31751. }, null, 2),
  31752. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  31753. default: vue.withCtx(() => [
  31754. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  31755. ]),
  31756. _: 1
  31757. }),
  31758. vue.createElementVNode("i", {
  31759. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  31760. }, null, 2),
  31761. vue.createVNode(vue.unref(ElIcon), {
  31762. onClick: ($event) => handleActions("anticlockwise")
  31763. }, {
  31764. default: vue.withCtx(() => [
  31765. vue.createVNode(vue.unref(refresh_left_default))
  31766. ]),
  31767. _: 1
  31768. }, 8, ["onClick"]),
  31769. vue.createVNode(vue.unref(ElIcon), {
  31770. onClick: ($event) => handleActions("clockwise")
  31771. }, {
  31772. default: vue.withCtx(() => [
  31773. vue.createVNode(vue.unref(refresh_right_default))
  31774. ]),
  31775. _: 1
  31776. }, 8, ["onClick"])
  31777. ])
  31778. ], 2)
  31779. ], 2),
  31780. vue.createCommentVNode(" CANVAS "),
  31781. vue.createElementVNode("div", {
  31782. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  31783. }, [
  31784. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => {
  31785. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", {
  31786. ref_for: true,
  31787. ref: (el) => imgRefs.value[i] = el,
  31788. key: url,
  31789. src: url,
  31790. style: vue.normalizeStyle(vue.unref(imgStyle)),
  31791. class: vue.normalizeClass(vue.unref(ns).e("img")),
  31792. crossorigin: _ctx.crossorigin,
  31793. onLoad: handleImgLoad,
  31794. onError: handleImgError,
  31795. onMousedown: handleMouseDown
  31796. }, null, 46, ["src", "crossorigin"])), [
  31797. [vue.vShow, i === activeIndex.value]
  31798. ]);
  31799. }), 128))
  31800. ], 2),
  31801. vue.renderSlot(_ctx.$slots, "default")
  31802. ]),
  31803. _: 3
  31804. }, 8, ["focus-trap-el"])
  31805. ], 6)
  31806. ]),
  31807. _: 3
  31808. })
  31809. ]),
  31810. _: 3
  31811. }, 8, ["disabled"]);
  31812. };
  31813. }
  31814. });
  31815. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__file", "image-viewer.vue"]]);
  31816. const ElImageViewer = withInstall(ImageViewer);
  31817. const imageProps = buildProps({
  31818. hideOnClickModal: Boolean,
  31819. src: {
  31820. type: String,
  31821. default: ""
  31822. },
  31823. fit: {
  31824. type: String,
  31825. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  31826. default: ""
  31827. },
  31828. loading: {
  31829. type: String,
  31830. values: ["eager", "lazy"]
  31831. },
  31832. lazy: Boolean,
  31833. scrollContainer: {
  31834. type: definePropType([String, Object])
  31835. },
  31836. previewSrcList: {
  31837. type: definePropType(Array),
  31838. default: () => mutable([])
  31839. },
  31840. previewTeleported: Boolean,
  31841. zIndex: {
  31842. type: Number
  31843. },
  31844. initialIndex: {
  31845. type: Number,
  31846. default: 0
  31847. },
  31848. infinite: {
  31849. type: Boolean,
  31850. default: true
  31851. },
  31852. closeOnPressEscape: {
  31853. type: Boolean,
  31854. default: true
  31855. },
  31856. zoomRate: {
  31857. type: Number,
  31858. default: 1.2
  31859. },
  31860. minScale: {
  31861. type: Number,
  31862. default: 0.2
  31863. },
  31864. maxScale: {
  31865. type: Number,
  31866. default: 7
  31867. },
  31868. showProgress: {
  31869. type: Boolean,
  31870. default: false
  31871. },
  31872. crossorigin: {
  31873. type: definePropType(String)
  31874. }
  31875. });
  31876. const imageEmits = {
  31877. load: (evt) => evt instanceof Event,
  31878. error: (evt) => evt instanceof Event,
  31879. switch: (val) => isNumber(val),
  31880. close: () => true,
  31881. show: () => true
  31882. };
  31883. const __default__$X = vue.defineComponent({
  31884. name: "ElImage",
  31885. inheritAttrs: false
  31886. });
  31887. const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
  31888. ...__default__$X,
  31889. props: imageProps,
  31890. emits: imageEmits,
  31891. setup(__props, { expose, emit }) {
  31892. const props = __props;
  31893. const { t } = useLocale();
  31894. const ns = useNamespace("image");
  31895. const rawAttrs = vue.useAttrs();
  31896. const containerAttrs = vue.computed(() => {
  31897. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  31898. });
  31899. const imgAttrs = useAttrs({
  31900. excludeListeners: true,
  31901. excludeKeys: vue.computed(() => {
  31902. return Object.keys(containerAttrs.value);
  31903. })
  31904. });
  31905. const imageSrc = vue.ref();
  31906. const hasLoadError = vue.ref(false);
  31907. const isLoading = vue.ref(true);
  31908. const showViewer = vue.ref(false);
  31909. const container = vue.ref();
  31910. const _scrollContainer = vue.ref();
  31911. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  31912. let stopScrollListener;
  31913. const imageKls = vue.computed(() => [
  31914. ns.e("inner"),
  31915. preview.value && ns.e("preview"),
  31916. isLoading.value && ns.is("loading")
  31917. ]);
  31918. const imageStyle = vue.computed(() => {
  31919. const { fit } = props;
  31920. if (isClient && fit) {
  31921. return { objectFit: fit };
  31922. }
  31923. return {};
  31924. });
  31925. const preview = vue.computed(() => {
  31926. const { previewSrcList } = props;
  31927. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  31928. });
  31929. const imageIndex = vue.computed(() => {
  31930. const { previewSrcList, initialIndex } = props;
  31931. let previewIndex = initialIndex;
  31932. if (initialIndex > previewSrcList.length - 1) {
  31933. previewIndex = 0;
  31934. }
  31935. return previewIndex;
  31936. });
  31937. const isManual = vue.computed(() => {
  31938. if (props.loading === "eager")
  31939. return false;
  31940. return !supportLoading && props.loading === "lazy" || props.lazy;
  31941. });
  31942. const loadImage = () => {
  31943. if (!isClient)
  31944. return;
  31945. isLoading.value = true;
  31946. hasLoadError.value = false;
  31947. imageSrc.value = props.src;
  31948. };
  31949. function handleLoad(event) {
  31950. isLoading.value = false;
  31951. hasLoadError.value = false;
  31952. emit("load", event);
  31953. }
  31954. function handleError(event) {
  31955. isLoading.value = false;
  31956. hasLoadError.value = true;
  31957. emit("error", event);
  31958. }
  31959. function handleLazyLoad() {
  31960. if (isInContainer(container.value, _scrollContainer.value)) {
  31961. loadImage();
  31962. removeLazyLoadListener();
  31963. }
  31964. }
  31965. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  31966. async function addLazyLoadListener() {
  31967. var _a;
  31968. if (!isClient)
  31969. return;
  31970. await vue.nextTick();
  31971. const { scrollContainer } = props;
  31972. if (isElement$1(scrollContainer)) {
  31973. _scrollContainer.value = scrollContainer;
  31974. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  31975. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  31976. } else if (container.value) {
  31977. _scrollContainer.value = getScrollContainer(container.value);
  31978. }
  31979. if (_scrollContainer.value) {
  31980. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  31981. setTimeout(() => handleLazyLoad(), 100);
  31982. }
  31983. }
  31984. function removeLazyLoadListener() {
  31985. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  31986. return;
  31987. stopScrollListener == null ? void 0 : stopScrollListener();
  31988. _scrollContainer.value = void 0;
  31989. }
  31990. function clickHandler() {
  31991. if (!preview.value)
  31992. return;
  31993. showViewer.value = true;
  31994. emit("show");
  31995. }
  31996. function closeViewer() {
  31997. showViewer.value = false;
  31998. emit("close");
  31999. }
  32000. function switchViewer(val) {
  32001. emit("switch", val);
  32002. }
  32003. vue.watch(() => props.src, () => {
  32004. if (isManual.value) {
  32005. isLoading.value = true;
  32006. hasLoadError.value = false;
  32007. removeLazyLoadListener();
  32008. addLazyLoadListener();
  32009. } else {
  32010. loadImage();
  32011. }
  32012. });
  32013. vue.onMounted(() => {
  32014. if (isManual.value) {
  32015. addLazyLoadListener();
  32016. } else {
  32017. loadImage();
  32018. }
  32019. });
  32020. expose({
  32021. showPreview: clickHandler
  32022. });
  32023. return (_ctx, _cache) => {
  32024. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  32025. ref_key: "container",
  32026. ref: container
  32027. }, vue.unref(containerAttrs), {
  32028. class: [vue.unref(ns).b(), _ctx.$attrs.class]
  32029. }), [
  32030. hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  32031. vue.createElementVNode("div", {
  32032. class: vue.normalizeClass(vue.unref(ns).e("error"))
  32033. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  32034. ]) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  32035. imageSrc.value !== void 0 ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(imgAttrs), {
  32036. src: imageSrc.value,
  32037. loading: _ctx.loading,
  32038. style: vue.unref(imageStyle),
  32039. class: vue.unref(imageKls),
  32040. crossorigin: _ctx.crossorigin,
  32041. onClick: clickHandler,
  32042. onLoad: handleLoad,
  32043. onError: handleError
  32044. }), null, 16, ["src", "loading", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  32045. isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", {
  32046. key: 1,
  32047. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  32048. }, [
  32049. vue.renderSlot(_ctx.$slots, "placeholder", {}, () => [
  32050. vue.createElementVNode("div", {
  32051. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  32052. }, null, 2)
  32053. ])
  32054. ], 2)) : vue.createCommentVNode("v-if", true)
  32055. ], 64)),
  32056. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  32057. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  32058. key: 0,
  32059. "z-index": _ctx.zIndex,
  32060. "initial-index": vue.unref(imageIndex),
  32061. infinite: _ctx.infinite,
  32062. "zoom-rate": _ctx.zoomRate,
  32063. "min-scale": _ctx.minScale,
  32064. "max-scale": _ctx.maxScale,
  32065. "show-progress": _ctx.showProgress,
  32066. "url-list": _ctx.previewSrcList,
  32067. crossorigin: _ctx.crossorigin,
  32068. "hide-on-click-modal": _ctx.hideOnClickModal,
  32069. teleported: _ctx.previewTeleported,
  32070. "close-on-press-escape": _ctx.closeOnPressEscape,
  32071. onClose: closeViewer,
  32072. onSwitch: switchViewer
  32073. }, {
  32074. progress: vue.withCtx((progress) => [
  32075. vue.renderSlot(_ctx.$slots, "progress", vue.normalizeProps(vue.guardReactiveProps(progress)))
  32076. ]),
  32077. toolbar: vue.withCtx((toolbar) => [
  32078. vue.renderSlot(_ctx.$slots, "toolbar", vue.normalizeProps(vue.guardReactiveProps(toolbar)))
  32079. ]),
  32080. default: vue.withCtx(() => [
  32081. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  32082. vue.renderSlot(_ctx.$slots, "viewer")
  32083. ])) : vue.createCommentVNode("v-if", true)
  32084. ]),
  32085. _: 3
  32086. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "show-progress", "url-list", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  32087. ], 64)) : vue.createCommentVNode("v-if", true)
  32088. ], 16);
  32089. };
  32090. }
  32091. });
  32092. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__file", "image.vue"]]);
  32093. const ElImage = withInstall(Image$1);
  32094. const inputNumberProps = buildProps({
  32095. id: {
  32096. type: String,
  32097. default: void 0
  32098. },
  32099. step: {
  32100. type: Number,
  32101. default: 1
  32102. },
  32103. stepStrictly: Boolean,
  32104. max: {
  32105. type: Number,
  32106. default: Number.POSITIVE_INFINITY
  32107. },
  32108. min: {
  32109. type: Number,
  32110. default: Number.NEGATIVE_INFINITY
  32111. },
  32112. modelValue: Number,
  32113. readonly: Boolean,
  32114. disabled: Boolean,
  32115. size: useSizeProp,
  32116. controls: {
  32117. type: Boolean,
  32118. default: true
  32119. },
  32120. controlsPosition: {
  32121. type: String,
  32122. default: "",
  32123. values: ["", "right"]
  32124. },
  32125. valueOnClear: {
  32126. type: [String, Number, null],
  32127. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  32128. default: null
  32129. },
  32130. name: String,
  32131. placeholder: String,
  32132. precision: {
  32133. type: Number,
  32134. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  32135. },
  32136. validateEvent: {
  32137. type: Boolean,
  32138. default: true
  32139. },
  32140. ...useAriaProps(["ariaLabel"])
  32141. });
  32142. const inputNumberEmits = {
  32143. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  32144. blur: (e) => e instanceof FocusEvent,
  32145. focus: (e) => e instanceof FocusEvent,
  32146. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  32147. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  32148. };
  32149. const __default__$W = vue.defineComponent({
  32150. name: "ElInputNumber"
  32151. });
  32152. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  32153. ...__default__$W,
  32154. props: inputNumberProps,
  32155. emits: inputNumberEmits,
  32156. setup(__props, { expose, emit }) {
  32157. const props = __props;
  32158. const { t } = useLocale();
  32159. const ns = useNamespace("input-number");
  32160. const input = vue.ref();
  32161. const data = vue.reactive({
  32162. currentValue: props.modelValue,
  32163. userInput: null
  32164. });
  32165. const { formItem } = useFormItem();
  32166. const minDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  32167. const maxDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  32168. const numPrecision = vue.computed(() => {
  32169. const stepPrecision = getPrecision(props.step);
  32170. if (!isUndefined(props.precision)) {
  32171. if (stepPrecision > props.precision) ;
  32172. return props.precision;
  32173. } else {
  32174. return Math.max(getPrecision(props.modelValue), stepPrecision);
  32175. }
  32176. });
  32177. const controlsAtRight = vue.computed(() => {
  32178. return props.controls && props.controlsPosition === "right";
  32179. });
  32180. const inputNumberSize = useFormSize();
  32181. const inputNumberDisabled = useFormDisabled();
  32182. const displayValue = vue.computed(() => {
  32183. if (data.userInput !== null) {
  32184. return data.userInput;
  32185. }
  32186. let currentValue = data.currentValue;
  32187. if (isNil(currentValue))
  32188. return "";
  32189. if (isNumber(currentValue)) {
  32190. if (Number.isNaN(currentValue))
  32191. return "";
  32192. if (!isUndefined(props.precision)) {
  32193. currentValue = currentValue.toFixed(props.precision);
  32194. }
  32195. }
  32196. return currentValue;
  32197. });
  32198. const toPrecision = (num, pre) => {
  32199. if (isUndefined(pre))
  32200. pre = numPrecision.value;
  32201. if (pre === 0)
  32202. return Math.round(num);
  32203. let snum = String(num);
  32204. const pointPos = snum.indexOf(".");
  32205. if (pointPos === -1)
  32206. return num;
  32207. const nums = snum.replace(".", "").split("");
  32208. const datum = nums[pointPos + pre];
  32209. if (!datum)
  32210. return num;
  32211. const length = snum.length;
  32212. if (snum.charAt(length - 1) === "5") {
  32213. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  32214. }
  32215. return Number.parseFloat(Number(snum).toFixed(pre));
  32216. };
  32217. const getPrecision = (value) => {
  32218. if (isNil(value))
  32219. return 0;
  32220. const valueString = value.toString();
  32221. const dotPosition = valueString.indexOf(".");
  32222. let precision = 0;
  32223. if (dotPosition !== -1) {
  32224. precision = valueString.length - dotPosition - 1;
  32225. }
  32226. return precision;
  32227. };
  32228. const ensurePrecision = (val, coefficient = 1) => {
  32229. if (!isNumber(val))
  32230. return data.currentValue;
  32231. return toPrecision(val + props.step * coefficient);
  32232. };
  32233. const increase = () => {
  32234. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  32235. return;
  32236. const value = Number(displayValue.value) || 0;
  32237. const newVal = ensurePrecision(value);
  32238. setCurrentValue(newVal);
  32239. emit(INPUT_EVENT, data.currentValue);
  32240. setCurrentValueToModelValue();
  32241. };
  32242. const decrease = () => {
  32243. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  32244. return;
  32245. const value = Number(displayValue.value) || 0;
  32246. const newVal = ensurePrecision(value, -1);
  32247. setCurrentValue(newVal);
  32248. emit(INPUT_EVENT, data.currentValue);
  32249. setCurrentValueToModelValue();
  32250. };
  32251. const verifyValue = (value, update) => {
  32252. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  32253. if (max < min) {
  32254. throwError("InputNumber", "min should not be greater than max.");
  32255. }
  32256. let newVal = Number(value);
  32257. if (isNil(value) || Number.isNaN(newVal)) {
  32258. return null;
  32259. }
  32260. if (value === "") {
  32261. if (valueOnClear === null) {
  32262. return null;
  32263. }
  32264. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  32265. }
  32266. if (stepStrictly) {
  32267. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  32268. if (newVal !== value) {
  32269. update && emit(UPDATE_MODEL_EVENT, newVal);
  32270. }
  32271. }
  32272. if (!isUndefined(precision)) {
  32273. newVal = toPrecision(newVal, precision);
  32274. }
  32275. if (newVal > max || newVal < min) {
  32276. newVal = newVal > max ? max : min;
  32277. update && emit(UPDATE_MODEL_EVENT, newVal);
  32278. }
  32279. return newVal;
  32280. };
  32281. const setCurrentValue = (value, emitChange = true) => {
  32282. var _a;
  32283. const oldVal = data.currentValue;
  32284. const newVal = verifyValue(value);
  32285. if (!emitChange) {
  32286. emit(UPDATE_MODEL_EVENT, newVal);
  32287. return;
  32288. }
  32289. if (oldVal === newVal && value)
  32290. return;
  32291. data.userInput = null;
  32292. emit(UPDATE_MODEL_EVENT, newVal);
  32293. if (oldVal !== newVal) {
  32294. emit(CHANGE_EVENT, newVal, oldVal);
  32295. }
  32296. if (props.validateEvent) {
  32297. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  32298. }
  32299. data.currentValue = newVal;
  32300. };
  32301. const handleInput = (value) => {
  32302. data.userInput = value;
  32303. const newVal = value === "" ? null : Number(value);
  32304. emit(INPUT_EVENT, newVal);
  32305. setCurrentValue(newVal, false);
  32306. };
  32307. const handleInputChange = (value) => {
  32308. const newVal = value !== "" ? Number(value) : "";
  32309. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  32310. setCurrentValue(newVal);
  32311. }
  32312. setCurrentValueToModelValue();
  32313. data.userInput = null;
  32314. };
  32315. const focus = () => {
  32316. var _a, _b;
  32317. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  32318. };
  32319. const blur = () => {
  32320. var _a, _b;
  32321. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  32322. };
  32323. const handleFocus = (event) => {
  32324. emit("focus", event);
  32325. };
  32326. const handleBlur = (event) => {
  32327. var _a, _b;
  32328. data.userInput = null;
  32329. if (isFirefox() && data.currentValue === null && ((_a = input.value) == null ? void 0 : _a.input)) {
  32330. input.value.input.value = "";
  32331. }
  32332. emit("blur", event);
  32333. if (props.validateEvent) {
  32334. (_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur").catch((err) => debugWarn());
  32335. }
  32336. };
  32337. const setCurrentValueToModelValue = () => {
  32338. if (data.currentValue !== props.modelValue) {
  32339. data.currentValue = props.modelValue;
  32340. }
  32341. };
  32342. const handleWheel = (e) => {
  32343. if (document.activeElement === e.target)
  32344. e.preventDefault();
  32345. };
  32346. vue.watch(() => props.modelValue, (value, oldValue) => {
  32347. const newValue = verifyValue(value, true);
  32348. if (data.userInput === null && newValue !== oldValue) {
  32349. data.currentValue = newValue;
  32350. }
  32351. }, { immediate: true });
  32352. vue.onMounted(() => {
  32353. var _a;
  32354. const { min, max, modelValue } = props;
  32355. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32356. innerInput.setAttribute("role", "spinbutton");
  32357. if (Number.isFinite(max)) {
  32358. innerInput.setAttribute("aria-valuemax", String(max));
  32359. } else {
  32360. innerInput.removeAttribute("aria-valuemax");
  32361. }
  32362. if (Number.isFinite(min)) {
  32363. innerInput.setAttribute("aria-valuemin", String(min));
  32364. } else {
  32365. innerInput.removeAttribute("aria-valuemin");
  32366. }
  32367. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  32368. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  32369. if (!isNumber(modelValue) && modelValue != null) {
  32370. let val = Number(modelValue);
  32371. if (Number.isNaN(val)) {
  32372. val = null;
  32373. }
  32374. emit(UPDATE_MODEL_EVENT, val);
  32375. }
  32376. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  32377. });
  32378. vue.onUpdated(() => {
  32379. var _a, _b;
  32380. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32381. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  32382. });
  32383. expose({
  32384. focus,
  32385. blur
  32386. });
  32387. return (_ctx, _cache) => {
  32388. return vue.openBlock(), vue.createElementBlock("div", {
  32389. class: vue.normalizeClass([
  32390. vue.unref(ns).b(),
  32391. vue.unref(ns).m(vue.unref(inputNumberSize)),
  32392. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  32393. vue.unref(ns).is("without-controls", !_ctx.controls),
  32394. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight))
  32395. ]),
  32396. onDragstart: vue.withModifiers(() => {
  32397. }, ["prevent"])
  32398. }, [
  32399. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  32400. key: 0,
  32401. role: "button",
  32402. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  32403. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  32404. onKeydown: vue.withKeys(decrease, ["enter"])
  32405. }, [
  32406. vue.renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  32407. vue.createVNode(vue.unref(ElIcon), null, {
  32408. default: vue.withCtx(() => [
  32409. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  32410. ]),
  32411. _: 1
  32412. })
  32413. ])
  32414. ], 42, ["aria-label", "onKeydown"])), [
  32415. [vue.unref(vRepeatClick), decrease]
  32416. ]) : vue.createCommentVNode("v-if", true),
  32417. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  32418. key: 1,
  32419. role: "button",
  32420. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  32421. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  32422. onKeydown: vue.withKeys(increase, ["enter"])
  32423. }, [
  32424. vue.renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  32425. vue.createVNode(vue.unref(ElIcon), null, {
  32426. default: vue.withCtx(() => [
  32427. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  32428. ]),
  32429. _: 1
  32430. })
  32431. ])
  32432. ], 42, ["aria-label", "onKeydown"])), [
  32433. [vue.unref(vRepeatClick), increase]
  32434. ]) : vue.createCommentVNode("v-if", true),
  32435. vue.createVNode(vue.unref(ElInput), {
  32436. id: _ctx.id,
  32437. ref_key: "input",
  32438. ref: input,
  32439. type: "number",
  32440. step: _ctx.step,
  32441. "model-value": vue.unref(displayValue),
  32442. placeholder: _ctx.placeholder,
  32443. readonly: _ctx.readonly,
  32444. disabled: vue.unref(inputNumberDisabled),
  32445. size: vue.unref(inputNumberSize),
  32446. max: _ctx.max,
  32447. min: _ctx.min,
  32448. name: _ctx.name,
  32449. "aria-label": _ctx.ariaLabel,
  32450. "validate-event": false,
  32451. onKeydown: [
  32452. vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]),
  32453. vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"])
  32454. ],
  32455. onBlur: handleBlur,
  32456. onFocus: handleFocus,
  32457. onInput: handleInput,
  32458. onChange: handleInputChange
  32459. }, vue.createSlots({
  32460. _: 2
  32461. }, [
  32462. _ctx.$slots.prefix ? {
  32463. name: "prefix",
  32464. fn: vue.withCtx(() => [
  32465. vue.renderSlot(_ctx.$slots, "prefix")
  32466. ])
  32467. } : void 0,
  32468. _ctx.$slots.suffix ? {
  32469. name: "suffix",
  32470. fn: vue.withCtx(() => [
  32471. vue.renderSlot(_ctx.$slots, "suffix")
  32472. ])
  32473. } : void 0
  32474. ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
  32475. ], 42, ["onDragstart"]);
  32476. };
  32477. }
  32478. });
  32479. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "input-number.vue"]]);
  32480. const ElInputNumber = withInstall(InputNumber);
  32481. const inputTagProps = buildProps({
  32482. modelValue: {
  32483. type: definePropType(Array)
  32484. },
  32485. max: Number,
  32486. tagType: { ...tagProps.type, default: "info" },
  32487. tagEffect: tagProps.effect,
  32488. trigger: {
  32489. type: definePropType(String),
  32490. default: EVENT_CODE.enter
  32491. },
  32492. draggable: {
  32493. type: Boolean,
  32494. default: false
  32495. },
  32496. size: useSizeProp,
  32497. clearable: Boolean,
  32498. disabled: {
  32499. type: Boolean,
  32500. default: void 0
  32501. },
  32502. validateEvent: {
  32503. type: Boolean,
  32504. default: true
  32505. },
  32506. readonly: Boolean,
  32507. autofocus: Boolean,
  32508. id: {
  32509. type: String,
  32510. default: void 0
  32511. },
  32512. tabindex: {
  32513. type: [String, Number],
  32514. default: 0
  32515. },
  32516. maxlength: {
  32517. type: [String, Number]
  32518. },
  32519. minlength: {
  32520. type: [String, Number]
  32521. },
  32522. placeholder: String,
  32523. autocomplete: {
  32524. type: String,
  32525. default: "off"
  32526. },
  32527. saveOnBlur: {
  32528. type: Boolean,
  32529. default: true
  32530. },
  32531. ariaLabel: String
  32532. });
  32533. const inputTagEmits = {
  32534. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32535. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32536. [INPUT_EVENT]: (value) => isString$1(value),
  32537. "add-tag": (value) => isString$1(value),
  32538. "remove-tag": (value) => isString$1(value),
  32539. focus: (evt) => evt instanceof FocusEvent,
  32540. blur: (evt) => evt instanceof FocusEvent,
  32541. clear: () => true
  32542. };
  32543. function useDragTag({
  32544. wrapperRef,
  32545. handleDragged,
  32546. afterDragged
  32547. }) {
  32548. const ns = useNamespace("input-tag");
  32549. const dropIndicatorRef = vue.shallowRef();
  32550. const showDropIndicator = vue.ref(false);
  32551. let draggingIndex;
  32552. let draggingTag;
  32553. let dropIndex;
  32554. let dropType;
  32555. function getTagClassName(index) {
  32556. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  32557. }
  32558. function handleDragStart(event, index) {
  32559. draggingIndex = index;
  32560. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  32561. if (draggingTag) {
  32562. draggingTag.style.opacity = "0.5";
  32563. }
  32564. event.dataTransfer.effectAllowed = "move";
  32565. }
  32566. function handleDragOver(event, index) {
  32567. dropIndex = index;
  32568. event.preventDefault();
  32569. event.dataTransfer.dropEffect = "move";
  32570. if (isUndefined(draggingIndex) || draggingIndex === index) {
  32571. showDropIndicator.value = false;
  32572. return;
  32573. }
  32574. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  32575. const dropPrev = !(draggingIndex + 1 === index);
  32576. const dropNext = !(draggingIndex - 1 === index);
  32577. const distance = event.clientX - dropPosition.left;
  32578. const prevPercent = dropPrev ? dropNext ? 0.5 : 1 : -1;
  32579. const nextPercent = dropNext ? dropPrev ? 0.5 : 0 : 1;
  32580. if (distance <= dropPosition.width * prevPercent) {
  32581. dropType = "before";
  32582. } else if (distance > dropPosition.width * nextPercent) {
  32583. dropType = "after";
  32584. } else {
  32585. dropType = void 0;
  32586. }
  32587. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  32588. const innerPosition = innerEl.getBoundingClientRect();
  32589. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  32590. const indicatorTop = dropPosition.top - innerPosition.top;
  32591. let indicatorLeft = -9999;
  32592. if (dropType === "before") {
  32593. indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  32594. } else if (dropType === "after") {
  32595. const left = dropPosition.right - innerPosition.left;
  32596. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  32597. }
  32598. setStyle(dropIndicatorRef.value, {
  32599. top: `${indicatorTop}px`,
  32600. left: `${indicatorLeft}px`
  32601. });
  32602. showDropIndicator.value = !!dropType;
  32603. }
  32604. function handleDragEnd(event) {
  32605. event.preventDefault();
  32606. if (draggingTag) {
  32607. draggingTag.style.opacity = "";
  32608. }
  32609. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) {
  32610. handleDragged(draggingIndex, dropIndex, dropType);
  32611. }
  32612. showDropIndicator.value = false;
  32613. draggingIndex = void 0;
  32614. draggingTag = null;
  32615. dropIndex = void 0;
  32616. dropType = void 0;
  32617. afterDragged == null ? void 0 : afterDragged();
  32618. }
  32619. return {
  32620. dropIndicatorRef,
  32621. showDropIndicator,
  32622. handleDragStart,
  32623. handleDragOver,
  32624. handleDragEnd
  32625. };
  32626. }
  32627. function useHovering() {
  32628. const hovering = vue.ref(false);
  32629. const handleMouseEnter = () => {
  32630. hovering.value = true;
  32631. };
  32632. const handleMouseLeave = () => {
  32633. hovering.value = false;
  32634. };
  32635. return {
  32636. hovering,
  32637. handleMouseEnter,
  32638. handleMouseLeave
  32639. };
  32640. }
  32641. function useInputTag({ props, emit, formItem }) {
  32642. const disabled = useFormDisabled();
  32643. const size = useFormSize();
  32644. const inputRef = vue.shallowRef();
  32645. const inputValue = vue.ref();
  32646. const tagSize = vue.computed(() => {
  32647. return ["small"].includes(size.value) ? "small" : "default";
  32648. });
  32649. const placeholder = vue.computed(() => {
  32650. var _a;
  32651. return ((_a = props.modelValue) == null ? void 0 : _a.length) ? void 0 : props.placeholder;
  32652. });
  32653. const closable = vue.computed(() => !(props.readonly || disabled.value));
  32654. const inputLimit = vue.computed(() => {
  32655. var _a, _b;
  32656. return isUndefined(props.max) ? false : ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0) >= props.max;
  32657. });
  32658. const handleInput = (event) => {
  32659. if (inputLimit.value) {
  32660. inputValue.value = void 0;
  32661. return;
  32662. }
  32663. if (isComposing.value)
  32664. return;
  32665. emit(INPUT_EVENT, event.target.value);
  32666. };
  32667. const handleKeydown = (event) => {
  32668. var _a;
  32669. if (isComposing.value)
  32670. return;
  32671. switch (event.code) {
  32672. case props.trigger:
  32673. event.preventDefault();
  32674. event.stopPropagation();
  32675. handleAddTag();
  32676. break;
  32677. case EVENT_CODE.numpadEnter:
  32678. if (props.trigger === EVENT_CODE.enter) {
  32679. event.preventDefault();
  32680. event.stopPropagation();
  32681. handleAddTag();
  32682. }
  32683. break;
  32684. case EVENT_CODE.backspace:
  32685. if (!inputValue.value && ((_a = props.modelValue) == null ? void 0 : _a.length)) {
  32686. event.preventDefault();
  32687. event.stopPropagation();
  32688. handleRemoveTag(props.modelValue.length - 1);
  32689. }
  32690. break;
  32691. }
  32692. };
  32693. const handleAddTag = () => {
  32694. var _a, _b;
  32695. const value = (_a = inputValue.value) == null ? void 0 : _a.trim();
  32696. if (!value || inputLimit.value)
  32697. return;
  32698. const list = [...(_b = props.modelValue) != null ? _b : [], value];
  32699. emit(UPDATE_MODEL_EVENT, list);
  32700. emit(CHANGE_EVENT, list);
  32701. emit("add-tag", value);
  32702. inputValue.value = void 0;
  32703. };
  32704. const handleRemoveTag = (index) => {
  32705. var _a;
  32706. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32707. const [item] = value.splice(index, 1);
  32708. emit(UPDATE_MODEL_EVENT, value);
  32709. emit(CHANGE_EVENT, value);
  32710. emit("remove-tag", item);
  32711. };
  32712. const handleClear = () => {
  32713. inputValue.value = void 0;
  32714. emit(UPDATE_MODEL_EVENT, void 0);
  32715. emit(CHANGE_EVENT, void 0);
  32716. emit("clear");
  32717. };
  32718. const handleDragged = (draggingIndex, dropIndex, type) => {
  32719. var _a;
  32720. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32721. const [draggedItem] = value.splice(draggingIndex, 1);
  32722. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  32723. value.splice(dropIndex + step, 0, draggedItem);
  32724. emit(UPDATE_MODEL_EVENT, value);
  32725. emit(CHANGE_EVENT, value);
  32726. };
  32727. const focus = () => {
  32728. var _a;
  32729. (_a = inputRef.value) == null ? void 0 : _a.focus();
  32730. };
  32731. const blur = () => {
  32732. var _a;
  32733. (_a = inputRef.value) == null ? void 0 : _a.blur();
  32734. };
  32735. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  32736. beforeFocus() {
  32737. return disabled.value;
  32738. },
  32739. afterBlur() {
  32740. var _a;
  32741. if (props.saveOnBlur) {
  32742. handleAddTag();
  32743. } else {
  32744. inputValue.value = void 0;
  32745. }
  32746. if (props.validateEvent) {
  32747. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  32748. }
  32749. }
  32750. });
  32751. const {
  32752. isComposing,
  32753. handleCompositionStart,
  32754. handleCompositionUpdate,
  32755. handleCompositionEnd
  32756. } = useComposition({ afterComposition: handleInput });
  32757. vue.watch(() => props.modelValue, () => {
  32758. var _a;
  32759. if (props.validateEvent) {
  32760. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, CHANGE_EVENT).catch((err) => debugWarn());
  32761. }
  32762. });
  32763. return {
  32764. inputRef,
  32765. wrapperRef,
  32766. isFocused,
  32767. isComposing,
  32768. inputValue,
  32769. size,
  32770. tagSize,
  32771. placeholder,
  32772. closable,
  32773. disabled,
  32774. inputLimit,
  32775. handleDragged,
  32776. handleInput,
  32777. handleKeydown,
  32778. handleAddTag,
  32779. handleRemoveTag,
  32780. handleClear,
  32781. handleCompositionStart,
  32782. handleCompositionUpdate,
  32783. handleCompositionEnd,
  32784. focus,
  32785. blur
  32786. };
  32787. }
  32788. function useInputTagDom({
  32789. props,
  32790. isFocused,
  32791. hovering,
  32792. disabled,
  32793. inputValue,
  32794. size,
  32795. validateState,
  32796. validateIcon,
  32797. needStatusIcon
  32798. }) {
  32799. const attrs = vue.useAttrs();
  32800. const slots = vue.useSlots();
  32801. const ns = useNamespace("input-tag");
  32802. const nsInput = useNamespace("input");
  32803. const containerKls = vue.computed(() => [
  32804. ns.b(),
  32805. ns.is("focused", isFocused.value),
  32806. ns.is("hovering", hovering.value),
  32807. ns.is("disabled", disabled.value),
  32808. ns.m(size.value),
  32809. ns.e("wrapper"),
  32810. attrs.class
  32811. ]);
  32812. const containerStyle = vue.computed(() => [attrs.style]);
  32813. const innerKls = vue.computed(() => {
  32814. var _a, _b;
  32815. return [
  32816. ns.e("inner"),
  32817. ns.is("draggable", props.draggable),
  32818. ns.is("left-space", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix),
  32819. ns.is("right-space", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)
  32820. ];
  32821. });
  32822. const showClear = vue.computed(() => {
  32823. var _a;
  32824. return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);
  32825. });
  32826. const showSuffix = vue.computed(() => {
  32827. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  32828. });
  32829. return {
  32830. ns,
  32831. nsInput,
  32832. containerKls,
  32833. containerStyle,
  32834. innerKls,
  32835. showClear,
  32836. showSuffix
  32837. };
  32838. }
  32839. const __default__$V = vue.defineComponent({
  32840. name: "ElInputTag",
  32841. inheritAttrs: false
  32842. });
  32843. const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
  32844. ...__default__$V,
  32845. props: inputTagProps,
  32846. emits: inputTagEmits,
  32847. setup(__props, { expose, emit }) {
  32848. const props = __props;
  32849. const attrs = useAttrs();
  32850. const slots = vue.useSlots();
  32851. const { form, formItem } = useFormItem();
  32852. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  32853. const needStatusIcon = vue.computed(() => {
  32854. var _a;
  32855. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  32856. });
  32857. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  32858. const validateIcon = vue.computed(() => {
  32859. return validateState.value && ValidateComponentsMap[validateState.value];
  32860. });
  32861. const {
  32862. inputRef,
  32863. wrapperRef,
  32864. isFocused,
  32865. inputValue,
  32866. size,
  32867. tagSize,
  32868. placeholder,
  32869. closable,
  32870. disabled,
  32871. handleDragged,
  32872. handleInput,
  32873. handleKeydown,
  32874. handleRemoveTag,
  32875. handleClear,
  32876. handleCompositionStart,
  32877. handleCompositionUpdate,
  32878. handleCompositionEnd,
  32879. focus,
  32880. blur
  32881. } = useInputTag({ props, emit, formItem });
  32882. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  32883. const { calculatorRef, inputStyle } = useCalcInputWidth();
  32884. const {
  32885. dropIndicatorRef,
  32886. showDropIndicator,
  32887. handleDragStart,
  32888. handleDragOver,
  32889. handleDragEnd
  32890. } = useDragTag({ wrapperRef, handleDragged, afterDragged: focus });
  32891. const {
  32892. ns,
  32893. nsInput,
  32894. containerKls,
  32895. containerStyle,
  32896. innerKls,
  32897. showClear,
  32898. showSuffix
  32899. } = useInputTagDom({
  32900. props,
  32901. hovering,
  32902. isFocused,
  32903. inputValue,
  32904. disabled,
  32905. size,
  32906. validateState,
  32907. validateIcon,
  32908. needStatusIcon
  32909. });
  32910. expose({
  32911. focus,
  32912. blur
  32913. });
  32914. return (_ctx, _cache) => {
  32915. return vue.openBlock(), vue.createElementBlock("div", {
  32916. ref_key: "wrapperRef",
  32917. ref: wrapperRef,
  32918. class: vue.normalizeClass(vue.unref(containerKls)),
  32919. style: vue.normalizeStyle(vue.unref(containerStyle)),
  32920. onMouseenter: vue.unref(handleMouseEnter),
  32921. onMouseleave: vue.unref(handleMouseLeave)
  32922. }, [
  32923. vue.unref(slots).prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  32924. key: 0,
  32925. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  32926. }, [
  32927. vue.renderSlot(_ctx.$slots, "prefix")
  32928. ], 2)) : vue.createCommentVNode("v-if", true),
  32929. vue.createElementVNode("div", {
  32930. class: vue.normalizeClass(vue.unref(innerKls))
  32931. }, [
  32932. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.modelValue, (item, index) => {
  32933. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  32934. key: index,
  32935. size: vue.unref(tagSize),
  32936. closable: vue.unref(closable),
  32937. type: _ctx.tagType,
  32938. effect: _ctx.tagEffect,
  32939. draggable: vue.unref(closable) && _ctx.draggable,
  32940. "disable-transitions": "",
  32941. onClose: ($event) => vue.unref(handleRemoveTag)(index),
  32942. onDragstart: (event) => vue.unref(handleDragStart)(event, index),
  32943. onDragover: (event) => vue.unref(handleDragOver)(event, index),
  32944. onDragend: vue.unref(handleDragEnd),
  32945. onDrop: vue.withModifiers(() => {
  32946. }, ["stop"])
  32947. }, {
  32948. default: vue.withCtx(() => [
  32949. vue.renderSlot(_ctx.$slots, "tag", {
  32950. value: item,
  32951. index
  32952. }, () => [
  32953. vue.createTextVNode(vue.toDisplayString(item), 1)
  32954. ])
  32955. ]),
  32956. _: 2
  32957. }, 1032, ["size", "closable", "type", "effect", "draggable", "onClose", "onDragstart", "onDragover", "onDragend", "onDrop"]);
  32958. }), 128)),
  32959. vue.createElementVNode("div", {
  32960. class: vue.normalizeClass(vue.unref(ns).e("input-wrapper"))
  32961. }, [
  32962. vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
  32963. id: vue.unref(inputId),
  32964. ref_key: "inputRef",
  32965. ref: inputRef,
  32966. "onUpdate:modelValue": ($event) => vue.isRef(inputValue) ? inputValue.value = $event : null
  32967. }, vue.unref(attrs), {
  32968. type: "text",
  32969. minlength: _ctx.minlength,
  32970. maxlength: _ctx.maxlength,
  32971. disabled: vue.unref(disabled),
  32972. readonly: _ctx.readonly,
  32973. autocomplete: _ctx.autocomplete,
  32974. tabindex: _ctx.tabindex,
  32975. placeholder: vue.unref(placeholder),
  32976. autofocus: _ctx.autofocus,
  32977. ariaLabel: _ctx.ariaLabel,
  32978. class: vue.unref(ns).e("input"),
  32979. style: vue.unref(inputStyle),
  32980. onCompositionstart: vue.unref(handleCompositionStart),
  32981. onCompositionupdate: vue.unref(handleCompositionUpdate),
  32982. onCompositionend: vue.unref(handleCompositionEnd),
  32983. onInput: vue.unref(handleInput),
  32984. onKeydown: vue.unref(handleKeydown)
  32985. }), null, 16, ["id", "onUpdate:modelValue", "minlength", "maxlength", "disabled", "readonly", "autocomplete", "tabindex", "placeholder", "autofocus", "ariaLabel", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onKeydown"]), [
  32986. [vue.vModelText, vue.unref(inputValue)]
  32987. ]),
  32988. vue.createElementVNode("span", {
  32989. ref_key: "calculatorRef",
  32990. ref: calculatorRef,
  32991. "aria-hidden": "true",
  32992. class: vue.normalizeClass(vue.unref(ns).e("input-calculator")),
  32993. textContent: vue.toDisplayString(vue.unref(inputValue))
  32994. }, null, 10, ["textContent"])
  32995. ], 2),
  32996. vue.withDirectives(vue.createElementVNode("div", {
  32997. ref_key: "dropIndicatorRef",
  32998. ref: dropIndicatorRef,
  32999. class: vue.normalizeClass(vue.unref(ns).e("drop-indicator"))
  33000. }, null, 2), [
  33001. [vue.vShow, vue.unref(showDropIndicator)]
  33002. ])
  33003. ], 2),
  33004. vue.unref(showSuffix) ? (vue.openBlock(), vue.createElementBlock("div", {
  33005. key: 1,
  33006. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  33007. }, [
  33008. vue.renderSlot(_ctx.$slots, "suffix"),
  33009. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  33010. key: 0,
  33011. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("clear")]),
  33012. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  33013. onClick: vue.unref(handleClear)
  33014. }, {
  33015. default: vue.withCtx(() => [
  33016. vue.createVNode(vue.unref(circle_close_default))
  33017. ]),
  33018. _: 1
  33019. }, 8, ["class", "onMousedown", "onClick"])) : vue.createCommentVNode("v-if", true),
  33020. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  33021. key: 1,
  33022. class: vue.normalizeClass([
  33023. vue.unref(nsInput).e("icon"),
  33024. vue.unref(nsInput).e("validateIcon"),
  33025. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  33026. ])
  33027. }, {
  33028. default: vue.withCtx(() => [
  33029. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  33030. ]),
  33031. _: 1
  33032. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  33033. ], 2)) : vue.createCommentVNode("v-if", true)
  33034. ], 46, ["onMouseenter", "onMouseleave"]);
  33035. };
  33036. }
  33037. });
  33038. var InputTag = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "input-tag.vue"]]);
  33039. const ElInputTag = withInstall(InputTag);
  33040. const linkProps = buildProps({
  33041. type: {
  33042. type: String,
  33043. values: ["primary", "success", "warning", "info", "danger", "default"],
  33044. default: "default"
  33045. },
  33046. underline: {
  33047. type: Boolean,
  33048. default: true
  33049. },
  33050. disabled: Boolean,
  33051. href: { type: String, default: "" },
  33052. target: {
  33053. type: String,
  33054. default: "_self"
  33055. },
  33056. icon: {
  33057. type: iconPropType
  33058. }
  33059. });
  33060. const linkEmits = {
  33061. click: (evt) => evt instanceof MouseEvent
  33062. };
  33063. const __default__$U = vue.defineComponent({
  33064. name: "ElLink"
  33065. });
  33066. const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
  33067. ...__default__$U,
  33068. props: linkProps,
  33069. emits: linkEmits,
  33070. setup(__props, { emit }) {
  33071. const props = __props;
  33072. const ns = useNamespace("link");
  33073. const linkKls = vue.computed(() => [
  33074. ns.b(),
  33075. ns.m(props.type),
  33076. ns.is("disabled", props.disabled),
  33077. ns.is("underline", props.underline && !props.disabled)
  33078. ]);
  33079. function handleClick(event) {
  33080. if (!props.disabled)
  33081. emit("click", event);
  33082. }
  33083. return (_ctx, _cache) => {
  33084. return vue.openBlock(), vue.createElementBlock("a", {
  33085. class: vue.normalizeClass(vue.unref(linkKls)),
  33086. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  33087. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  33088. onClick: handleClick
  33089. }, [
  33090. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  33091. default: vue.withCtx(() => [
  33092. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  33093. ]),
  33094. _: 1
  33095. })) : vue.createCommentVNode("v-if", true),
  33096. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  33097. key: 1,
  33098. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  33099. }, [
  33100. vue.renderSlot(_ctx.$slots, "default")
  33101. ], 2)) : vue.createCommentVNode("v-if", true),
  33102. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  33103. ], 10, ["href", "target"]);
  33104. };
  33105. }
  33106. });
  33107. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "link.vue"]]);
  33108. const ElLink = withInstall(Link);
  33109. class SubMenu$1 {
  33110. constructor(parent, domNode) {
  33111. this.parent = parent;
  33112. this.domNode = domNode;
  33113. this.subIndex = 0;
  33114. this.subIndex = 0;
  33115. this.init();
  33116. }
  33117. init() {
  33118. this.subMenuItems = this.domNode.querySelectorAll("li");
  33119. this.addListeners();
  33120. }
  33121. gotoSubIndex(idx) {
  33122. if (idx === this.subMenuItems.length) {
  33123. idx = 0;
  33124. } else if (idx < 0) {
  33125. idx = this.subMenuItems.length - 1;
  33126. }
  33127. this.subMenuItems[idx].focus();
  33128. this.subIndex = idx;
  33129. }
  33130. addListeners() {
  33131. const parentNode = this.parent.domNode;
  33132. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  33133. el.addEventListener("keydown", (event) => {
  33134. let prevDef = false;
  33135. switch (event.code) {
  33136. case EVENT_CODE.down: {
  33137. this.gotoSubIndex(this.subIndex + 1);
  33138. prevDef = true;
  33139. break;
  33140. }
  33141. case EVENT_CODE.up: {
  33142. this.gotoSubIndex(this.subIndex - 1);
  33143. prevDef = true;
  33144. break;
  33145. }
  33146. case EVENT_CODE.tab: {
  33147. triggerEvent(parentNode, "mouseleave");
  33148. break;
  33149. }
  33150. case EVENT_CODE.enter:
  33151. case EVENT_CODE.numpadEnter:
  33152. case EVENT_CODE.space: {
  33153. prevDef = true;
  33154. event.currentTarget.click();
  33155. break;
  33156. }
  33157. }
  33158. if (prevDef) {
  33159. event.preventDefault();
  33160. event.stopPropagation();
  33161. }
  33162. return false;
  33163. });
  33164. });
  33165. }
  33166. }
  33167. var SubMenu$2 = SubMenu$1;
  33168. class MenuItem$1 {
  33169. constructor(domNode, namespace) {
  33170. this.domNode = domNode;
  33171. this.submenu = null;
  33172. this.submenu = null;
  33173. this.init(namespace);
  33174. }
  33175. init(namespace) {
  33176. this.domNode.setAttribute("tabindex", "0");
  33177. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  33178. if (menuChild) {
  33179. this.submenu = new SubMenu$2(this, menuChild);
  33180. }
  33181. this.addListeners();
  33182. }
  33183. addListeners() {
  33184. this.domNode.addEventListener("keydown", (event) => {
  33185. let prevDef = false;
  33186. switch (event.code) {
  33187. case EVENT_CODE.down: {
  33188. triggerEvent(event.currentTarget, "mouseenter");
  33189. this.submenu && this.submenu.gotoSubIndex(0);
  33190. prevDef = true;
  33191. break;
  33192. }
  33193. case EVENT_CODE.up: {
  33194. triggerEvent(event.currentTarget, "mouseenter");
  33195. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  33196. prevDef = true;
  33197. break;
  33198. }
  33199. case EVENT_CODE.tab: {
  33200. triggerEvent(event.currentTarget, "mouseleave");
  33201. break;
  33202. }
  33203. case EVENT_CODE.enter:
  33204. case EVENT_CODE.numpadEnter:
  33205. case EVENT_CODE.space: {
  33206. prevDef = true;
  33207. event.currentTarget.click();
  33208. break;
  33209. }
  33210. }
  33211. if (prevDef) {
  33212. event.preventDefault();
  33213. }
  33214. });
  33215. }
  33216. }
  33217. var MenuItem$2 = MenuItem$1;
  33218. class Menu$1 {
  33219. constructor(domNode, namespace) {
  33220. this.domNode = domNode;
  33221. this.init(namespace);
  33222. }
  33223. init(namespace) {
  33224. const menuChildren = this.domNode.childNodes;
  33225. Array.from(menuChildren).forEach((child) => {
  33226. if (child.nodeType === 1) {
  33227. new MenuItem$2(child, namespace);
  33228. }
  33229. });
  33230. }
  33231. }
  33232. var Menubar = Menu$1;
  33233. const __default__$T = vue.defineComponent({
  33234. name: "ElMenuCollapseTransition"
  33235. });
  33236. const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
  33237. ...__default__$T,
  33238. setup(__props) {
  33239. const ns = useNamespace("menu");
  33240. const listeners = {
  33241. onBeforeEnter: (el) => el.style.opacity = "0.2",
  33242. onEnter(el, done) {
  33243. addClass(el, `${ns.namespace.value}-opacity-transition`);
  33244. el.style.opacity = "1";
  33245. done();
  33246. },
  33247. onAfterEnter(el) {
  33248. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  33249. el.style.opacity = "";
  33250. },
  33251. onBeforeLeave(el) {
  33252. if (!el.dataset)
  33253. el.dataset = {};
  33254. if (hasClass(el, ns.m("collapse"))) {
  33255. removeClass(el, ns.m("collapse"));
  33256. el.dataset.oldOverflow = el.style.overflow;
  33257. el.dataset.scrollWidth = el.clientWidth.toString();
  33258. addClass(el, ns.m("collapse"));
  33259. } else {
  33260. addClass(el, ns.m("collapse"));
  33261. el.dataset.oldOverflow = el.style.overflow;
  33262. el.dataset.scrollWidth = el.clientWidth.toString();
  33263. removeClass(el, ns.m("collapse"));
  33264. }
  33265. el.style.width = `${el.scrollWidth}px`;
  33266. el.style.overflow = "hidden";
  33267. },
  33268. onLeave(el) {
  33269. addClass(el, "horizontal-collapse-transition");
  33270. el.style.width = `${el.dataset.scrollWidth}px`;
  33271. }
  33272. };
  33273. return (_ctx, _cache) => {
  33274. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, vue.unref(listeners)), {
  33275. default: vue.withCtx(() => [
  33276. vue.renderSlot(_ctx.$slots, "default")
  33277. ]),
  33278. _: 3
  33279. }, 16);
  33280. };
  33281. }
  33282. });
  33283. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__file", "menu-collapse-transition.vue"]]);
  33284. function useMenu(instance, currentIndex) {
  33285. const indexPath = vue.computed(() => {
  33286. let parent = instance.parent;
  33287. const path = [currentIndex.value];
  33288. while (parent.type.name !== "ElMenu") {
  33289. if (parent.props.index) {
  33290. path.unshift(parent.props.index);
  33291. }
  33292. parent = parent.parent;
  33293. }
  33294. return path;
  33295. });
  33296. const parentMenu = vue.computed(() => {
  33297. let parent = instance.parent;
  33298. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  33299. parent = parent.parent;
  33300. }
  33301. return parent;
  33302. });
  33303. return {
  33304. parentMenu,
  33305. indexPath
  33306. };
  33307. }
  33308. function useMenuColor(props) {
  33309. const menuBarColor = vue.computed(() => {
  33310. const color = props.backgroundColor;
  33311. return color ? new TinyColor(color).shade(20).toString() : "";
  33312. });
  33313. return menuBarColor;
  33314. }
  33315. const useMenuCssVar = (props, level) => {
  33316. const ns = useNamespace("menu");
  33317. return vue.computed(() => ns.cssVarBlock({
  33318. "text-color": props.textColor || "",
  33319. "hover-text-color": props.textColor || "",
  33320. "bg-color": props.backgroundColor || "",
  33321. "hover-bg-color": useMenuColor(props).value || "",
  33322. "active-color": props.activeTextColor || "",
  33323. level: `${level}`
  33324. }));
  33325. };
  33326. const subMenuProps = buildProps({
  33327. index: {
  33328. type: String,
  33329. required: true
  33330. },
  33331. showTimeout: Number,
  33332. hideTimeout: Number,
  33333. popperClass: String,
  33334. disabled: Boolean,
  33335. teleported: {
  33336. type: Boolean,
  33337. default: void 0
  33338. },
  33339. popperOffset: Number,
  33340. expandCloseIcon: {
  33341. type: iconPropType
  33342. },
  33343. expandOpenIcon: {
  33344. type: iconPropType
  33345. },
  33346. collapseCloseIcon: {
  33347. type: iconPropType
  33348. },
  33349. collapseOpenIcon: {
  33350. type: iconPropType
  33351. }
  33352. });
  33353. const COMPONENT_NAME$c = "ElSubMenu";
  33354. var SubMenu = vue.defineComponent({
  33355. name: COMPONENT_NAME$c,
  33356. props: subMenuProps,
  33357. setup(props, { slots, expose }) {
  33358. const instance = vue.getCurrentInstance();
  33359. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  33360. const nsMenu = useNamespace("menu");
  33361. const nsSubMenu = useNamespace("sub-menu");
  33362. const rootMenu = vue.inject("rootMenu");
  33363. if (!rootMenu)
  33364. throwError(COMPONENT_NAME$c, "can not inject root menu");
  33365. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  33366. if (!subMenu)
  33367. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  33368. const items = vue.ref({});
  33369. const subMenus = vue.ref({});
  33370. let timeout;
  33371. const mouseInChild = vue.ref(false);
  33372. const verticalTitleRef = vue.ref();
  33373. const vPopper = vue.ref();
  33374. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  33375. const subMenuTitleIcon = vue.computed(() => {
  33376. 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;
  33377. });
  33378. const isFirstLevel = vue.computed(() => subMenu.level === 0);
  33379. const appendToBody = vue.computed(() => {
  33380. const value = props.teleported;
  33381. return value === void 0 ? isFirstLevel.value : value;
  33382. });
  33383. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  33384. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  33385. "bottom-start",
  33386. "bottom-end",
  33387. "top-start",
  33388. "top-end",
  33389. "right-start",
  33390. "left-start"
  33391. ] : [
  33392. "right-start",
  33393. "right",
  33394. "right-end",
  33395. "left-start",
  33396. "bottom-start",
  33397. "bottom-end",
  33398. "top-start",
  33399. "top-end"
  33400. ]);
  33401. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  33402. const active = vue.computed(() => [...Object.values(items.value), ...Object.values(subMenus.value)].some(({ active: active2 }) => active2));
  33403. const mode = vue.computed(() => rootMenu.props.mode);
  33404. const persistent = vue.computed(() => rootMenu.props.persistent);
  33405. const item = vue.reactive({
  33406. index: props.index,
  33407. indexPath,
  33408. active
  33409. });
  33410. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  33411. const subMenuPopperOffset = vue.computed(() => {
  33412. var _a;
  33413. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  33414. });
  33415. const subMenuPopperClass = vue.computed(() => {
  33416. var _a;
  33417. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  33418. });
  33419. const subMenuShowTimeout = vue.computed(() => {
  33420. var _a;
  33421. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  33422. });
  33423. const subMenuHideTimeout = vue.computed(() => {
  33424. var _a;
  33425. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  33426. });
  33427. const doDestroy = () => {
  33428. var _a, _b, _c;
  33429. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  33430. };
  33431. const handleCollapseToggle = (value) => {
  33432. if (!value) {
  33433. doDestroy();
  33434. }
  33435. };
  33436. const handleClick = () => {
  33437. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  33438. return;
  33439. rootMenu.handleSubMenuClick({
  33440. index: props.index,
  33441. indexPath: indexPath.value,
  33442. active: active.value
  33443. });
  33444. };
  33445. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  33446. var _a;
  33447. if (event.type === "focus")
  33448. return;
  33449. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  33450. subMenu.mouseInChild.value = true;
  33451. return;
  33452. }
  33453. subMenu.mouseInChild.value = true;
  33454. timeout == null ? void 0 : timeout();
  33455. ({ stop: timeout } = useTimeoutFn(() => {
  33456. rootMenu.openMenu(props.index, indexPath.value);
  33457. }, showTimeout));
  33458. if (appendToBody.value) {
  33459. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  33460. }
  33461. };
  33462. const handleMouseleave = (deepDispatch = false) => {
  33463. var _a;
  33464. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  33465. subMenu.mouseInChild.value = false;
  33466. return;
  33467. }
  33468. timeout == null ? void 0 : timeout();
  33469. subMenu.mouseInChild.value = false;
  33470. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  33471. if (appendToBody.value && deepDispatch) {
  33472. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  33473. }
  33474. };
  33475. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  33476. {
  33477. const addSubMenu = (item2) => {
  33478. subMenus.value[item2.index] = item2;
  33479. };
  33480. const removeSubMenu = (item2) => {
  33481. delete subMenus.value[item2.index];
  33482. };
  33483. vue.provide(`subMenu:${instance.uid}`, {
  33484. addSubMenu,
  33485. removeSubMenu,
  33486. handleMouseleave,
  33487. mouseInChild,
  33488. level: subMenu.level + 1
  33489. });
  33490. }
  33491. expose({
  33492. opened
  33493. });
  33494. vue.onMounted(() => {
  33495. rootMenu.addSubMenu(item);
  33496. subMenu.addSubMenu(item);
  33497. });
  33498. vue.onBeforeUnmount(() => {
  33499. subMenu.removeSubMenu(item);
  33500. rootMenu.removeSubMenu(item);
  33501. });
  33502. return () => {
  33503. var _a;
  33504. const titleTag = [
  33505. (_a = slots.title) == null ? void 0 : _a.call(slots),
  33506. vue.h(ElIcon, {
  33507. class: nsSubMenu.e("icon-arrow"),
  33508. style: {
  33509. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  33510. }
  33511. }, {
  33512. default: () => isString$1(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  33513. })
  33514. ];
  33515. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  33516. ref: vPopper,
  33517. visible: opened.value,
  33518. effect: "light",
  33519. pure: true,
  33520. offset: subMenuPopperOffset.value,
  33521. showArrow: false,
  33522. persistent: persistent.value,
  33523. popperClass: subMenuPopperClass.value,
  33524. placement: currentPlacement.value,
  33525. teleported: appendToBody.value,
  33526. fallbackPlacements: fallbackPlacements.value,
  33527. transition: menuTransitionName.value,
  33528. gpuAcceleration: false
  33529. }, {
  33530. content: () => {
  33531. var _a2;
  33532. return vue.h("div", {
  33533. class: [
  33534. nsMenu.m(mode.value),
  33535. nsMenu.m("popup-container"),
  33536. subMenuPopperClass.value
  33537. ],
  33538. onMouseenter: (evt) => handleMouseenter(evt, 100),
  33539. onMouseleave: () => handleMouseleave(true),
  33540. onFocus: (evt) => handleMouseenter(evt, 100)
  33541. }, [
  33542. vue.h("ul", {
  33543. class: [
  33544. nsMenu.b(),
  33545. nsMenu.m("popup"),
  33546. nsMenu.m(`popup-${currentPlacement.value}`)
  33547. ],
  33548. style: ulStyle.value
  33549. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  33550. ]);
  33551. },
  33552. default: () => vue.h("div", {
  33553. class: nsSubMenu.e("title"),
  33554. onClick: handleClick
  33555. }, titleTag)
  33556. }) : vue.h(vue.Fragment, {}, [
  33557. vue.h("div", {
  33558. class: nsSubMenu.e("title"),
  33559. ref: verticalTitleRef,
  33560. onClick: handleClick
  33561. }, titleTag),
  33562. vue.h(ElCollapseTransition, {}, {
  33563. default: () => {
  33564. var _a2;
  33565. return vue.withDirectives(vue.h("ul", {
  33566. role: "menu",
  33567. class: [nsMenu.b(), nsMenu.m("inline")],
  33568. style: ulStyle.value
  33569. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  33570. }
  33571. })
  33572. ]);
  33573. return vue.h("li", {
  33574. class: [
  33575. nsSubMenu.b(),
  33576. nsSubMenu.is("active", active.value),
  33577. nsSubMenu.is("opened", opened.value),
  33578. nsSubMenu.is("disabled", props.disabled)
  33579. ],
  33580. role: "menuitem",
  33581. ariaHaspopup: true,
  33582. ariaExpanded: opened.value,
  33583. onMouseenter: handleMouseenter,
  33584. onMouseleave: () => handleMouseleave(),
  33585. onFocus: handleMouseenter
  33586. }, [child]);
  33587. };
  33588. }
  33589. });
  33590. const menuProps = buildProps({
  33591. mode: {
  33592. type: String,
  33593. values: ["horizontal", "vertical"],
  33594. default: "vertical"
  33595. },
  33596. defaultActive: {
  33597. type: String,
  33598. default: ""
  33599. },
  33600. defaultOpeneds: {
  33601. type: definePropType(Array),
  33602. default: () => mutable([])
  33603. },
  33604. uniqueOpened: Boolean,
  33605. router: Boolean,
  33606. menuTrigger: {
  33607. type: String,
  33608. values: ["hover", "click"],
  33609. default: "hover"
  33610. },
  33611. collapse: Boolean,
  33612. backgroundColor: String,
  33613. textColor: String,
  33614. activeTextColor: String,
  33615. closeOnClickOutside: Boolean,
  33616. collapseTransition: {
  33617. type: Boolean,
  33618. default: true
  33619. },
  33620. ellipsis: {
  33621. type: Boolean,
  33622. default: true
  33623. },
  33624. popperOffset: {
  33625. type: Number,
  33626. default: 6
  33627. },
  33628. ellipsisIcon: {
  33629. type: iconPropType,
  33630. default: () => more_default
  33631. },
  33632. popperEffect: {
  33633. type: definePropType(String),
  33634. default: "dark"
  33635. },
  33636. popperClass: String,
  33637. showTimeout: {
  33638. type: Number,
  33639. default: 300
  33640. },
  33641. hideTimeout: {
  33642. type: Number,
  33643. default: 300
  33644. },
  33645. persistent: {
  33646. type: Boolean,
  33647. default: true
  33648. }
  33649. });
  33650. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString$1(path));
  33651. const menuEmits = {
  33652. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33653. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33654. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  33655. };
  33656. var Menu = vue.defineComponent({
  33657. name: "ElMenu",
  33658. props: menuProps,
  33659. emits: menuEmits,
  33660. setup(props, { emit, slots, expose }) {
  33661. const instance = vue.getCurrentInstance();
  33662. const router = instance.appContext.config.globalProperties.$router;
  33663. const menu = vue.ref();
  33664. const nsMenu = useNamespace("menu");
  33665. const nsSubMenu = useNamespace("sub-menu");
  33666. const sliceIndex = vue.ref(-1);
  33667. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  33668. const activeIndex = vue.ref(props.defaultActive);
  33669. const items = vue.ref({});
  33670. const subMenus = vue.ref({});
  33671. const isMenuPopup = vue.computed(() => props.mode === "horizontal" || props.mode === "vertical" && props.collapse);
  33672. const initMenu = () => {
  33673. const activeItem = activeIndex.value && items.value[activeIndex.value];
  33674. if (!activeItem || props.mode === "horizontal" || props.collapse)
  33675. return;
  33676. const indexPath = activeItem.indexPath;
  33677. indexPath.forEach((index) => {
  33678. const subMenu = subMenus.value[index];
  33679. subMenu && openMenu(index, subMenu.indexPath);
  33680. });
  33681. };
  33682. const openMenu = (index, indexPath) => {
  33683. if (openedMenus.value.includes(index))
  33684. return;
  33685. if (props.uniqueOpened) {
  33686. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  33687. }
  33688. openedMenus.value.push(index);
  33689. emit("open", index, indexPath);
  33690. };
  33691. const close = (index) => {
  33692. const i = openedMenus.value.indexOf(index);
  33693. if (i !== -1) {
  33694. openedMenus.value.splice(i, 1);
  33695. }
  33696. };
  33697. const closeMenu = (index, indexPath) => {
  33698. close(index);
  33699. emit("close", index, indexPath);
  33700. };
  33701. const handleSubMenuClick = ({
  33702. index,
  33703. indexPath
  33704. }) => {
  33705. const isOpened = openedMenus.value.includes(index);
  33706. isOpened ? closeMenu(index, indexPath) : openMenu(index, indexPath);
  33707. };
  33708. const handleMenuItemClick = (menuItem) => {
  33709. if (props.mode === "horizontal" || props.collapse) {
  33710. openedMenus.value = [];
  33711. }
  33712. const { index, indexPath } = menuItem;
  33713. if (isNil(index) || isNil(indexPath))
  33714. return;
  33715. if (props.router && router) {
  33716. const route = menuItem.route || index;
  33717. const routerResult = router.push(route).then((res) => {
  33718. if (!res)
  33719. activeIndex.value = index;
  33720. return res;
  33721. });
  33722. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  33723. } else {
  33724. activeIndex.value = index;
  33725. emit("select", index, indexPath, { index, indexPath });
  33726. }
  33727. };
  33728. const updateActiveIndex = (val) => {
  33729. var _a;
  33730. const itemsInData = items.value;
  33731. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  33732. activeIndex.value = (_a = item == null ? void 0 : item.index) != null ? _a : val;
  33733. };
  33734. const calcMenuItemWidth = (menuItem) => {
  33735. const computedStyle = getComputedStyle(menuItem);
  33736. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  33737. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  33738. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  33739. };
  33740. const calcSliceIndex = () => {
  33741. var _a, _b;
  33742. if (!menu.value)
  33743. return -1;
  33744. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#text" || item.nodeValue);
  33745. const moreItemWidth = 64;
  33746. const computedMenuStyle = getComputedStyle(menu.value);
  33747. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  33748. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  33749. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  33750. let calcWidth = 0;
  33751. let sliceIndex2 = 0;
  33752. items2.forEach((item, index) => {
  33753. if (item.nodeName === "#comment")
  33754. return;
  33755. calcWidth += calcMenuItemWidth(item);
  33756. if (calcWidth <= menuWidth - moreItemWidth) {
  33757. sliceIndex2 = index + 1;
  33758. }
  33759. });
  33760. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  33761. };
  33762. const getIndexPath = (index) => subMenus.value[index].indexPath;
  33763. const debounce = (fn, wait = 33.34) => {
  33764. let timmer;
  33765. return () => {
  33766. timmer && clearTimeout(timmer);
  33767. timmer = setTimeout(() => {
  33768. fn();
  33769. }, wait);
  33770. };
  33771. };
  33772. let isFirstTimeRender = true;
  33773. const handleResize = () => {
  33774. if (sliceIndex.value === calcSliceIndex())
  33775. return;
  33776. const callback = () => {
  33777. sliceIndex.value = -1;
  33778. vue.nextTick(() => {
  33779. sliceIndex.value = calcSliceIndex();
  33780. });
  33781. };
  33782. isFirstTimeRender ? callback() : debounce(callback)();
  33783. isFirstTimeRender = false;
  33784. };
  33785. vue.watch(() => props.defaultActive, (currentActive) => {
  33786. if (!items.value[currentActive]) {
  33787. activeIndex.value = "";
  33788. }
  33789. updateActiveIndex(currentActive);
  33790. });
  33791. vue.watch(() => props.collapse, (value) => {
  33792. if (value)
  33793. openedMenus.value = [];
  33794. });
  33795. vue.watch(items.value, initMenu);
  33796. let resizeStopper;
  33797. vue.watchEffect(() => {
  33798. if (props.mode === "horizontal" && props.ellipsis)
  33799. resizeStopper = useResizeObserver(menu, handleResize).stop;
  33800. else
  33801. resizeStopper == null ? void 0 : resizeStopper();
  33802. });
  33803. const mouseInChild = vue.ref(false);
  33804. {
  33805. const addSubMenu = (item) => {
  33806. subMenus.value[item.index] = item;
  33807. };
  33808. const removeSubMenu = (item) => {
  33809. delete subMenus.value[item.index];
  33810. };
  33811. const addMenuItem = (item) => {
  33812. items.value[item.index] = item;
  33813. };
  33814. const removeMenuItem = (item) => {
  33815. delete items.value[item.index];
  33816. };
  33817. vue.provide("rootMenu", vue.reactive({
  33818. props,
  33819. openedMenus,
  33820. items,
  33821. subMenus,
  33822. activeIndex,
  33823. isMenuPopup,
  33824. addMenuItem,
  33825. removeMenuItem,
  33826. addSubMenu,
  33827. removeSubMenu,
  33828. openMenu,
  33829. closeMenu,
  33830. handleMenuItemClick,
  33831. handleSubMenuClick
  33832. }));
  33833. vue.provide(`subMenu:${instance.uid}`, {
  33834. addSubMenu,
  33835. removeSubMenu,
  33836. mouseInChild,
  33837. level: 0
  33838. });
  33839. }
  33840. vue.onMounted(() => {
  33841. if (props.mode === "horizontal") {
  33842. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  33843. }
  33844. });
  33845. {
  33846. const open = (index) => {
  33847. const { indexPath } = subMenus.value[index];
  33848. indexPath.forEach((i) => openMenu(i, indexPath));
  33849. };
  33850. expose({
  33851. open,
  33852. close,
  33853. updateActiveIndex,
  33854. handleResize
  33855. });
  33856. }
  33857. const ulStyle = useMenuCssVar(props, 0);
  33858. return () => {
  33859. var _a, _b;
  33860. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  33861. const vShowMore = [];
  33862. if (props.mode === "horizontal" && menu.value) {
  33863. const originalSlot = flattedChildren(slot);
  33864. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  33865. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  33866. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  33867. slot = slotDefault;
  33868. vShowMore.push(vue.h(SubMenu, {
  33869. index: "sub-menu-more",
  33870. class: nsSubMenu.e("hide-arrow"),
  33871. popperOffset: props.popperOffset
  33872. }, {
  33873. title: () => vue.h(ElIcon, {
  33874. class: nsSubMenu.e("icon-more")
  33875. }, {
  33876. default: () => vue.h(props.ellipsisIcon)
  33877. }),
  33878. default: () => slotMore
  33879. }));
  33880. }
  33881. }
  33882. const directives = props.closeOnClickOutside ? [
  33883. [
  33884. ClickOutside,
  33885. () => {
  33886. if (!openedMenus.value.length)
  33887. return;
  33888. if (!mouseInChild.value) {
  33889. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  33890. openedMenus.value = [];
  33891. }
  33892. }
  33893. ]
  33894. ] : [];
  33895. const vMenu = vue.withDirectives(vue.h("ul", {
  33896. key: String(props.collapse),
  33897. role: "menubar",
  33898. ref: menu,
  33899. style: ulStyle.value,
  33900. class: {
  33901. [nsMenu.b()]: true,
  33902. [nsMenu.m(props.mode)]: true,
  33903. [nsMenu.m("collapse")]: props.collapse
  33904. }
  33905. }, [...slot, ...vShowMore]), directives);
  33906. if (props.collapseTransition && props.mode === "vertical") {
  33907. return vue.h(ElMenuCollapseTransition, () => vMenu);
  33908. }
  33909. return vMenu;
  33910. };
  33911. }
  33912. });
  33913. const menuItemProps = buildProps({
  33914. index: {
  33915. type: definePropType([String, null]),
  33916. default: null
  33917. },
  33918. route: {
  33919. type: definePropType([String, Object])
  33920. },
  33921. disabled: Boolean
  33922. });
  33923. const menuItemEmits = {
  33924. click: (item) => isString$1(item.index) && isArray$1(item.indexPath)
  33925. };
  33926. const COMPONENT_NAME$b = "ElMenuItem";
  33927. const __default__$S = vue.defineComponent({
  33928. name: COMPONENT_NAME$b
  33929. });
  33930. const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
  33931. ...__default__$S,
  33932. props: menuItemProps,
  33933. emits: menuItemEmits,
  33934. setup(__props, { expose, emit }) {
  33935. const props = __props;
  33936. const instance = vue.getCurrentInstance();
  33937. const rootMenu = vue.inject("rootMenu");
  33938. const nsMenu = useNamespace("menu");
  33939. const nsMenuItem = useNamespace("menu-item");
  33940. if (!rootMenu)
  33941. throwError(COMPONENT_NAME$b, "can not inject root menu");
  33942. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  33943. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  33944. if (!subMenu)
  33945. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  33946. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  33947. const item = vue.reactive({
  33948. index: props.index,
  33949. indexPath,
  33950. active
  33951. });
  33952. const handleClick = () => {
  33953. if (!props.disabled) {
  33954. rootMenu.handleMenuItemClick({
  33955. index: props.index,
  33956. indexPath: indexPath.value,
  33957. route: props.route
  33958. });
  33959. emit("click", item);
  33960. }
  33961. };
  33962. vue.onMounted(() => {
  33963. subMenu.addSubMenu(item);
  33964. rootMenu.addMenuItem(item);
  33965. });
  33966. vue.onBeforeUnmount(() => {
  33967. subMenu.removeSubMenu(item);
  33968. rootMenu.removeMenuItem(item);
  33969. });
  33970. expose({
  33971. parentMenu,
  33972. rootMenu,
  33973. active,
  33974. nsMenu,
  33975. nsMenuItem,
  33976. handleClick
  33977. });
  33978. return (_ctx, _cache) => {
  33979. return vue.openBlock(), vue.createElementBlock("li", {
  33980. class: vue.normalizeClass([
  33981. vue.unref(nsMenuItem).b(),
  33982. vue.unref(nsMenuItem).is("active", vue.unref(active)),
  33983. vue.unref(nsMenuItem).is("disabled", _ctx.disabled)
  33984. ]),
  33985. role: "menuitem",
  33986. tabindex: "-1",
  33987. onClick: handleClick
  33988. }, [
  33989. vue.unref(parentMenu).type.name === "ElMenu" && vue.unref(rootMenu).props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  33990. key: 0,
  33991. effect: vue.unref(rootMenu).props.popperEffect,
  33992. placement: "right",
  33993. "fallback-placements": ["left"],
  33994. persistent: vue.unref(rootMenu).props.persistent
  33995. }, {
  33996. content: vue.withCtx(() => [
  33997. vue.renderSlot(_ctx.$slots, "title")
  33998. ]),
  33999. default: vue.withCtx(() => [
  34000. vue.createElementVNode("div", {
  34001. class: vue.normalizeClass(vue.unref(nsMenu).be("tooltip", "trigger"))
  34002. }, [
  34003. vue.renderSlot(_ctx.$slots, "default")
  34004. ], 2)
  34005. ]),
  34006. _: 3
  34007. }, 8, ["effect", "persistent"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  34008. vue.renderSlot(_ctx.$slots, "default"),
  34009. vue.renderSlot(_ctx.$slots, "title")
  34010. ], 64))
  34011. ], 2);
  34012. };
  34013. }
  34014. });
  34015. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__file", "menu-item.vue"]]);
  34016. const menuItemGroupProps = {
  34017. title: String
  34018. };
  34019. const __default__$R = vue.defineComponent({
  34020. name: "ElMenuItemGroup"
  34021. });
  34022. const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
  34023. ...__default__$R,
  34024. props: menuItemGroupProps,
  34025. setup(__props) {
  34026. const ns = useNamespace("menu-item-group");
  34027. return (_ctx, _cache) => {
  34028. return vue.openBlock(), vue.createElementBlock("li", {
  34029. class: vue.normalizeClass(vue.unref(ns).b())
  34030. }, [
  34031. vue.createElementVNode("div", {
  34032. class: vue.normalizeClass(vue.unref(ns).e("title"))
  34033. }, [
  34034. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  34035. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  34036. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  34037. ], 2),
  34038. vue.createElementVNode("ul", null, [
  34039. vue.renderSlot(_ctx.$slots, "default")
  34040. ])
  34041. ], 2);
  34042. };
  34043. }
  34044. });
  34045. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__file", "menu-item-group.vue"]]);
  34046. const ElMenu = withInstall(Menu, {
  34047. MenuItem,
  34048. MenuItemGroup,
  34049. SubMenu
  34050. });
  34051. const ElMenuItem = withNoopInstall(MenuItem);
  34052. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  34053. const ElSubMenu = withNoopInstall(SubMenu);
  34054. const pageHeaderProps = buildProps({
  34055. icon: {
  34056. type: iconPropType,
  34057. default: () => back_default
  34058. },
  34059. title: String,
  34060. content: {
  34061. type: String,
  34062. default: ""
  34063. }
  34064. });
  34065. const pageHeaderEmits = {
  34066. back: () => true
  34067. };
  34068. const __default__$Q = vue.defineComponent({
  34069. name: "ElPageHeader"
  34070. });
  34071. const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
  34072. ...__default__$Q,
  34073. props: pageHeaderProps,
  34074. emits: pageHeaderEmits,
  34075. setup(__props, { emit }) {
  34076. const { t } = useLocale();
  34077. const ns = useNamespace("page-header");
  34078. function handleClick() {
  34079. emit("back");
  34080. }
  34081. return (_ctx, _cache) => {
  34082. return vue.openBlock(), vue.createElementBlock("div", {
  34083. class: vue.normalizeClass([
  34084. vue.unref(ns).b(),
  34085. {
  34086. [vue.unref(ns).m("has-breadcrumb")]: !!_ctx.$slots.breadcrumb,
  34087. [vue.unref(ns).m("has-extra")]: !!_ctx.$slots.extra,
  34088. [vue.unref(ns).is("contentful")]: !!_ctx.$slots.default
  34089. }
  34090. ])
  34091. }, [
  34092. _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", {
  34093. key: 0,
  34094. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  34095. }, [
  34096. vue.renderSlot(_ctx.$slots, "breadcrumb")
  34097. ], 2)) : vue.createCommentVNode("v-if", true),
  34098. vue.createElementVNode("div", {
  34099. class: vue.normalizeClass(vue.unref(ns).e("header"))
  34100. }, [
  34101. vue.createElementVNode("div", {
  34102. class: vue.normalizeClass(vue.unref(ns).e("left"))
  34103. }, [
  34104. vue.createElementVNode("div", {
  34105. class: vue.normalizeClass(vue.unref(ns).e("back")),
  34106. role: "button",
  34107. tabindex: "0",
  34108. onClick: handleClick
  34109. }, [
  34110. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  34111. key: 0,
  34112. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  34113. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  34114. }, [
  34115. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  34116. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  34117. default: vue.withCtx(() => [
  34118. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  34119. ]),
  34120. _: 1
  34121. })) : vue.createCommentVNode("v-if", true)
  34122. ])
  34123. ], 10, ["aria-label"])) : vue.createCommentVNode("v-if", true),
  34124. vue.createElementVNode("div", {
  34125. class: vue.normalizeClass(vue.unref(ns).e("title"))
  34126. }, [
  34127. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  34128. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  34129. ])
  34130. ], 2)
  34131. ], 2),
  34132. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  34133. vue.createElementVNode("div", {
  34134. class: vue.normalizeClass(vue.unref(ns).e("content"))
  34135. }, [
  34136. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  34137. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  34138. ])
  34139. ], 2)
  34140. ], 2),
  34141. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  34142. key: 0,
  34143. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  34144. }, [
  34145. vue.renderSlot(_ctx.$slots, "extra")
  34146. ], 2)) : vue.createCommentVNode("v-if", true)
  34147. ], 2),
  34148. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  34149. key: 1,
  34150. class: vue.normalizeClass(vue.unref(ns).e("main"))
  34151. }, [
  34152. vue.renderSlot(_ctx.$slots, "default")
  34153. ], 2)) : vue.createCommentVNode("v-if", true)
  34154. ], 2);
  34155. };
  34156. }
  34157. });
  34158. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__file", "page-header.vue"]]);
  34159. const ElPageHeader = withInstall(PageHeader);
  34160. const elPaginationKey = Symbol("elPaginationKey");
  34161. const paginationPrevProps = buildProps({
  34162. disabled: Boolean,
  34163. currentPage: {
  34164. type: Number,
  34165. default: 1
  34166. },
  34167. prevText: {
  34168. type: String
  34169. },
  34170. prevIcon: {
  34171. type: iconPropType
  34172. }
  34173. });
  34174. const paginationPrevEmits = {
  34175. click: (evt) => evt instanceof MouseEvent
  34176. };
  34177. const __default__$P = vue.defineComponent({
  34178. name: "ElPaginationPrev"
  34179. });
  34180. const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
  34181. ...__default__$P,
  34182. props: paginationPrevProps,
  34183. emits: paginationPrevEmits,
  34184. setup(__props) {
  34185. const props = __props;
  34186. const { t } = useLocale();
  34187. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  34188. return (_ctx, _cache) => {
  34189. return vue.openBlock(), vue.createElementBlock("button", {
  34190. type: "button",
  34191. class: "btn-prev",
  34192. disabled: vue.unref(internalDisabled),
  34193. "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
  34194. "aria-disabled": vue.unref(internalDisabled),
  34195. onClick: ($event) => _ctx.$emit("click", $event)
  34196. }, [
  34197. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  34198. default: vue.withCtx(() => [
  34199. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  34200. ]),
  34201. _: 1
  34202. }))
  34203. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34204. };
  34205. }
  34206. });
  34207. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__file", "prev.vue"]]);
  34208. const paginationNextProps = buildProps({
  34209. disabled: Boolean,
  34210. currentPage: {
  34211. type: Number,
  34212. default: 1
  34213. },
  34214. pageCount: {
  34215. type: Number,
  34216. default: 50
  34217. },
  34218. nextText: {
  34219. type: String
  34220. },
  34221. nextIcon: {
  34222. type: iconPropType
  34223. }
  34224. });
  34225. const __default__$O = vue.defineComponent({
  34226. name: "ElPaginationNext"
  34227. });
  34228. const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
  34229. ...__default__$O,
  34230. props: paginationNextProps,
  34231. emits: ["click"],
  34232. setup(__props) {
  34233. const props = __props;
  34234. const { t } = useLocale();
  34235. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  34236. return (_ctx, _cache) => {
  34237. return vue.openBlock(), vue.createElementBlock("button", {
  34238. type: "button",
  34239. class: "btn-next",
  34240. disabled: vue.unref(internalDisabled),
  34241. "aria-label": _ctx.nextText || vue.unref(t)("el.pagination.next"),
  34242. "aria-disabled": vue.unref(internalDisabled),
  34243. onClick: ($event) => _ctx.$emit("click", $event)
  34244. }, [
  34245. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  34246. default: vue.withCtx(() => [
  34247. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  34248. ]),
  34249. _: 1
  34250. }))
  34251. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34252. };
  34253. }
  34254. });
  34255. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "next.vue"]]);
  34256. const selectGroupKey = Symbol("ElSelectGroup");
  34257. const selectKey = Symbol("ElSelect");
  34258. const COMPONENT_NAME$a = "ElOption";
  34259. const optionProps = buildProps({
  34260. value: {
  34261. type: [String, Number, Boolean, Object],
  34262. required: true
  34263. },
  34264. label: {
  34265. type: [String, Number]
  34266. },
  34267. created: Boolean,
  34268. disabled: Boolean
  34269. });
  34270. function useOption$1(props, states) {
  34271. const select = vue.inject(selectKey);
  34272. if (!select) {
  34273. throwError(COMPONENT_NAME$a, "usage: <el-select><el-option /></el-select/>");
  34274. }
  34275. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  34276. const itemSelected = vue.computed(() => {
  34277. return contains(castArray$1(select.props.modelValue), props.value);
  34278. });
  34279. const limitReached = vue.computed(() => {
  34280. var _a;
  34281. if (select.props.multiple) {
  34282. const modelValue = castArray$1((_a = select.props.modelValue) != null ? _a : []);
  34283. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  34284. } else {
  34285. return false;
  34286. }
  34287. });
  34288. const currentLabel = vue.computed(() => {
  34289. return props.label || (isObject$1(props.value) ? "" : props.value);
  34290. });
  34291. const currentValue = vue.computed(() => {
  34292. return props.value || props.label || "";
  34293. });
  34294. const isDisabled = vue.computed(() => {
  34295. return props.disabled || states.groupDisabled || limitReached.value;
  34296. });
  34297. const instance = vue.getCurrentInstance();
  34298. const contains = (arr = [], target) => {
  34299. if (!isObject$1(props.value)) {
  34300. return arr && arr.includes(target);
  34301. } else {
  34302. const valueKey = select.props.valueKey;
  34303. return arr && arr.some((item) => {
  34304. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  34305. });
  34306. }
  34307. };
  34308. const hoverItem = () => {
  34309. if (!props.disabled && !selectGroup.disabled) {
  34310. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  34311. }
  34312. };
  34313. const updateOption = (query) => {
  34314. const regexp = new RegExp(escapeStringRegexp(query), "i");
  34315. states.visible = regexp.test(String(currentLabel.value)) || props.created;
  34316. };
  34317. vue.watch(() => currentLabel.value, () => {
  34318. if (!props.created && !select.props.remote)
  34319. select.setSelected();
  34320. });
  34321. vue.watch(() => props.value, (val, oldVal) => {
  34322. const { remote, valueKey } = select.props;
  34323. const shouldUpdate = remote ? val !== oldVal : !isEqual$1(val, oldVal);
  34324. if (shouldUpdate) {
  34325. select.onOptionDestroy(oldVal, instance.proxy);
  34326. select.onOptionCreate(instance.proxy);
  34327. }
  34328. if (!props.created && !remote) {
  34329. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  34330. return;
  34331. }
  34332. select.setSelected();
  34333. }
  34334. });
  34335. vue.watch(() => selectGroup.disabled, () => {
  34336. states.groupDisabled = selectGroup.disabled;
  34337. }, { immediate: true });
  34338. return {
  34339. select,
  34340. currentLabel,
  34341. currentValue,
  34342. itemSelected,
  34343. isDisabled,
  34344. hoverItem,
  34345. updateOption
  34346. };
  34347. }
  34348. const _sfc_main$$ = vue.defineComponent({
  34349. name: COMPONENT_NAME$a,
  34350. componentName: COMPONENT_NAME$a,
  34351. props: optionProps,
  34352. setup(props) {
  34353. const ns = useNamespace("select");
  34354. const id = useId();
  34355. const containerKls = vue.computed(() => [
  34356. ns.be("dropdown", "item"),
  34357. ns.is("disabled", vue.unref(isDisabled)),
  34358. ns.is("selected", vue.unref(itemSelected)),
  34359. ns.is("hovering", vue.unref(hover))
  34360. ]);
  34361. const states = vue.reactive({
  34362. index: -1,
  34363. groupDisabled: false,
  34364. visible: true,
  34365. hover: false
  34366. });
  34367. const {
  34368. currentLabel,
  34369. itemSelected,
  34370. isDisabled,
  34371. select,
  34372. hoverItem,
  34373. updateOption
  34374. } = useOption$1(props, states);
  34375. const { visible, hover } = vue.toRefs(states);
  34376. const vm = vue.getCurrentInstance().proxy;
  34377. select.onOptionCreate(vm);
  34378. vue.onBeforeUnmount(() => {
  34379. const key = vm.value;
  34380. const { selected: selectedOptions } = select.states;
  34381. const doesSelected = selectedOptions.some((item) => {
  34382. return item.value === vm.value;
  34383. });
  34384. vue.nextTick(() => {
  34385. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  34386. select.states.cachedOptions.delete(key);
  34387. }
  34388. });
  34389. select.onOptionDestroy(key, vm);
  34390. });
  34391. function selectOptionClick() {
  34392. if (!isDisabled.value) {
  34393. select.handleOptionSelect(vm);
  34394. }
  34395. }
  34396. return {
  34397. ns,
  34398. id,
  34399. containerKls,
  34400. currentLabel,
  34401. itemSelected,
  34402. isDisabled,
  34403. select,
  34404. visible,
  34405. hover,
  34406. states,
  34407. hoverItem,
  34408. updateOption,
  34409. selectOptionClick
  34410. };
  34411. }
  34412. });
  34413. function _sfc_render$b(_ctx, _cache) {
  34414. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  34415. id: _ctx.id,
  34416. class: vue.normalizeClass(_ctx.containerKls),
  34417. role: "option",
  34418. "aria-disabled": _ctx.isDisabled || void 0,
  34419. "aria-selected": _ctx.itemSelected,
  34420. onMousemove: _ctx.hoverItem,
  34421. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  34422. }, [
  34423. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  34424. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  34425. ])
  34426. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
  34427. [vue.vShow, _ctx.visible]
  34428. ]);
  34429. }
  34430. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  34431. const _sfc_main$_ = vue.defineComponent({
  34432. name: "ElSelectDropdown",
  34433. componentName: "ElSelectDropdown",
  34434. setup() {
  34435. const select = vue.inject(selectKey);
  34436. const ns = useNamespace("select");
  34437. const popperClass = vue.computed(() => select.props.popperClass);
  34438. const isMultiple = vue.computed(() => select.props.multiple);
  34439. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  34440. const minWidth = vue.ref("");
  34441. function updateMinWidth() {
  34442. var _a;
  34443. minWidth.value = `${(_a = select.selectRef) == null ? void 0 : _a.offsetWidth}px`;
  34444. }
  34445. vue.onMounted(() => {
  34446. updateMinWidth();
  34447. useResizeObserver(select.selectRef, updateMinWidth);
  34448. });
  34449. return {
  34450. ns,
  34451. minWidth,
  34452. popperClass,
  34453. isMultiple,
  34454. isFitInputWidth
  34455. };
  34456. }
  34457. });
  34458. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  34459. return vue.openBlock(), vue.createElementBlock("div", {
  34460. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  34461. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  34462. }, [
  34463. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  34464. key: 0,
  34465. class: vue.normalizeClass(_ctx.ns.be("dropdown", "header"))
  34466. }, [
  34467. vue.renderSlot(_ctx.$slots, "header")
  34468. ], 2)) : vue.createCommentVNode("v-if", true),
  34469. vue.renderSlot(_ctx.$slots, "default"),
  34470. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  34471. key: 1,
  34472. class: vue.normalizeClass(_ctx.ns.be("dropdown", "footer"))
  34473. }, [
  34474. vue.renderSlot(_ctx.$slots, "footer")
  34475. ], 2)) : vue.createCommentVNode("v-if", true)
  34476. ], 6);
  34477. }
  34478. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  34479. const useSelect$3 = (props, emit) => {
  34480. const { t } = useLocale();
  34481. const contentId = useId();
  34482. const nsSelect = useNamespace("select");
  34483. const nsInput = useNamespace("input");
  34484. const states = vue.reactive({
  34485. inputValue: "",
  34486. options: /* @__PURE__ */ new Map(),
  34487. cachedOptions: /* @__PURE__ */ new Map(),
  34488. optionValues: [],
  34489. selected: [],
  34490. selectionWidth: 0,
  34491. collapseItemWidth: 0,
  34492. selectedLabel: "",
  34493. hoveringIndex: -1,
  34494. previousQuery: null,
  34495. inputHovering: false,
  34496. menuVisibleOnFocus: false,
  34497. isBeforeHide: false
  34498. });
  34499. const selectRef = vue.ref();
  34500. const selectionRef = vue.ref();
  34501. const tooltipRef = vue.ref();
  34502. const tagTooltipRef = vue.ref();
  34503. const inputRef = vue.ref();
  34504. const prefixRef = vue.ref();
  34505. const suffixRef = vue.ref();
  34506. const menuRef = vue.ref();
  34507. const tagMenuRef = vue.ref();
  34508. const collapseItemRef = vue.ref();
  34509. const scrollbarRef = vue.ref();
  34510. const {
  34511. isComposing,
  34512. handleCompositionStart,
  34513. handleCompositionUpdate,
  34514. handleCompositionEnd
  34515. } = useComposition({
  34516. afterComposition: (e) => onInput(e)
  34517. });
  34518. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  34519. beforeFocus() {
  34520. return selectDisabled.value;
  34521. },
  34522. afterFocus() {
  34523. if (props.automaticDropdown && !expanded.value) {
  34524. expanded.value = true;
  34525. states.menuVisibleOnFocus = true;
  34526. }
  34527. },
  34528. beforeBlur(event) {
  34529. var _a, _b;
  34530. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  34531. },
  34532. afterBlur() {
  34533. var _a;
  34534. expanded.value = false;
  34535. states.menuVisibleOnFocus = false;
  34536. if (props.validateEvent) {
  34537. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  34538. }
  34539. }
  34540. });
  34541. const expanded = vue.ref(false);
  34542. const hoverOption = vue.ref();
  34543. const { form, formItem } = useFormItem();
  34544. const { inputId } = useFormItemInputId(props, {
  34545. formItemContext: formItem
  34546. });
  34547. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  34548. const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  34549. const hasModelValue = vue.computed(() => {
  34550. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  34551. });
  34552. const needStatusIcon = vue.computed(() => {
  34553. var _a;
  34554. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  34555. });
  34556. const showClose = vue.computed(() => {
  34557. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  34558. });
  34559. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  34560. const iconReverse = vue.computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
  34561. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  34562. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  34563. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  34564. const isRemoteSearchEmpty = vue.computed(() => props.remote && !states.inputValue && states.options.size === 0);
  34565. const emptyText = vue.computed(() => {
  34566. if (props.loading) {
  34567. return props.loadingText || t("el.select.loading");
  34568. } else {
  34569. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  34570. return props.noMatchText || t("el.select.noMatch");
  34571. }
  34572. if (states.options.size === 0) {
  34573. return props.noDataText || t("el.select.noData");
  34574. }
  34575. }
  34576. return null;
  34577. });
  34578. const filteredOptionsCount = vue.computed(() => optionsArray.value.filter((option) => option.visible).length);
  34579. const optionsArray = vue.computed(() => {
  34580. const list = Array.from(states.options.values());
  34581. const newList = [];
  34582. states.optionValues.forEach((item) => {
  34583. const index = list.findIndex((i) => i.value === item);
  34584. if (index > -1) {
  34585. newList.push(list[index]);
  34586. }
  34587. });
  34588. return newList.length >= list.length ? newList : list;
  34589. });
  34590. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  34591. const showNewOption = vue.computed(() => {
  34592. const hasExistingOption = optionsArray.value.filter((option) => {
  34593. return !option.created;
  34594. }).some((option) => {
  34595. return option.currentLabel === states.inputValue;
  34596. });
  34597. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  34598. });
  34599. const updateOptions = () => {
  34600. if (props.filterable && isFunction$1(props.filterMethod))
  34601. return;
  34602. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  34603. return;
  34604. optionsArray.value.forEach((option) => {
  34605. var _a;
  34606. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  34607. });
  34608. };
  34609. const selectSize = useFormSize();
  34610. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  34611. const dropdownMenuVisible = vue.computed({
  34612. get() {
  34613. return expanded.value && !isRemoteSearchEmpty.value;
  34614. },
  34615. set(val) {
  34616. expanded.value = val;
  34617. }
  34618. });
  34619. const shouldShowPlaceholder = vue.computed(() => {
  34620. if (props.multiple && !isUndefined(props.modelValue)) {
  34621. return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  34622. }
  34623. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34624. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  34625. });
  34626. const currentPlaceholder = vue.computed(() => {
  34627. var _a;
  34628. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  34629. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  34630. });
  34631. const mouseEnterEventName = vue.computed(() => isIOS ? null : "mouseenter");
  34632. vue.watch(() => props.modelValue, (val, oldVal) => {
  34633. if (props.multiple) {
  34634. if (props.filterable && !props.reserveKeyword) {
  34635. states.inputValue = "";
  34636. handleQueryChange("");
  34637. }
  34638. }
  34639. setSelected();
  34640. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  34641. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  34642. }
  34643. }, {
  34644. flush: "post",
  34645. deep: true
  34646. });
  34647. vue.watch(() => expanded.value, (val) => {
  34648. if (val) {
  34649. handleQueryChange(states.inputValue);
  34650. } else {
  34651. states.inputValue = "";
  34652. states.previousQuery = null;
  34653. states.isBeforeHide = true;
  34654. }
  34655. emit("visible-change", val);
  34656. });
  34657. vue.watch(() => states.options.entries(), () => {
  34658. if (!isClient)
  34659. return;
  34660. setSelected();
  34661. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34662. checkDefaultFirstOption();
  34663. }
  34664. }, {
  34665. flush: "post"
  34666. });
  34667. vue.watch([() => states.hoveringIndex, optionsArray], ([val]) => {
  34668. if (isNumber(val) && val > -1) {
  34669. hoverOption.value = optionsArray.value[val] || {};
  34670. } else {
  34671. hoverOption.value = {};
  34672. }
  34673. optionsArray.value.forEach((option) => {
  34674. option.hover = hoverOption.value === option;
  34675. });
  34676. });
  34677. vue.watchEffect(() => {
  34678. if (states.isBeforeHide)
  34679. return;
  34680. updateOptions();
  34681. });
  34682. const handleQueryChange = (val) => {
  34683. if (states.previousQuery === val || isComposing.value) {
  34684. return;
  34685. }
  34686. states.previousQuery = val;
  34687. if (props.filterable && isFunction$1(props.filterMethod)) {
  34688. props.filterMethod(val);
  34689. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  34690. props.remoteMethod(val);
  34691. }
  34692. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34693. vue.nextTick(checkDefaultFirstOption);
  34694. } else {
  34695. vue.nextTick(updateHoveringIndex);
  34696. }
  34697. };
  34698. const checkDefaultFirstOption = () => {
  34699. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  34700. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  34701. const firstOriginOption = optionsInDropdown[0];
  34702. const valueList = optionsArray.value.map((item) => item.value);
  34703. states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
  34704. };
  34705. const setSelected = () => {
  34706. if (!props.multiple) {
  34707. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34708. const option = getOption(value);
  34709. states.selectedLabel = option.currentLabel;
  34710. states.selected = [option];
  34711. return;
  34712. } else {
  34713. states.selectedLabel = "";
  34714. }
  34715. const result = [];
  34716. if (!isUndefined(props.modelValue)) {
  34717. castArray$1(props.modelValue).forEach((value) => {
  34718. result.push(getOption(value));
  34719. });
  34720. }
  34721. states.selected = result;
  34722. };
  34723. const getOption = (value) => {
  34724. let option;
  34725. const isObjectValue = isPlainObject$1(value);
  34726. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  34727. const cachedOption = cachedOptionsArray.value[i];
  34728. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  34729. if (isEqualValue) {
  34730. option = {
  34731. value,
  34732. currentLabel: cachedOption.currentLabel,
  34733. get isDisabled() {
  34734. return cachedOption.isDisabled;
  34735. }
  34736. };
  34737. break;
  34738. }
  34739. }
  34740. if (option)
  34741. return option;
  34742. const label = isObjectValue ? value.label : value != null ? value : "";
  34743. const newOption = {
  34744. value,
  34745. currentLabel: label
  34746. };
  34747. return newOption;
  34748. };
  34749. const updateHoveringIndex = () => {
  34750. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  34751. };
  34752. const resetSelectionWidth = () => {
  34753. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  34754. };
  34755. const resetCollapseItemWidth = () => {
  34756. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  34757. };
  34758. const updateTooltip = () => {
  34759. var _a, _b;
  34760. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34761. };
  34762. const updateTagTooltip = () => {
  34763. var _a, _b;
  34764. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34765. };
  34766. const onInputChange = () => {
  34767. if (states.inputValue.length > 0 && !expanded.value) {
  34768. expanded.value = true;
  34769. }
  34770. handleQueryChange(states.inputValue);
  34771. };
  34772. const onInput = (event) => {
  34773. states.inputValue = event.target.value;
  34774. if (props.remote) {
  34775. debouncedOnInputChange();
  34776. } else {
  34777. return onInputChange();
  34778. }
  34779. };
  34780. const debouncedOnInputChange = debounce(() => {
  34781. onInputChange();
  34782. }, debounce$1.value);
  34783. const emitChange = (val) => {
  34784. if (!isEqual$1(props.modelValue, val)) {
  34785. emit(CHANGE_EVENT, val);
  34786. }
  34787. };
  34788. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  34789. const option = states.cachedOptions.get(it);
  34790. return option && !option.disabled && !option.states.groupDisabled;
  34791. });
  34792. const deletePrevTag = (e) => {
  34793. if (!props.multiple)
  34794. return;
  34795. if (e.code === EVENT_CODE.delete)
  34796. return;
  34797. if (e.target.value.length <= 0) {
  34798. const value = castArray$1(props.modelValue).slice();
  34799. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  34800. if (lastNotDisabledIndex < 0)
  34801. return;
  34802. const removeTagValue = value[lastNotDisabledIndex];
  34803. value.splice(lastNotDisabledIndex, 1);
  34804. emit(UPDATE_MODEL_EVENT, value);
  34805. emitChange(value);
  34806. emit("remove-tag", removeTagValue);
  34807. }
  34808. };
  34809. const deleteTag = (event, tag) => {
  34810. const index = states.selected.indexOf(tag);
  34811. if (index > -1 && !selectDisabled.value) {
  34812. const value = castArray$1(props.modelValue).slice();
  34813. value.splice(index, 1);
  34814. emit(UPDATE_MODEL_EVENT, value);
  34815. emitChange(value);
  34816. emit("remove-tag", tag.value);
  34817. }
  34818. event.stopPropagation();
  34819. focus();
  34820. };
  34821. const deleteSelected = (event) => {
  34822. event.stopPropagation();
  34823. const value = props.multiple ? [] : valueOnClear.value;
  34824. if (props.multiple) {
  34825. for (const item of states.selected) {
  34826. if (item.isDisabled)
  34827. value.push(item.value);
  34828. }
  34829. }
  34830. emit(UPDATE_MODEL_EVENT, value);
  34831. emitChange(value);
  34832. states.hoveringIndex = -1;
  34833. expanded.value = false;
  34834. emit("clear");
  34835. focus();
  34836. };
  34837. const handleOptionSelect = (option) => {
  34838. var _a;
  34839. if (props.multiple) {
  34840. const value = castArray$1((_a = props.modelValue) != null ? _a : []).slice();
  34841. const optionIndex = getValueIndex(value, option);
  34842. if (optionIndex > -1) {
  34843. value.splice(optionIndex, 1);
  34844. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  34845. value.push(option.value);
  34846. }
  34847. emit(UPDATE_MODEL_EVENT, value);
  34848. emitChange(value);
  34849. if (option.created) {
  34850. handleQueryChange("");
  34851. }
  34852. if (props.filterable && !props.reserveKeyword) {
  34853. states.inputValue = "";
  34854. }
  34855. } else {
  34856. emit(UPDATE_MODEL_EVENT, option.value);
  34857. emitChange(option.value);
  34858. expanded.value = false;
  34859. }
  34860. focus();
  34861. if (expanded.value)
  34862. return;
  34863. vue.nextTick(() => {
  34864. scrollToOption(option);
  34865. });
  34866. };
  34867. const getValueIndex = (arr, option) => {
  34868. if (isUndefined(option))
  34869. return -1;
  34870. if (!isObject$1(option.value))
  34871. return arr.indexOf(option.value);
  34872. return arr.findIndex((item) => {
  34873. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  34874. });
  34875. };
  34876. const scrollToOption = (option) => {
  34877. var _a, _b, _c, _d, _e;
  34878. const targetOption = isArray$1(option) ? option[0] : option;
  34879. let target = null;
  34880. if (targetOption == null ? void 0 : targetOption.value) {
  34881. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  34882. if (options.length > 0) {
  34883. target = options[0].$el;
  34884. }
  34885. }
  34886. if (tooltipRef.value && target) {
  34887. const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${nsSelect.be("dropdown", "wrap")}`);
  34888. if (menu) {
  34889. scrollIntoView(menu, target);
  34890. }
  34891. }
  34892. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  34893. };
  34894. const onOptionCreate = (vm) => {
  34895. states.options.set(vm.value, vm);
  34896. states.cachedOptions.set(vm.value, vm);
  34897. };
  34898. const onOptionDestroy = (key, vm) => {
  34899. if (states.options.get(key) === vm) {
  34900. states.options.delete(key);
  34901. }
  34902. };
  34903. const popperRef = vue.computed(() => {
  34904. var _a, _b;
  34905. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  34906. });
  34907. const handleMenuEnter = () => {
  34908. states.isBeforeHide = false;
  34909. vue.nextTick(() => {
  34910. var _a;
  34911. (_a = scrollbarRef.value) == null ? void 0 : _a.update();
  34912. scrollToOption(states.selected);
  34913. });
  34914. };
  34915. const focus = () => {
  34916. var _a;
  34917. (_a = inputRef.value) == null ? void 0 : _a.focus();
  34918. };
  34919. const blur = () => {
  34920. var _a;
  34921. if (expanded.value) {
  34922. expanded.value = false;
  34923. vue.nextTick(() => {
  34924. var _a2;
  34925. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  34926. });
  34927. return;
  34928. }
  34929. (_a = inputRef.value) == null ? void 0 : _a.blur();
  34930. };
  34931. const handleClearClick = (event) => {
  34932. deleteSelected(event);
  34933. };
  34934. const handleClickOutside = (event) => {
  34935. expanded.value = false;
  34936. if (isFocused.value) {
  34937. const _event = new FocusEvent("focus", event);
  34938. vue.nextTick(() => handleBlur(_event));
  34939. }
  34940. };
  34941. const handleEsc = () => {
  34942. if (states.inputValue.length > 0) {
  34943. states.inputValue = "";
  34944. } else {
  34945. expanded.value = false;
  34946. }
  34947. };
  34948. const toggleMenu = () => {
  34949. if (selectDisabled.value)
  34950. return;
  34951. if (isIOS)
  34952. states.inputHovering = true;
  34953. if (states.menuVisibleOnFocus) {
  34954. states.menuVisibleOnFocus = false;
  34955. } else {
  34956. expanded.value = !expanded.value;
  34957. }
  34958. };
  34959. const selectOption = () => {
  34960. if (!expanded.value) {
  34961. toggleMenu();
  34962. } else {
  34963. const option = optionsArray.value[states.hoveringIndex];
  34964. if (option && !option.isDisabled) {
  34965. handleOptionSelect(option);
  34966. }
  34967. }
  34968. };
  34969. const getValueKey = (item) => {
  34970. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  34971. };
  34972. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  34973. const showTagList = vue.computed(() => {
  34974. if (!props.multiple) {
  34975. return [];
  34976. }
  34977. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  34978. });
  34979. const collapseTagList = vue.computed(() => {
  34980. if (!props.multiple) {
  34981. return [];
  34982. }
  34983. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  34984. });
  34985. const navigateOptions = (direction) => {
  34986. if (!expanded.value) {
  34987. expanded.value = true;
  34988. return;
  34989. }
  34990. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
  34991. return;
  34992. if (!optionsAllDisabled.value) {
  34993. if (direction === "next") {
  34994. states.hoveringIndex++;
  34995. if (states.hoveringIndex === states.options.size) {
  34996. states.hoveringIndex = 0;
  34997. }
  34998. } else if (direction === "prev") {
  34999. states.hoveringIndex--;
  35000. if (states.hoveringIndex < 0) {
  35001. states.hoveringIndex = states.options.size - 1;
  35002. }
  35003. }
  35004. const option = optionsArray.value[states.hoveringIndex];
  35005. if (option.isDisabled || !option.visible) {
  35006. navigateOptions(direction);
  35007. }
  35008. vue.nextTick(() => scrollToOption(hoverOption.value));
  35009. }
  35010. };
  35011. const getGapWidth = () => {
  35012. if (!selectionRef.value)
  35013. return 0;
  35014. const style = window.getComputedStyle(selectionRef.value);
  35015. return Number.parseFloat(style.gap || "6px");
  35016. };
  35017. const tagStyle = vue.computed(() => {
  35018. const gapWidth = getGapWidth();
  35019. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  35020. return { maxWidth: `${maxWidth}px` };
  35021. });
  35022. const collapseTagStyle = vue.computed(() => {
  35023. return { maxWidth: `${states.selectionWidth}px` };
  35024. });
  35025. const popupScroll = (data) => {
  35026. emit("popup-scroll", data);
  35027. };
  35028. useResizeObserver(selectionRef, resetSelectionWidth);
  35029. useResizeObserver(menuRef, updateTooltip);
  35030. useResizeObserver(wrapperRef, updateTooltip);
  35031. useResizeObserver(tagMenuRef, updateTagTooltip);
  35032. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  35033. vue.onMounted(() => {
  35034. setSelected();
  35035. });
  35036. return {
  35037. inputId,
  35038. contentId,
  35039. nsSelect,
  35040. nsInput,
  35041. states,
  35042. isFocused,
  35043. expanded,
  35044. optionsArray,
  35045. hoverOption,
  35046. selectSize,
  35047. filteredOptionsCount,
  35048. updateTooltip,
  35049. updateTagTooltip,
  35050. debouncedOnInputChange,
  35051. onInput,
  35052. deletePrevTag,
  35053. deleteTag,
  35054. deleteSelected,
  35055. handleOptionSelect,
  35056. scrollToOption,
  35057. hasModelValue,
  35058. shouldShowPlaceholder,
  35059. currentPlaceholder,
  35060. mouseEnterEventName,
  35061. needStatusIcon,
  35062. showClose,
  35063. iconComponent,
  35064. iconReverse,
  35065. validateState,
  35066. validateIcon,
  35067. showNewOption,
  35068. updateOptions,
  35069. collapseTagSize,
  35070. setSelected,
  35071. selectDisabled,
  35072. emptyText,
  35073. handleCompositionStart,
  35074. handleCompositionUpdate,
  35075. handleCompositionEnd,
  35076. onOptionCreate,
  35077. onOptionDestroy,
  35078. handleMenuEnter,
  35079. focus,
  35080. blur,
  35081. handleClearClick,
  35082. handleClickOutside,
  35083. handleEsc,
  35084. toggleMenu,
  35085. selectOption,
  35086. getValueKey,
  35087. navigateOptions,
  35088. dropdownMenuVisible,
  35089. showTagList,
  35090. collapseTagList,
  35091. popupScroll,
  35092. tagStyle,
  35093. collapseTagStyle,
  35094. popperRef,
  35095. inputRef,
  35096. tooltipRef,
  35097. tagTooltipRef,
  35098. prefixRef,
  35099. suffixRef,
  35100. selectRef,
  35101. wrapperRef,
  35102. selectionRef,
  35103. scrollbarRef,
  35104. menuRef,
  35105. tagMenuRef,
  35106. collapseItemRef
  35107. };
  35108. };
  35109. var ElOptions = vue.defineComponent({
  35110. name: "ElOptions",
  35111. setup(_, { slots }) {
  35112. const select = vue.inject(selectKey);
  35113. let cachedValueList = [];
  35114. return () => {
  35115. var _a, _b;
  35116. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  35117. const valueList = [];
  35118. function filterOptions(children2) {
  35119. if (!isArray$1(children2))
  35120. return;
  35121. children2.forEach((item) => {
  35122. var _a2, _b2, _c, _d;
  35123. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  35124. if (name === "ElOptionGroup") {
  35125. filterOptions(!isString$1(item.children) && !isArray$1(item.children) && isFunction$1((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  35126. } else if (name === "ElOption") {
  35127. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  35128. } else if (isArray$1(item.children)) {
  35129. filterOptions(item.children);
  35130. }
  35131. });
  35132. }
  35133. if (children.length) {
  35134. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  35135. }
  35136. if (!isEqual$1(valueList, cachedValueList)) {
  35137. cachedValueList = valueList;
  35138. if (select) {
  35139. select.states.optionValues = valueList;
  35140. }
  35141. }
  35142. return children;
  35143. };
  35144. }
  35145. });
  35146. const SelectProps$1 = buildProps({
  35147. name: String,
  35148. id: String,
  35149. modelValue: {
  35150. type: definePropType([
  35151. Array,
  35152. String,
  35153. Number,
  35154. Boolean,
  35155. Object
  35156. ]),
  35157. default: void 0
  35158. },
  35159. autocomplete: {
  35160. type: String,
  35161. default: "off"
  35162. },
  35163. automaticDropdown: Boolean,
  35164. size: useSizeProp,
  35165. effect: {
  35166. type: definePropType(String),
  35167. default: "light"
  35168. },
  35169. disabled: Boolean,
  35170. clearable: Boolean,
  35171. filterable: Boolean,
  35172. allowCreate: Boolean,
  35173. loading: Boolean,
  35174. popperClass: {
  35175. type: String,
  35176. default: ""
  35177. },
  35178. popperOptions: {
  35179. type: definePropType(Object),
  35180. default: () => ({})
  35181. },
  35182. remote: Boolean,
  35183. loadingText: String,
  35184. noMatchText: String,
  35185. noDataText: String,
  35186. remoteMethod: Function,
  35187. filterMethod: Function,
  35188. multiple: Boolean,
  35189. multipleLimit: {
  35190. type: Number,
  35191. default: 0
  35192. },
  35193. placeholder: {
  35194. type: String
  35195. },
  35196. defaultFirstOption: Boolean,
  35197. reserveKeyword: {
  35198. type: Boolean,
  35199. default: true
  35200. },
  35201. valueKey: {
  35202. type: String,
  35203. default: "value"
  35204. },
  35205. collapseTags: Boolean,
  35206. collapseTagsTooltip: Boolean,
  35207. maxCollapseTags: {
  35208. type: Number,
  35209. default: 1
  35210. },
  35211. teleported: useTooltipContentProps.teleported,
  35212. persistent: {
  35213. type: Boolean,
  35214. default: true
  35215. },
  35216. clearIcon: {
  35217. type: iconPropType,
  35218. default: circle_close_default
  35219. },
  35220. fitInputWidth: Boolean,
  35221. suffixIcon: {
  35222. type: iconPropType,
  35223. default: arrow_down_default
  35224. },
  35225. tagType: { ...tagProps.type, default: "info" },
  35226. tagEffect: { ...tagProps.effect, default: "light" },
  35227. validateEvent: {
  35228. type: Boolean,
  35229. default: true
  35230. },
  35231. remoteShowSuffix: Boolean,
  35232. showArrow: {
  35233. type: Boolean,
  35234. default: true
  35235. },
  35236. offset: {
  35237. type: Number,
  35238. default: 12
  35239. },
  35240. placement: {
  35241. type: definePropType(String),
  35242. values: Ee,
  35243. default: "bottom-start"
  35244. },
  35245. fallbackPlacements: {
  35246. type: definePropType(Array),
  35247. default: ["bottom-start", "top-start", "right", "left"]
  35248. },
  35249. tabindex: {
  35250. type: [String, Number],
  35251. default: 0
  35252. },
  35253. appendTo: String,
  35254. ...useEmptyValuesProps,
  35255. ...useAriaProps(["ariaLabel"])
  35256. });
  35257. const selectEmits$1 = {
  35258. [UPDATE_MODEL_EVENT]: (val) => true,
  35259. [CHANGE_EVENT]: (val) => true,
  35260. "popup-scroll": scrollbarEmits.scroll,
  35261. "remove-tag": (val) => true,
  35262. "visible-change": (visible) => true,
  35263. focus: (evt) => evt instanceof FocusEvent,
  35264. blur: (evt) => evt instanceof FocusEvent,
  35265. clear: () => true
  35266. };
  35267. const COMPONENT_NAME$9 = "ElSelect";
  35268. const _sfc_main$Z = vue.defineComponent({
  35269. name: COMPONENT_NAME$9,
  35270. componentName: COMPONENT_NAME$9,
  35271. components: {
  35272. ElSelectMenu: ElSelectMenu$1,
  35273. ElOption: Option,
  35274. ElOptions,
  35275. ElTag,
  35276. ElScrollbar,
  35277. ElTooltip,
  35278. ElIcon
  35279. },
  35280. directives: { ClickOutside },
  35281. props: SelectProps$1,
  35282. emits: [
  35283. UPDATE_MODEL_EVENT,
  35284. CHANGE_EVENT,
  35285. "remove-tag",
  35286. "clear",
  35287. "visible-change",
  35288. "focus",
  35289. "blur",
  35290. "popup-scroll"
  35291. ],
  35292. setup(props, { emit }) {
  35293. const modelValue = vue.computed(() => {
  35294. const { modelValue: rawModelValue, multiple } = props;
  35295. const fallback = multiple ? [] : void 0;
  35296. if (isArray$1(rawModelValue)) {
  35297. return multiple ? rawModelValue : fallback;
  35298. }
  35299. return multiple ? fallback : rawModelValue;
  35300. });
  35301. const _props = vue.reactive({
  35302. ...vue.toRefs(props),
  35303. modelValue
  35304. });
  35305. const API = useSelect$3(_props, emit);
  35306. const { calculatorRef, inputStyle } = useCalcInputWidth();
  35307. vue.provide(selectKey, vue.reactive({
  35308. props: _props,
  35309. states: API.states,
  35310. selectRef: API.selectRef,
  35311. optionsArray: API.optionsArray,
  35312. setSelected: API.setSelected,
  35313. handleOptionSelect: API.handleOptionSelect,
  35314. onOptionCreate: API.onOptionCreate,
  35315. onOptionDestroy: API.onOptionDestroy
  35316. }));
  35317. const selectedLabel = vue.computed(() => {
  35318. if (!props.multiple) {
  35319. return API.states.selectedLabel;
  35320. }
  35321. return API.states.selected.map((i) => i.currentLabel);
  35322. });
  35323. return {
  35324. ...API,
  35325. modelValue,
  35326. selectedLabel,
  35327. calculatorRef,
  35328. inputStyle
  35329. };
  35330. }
  35331. });
  35332. function _sfc_render$9(_ctx, _cache) {
  35333. const _component_el_tag = vue.resolveComponent("el-tag");
  35334. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  35335. const _component_el_icon = vue.resolveComponent("el-icon");
  35336. const _component_el_option = vue.resolveComponent("el-option");
  35337. const _component_el_options = vue.resolveComponent("el-options");
  35338. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  35339. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  35340. const _directive_click_outside = vue.resolveDirective("click-outside");
  35341. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  35342. ref: "selectRef",
  35343. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  35344. [vue.toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
  35345. onMouseleave: ($event) => _ctx.states.inputHovering = false
  35346. }, [
  35347. vue.createVNode(_component_el_tooltip, {
  35348. ref: "tooltipRef",
  35349. visible: _ctx.dropdownMenuVisible,
  35350. placement: _ctx.placement,
  35351. teleported: _ctx.teleported,
  35352. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  35353. "popper-options": _ctx.popperOptions,
  35354. "fallback-placements": _ctx.fallbackPlacements,
  35355. effect: _ctx.effect,
  35356. pure: "",
  35357. trigger: "click",
  35358. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  35359. "stop-popper-mouse-event": false,
  35360. "gpu-acceleration": false,
  35361. persistent: _ctx.persistent,
  35362. "append-to": _ctx.appendTo,
  35363. "show-arrow": _ctx.showArrow,
  35364. offset: _ctx.offset,
  35365. onBeforeShow: _ctx.handleMenuEnter,
  35366. onHide: ($event) => _ctx.states.isBeforeHide = false
  35367. }, {
  35368. default: vue.withCtx(() => {
  35369. var _a;
  35370. return [
  35371. vue.createElementVNode("div", {
  35372. ref: "wrapperRef",
  35373. class: vue.normalizeClass([
  35374. _ctx.nsSelect.e("wrapper"),
  35375. _ctx.nsSelect.is("focused", _ctx.isFocused),
  35376. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  35377. _ctx.nsSelect.is("filterable", _ctx.filterable),
  35378. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  35379. ]),
  35380. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  35381. }, [
  35382. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  35383. key: 0,
  35384. ref: "prefixRef",
  35385. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  35386. }, [
  35387. vue.renderSlot(_ctx.$slots, "prefix")
  35388. ], 2)) : vue.createCommentVNode("v-if", true),
  35389. vue.createElementVNode("div", {
  35390. ref: "selectionRef",
  35391. class: vue.normalizeClass([
  35392. _ctx.nsSelect.e("selection"),
  35393. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  35394. ])
  35395. }, [
  35396. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  35397. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  35398. return vue.openBlock(), vue.createElementBlock("div", {
  35399. key: _ctx.getValueKey(item),
  35400. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  35401. }, [
  35402. vue.createVNode(_component_el_tag, {
  35403. closable: !_ctx.selectDisabled && !item.isDisabled,
  35404. size: _ctx.collapseTagSize,
  35405. type: _ctx.tagType,
  35406. effect: _ctx.tagEffect,
  35407. "disable-transitions": "",
  35408. style: vue.normalizeStyle(_ctx.tagStyle),
  35409. onClose: ($event) => _ctx.deleteTag($event, item)
  35410. }, {
  35411. default: vue.withCtx(() => [
  35412. vue.createElementVNode("span", {
  35413. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  35414. }, [
  35415. vue.renderSlot(_ctx.$slots, "label", {
  35416. label: item.currentLabel,
  35417. value: item.value
  35418. }, () => [
  35419. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  35420. ])
  35421. ], 2)
  35422. ]),
  35423. _: 2
  35424. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  35425. ], 2);
  35426. }), 128)),
  35427. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  35428. key: 0,
  35429. ref: "tagTooltipRef",
  35430. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  35431. "fallback-placements": ["bottom", "top", "right", "left"],
  35432. effect: _ctx.effect,
  35433. placement: "bottom",
  35434. teleported: _ctx.teleported
  35435. }, {
  35436. default: vue.withCtx(() => [
  35437. vue.createElementVNode("div", {
  35438. ref: "collapseItemRef",
  35439. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  35440. }, [
  35441. vue.createVNode(_component_el_tag, {
  35442. closable: false,
  35443. size: _ctx.collapseTagSize,
  35444. type: _ctx.tagType,
  35445. effect: _ctx.tagEffect,
  35446. "disable-transitions": "",
  35447. style: vue.normalizeStyle(_ctx.collapseTagStyle)
  35448. }, {
  35449. default: vue.withCtx(() => [
  35450. vue.createElementVNode("span", {
  35451. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  35452. }, " + " + vue.toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  35453. ]),
  35454. _: 1
  35455. }, 8, ["size", "type", "effect", "style"])
  35456. ], 2)
  35457. ]),
  35458. content: vue.withCtx(() => [
  35459. vue.createElementVNode("div", {
  35460. ref: "tagMenuRef",
  35461. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  35462. }, [
  35463. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (item) => {
  35464. return vue.openBlock(), vue.createElementBlock("div", {
  35465. key: _ctx.getValueKey(item),
  35466. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  35467. }, [
  35468. vue.createVNode(_component_el_tag, {
  35469. class: "in-tooltip",
  35470. closable: !_ctx.selectDisabled && !item.isDisabled,
  35471. size: _ctx.collapseTagSize,
  35472. type: _ctx.tagType,
  35473. effect: _ctx.tagEffect,
  35474. "disable-transitions": "",
  35475. onClose: ($event) => _ctx.deleteTag($event, item)
  35476. }, {
  35477. default: vue.withCtx(() => [
  35478. vue.createElementVNode("span", {
  35479. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  35480. }, [
  35481. vue.renderSlot(_ctx.$slots, "label", {
  35482. label: item.currentLabel,
  35483. value: item.value
  35484. }, () => [
  35485. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  35486. ])
  35487. ], 2)
  35488. ]),
  35489. _: 2
  35490. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  35491. ], 2);
  35492. }), 128))
  35493. ], 2)
  35494. ]),
  35495. _: 3
  35496. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  35497. ]) : vue.createCommentVNode("v-if", true),
  35498. vue.createElementVNode("div", {
  35499. class: vue.normalizeClass([
  35500. _ctx.nsSelect.e("selected-item"),
  35501. _ctx.nsSelect.e("input-wrapper"),
  35502. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  35503. ])
  35504. }, [
  35505. vue.withDirectives(vue.createElementVNode("input", {
  35506. id: _ctx.inputId,
  35507. ref: "inputRef",
  35508. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  35509. type: "text",
  35510. name: _ctx.name,
  35511. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  35512. disabled: _ctx.selectDisabled,
  35513. autocomplete: _ctx.autocomplete,
  35514. style: vue.normalizeStyle(_ctx.inputStyle),
  35515. tabindex: _ctx.tabindex,
  35516. role: "combobox",
  35517. readonly: !_ctx.filterable,
  35518. spellcheck: "false",
  35519. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  35520. "aria-controls": _ctx.contentId,
  35521. "aria-expanded": _ctx.dropdownMenuVisible,
  35522. "aria-label": _ctx.ariaLabel,
  35523. "aria-autocomplete": "none",
  35524. "aria-haspopup": "listbox",
  35525. onKeydown: [
  35526. vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
  35527. vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
  35528. vue.withKeys(vue.withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  35529. vue.withKeys(vue.withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  35530. vue.withKeys(vue.withModifiers(_ctx.deletePrevTag, ["stop"]), ["delete"])
  35531. ],
  35532. onCompositionstart: _ctx.handleCompositionStart,
  35533. onCompositionupdate: _ctx.handleCompositionUpdate,
  35534. onCompositionend: _ctx.handleCompositionEnd,
  35535. onInput: _ctx.onInput,
  35536. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  35537. }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
  35538. [vue.vModelText, _ctx.states.inputValue]
  35539. ]),
  35540. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  35541. key: 0,
  35542. ref: "calculatorRef",
  35543. "aria-hidden": "true",
  35544. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  35545. textContent: vue.toDisplayString(_ctx.states.inputValue)
  35546. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  35547. ], 2),
  35548. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  35549. key: 1,
  35550. class: vue.normalizeClass([
  35551. _ctx.nsSelect.e("selected-item"),
  35552. _ctx.nsSelect.e("placeholder"),
  35553. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  35554. ])
  35555. }, [
  35556. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  35557. key: 0,
  35558. label: _ctx.currentPlaceholder,
  35559. value: _ctx.modelValue
  35560. }, () => [
  35561. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  35562. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  35563. ], 2)) : vue.createCommentVNode("v-if", true)
  35564. ], 2),
  35565. vue.createElementVNode("div", {
  35566. ref: "suffixRef",
  35567. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  35568. }, [
  35569. _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  35570. key: 0,
  35571. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  35572. }, {
  35573. default: vue.withCtx(() => [
  35574. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  35575. ]),
  35576. _: 1
  35577. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  35578. _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  35579. key: 1,
  35580. class: vue.normalizeClass([
  35581. _ctx.nsSelect.e("caret"),
  35582. _ctx.nsSelect.e("icon"),
  35583. _ctx.nsSelect.e("clear")
  35584. ]),
  35585. onClick: _ctx.handleClearClick
  35586. }, {
  35587. default: vue.withCtx(() => [
  35588. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  35589. ]),
  35590. _: 1
  35591. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  35592. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  35593. key: 2,
  35594. class: vue.normalizeClass([
  35595. _ctx.nsInput.e("icon"),
  35596. _ctx.nsInput.e("validateIcon"),
  35597. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  35598. ])
  35599. }, {
  35600. default: vue.withCtx(() => [
  35601. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  35602. ]),
  35603. _: 1
  35604. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  35605. ], 2)
  35606. ], 10, ["onClick"])
  35607. ];
  35608. }),
  35609. content: vue.withCtx(() => [
  35610. vue.createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  35611. default: vue.withCtx(() => [
  35612. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  35613. key: 0,
  35614. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  35615. onClick: vue.withModifiers(() => {
  35616. }, ["stop"])
  35617. }, [
  35618. vue.renderSlot(_ctx.$slots, "header")
  35619. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true),
  35620. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  35621. id: _ctx.contentId,
  35622. ref: "scrollbarRef",
  35623. tag: "ul",
  35624. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  35625. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  35626. class: vue.normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  35627. role: "listbox",
  35628. "aria-label": _ctx.ariaLabel,
  35629. "aria-orientation": "vertical",
  35630. onScroll: _ctx.popupScroll
  35631. }, {
  35632. default: vue.withCtx(() => [
  35633. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  35634. key: 0,
  35635. value: _ctx.states.inputValue,
  35636. created: true
  35637. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  35638. vue.createVNode(_component_el_options, null, {
  35639. default: vue.withCtx(() => [
  35640. vue.renderSlot(_ctx.$slots, "default")
  35641. ]),
  35642. _: 3
  35643. })
  35644. ]),
  35645. _: 3
  35646. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label", "onScroll"]), [
  35647. [vue.vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  35648. ]),
  35649. _ctx.$slots.loading && _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  35650. key: 1,
  35651. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  35652. }, [
  35653. vue.renderSlot(_ctx.$slots, "loading")
  35654. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  35655. key: 2,
  35656. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  35657. }, [
  35658. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  35659. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  35660. ])
  35661. ], 2)) : vue.createCommentVNode("v-if", true),
  35662. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  35663. key: 3,
  35664. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  35665. onClick: vue.withModifiers(() => {
  35666. }, ["stop"])
  35667. }, [
  35668. vue.renderSlot(_ctx.$slots, "footer")
  35669. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  35670. ]),
  35671. _: 3
  35672. }, 512)
  35673. ]),
  35674. _: 3
  35675. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  35676. ], 16, ["onMouseleave"])), [
  35677. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  35678. ]);
  35679. }
  35680. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  35681. const _sfc_main$Y = vue.defineComponent({
  35682. name: "ElOptionGroup",
  35683. componentName: "ElOptionGroup",
  35684. props: {
  35685. label: String,
  35686. disabled: Boolean
  35687. },
  35688. setup(props) {
  35689. const ns = useNamespace("select");
  35690. const groupRef = vue.ref();
  35691. const instance = vue.getCurrentInstance();
  35692. const children = vue.ref([]);
  35693. vue.provide(selectGroupKey, vue.reactive({
  35694. ...vue.toRefs(props)
  35695. }));
  35696. const visible = vue.computed(() => children.value.some((option) => option.visible === true));
  35697. const isOption = (node) => {
  35698. var _a;
  35699. return node.type.name === "ElOption" && !!((_a = node.component) == null ? void 0 : _a.proxy);
  35700. };
  35701. const flattedChildren = (node) => {
  35702. const nodes = castArray$1(node);
  35703. const children2 = [];
  35704. nodes.forEach((child) => {
  35705. var _a;
  35706. if (!vue.isVNode(child))
  35707. return;
  35708. if (isOption(child)) {
  35709. children2.push(child.component.proxy);
  35710. } else if (isArray$1(child.children) && child.children.length) {
  35711. children2.push(...flattedChildren(child.children));
  35712. } else if ((_a = child.component) == null ? void 0 : _a.subTree) {
  35713. children2.push(...flattedChildren(child.component.subTree));
  35714. }
  35715. });
  35716. return children2;
  35717. };
  35718. const updateChildren = () => {
  35719. children.value = flattedChildren(instance.subTree);
  35720. };
  35721. vue.onMounted(() => {
  35722. updateChildren();
  35723. });
  35724. useMutationObserver(groupRef, updateChildren, {
  35725. attributes: true,
  35726. subtree: true,
  35727. childList: true
  35728. });
  35729. return {
  35730. groupRef,
  35731. visible,
  35732. ns
  35733. };
  35734. }
  35735. });
  35736. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  35737. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  35738. ref: "groupRef",
  35739. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  35740. }, [
  35741. vue.createElementVNode("li", {
  35742. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  35743. }, vue.toDisplayString(_ctx.label), 3),
  35744. vue.createElementVNode("li", null, [
  35745. vue.createElementVNode("ul", {
  35746. class: vue.normalizeClass(_ctx.ns.b("group"))
  35747. }, [
  35748. vue.renderSlot(_ctx.$slots, "default")
  35749. ], 2)
  35750. ])
  35751. ], 2)), [
  35752. [vue.vShow, _ctx.visible]
  35753. ]);
  35754. }
  35755. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  35756. const ElSelect = withInstall(Select$1, {
  35757. Option,
  35758. OptionGroup
  35759. });
  35760. const ElOption = withNoopInstall(Option);
  35761. const ElOptionGroup = withNoopInstall(OptionGroup);
  35762. const usePagination = () => vue.inject(elPaginationKey, {});
  35763. const paginationSizesProps = buildProps({
  35764. pageSize: {
  35765. type: Number,
  35766. required: true
  35767. },
  35768. pageSizes: {
  35769. type: definePropType(Array),
  35770. default: () => mutable([10, 20, 30, 40, 50, 100])
  35771. },
  35772. popperClass: {
  35773. type: String
  35774. },
  35775. disabled: Boolean,
  35776. teleported: Boolean,
  35777. size: {
  35778. type: String,
  35779. values: componentSizes
  35780. },
  35781. appendSizeTo: String
  35782. });
  35783. const __default__$N = vue.defineComponent({
  35784. name: "ElPaginationSizes"
  35785. });
  35786. const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
  35787. ...__default__$N,
  35788. props: paginationSizesProps,
  35789. emits: ["page-size-change"],
  35790. setup(__props, { emit }) {
  35791. const props = __props;
  35792. const { t } = useLocale();
  35793. const ns = useNamespace("pagination");
  35794. const pagination = usePagination();
  35795. const innerPageSize = vue.ref(props.pageSize);
  35796. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  35797. if (isEqual$1(newVal, oldVal))
  35798. return;
  35799. if (isArray$1(newVal)) {
  35800. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  35801. emit("page-size-change", pageSize);
  35802. }
  35803. });
  35804. vue.watch(() => props.pageSize, (newVal) => {
  35805. innerPageSize.value = newVal;
  35806. });
  35807. const innerPageSizes = vue.computed(() => props.pageSizes);
  35808. function handleChange(val) {
  35809. var _a;
  35810. if (val !== innerPageSize.value) {
  35811. innerPageSize.value = val;
  35812. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  35813. }
  35814. }
  35815. return (_ctx, _cache) => {
  35816. return vue.openBlock(), vue.createElementBlock("span", {
  35817. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  35818. }, [
  35819. vue.createVNode(vue.unref(ElSelect), {
  35820. "model-value": innerPageSize.value,
  35821. disabled: _ctx.disabled,
  35822. "popper-class": _ctx.popperClass,
  35823. size: _ctx.size,
  35824. teleported: _ctx.teleported,
  35825. "validate-event": false,
  35826. "append-to": _ctx.appendSizeTo,
  35827. onChange: handleChange
  35828. }, {
  35829. default: vue.withCtx(() => [
  35830. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  35831. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  35832. key: item,
  35833. value: item,
  35834. label: item + vue.unref(t)("el.pagination.pagesize")
  35835. }, null, 8, ["value", "label"]);
  35836. }), 128))
  35837. ]),
  35838. _: 1
  35839. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported", "append-to"])
  35840. ], 2);
  35841. };
  35842. }
  35843. });
  35844. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "sizes.vue"]]);
  35845. const paginationJumperProps = buildProps({
  35846. size: {
  35847. type: String,
  35848. values: componentSizes
  35849. }
  35850. });
  35851. const __default__$M = vue.defineComponent({
  35852. name: "ElPaginationJumper"
  35853. });
  35854. const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
  35855. ...__default__$M,
  35856. props: paginationJumperProps,
  35857. setup(__props) {
  35858. const { t } = useLocale();
  35859. const ns = useNamespace("pagination");
  35860. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  35861. const userInput = vue.ref();
  35862. const innerValue = vue.computed(() => {
  35863. var _a;
  35864. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  35865. });
  35866. function handleInput(val) {
  35867. userInput.value = val ? +val : "";
  35868. }
  35869. function handleChange(val) {
  35870. val = Math.trunc(+val);
  35871. changeEvent == null ? void 0 : changeEvent(val);
  35872. userInput.value = void 0;
  35873. }
  35874. return (_ctx, _cache) => {
  35875. return vue.openBlock(), vue.createElementBlock("span", {
  35876. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  35877. disabled: vue.unref(disabled)
  35878. }, [
  35879. vue.createElementVNode("span", {
  35880. class: vue.normalizeClass([vue.unref(ns).e("goto")])
  35881. }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3),
  35882. vue.createVNode(vue.unref(ElInput), {
  35883. size: _ctx.size,
  35884. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  35885. min: 1,
  35886. max: vue.unref(pageCount),
  35887. disabled: vue.unref(disabled),
  35888. "model-value": vue.unref(innerValue),
  35889. "validate-event": false,
  35890. "aria-label": vue.unref(t)("el.pagination.page"),
  35891. type: "number",
  35892. "onUpdate:modelValue": handleInput,
  35893. onChange: handleChange
  35894. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  35895. vue.createElementVNode("span", {
  35896. class: vue.normalizeClass([vue.unref(ns).e("classifier")])
  35897. }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3)
  35898. ], 10, ["disabled"]);
  35899. };
  35900. }
  35901. });
  35902. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__file", "jumper.vue"]]);
  35903. const paginationTotalProps = buildProps({
  35904. total: {
  35905. type: Number,
  35906. default: 1e3
  35907. }
  35908. });
  35909. const __default__$L = vue.defineComponent({
  35910. name: "ElPaginationTotal"
  35911. });
  35912. const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
  35913. ...__default__$L,
  35914. props: paginationTotalProps,
  35915. setup(__props) {
  35916. const { t } = useLocale();
  35917. const ns = useNamespace("pagination");
  35918. const { disabled } = usePagination();
  35919. return (_ctx, _cache) => {
  35920. return vue.openBlock(), vue.createElementBlock("span", {
  35921. class: vue.normalizeClass(vue.unref(ns).e("total")),
  35922. disabled: vue.unref(disabled)
  35923. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  35924. total: _ctx.total
  35925. })), 11, ["disabled"]);
  35926. };
  35927. }
  35928. });
  35929. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__file", "total.vue"]]);
  35930. const paginationPagerProps = buildProps({
  35931. currentPage: {
  35932. type: Number,
  35933. default: 1
  35934. },
  35935. pageCount: {
  35936. type: Number,
  35937. required: true
  35938. },
  35939. pagerCount: {
  35940. type: Number,
  35941. default: 7
  35942. },
  35943. disabled: Boolean
  35944. });
  35945. const __default__$K = vue.defineComponent({
  35946. name: "ElPaginationPager"
  35947. });
  35948. const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
  35949. ...__default__$K,
  35950. props: paginationPagerProps,
  35951. emits: [CHANGE_EVENT],
  35952. setup(__props, { emit }) {
  35953. const props = __props;
  35954. const nsPager = useNamespace("pager");
  35955. const nsIcon = useNamespace("icon");
  35956. const { t } = useLocale();
  35957. const showPrevMore = vue.ref(false);
  35958. const showNextMore = vue.ref(false);
  35959. const quickPrevHover = vue.ref(false);
  35960. const quickNextHover = vue.ref(false);
  35961. const quickPrevFocus = vue.ref(false);
  35962. const quickNextFocus = vue.ref(false);
  35963. const pagers = vue.computed(() => {
  35964. const pagerCount = props.pagerCount;
  35965. const halfPagerCount = (pagerCount - 1) / 2;
  35966. const currentPage = Number(props.currentPage);
  35967. const pageCount = Number(props.pageCount);
  35968. let showPrevMore2 = false;
  35969. let showNextMore2 = false;
  35970. if (pageCount > pagerCount) {
  35971. if (currentPage > pagerCount - halfPagerCount) {
  35972. showPrevMore2 = true;
  35973. }
  35974. if (currentPage < pageCount - halfPagerCount) {
  35975. showNextMore2 = true;
  35976. }
  35977. }
  35978. const array = [];
  35979. if (showPrevMore2 && !showNextMore2) {
  35980. const startPage = pageCount - (pagerCount - 2);
  35981. for (let i = startPage; i < pageCount; i++) {
  35982. array.push(i);
  35983. }
  35984. } else if (!showPrevMore2 && showNextMore2) {
  35985. for (let i = 2; i < pagerCount; i++) {
  35986. array.push(i);
  35987. }
  35988. } else if (showPrevMore2 && showNextMore2) {
  35989. const offset = Math.floor(pagerCount / 2) - 1;
  35990. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  35991. array.push(i);
  35992. }
  35993. } else {
  35994. for (let i = 2; i < pageCount; i++) {
  35995. array.push(i);
  35996. }
  35997. }
  35998. return array;
  35999. });
  36000. const prevMoreKls = vue.computed(() => [
  36001. "more",
  36002. "btn-quickprev",
  36003. nsIcon.b(),
  36004. nsPager.is("disabled", props.disabled)
  36005. ]);
  36006. const nextMoreKls = vue.computed(() => [
  36007. "more",
  36008. "btn-quicknext",
  36009. nsIcon.b(),
  36010. nsPager.is("disabled", props.disabled)
  36011. ]);
  36012. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  36013. vue.watchEffect(() => {
  36014. const halfPagerCount = (props.pagerCount - 1) / 2;
  36015. showPrevMore.value = false;
  36016. showNextMore.value = false;
  36017. if (props.pageCount > props.pagerCount) {
  36018. if (props.currentPage > props.pagerCount - halfPagerCount) {
  36019. showPrevMore.value = true;
  36020. }
  36021. if (props.currentPage < props.pageCount - halfPagerCount) {
  36022. showNextMore.value = true;
  36023. }
  36024. }
  36025. });
  36026. function onMouseEnter(forward = false) {
  36027. if (props.disabled)
  36028. return;
  36029. if (forward) {
  36030. quickPrevHover.value = true;
  36031. } else {
  36032. quickNextHover.value = true;
  36033. }
  36034. }
  36035. function onFocus(forward = false) {
  36036. if (forward) {
  36037. quickPrevFocus.value = true;
  36038. } else {
  36039. quickNextFocus.value = true;
  36040. }
  36041. }
  36042. function onEnter(e) {
  36043. const target = e.target;
  36044. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  36045. const newPage = Number(target.textContent);
  36046. if (newPage !== props.currentPage) {
  36047. emit(CHANGE_EVENT, newPage);
  36048. }
  36049. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  36050. onPagerClick(e);
  36051. }
  36052. }
  36053. function onPagerClick(event) {
  36054. const target = event.target;
  36055. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  36056. return;
  36057. }
  36058. let newPage = Number(target.textContent);
  36059. const pageCount = props.pageCount;
  36060. const currentPage = props.currentPage;
  36061. const pagerCountOffset = props.pagerCount - 2;
  36062. if (target.className.includes("more")) {
  36063. if (target.className.includes("quickprev")) {
  36064. newPage = currentPage - pagerCountOffset;
  36065. } else if (target.className.includes("quicknext")) {
  36066. newPage = currentPage + pagerCountOffset;
  36067. }
  36068. }
  36069. if (!Number.isNaN(+newPage)) {
  36070. if (newPage < 1) {
  36071. newPage = 1;
  36072. }
  36073. if (newPage > pageCount) {
  36074. newPage = pageCount;
  36075. }
  36076. }
  36077. if (newPage !== currentPage) {
  36078. emit(CHANGE_EVENT, newPage);
  36079. }
  36080. }
  36081. return (_ctx, _cache) => {
  36082. return vue.openBlock(), vue.createElementBlock("ul", {
  36083. class: vue.normalizeClass(vue.unref(nsPager).b()),
  36084. onClick: onPagerClick,
  36085. onKeyup: vue.withKeys(onEnter, ["enter"])
  36086. }, [
  36087. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  36088. key: 0,
  36089. class: vue.normalizeClass([[
  36090. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  36091. vue.unref(nsPager).is("disabled", _ctx.disabled)
  36092. ], "number"]),
  36093. "aria-current": _ctx.currentPage === 1,
  36094. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }),
  36095. tabindex: vue.unref(tabindex)
  36096. }, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true),
  36097. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  36098. key: 1,
  36099. class: vue.normalizeClass(vue.unref(prevMoreKls)),
  36100. tabindex: vue.unref(tabindex),
  36101. "aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  36102. onMouseenter: ($event) => onMouseEnter(true),
  36103. onMouseleave: ($event) => quickPrevHover.value = false,
  36104. onFocus: ($event) => onFocus(true),
  36105. onBlur: ($event) => quickPrevFocus.value = false
  36106. }, [
  36107. (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_left_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  36108. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  36109. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  36110. return vue.openBlock(), vue.createElementBlock("li", {
  36111. key: pager,
  36112. class: vue.normalizeClass([[
  36113. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  36114. vue.unref(nsPager).is("disabled", _ctx.disabled)
  36115. ], "number"]),
  36116. "aria-current": _ctx.currentPage === pager,
  36117. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager }),
  36118. tabindex: vue.unref(tabindex)
  36119. }, vue.toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
  36120. }), 128)),
  36121. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  36122. key: 2,
  36123. class: vue.normalizeClass(vue.unref(nextMoreKls)),
  36124. tabindex: vue.unref(tabindex),
  36125. "aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  36126. onMouseenter: ($event) => onMouseEnter(),
  36127. onMouseleave: ($event) => quickNextHover.value = false,
  36128. onFocus: ($event) => onFocus(),
  36129. onBlur: ($event) => quickNextFocus.value = false
  36130. }, [
  36131. (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_right_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  36132. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  36133. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  36134. key: 3,
  36135. class: vue.normalizeClass([[
  36136. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  36137. vue.unref(nsPager).is("disabled", _ctx.disabled)
  36138. ], "number"]),
  36139. "aria-current": _ctx.currentPage === _ctx.pageCount,
  36140. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  36141. tabindex: vue.unref(tabindex)
  36142. }, vue.toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true)
  36143. ], 42, ["onKeyup"]);
  36144. };
  36145. }
  36146. });
  36147. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "pager.vue"]]);
  36148. const isAbsent = (v) => typeof v !== "number";
  36149. const paginationProps = buildProps({
  36150. pageSize: Number,
  36151. defaultPageSize: Number,
  36152. total: Number,
  36153. pageCount: Number,
  36154. pagerCount: {
  36155. type: Number,
  36156. validator: (value) => {
  36157. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  36158. },
  36159. default: 7
  36160. },
  36161. currentPage: Number,
  36162. defaultCurrentPage: Number,
  36163. layout: {
  36164. type: String,
  36165. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  36166. },
  36167. pageSizes: {
  36168. type: definePropType(Array),
  36169. default: () => mutable([10, 20, 30, 40, 50, 100])
  36170. },
  36171. popperClass: {
  36172. type: String,
  36173. default: ""
  36174. },
  36175. prevText: {
  36176. type: String,
  36177. default: ""
  36178. },
  36179. prevIcon: {
  36180. type: iconPropType,
  36181. default: () => arrow_left_default
  36182. },
  36183. nextText: {
  36184. type: String,
  36185. default: ""
  36186. },
  36187. nextIcon: {
  36188. type: iconPropType,
  36189. default: () => arrow_right_default
  36190. },
  36191. teleported: {
  36192. type: Boolean,
  36193. default: true
  36194. },
  36195. small: Boolean,
  36196. size: useSizeProp,
  36197. background: Boolean,
  36198. disabled: Boolean,
  36199. hideOnSinglePage: Boolean,
  36200. appendSizeTo: String
  36201. });
  36202. const paginationEmits = {
  36203. "update:current-page": (val) => isNumber(val),
  36204. "update:page-size": (val) => isNumber(val),
  36205. "size-change": (val) => isNumber(val),
  36206. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  36207. "current-change": (val) => isNumber(val),
  36208. "prev-click": (val) => isNumber(val),
  36209. "next-click": (val) => isNumber(val)
  36210. };
  36211. const componentName = "ElPagination";
  36212. var Pagination = vue.defineComponent({
  36213. name: componentName,
  36214. props: paginationProps,
  36215. emits: paginationEmits,
  36216. setup(props, { emit, slots }) {
  36217. const { t } = useLocale();
  36218. const ns = useNamespace("pagination");
  36219. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  36220. const _globalSize = useGlobalSize();
  36221. const _size = vue.computed(() => {
  36222. var _a;
  36223. return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
  36224. });
  36225. useDeprecated({
  36226. from: "small",
  36227. replacement: "size",
  36228. version: "3.0.0",
  36229. scope: "el-pagination",
  36230. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  36231. }, vue.computed(() => !!props.small));
  36232. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  36233. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  36234. const assertValidUsage = vue.computed(() => {
  36235. if (isAbsent(props.total) && isAbsent(props.pageCount))
  36236. return false;
  36237. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  36238. return false;
  36239. if (props.layout.includes("sizes")) {
  36240. if (!isAbsent(props.pageCount)) {
  36241. if (!hasPageSizeListener)
  36242. return false;
  36243. } else if (!isAbsent(props.total)) {
  36244. if (!isAbsent(props.pageSize)) {
  36245. if (!hasPageSizeListener) {
  36246. return false;
  36247. }
  36248. }
  36249. }
  36250. }
  36251. return true;
  36252. });
  36253. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  36254. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  36255. const pageSizeBridge = vue.computed({
  36256. get() {
  36257. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  36258. },
  36259. set(v) {
  36260. if (isAbsent(props.pageSize)) {
  36261. innerPageSize.value = v;
  36262. }
  36263. if (hasPageSizeListener) {
  36264. emit("update:page-size", v);
  36265. emit("size-change", v);
  36266. }
  36267. }
  36268. });
  36269. const pageCountBridge = vue.computed(() => {
  36270. let pageCount = 0;
  36271. if (!isAbsent(props.pageCount)) {
  36272. pageCount = props.pageCount;
  36273. } else if (!isAbsent(props.total)) {
  36274. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  36275. }
  36276. return pageCount;
  36277. });
  36278. const currentPageBridge = vue.computed({
  36279. get() {
  36280. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  36281. },
  36282. set(v) {
  36283. let newCurrentPage = v;
  36284. if (v < 1) {
  36285. newCurrentPage = 1;
  36286. } else if (v > pageCountBridge.value) {
  36287. newCurrentPage = pageCountBridge.value;
  36288. }
  36289. if (isAbsent(props.currentPage)) {
  36290. innerCurrentPage.value = newCurrentPage;
  36291. }
  36292. if (hasCurrentPageListener) {
  36293. emit("update:current-page", newCurrentPage);
  36294. emit("current-change", newCurrentPage);
  36295. }
  36296. }
  36297. });
  36298. vue.watch(pageCountBridge, (val) => {
  36299. if (currentPageBridge.value > val)
  36300. currentPageBridge.value = val;
  36301. });
  36302. vue.watch([currentPageBridge, pageSizeBridge], (value) => {
  36303. emit(CHANGE_EVENT, ...value);
  36304. }, { flush: "post" });
  36305. function handleCurrentChange(val) {
  36306. currentPageBridge.value = val;
  36307. }
  36308. function handleSizeChange(val) {
  36309. pageSizeBridge.value = val;
  36310. const newPageCount = pageCountBridge.value;
  36311. if (currentPageBridge.value > newPageCount) {
  36312. currentPageBridge.value = newPageCount;
  36313. }
  36314. }
  36315. function prev() {
  36316. if (props.disabled)
  36317. return;
  36318. currentPageBridge.value -= 1;
  36319. emit("prev-click", currentPageBridge.value);
  36320. }
  36321. function next() {
  36322. if (props.disabled)
  36323. return;
  36324. currentPageBridge.value += 1;
  36325. emit("next-click", currentPageBridge.value);
  36326. }
  36327. function addClass(element, cls) {
  36328. if (element) {
  36329. if (!element.props) {
  36330. element.props = {};
  36331. }
  36332. element.props.class = [element.props.class, cls].join(" ");
  36333. }
  36334. }
  36335. vue.provide(elPaginationKey, {
  36336. pageCount: pageCountBridge,
  36337. disabled: vue.computed(() => props.disabled),
  36338. currentPage: currentPageBridge,
  36339. changeEvent: handleCurrentChange,
  36340. handleSizeChange
  36341. });
  36342. return () => {
  36343. var _a, _b;
  36344. if (!assertValidUsage.value) {
  36345. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  36346. return null;
  36347. }
  36348. if (!props.layout)
  36349. return null;
  36350. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  36351. return null;
  36352. const rootChildren = [];
  36353. const rightWrapperChildren = [];
  36354. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  36355. const TEMPLATE_MAP = {
  36356. prev: vue.h(Prev, {
  36357. disabled: props.disabled,
  36358. currentPage: currentPageBridge.value,
  36359. prevText: props.prevText,
  36360. prevIcon: props.prevIcon,
  36361. onClick: prev
  36362. }),
  36363. jumper: vue.h(Jumper, {
  36364. size: _size.value
  36365. }),
  36366. pager: vue.h(Pager, {
  36367. currentPage: currentPageBridge.value,
  36368. pageCount: pageCountBridge.value,
  36369. pagerCount: props.pagerCount,
  36370. onChange: handleCurrentChange,
  36371. disabled: props.disabled
  36372. }),
  36373. next: vue.h(Next, {
  36374. disabled: props.disabled,
  36375. currentPage: currentPageBridge.value,
  36376. pageCount: pageCountBridge.value,
  36377. nextText: props.nextText,
  36378. nextIcon: props.nextIcon,
  36379. onClick: next
  36380. }),
  36381. sizes: vue.h(Sizes, {
  36382. pageSize: pageSizeBridge.value,
  36383. pageSizes: props.pageSizes,
  36384. popperClass: props.popperClass,
  36385. disabled: props.disabled,
  36386. teleported: props.teleported,
  36387. size: _size.value,
  36388. appendSizeTo: props.appendSizeTo
  36389. }),
  36390. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  36391. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  36392. };
  36393. const components = props.layout.split(",").map((item) => item.trim());
  36394. let haveRightWrapper = false;
  36395. components.forEach((c) => {
  36396. if (c === "->") {
  36397. haveRightWrapper = true;
  36398. return;
  36399. }
  36400. if (!haveRightWrapper) {
  36401. rootChildren.push(TEMPLATE_MAP[c]);
  36402. } else {
  36403. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  36404. }
  36405. });
  36406. addClass(rootChildren[0], ns.is("first"));
  36407. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  36408. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  36409. addClass(rightWrapperChildren[0], ns.is("first"));
  36410. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  36411. rootChildren.push(rightWrapperRoot);
  36412. }
  36413. return vue.h("div", {
  36414. class: [
  36415. ns.b(),
  36416. ns.is("background", props.background),
  36417. ns.m(_size.value)
  36418. ]
  36419. }, rootChildren);
  36420. };
  36421. }
  36422. });
  36423. const ElPagination = withInstall(Pagination);
  36424. const popconfirmProps = buildProps({
  36425. title: String,
  36426. confirmButtonText: String,
  36427. cancelButtonText: String,
  36428. confirmButtonType: {
  36429. type: String,
  36430. values: buttonTypes,
  36431. default: "primary"
  36432. },
  36433. cancelButtonType: {
  36434. type: String,
  36435. values: buttonTypes,
  36436. default: "text"
  36437. },
  36438. icon: {
  36439. type: iconPropType,
  36440. default: () => question_filled_default
  36441. },
  36442. iconColor: {
  36443. type: String,
  36444. default: "#f90"
  36445. },
  36446. hideIcon: {
  36447. type: Boolean,
  36448. default: false
  36449. },
  36450. hideAfter: {
  36451. type: Number,
  36452. default: 200
  36453. },
  36454. teleported: useTooltipContentProps.teleported,
  36455. persistent: useTooltipContentProps.persistent,
  36456. width: {
  36457. type: [String, Number],
  36458. default: 150
  36459. }
  36460. });
  36461. const popconfirmEmits = {
  36462. confirm: (e) => e instanceof MouseEvent,
  36463. cancel: (e) => e instanceof MouseEvent
  36464. };
  36465. const __default__$J = vue.defineComponent({
  36466. name: "ElPopconfirm"
  36467. });
  36468. const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
  36469. ...__default__$J,
  36470. props: popconfirmProps,
  36471. emits: popconfirmEmits,
  36472. setup(__props, { emit }) {
  36473. const props = __props;
  36474. const { t } = useLocale();
  36475. const ns = useNamespace("popconfirm");
  36476. const tooltipRef = vue.ref();
  36477. const hidePopper = () => {
  36478. var _a, _b;
  36479. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  36480. };
  36481. const style = vue.computed(() => {
  36482. return {
  36483. width: addUnit(props.width)
  36484. };
  36485. });
  36486. const confirm = (e) => {
  36487. emit("confirm", e);
  36488. hidePopper();
  36489. };
  36490. const cancel = (e) => {
  36491. emit("cancel", e);
  36492. hidePopper();
  36493. };
  36494. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  36495. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  36496. return (_ctx, _cache) => {
  36497. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  36498. ref_key: "tooltipRef",
  36499. ref: tooltipRef,
  36500. trigger: "click",
  36501. effect: "light"
  36502. }, _ctx.$attrs, {
  36503. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  36504. "popper-style": vue.unref(style),
  36505. teleported: _ctx.teleported,
  36506. "fallback-placements": ["bottom", "top", "right", "left"],
  36507. "hide-after": _ctx.hideAfter,
  36508. persistent: _ctx.persistent
  36509. }), {
  36510. content: vue.withCtx(() => [
  36511. vue.createElementVNode("div", {
  36512. class: vue.normalizeClass(vue.unref(ns).b())
  36513. }, [
  36514. vue.createElementVNode("div", {
  36515. class: vue.normalizeClass(vue.unref(ns).e("main"))
  36516. }, [
  36517. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  36518. key: 0,
  36519. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  36520. style: vue.normalizeStyle({ color: _ctx.iconColor })
  36521. }, {
  36522. default: vue.withCtx(() => [
  36523. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  36524. ]),
  36525. _: 1
  36526. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  36527. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  36528. ], 2),
  36529. vue.createElementVNode("div", {
  36530. class: vue.normalizeClass(vue.unref(ns).e("action"))
  36531. }, [
  36532. vue.renderSlot(_ctx.$slots, "actions", {
  36533. confirm,
  36534. cancel
  36535. }, () => [
  36536. vue.createVNode(vue.unref(ElButton), {
  36537. size: "small",
  36538. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  36539. text: _ctx.cancelButtonType === "text",
  36540. onClick: cancel
  36541. }, {
  36542. default: vue.withCtx(() => [
  36543. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  36544. ]),
  36545. _: 1
  36546. }, 8, ["type", "text"]),
  36547. vue.createVNode(vue.unref(ElButton), {
  36548. size: "small",
  36549. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  36550. text: _ctx.confirmButtonType === "text",
  36551. onClick: confirm
  36552. }, {
  36553. default: vue.withCtx(() => [
  36554. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  36555. ]),
  36556. _: 1
  36557. }, 8, ["type", "text"])
  36558. ])
  36559. ], 2)
  36560. ], 2)
  36561. ]),
  36562. default: vue.withCtx(() => [
  36563. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  36564. ]),
  36565. _: 3
  36566. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  36567. };
  36568. }
  36569. });
  36570. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "popconfirm.vue"]]);
  36571. const ElPopconfirm = withInstall(Popconfirm);
  36572. const popoverProps = buildProps({
  36573. trigger: useTooltipTriggerProps.trigger,
  36574. triggerKeys: useTooltipTriggerProps.triggerKeys,
  36575. placement: dropdownProps.placement,
  36576. disabled: useTooltipTriggerProps.disabled,
  36577. visible: useTooltipContentProps.visible,
  36578. transition: useTooltipContentProps.transition,
  36579. popperOptions: dropdownProps.popperOptions,
  36580. tabindex: dropdownProps.tabindex,
  36581. content: useTooltipContentProps.content,
  36582. popperStyle: useTooltipContentProps.popperStyle,
  36583. popperClass: useTooltipContentProps.popperClass,
  36584. enterable: {
  36585. ...useTooltipContentProps.enterable,
  36586. default: true
  36587. },
  36588. effect: {
  36589. ...useTooltipContentProps.effect,
  36590. default: "light"
  36591. },
  36592. teleported: useTooltipContentProps.teleported,
  36593. title: String,
  36594. width: {
  36595. type: [String, Number],
  36596. default: 150
  36597. },
  36598. offset: {
  36599. type: Number,
  36600. default: void 0
  36601. },
  36602. showAfter: {
  36603. type: Number,
  36604. default: 0
  36605. },
  36606. hideAfter: {
  36607. type: Number,
  36608. default: 200
  36609. },
  36610. autoClose: {
  36611. type: Number,
  36612. default: 0
  36613. },
  36614. showArrow: {
  36615. type: Boolean,
  36616. default: true
  36617. },
  36618. persistent: {
  36619. type: Boolean,
  36620. default: true
  36621. },
  36622. "onUpdate:visible": {
  36623. type: Function
  36624. }
  36625. });
  36626. const popoverEmits = {
  36627. "update:visible": (value) => isBoolean(value),
  36628. "before-enter": () => true,
  36629. "before-leave": () => true,
  36630. "after-enter": () => true,
  36631. "after-leave": () => true
  36632. };
  36633. const updateEventKeyRaw = `onUpdate:visible`;
  36634. const __default__$I = vue.defineComponent({
  36635. name: "ElPopover"
  36636. });
  36637. const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
  36638. ...__default__$I,
  36639. props: popoverProps,
  36640. emits: popoverEmits,
  36641. setup(__props, { expose, emit }) {
  36642. const props = __props;
  36643. const onUpdateVisible = vue.computed(() => {
  36644. return props[updateEventKeyRaw];
  36645. });
  36646. const ns = useNamespace("popover");
  36647. const tooltipRef = vue.ref();
  36648. const popperRef = vue.computed(() => {
  36649. var _a;
  36650. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  36651. });
  36652. const style = vue.computed(() => {
  36653. return [
  36654. {
  36655. width: addUnit(props.width)
  36656. },
  36657. props.popperStyle
  36658. ];
  36659. });
  36660. const kls = vue.computed(() => {
  36661. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  36662. });
  36663. const gpuAcceleration = vue.computed(() => {
  36664. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  36665. });
  36666. const hide = () => {
  36667. var _a;
  36668. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  36669. };
  36670. const beforeEnter = () => {
  36671. emit("before-enter");
  36672. };
  36673. const beforeLeave = () => {
  36674. emit("before-leave");
  36675. };
  36676. const afterEnter = () => {
  36677. emit("after-enter");
  36678. };
  36679. const afterLeave = () => {
  36680. emit("update:visible", false);
  36681. emit("after-leave");
  36682. };
  36683. expose({
  36684. popperRef,
  36685. hide
  36686. });
  36687. return (_ctx, _cache) => {
  36688. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  36689. ref_key: "tooltipRef",
  36690. ref: tooltipRef
  36691. }, _ctx.$attrs, {
  36692. trigger: _ctx.trigger,
  36693. "trigger-keys": _ctx.triggerKeys,
  36694. placement: _ctx.placement,
  36695. disabled: _ctx.disabled,
  36696. visible: _ctx.visible,
  36697. transition: _ctx.transition,
  36698. "popper-options": _ctx.popperOptions,
  36699. tabindex: _ctx.tabindex,
  36700. content: _ctx.content,
  36701. offset: _ctx.offset,
  36702. "show-after": _ctx.showAfter,
  36703. "hide-after": _ctx.hideAfter,
  36704. "auto-close": _ctx.autoClose,
  36705. "show-arrow": _ctx.showArrow,
  36706. "aria-label": _ctx.title,
  36707. effect: _ctx.effect,
  36708. enterable: _ctx.enterable,
  36709. "popper-class": vue.unref(kls),
  36710. "popper-style": vue.unref(style),
  36711. teleported: _ctx.teleported,
  36712. persistent: _ctx.persistent,
  36713. "gpu-acceleration": vue.unref(gpuAcceleration),
  36714. "onUpdate:visible": vue.unref(onUpdateVisible),
  36715. onBeforeShow: beforeEnter,
  36716. onBeforeHide: beforeLeave,
  36717. onShow: afterEnter,
  36718. onHide: afterLeave
  36719. }), {
  36720. content: vue.withCtx(() => [
  36721. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  36722. key: 0,
  36723. class: vue.normalizeClass(vue.unref(ns).e("title")),
  36724. role: "title"
  36725. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  36726. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  36727. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  36728. ])
  36729. ]),
  36730. default: vue.withCtx(() => [
  36731. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  36732. ]),
  36733. _: 3
  36734. }, 16, ["trigger", "trigger-keys", "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"]);
  36735. };
  36736. }
  36737. });
  36738. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "popover.vue"]]);
  36739. const attachEvents = (el, binding) => {
  36740. const popperComponent = binding.arg || binding.value;
  36741. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  36742. if (popover) {
  36743. popover.triggerRef = el;
  36744. }
  36745. };
  36746. var PopoverDirective = {
  36747. mounted(el, binding) {
  36748. attachEvents(el, binding);
  36749. },
  36750. updated(el, binding) {
  36751. attachEvents(el, binding);
  36752. }
  36753. };
  36754. const VPopover = "popover";
  36755. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  36756. const ElPopover = withInstall(Popover, {
  36757. directive: ElPopoverDirective
  36758. });
  36759. const progressProps = buildProps({
  36760. type: {
  36761. type: String,
  36762. default: "line",
  36763. values: ["line", "circle", "dashboard"]
  36764. },
  36765. percentage: {
  36766. type: Number,
  36767. default: 0,
  36768. validator: (val) => val >= 0 && val <= 100
  36769. },
  36770. status: {
  36771. type: String,
  36772. default: "",
  36773. values: ["", "success", "exception", "warning"]
  36774. },
  36775. indeterminate: Boolean,
  36776. duration: {
  36777. type: Number,
  36778. default: 3
  36779. },
  36780. strokeWidth: {
  36781. type: Number,
  36782. default: 6
  36783. },
  36784. strokeLinecap: {
  36785. type: definePropType(String),
  36786. default: "round"
  36787. },
  36788. textInside: Boolean,
  36789. width: {
  36790. type: Number,
  36791. default: 126
  36792. },
  36793. showText: {
  36794. type: Boolean,
  36795. default: true
  36796. },
  36797. color: {
  36798. type: definePropType([
  36799. String,
  36800. Array,
  36801. Function
  36802. ]),
  36803. default: ""
  36804. },
  36805. striped: Boolean,
  36806. stripedFlow: Boolean,
  36807. format: {
  36808. type: definePropType(Function),
  36809. default: (percentage) => `${percentage}%`
  36810. }
  36811. });
  36812. const __default__$H = vue.defineComponent({
  36813. name: "ElProgress"
  36814. });
  36815. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  36816. ...__default__$H,
  36817. props: progressProps,
  36818. setup(__props) {
  36819. const props = __props;
  36820. const STATUS_COLOR_MAP = {
  36821. success: "#13ce66",
  36822. exception: "#ff4949",
  36823. warning: "#e6a23c",
  36824. default: "#20a0ff"
  36825. };
  36826. const ns = useNamespace("progress");
  36827. const barStyle = vue.computed(() => {
  36828. const barStyle2 = {
  36829. width: `${props.percentage}%`,
  36830. animationDuration: `${props.duration}s`
  36831. };
  36832. const color = getCurrentColor(props.percentage);
  36833. if (color.includes("gradient")) {
  36834. barStyle2.background = color;
  36835. } else {
  36836. barStyle2.backgroundColor = color;
  36837. }
  36838. return barStyle2;
  36839. });
  36840. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  36841. const radius = vue.computed(() => {
  36842. if (["circle", "dashboard"].includes(props.type)) {
  36843. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  36844. }
  36845. return 0;
  36846. });
  36847. const trackPath = vue.computed(() => {
  36848. const r = radius.value;
  36849. const isDashboard = props.type === "dashboard";
  36850. return `
  36851. M 50 50
  36852. m 0 ${isDashboard ? "" : "-"}${r}
  36853. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  36854. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  36855. `;
  36856. });
  36857. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  36858. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  36859. const strokeDashoffset = vue.computed(() => {
  36860. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  36861. return `${offset}px`;
  36862. });
  36863. const trailPathStyle = vue.computed(() => ({
  36864. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  36865. strokeDashoffset: strokeDashoffset.value
  36866. }));
  36867. const circlePathStyle = vue.computed(() => ({
  36868. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  36869. strokeDashoffset: strokeDashoffset.value,
  36870. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  36871. }));
  36872. const stroke = vue.computed(() => {
  36873. let ret;
  36874. if (props.color) {
  36875. ret = getCurrentColor(props.percentage);
  36876. } else {
  36877. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  36878. }
  36879. return ret;
  36880. });
  36881. const statusIcon = vue.computed(() => {
  36882. if (props.status === "warning") {
  36883. return warning_filled_default;
  36884. }
  36885. if (props.type === "line") {
  36886. return props.status === "success" ? circle_check_default : circle_close_default;
  36887. } else {
  36888. return props.status === "success" ? check_default : close_default;
  36889. }
  36890. });
  36891. const progressTextSize = vue.computed(() => {
  36892. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  36893. });
  36894. const content = vue.computed(() => props.format(props.percentage));
  36895. function getColors(color) {
  36896. const span = 100 / color.length;
  36897. const seriesColors = color.map((seriesColor, index) => {
  36898. if (isString$1(seriesColor)) {
  36899. return {
  36900. color: seriesColor,
  36901. percentage: (index + 1) * span
  36902. };
  36903. }
  36904. return seriesColor;
  36905. });
  36906. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  36907. }
  36908. const getCurrentColor = (percentage) => {
  36909. var _a;
  36910. const { color } = props;
  36911. if (isFunction$1(color)) {
  36912. return color(percentage);
  36913. } else if (isString$1(color)) {
  36914. return color;
  36915. } else {
  36916. const colors = getColors(color);
  36917. for (const color2 of colors) {
  36918. if (color2.percentage > percentage)
  36919. return color2.color;
  36920. }
  36921. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  36922. }
  36923. };
  36924. return (_ctx, _cache) => {
  36925. return vue.openBlock(), vue.createElementBlock("div", {
  36926. class: vue.normalizeClass([
  36927. vue.unref(ns).b(),
  36928. vue.unref(ns).m(_ctx.type),
  36929. vue.unref(ns).is(_ctx.status),
  36930. {
  36931. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  36932. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  36933. }
  36934. ]),
  36935. role: "progressbar",
  36936. "aria-valuenow": _ctx.percentage,
  36937. "aria-valuemin": "0",
  36938. "aria-valuemax": "100"
  36939. }, [
  36940. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  36941. key: 0,
  36942. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  36943. }, [
  36944. vue.createElementVNode("div", {
  36945. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  36946. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  36947. }, [
  36948. vue.createElementVNode("div", {
  36949. class: vue.normalizeClass([
  36950. vue.unref(ns).be("bar", "inner"),
  36951. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  36952. { [vue.unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  36953. { [vue.unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  36954. ]),
  36955. style: vue.normalizeStyle(vue.unref(barStyle))
  36956. }, [
  36957. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  36958. key: 0,
  36959. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  36960. }, [
  36961. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  36962. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  36963. ])
  36964. ], 2)) : vue.createCommentVNode("v-if", true)
  36965. ], 6)
  36966. ], 6)
  36967. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  36968. key: 1,
  36969. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  36970. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  36971. }, [
  36972. (vue.openBlock(), vue.createElementBlock("svg", { viewBox: "0 0 100 100" }, [
  36973. vue.createElementVNode("path", {
  36974. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  36975. d: vue.unref(trackPath),
  36976. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  36977. "stroke-linecap": _ctx.strokeLinecap,
  36978. "stroke-width": vue.unref(relativeStrokeWidth),
  36979. fill: "none",
  36980. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  36981. }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
  36982. vue.createElementVNode("path", {
  36983. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  36984. d: vue.unref(trackPath),
  36985. stroke: vue.unref(stroke),
  36986. fill: "none",
  36987. opacity: _ctx.percentage ? 1 : 0,
  36988. "stroke-linecap": _ctx.strokeLinecap,
  36989. "stroke-width": vue.unref(relativeStrokeWidth),
  36990. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  36991. }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
  36992. ]))
  36993. ], 6)),
  36994. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  36995. key: 2,
  36996. class: vue.normalizeClass(vue.unref(ns).e("text")),
  36997. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  36998. }, [
  36999. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  37000. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  37001. default: vue.withCtx(() => [
  37002. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  37003. ]),
  37004. _: 1
  37005. }))
  37006. ])
  37007. ], 6)) : vue.createCommentVNode("v-if", true)
  37008. ], 10, ["aria-valuenow"]);
  37009. };
  37010. }
  37011. });
  37012. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "progress.vue"]]);
  37013. const ElProgress = withInstall(Progress);
  37014. const rateProps = buildProps({
  37015. modelValue: {
  37016. type: Number,
  37017. default: 0
  37018. },
  37019. id: {
  37020. type: String,
  37021. default: void 0
  37022. },
  37023. lowThreshold: {
  37024. type: Number,
  37025. default: 2
  37026. },
  37027. highThreshold: {
  37028. type: Number,
  37029. default: 4
  37030. },
  37031. max: {
  37032. type: Number,
  37033. default: 5
  37034. },
  37035. colors: {
  37036. type: definePropType([Array, Object]),
  37037. default: () => mutable(["", "", ""])
  37038. },
  37039. voidColor: {
  37040. type: String,
  37041. default: ""
  37042. },
  37043. disabledVoidColor: {
  37044. type: String,
  37045. default: ""
  37046. },
  37047. icons: {
  37048. type: definePropType([Array, Object]),
  37049. default: () => [star_filled_default, star_filled_default, star_filled_default]
  37050. },
  37051. voidIcon: {
  37052. type: iconPropType,
  37053. default: () => star_default
  37054. },
  37055. disabledVoidIcon: {
  37056. type: iconPropType,
  37057. default: () => star_filled_default
  37058. },
  37059. disabled: Boolean,
  37060. allowHalf: Boolean,
  37061. showText: Boolean,
  37062. showScore: Boolean,
  37063. textColor: {
  37064. type: String,
  37065. default: ""
  37066. },
  37067. texts: {
  37068. type: definePropType(Array),
  37069. default: () => mutable([
  37070. "Extremely bad",
  37071. "Disappointed",
  37072. "Fair",
  37073. "Satisfied",
  37074. "Surprise"
  37075. ])
  37076. },
  37077. scoreTemplate: {
  37078. type: String,
  37079. default: "{value}"
  37080. },
  37081. size: useSizeProp,
  37082. clearable: Boolean,
  37083. ...useAriaProps(["ariaLabel"])
  37084. });
  37085. const rateEmits = {
  37086. [CHANGE_EVENT]: (value) => isNumber(value),
  37087. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  37088. };
  37089. const __default__$G = vue.defineComponent({
  37090. name: "ElRate"
  37091. });
  37092. const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
  37093. ...__default__$G,
  37094. props: rateProps,
  37095. emits: rateEmits,
  37096. setup(__props, { expose, emit }) {
  37097. const props = __props;
  37098. function getValueFromMap(value, map) {
  37099. const isExcludedObject = (val) => isObject$1(val);
  37100. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  37101. const val = map[key];
  37102. const excluded = isExcludedObject(val) ? val.excluded : false;
  37103. return excluded ? value < key : value <= key;
  37104. }).sort((a, b) => a - b);
  37105. const matchedValue = map[matchedKeys[0]];
  37106. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  37107. }
  37108. const formContext = vue.inject(formContextKey, void 0);
  37109. const formItemContext = vue.inject(formItemContextKey, void 0);
  37110. const rateSize = useFormSize();
  37111. const ns = useNamespace("rate");
  37112. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  37113. formItemContext
  37114. });
  37115. const currentValue = vue.ref(props.modelValue);
  37116. const hoverIndex = vue.ref(-1);
  37117. const pointerAtLeftHalf = vue.ref(true);
  37118. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  37119. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  37120. const rateStyles = vue.computed(() => {
  37121. return ns.cssVarBlock({
  37122. "void-color": props.voidColor,
  37123. "disabled-void-color": props.disabledVoidColor,
  37124. "fill-color": activeColor.value
  37125. });
  37126. });
  37127. const text = vue.computed(() => {
  37128. let result = "";
  37129. if (props.showScore) {
  37130. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  37131. } else if (props.showText) {
  37132. result = props.texts[Math.ceil(currentValue.value) - 1];
  37133. }
  37134. return result;
  37135. });
  37136. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  37137. const colorMap = vue.computed(() => isArray$1(props.colors) ? {
  37138. [props.lowThreshold]: props.colors[0],
  37139. [props.highThreshold]: { value: props.colors[1], excluded: true },
  37140. [props.max]: props.colors[2]
  37141. } : props.colors);
  37142. const activeColor = vue.computed(() => {
  37143. const color = getValueFromMap(currentValue.value, colorMap.value);
  37144. return isObject$1(color) ? "" : color;
  37145. });
  37146. const decimalStyle = vue.computed(() => {
  37147. let width = "";
  37148. if (rateDisabled.value) {
  37149. width = `${valueDecimal.value}%`;
  37150. } else if (props.allowHalf) {
  37151. width = "50%";
  37152. }
  37153. return {
  37154. color: activeColor.value,
  37155. width
  37156. };
  37157. });
  37158. const componentMap = vue.computed(() => {
  37159. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  37160. icons = vue.markRaw(icons);
  37161. return isArray$1(icons) ? {
  37162. [props.lowThreshold]: icons[0],
  37163. [props.highThreshold]: {
  37164. value: icons[1],
  37165. excluded: true
  37166. },
  37167. [props.max]: icons[2]
  37168. } : icons;
  37169. });
  37170. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  37171. const voidComponent = vue.computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : vue.markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : vue.markRaw(props.voidIcon));
  37172. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  37173. function showDecimalIcon(item) {
  37174. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  37175. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  37176. return showWhenDisabled || showWhenAllowHalf;
  37177. }
  37178. function emitValue(value) {
  37179. if (props.clearable && value === props.modelValue) {
  37180. value = 0;
  37181. }
  37182. emit(UPDATE_MODEL_EVENT, value);
  37183. if (props.modelValue !== value) {
  37184. emit(CHANGE_EVENT, value);
  37185. }
  37186. }
  37187. function selectValue(value) {
  37188. if (rateDisabled.value) {
  37189. return;
  37190. }
  37191. if (props.allowHalf && pointerAtLeftHalf.value) {
  37192. emitValue(currentValue.value);
  37193. } else {
  37194. emitValue(value);
  37195. }
  37196. }
  37197. function handleKey(e) {
  37198. if (rateDisabled.value) {
  37199. return;
  37200. }
  37201. let _currentValue = currentValue.value;
  37202. const code = e.code;
  37203. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  37204. if (props.allowHalf) {
  37205. _currentValue += 0.5;
  37206. } else {
  37207. _currentValue += 1;
  37208. }
  37209. e.stopPropagation();
  37210. e.preventDefault();
  37211. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  37212. if (props.allowHalf) {
  37213. _currentValue -= 0.5;
  37214. } else {
  37215. _currentValue -= 1;
  37216. }
  37217. e.stopPropagation();
  37218. e.preventDefault();
  37219. }
  37220. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  37221. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  37222. emit(UPDATE_MODEL_EVENT, _currentValue);
  37223. emit(CHANGE_EVENT, _currentValue);
  37224. return _currentValue;
  37225. }
  37226. function setCurrentValue(value, event) {
  37227. if (rateDisabled.value) {
  37228. return;
  37229. }
  37230. if (props.allowHalf && event) {
  37231. let target = event.target;
  37232. if (hasClass(target, ns.e("item"))) {
  37233. target = target.querySelector(`.${ns.e("icon")}`);
  37234. }
  37235. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  37236. target = target.parentNode;
  37237. }
  37238. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  37239. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  37240. } else {
  37241. currentValue.value = value;
  37242. }
  37243. hoverIndex.value = value;
  37244. }
  37245. function resetCurrentValue() {
  37246. if (rateDisabled.value) {
  37247. return;
  37248. }
  37249. if (props.allowHalf) {
  37250. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37251. }
  37252. currentValue.value = props.modelValue;
  37253. hoverIndex.value = -1;
  37254. }
  37255. vue.watch(() => props.modelValue, (val) => {
  37256. currentValue.value = val;
  37257. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37258. });
  37259. if (!props.modelValue) {
  37260. emit(UPDATE_MODEL_EVENT, 0);
  37261. }
  37262. expose({
  37263. setCurrentValue,
  37264. resetCurrentValue
  37265. });
  37266. return (_ctx, _cache) => {
  37267. var _a;
  37268. return vue.openBlock(), vue.createElementBlock("div", {
  37269. id: vue.unref(inputId),
  37270. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  37271. role: "slider",
  37272. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
  37273. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  37274. "aria-valuenow": currentValue.value,
  37275. "aria-valuetext": vue.unref(text) || void 0,
  37276. "aria-valuemin": "0",
  37277. "aria-valuemax": _ctx.max,
  37278. tabindex: "0",
  37279. style: vue.normalizeStyle(vue.unref(rateStyles)),
  37280. onKeydown: handleKey
  37281. }, [
  37282. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  37283. return vue.openBlock(), vue.createElementBlock("span", {
  37284. key,
  37285. class: vue.normalizeClass(vue.unref(ns).e("item")),
  37286. onMousemove: ($event) => setCurrentValue(item, $event),
  37287. onMouseleave: resetCurrentValue,
  37288. onClick: ($event) => selectValue(item)
  37289. }, [
  37290. vue.createVNode(vue.unref(ElIcon), {
  37291. class: vue.normalizeClass([
  37292. vue.unref(ns).e("icon"),
  37293. { hover: hoverIndex.value === item },
  37294. vue.unref(ns).is("active", item <= currentValue.value)
  37295. ])
  37296. }, {
  37297. default: vue.withCtx(() => [
  37298. !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  37299. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  37300. [vue.vShow, item <= currentValue.value]
  37301. ]),
  37302. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  37303. [vue.vShow, !(item <= currentValue.value)]
  37304. ])
  37305. ], 64)) : vue.createCommentVNode("v-if", true),
  37306. showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  37307. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), {
  37308. class: vue.normalizeClass([vue.unref(ns).em("decimal", "box")])
  37309. }, null, 8, ["class"])),
  37310. vue.createVNode(vue.unref(ElIcon), {
  37311. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  37312. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  37313. }, {
  37314. default: vue.withCtx(() => [
  37315. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  37316. ]),
  37317. _: 1
  37318. }, 8, ["style", "class"])
  37319. ], 64)) : vue.createCommentVNode("v-if", true)
  37320. ]),
  37321. _: 2
  37322. }, 1032, ["class"])
  37323. ], 42, ["onMousemove", "onClick"]);
  37324. }), 128)),
  37325. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  37326. key: 0,
  37327. class: vue.normalizeClass(vue.unref(ns).e("text")),
  37328. style: vue.normalizeStyle({ color: _ctx.textColor })
  37329. }, vue.toDisplayString(vue.unref(text)), 7)) : vue.createCommentVNode("v-if", true)
  37330. ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
  37331. };
  37332. }
  37333. });
  37334. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "rate.vue"]]);
  37335. const ElRate = withInstall(Rate);
  37336. const IconMap = {
  37337. success: "icon-success",
  37338. warning: "icon-warning",
  37339. error: "icon-error",
  37340. info: "icon-info"
  37341. };
  37342. const IconComponentMap = {
  37343. [IconMap.success]: circle_check_filled_default,
  37344. [IconMap.warning]: warning_filled_default,
  37345. [IconMap.error]: circle_close_filled_default,
  37346. [IconMap.info]: info_filled_default
  37347. };
  37348. const resultProps = buildProps({
  37349. title: {
  37350. type: String,
  37351. default: ""
  37352. },
  37353. subTitle: {
  37354. type: String,
  37355. default: ""
  37356. },
  37357. icon: {
  37358. type: String,
  37359. values: ["success", "warning", "info", "error"],
  37360. default: "info"
  37361. }
  37362. });
  37363. const __default__$F = vue.defineComponent({
  37364. name: "ElResult"
  37365. });
  37366. const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
  37367. ...__default__$F,
  37368. props: resultProps,
  37369. setup(__props) {
  37370. const props = __props;
  37371. const ns = useNamespace("result");
  37372. const resultIcon = vue.computed(() => {
  37373. const icon = props.icon;
  37374. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  37375. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  37376. return {
  37377. class: iconClass,
  37378. component: iconComponent
  37379. };
  37380. });
  37381. return (_ctx, _cache) => {
  37382. return vue.openBlock(), vue.createElementBlock("div", {
  37383. class: vue.normalizeClass(vue.unref(ns).b())
  37384. }, [
  37385. vue.createElementVNode("div", {
  37386. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  37387. }, [
  37388. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  37389. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  37390. key: 0,
  37391. class: vue.normalizeClass(vue.unref(resultIcon).class)
  37392. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  37393. ])
  37394. ], 2),
  37395. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  37396. key: 0,
  37397. class: vue.normalizeClass(vue.unref(ns).e("title"))
  37398. }, [
  37399. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  37400. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  37401. ])
  37402. ], 2)) : vue.createCommentVNode("v-if", true),
  37403. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  37404. key: 1,
  37405. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  37406. }, [
  37407. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  37408. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  37409. ])
  37410. ], 2)) : vue.createCommentVNode("v-if", true),
  37411. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  37412. key: 2,
  37413. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  37414. }, [
  37415. vue.renderSlot(_ctx.$slots, "extra")
  37416. ], 2)) : vue.createCommentVNode("v-if", true)
  37417. ], 2);
  37418. };
  37419. }
  37420. });
  37421. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "result.vue"]]);
  37422. const ElResult = withInstall(Result);
  37423. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  37424. return typeof value === "number" && value !== value;
  37425. };
  37426. function isEqual(first, second) {
  37427. if (first === second) {
  37428. return true;
  37429. }
  37430. if (safeIsNaN(first) && safeIsNaN(second)) {
  37431. return true;
  37432. }
  37433. return false;
  37434. }
  37435. function areInputsEqual(newInputs, lastInputs) {
  37436. if (newInputs.length !== lastInputs.length) {
  37437. return false;
  37438. }
  37439. for (var i = 0; i < newInputs.length; i++) {
  37440. if (!isEqual(newInputs[i], lastInputs[i])) {
  37441. return false;
  37442. }
  37443. }
  37444. return true;
  37445. }
  37446. function memoizeOne(resultFn, isEqual2) {
  37447. if (isEqual2 === void 0) {
  37448. isEqual2 = areInputsEqual;
  37449. }
  37450. var cache = null;
  37451. function memoized() {
  37452. var newArgs = [];
  37453. for (var _i = 0; _i < arguments.length; _i++) {
  37454. newArgs[_i] = arguments[_i];
  37455. }
  37456. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  37457. return cache.lastResult;
  37458. }
  37459. var lastResult = resultFn.apply(this, newArgs);
  37460. cache = {
  37461. lastResult,
  37462. lastArgs: newArgs,
  37463. lastThis: this
  37464. };
  37465. return lastResult;
  37466. }
  37467. memoized.clear = function clear() {
  37468. cache = null;
  37469. };
  37470. return memoized;
  37471. }
  37472. const useCache = () => {
  37473. const vm = vue.getCurrentInstance();
  37474. const props = vm.proxy.$props;
  37475. return vue.computed(() => {
  37476. const _getItemStyleCache = (_, __, ___) => ({});
  37477. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  37478. });
  37479. };
  37480. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  37481. const ITEM_RENDER_EVT = "itemRendered";
  37482. const SCROLL_EVT = "scroll";
  37483. const FORWARD = "forward";
  37484. const BACKWARD = "backward";
  37485. const AUTO_ALIGNMENT = "auto";
  37486. const SMART_ALIGNMENT = "smart";
  37487. const START_ALIGNMENT = "start";
  37488. const CENTERED_ALIGNMENT = "center";
  37489. const END_ALIGNMENT = "end";
  37490. const HORIZONTAL = "horizontal";
  37491. const VERTICAL = "vertical";
  37492. const LTR = "ltr";
  37493. const RTL = "rtl";
  37494. const RTL_OFFSET_NAG = "negative";
  37495. const RTL_OFFSET_POS_ASC = "positive-ascending";
  37496. const RTL_OFFSET_POS_DESC = "positive-descending";
  37497. const ScrollbarDirKey = {
  37498. [HORIZONTAL]: "left",
  37499. [VERTICAL]: "top"
  37500. };
  37501. const SCROLLBAR_MIN_SIZE = 20;
  37502. const LayoutKeys = {
  37503. [HORIZONTAL]: "deltaX",
  37504. [VERTICAL]: "deltaY"
  37505. };
  37506. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  37507. let frameHandle;
  37508. let offset = 0;
  37509. const hasReachedEdge = (offset2) => {
  37510. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  37511. return edgeReached;
  37512. };
  37513. const onWheel = (e) => {
  37514. cAF(frameHandle);
  37515. const newOffset = e[LayoutKeys[layout.value]];
  37516. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  37517. return;
  37518. offset += newOffset;
  37519. if (!isFirefox()) {
  37520. e.preventDefault();
  37521. }
  37522. frameHandle = rAF(() => {
  37523. onWheelDelta(offset);
  37524. offset = 0;
  37525. });
  37526. };
  37527. return {
  37528. hasReachedEdge,
  37529. onWheel
  37530. };
  37531. };
  37532. var useWheel$1 = useWheel;
  37533. const itemSize$1 = buildProp({
  37534. type: definePropType([Number, Function]),
  37535. required: true
  37536. });
  37537. const estimatedItemSize = buildProp({
  37538. type: Number
  37539. });
  37540. const cache = buildProp({
  37541. type: Number,
  37542. default: 2
  37543. });
  37544. const direction = buildProp({
  37545. type: String,
  37546. values: ["ltr", "rtl"],
  37547. default: "ltr"
  37548. });
  37549. const initScrollOffset = buildProp({
  37550. type: Number,
  37551. default: 0
  37552. });
  37553. const total = buildProp({
  37554. type: Number,
  37555. required: true
  37556. });
  37557. const layout = buildProp({
  37558. type: String,
  37559. values: ["horizontal", "vertical"],
  37560. default: VERTICAL
  37561. });
  37562. const virtualizedProps = buildProps({
  37563. className: {
  37564. type: String,
  37565. default: ""
  37566. },
  37567. containerElement: {
  37568. type: definePropType([String, Object]),
  37569. default: "div"
  37570. },
  37571. data: {
  37572. type: definePropType(Array),
  37573. default: () => mutable([])
  37574. },
  37575. direction,
  37576. height: {
  37577. type: [String, Number],
  37578. required: true
  37579. },
  37580. innerElement: {
  37581. type: [String, Object],
  37582. default: "div"
  37583. },
  37584. style: {
  37585. type: definePropType([Object, String, Array])
  37586. },
  37587. useIsScrolling: {
  37588. type: Boolean,
  37589. default: false
  37590. },
  37591. width: {
  37592. type: [Number, String],
  37593. required: false
  37594. },
  37595. perfMode: {
  37596. type: Boolean,
  37597. default: true
  37598. },
  37599. scrollbarAlwaysOn: {
  37600. type: Boolean,
  37601. default: false
  37602. }
  37603. });
  37604. const virtualizedListProps = buildProps({
  37605. cache,
  37606. estimatedItemSize,
  37607. layout,
  37608. initScrollOffset,
  37609. total,
  37610. itemSize: itemSize$1,
  37611. ...virtualizedProps
  37612. });
  37613. const scrollbarSize = {
  37614. type: Number,
  37615. default: 6
  37616. };
  37617. const startGap = { type: Number, default: 0 };
  37618. const endGap = { type: Number, default: 2 };
  37619. const virtualizedGridProps = buildProps({
  37620. columnCache: cache,
  37621. columnWidth: itemSize$1,
  37622. estimatedColumnWidth: estimatedItemSize,
  37623. estimatedRowHeight: estimatedItemSize,
  37624. initScrollLeft: initScrollOffset,
  37625. initScrollTop: initScrollOffset,
  37626. itemKey: {
  37627. type: definePropType(Function),
  37628. default: ({
  37629. columnIndex,
  37630. rowIndex
  37631. }) => `${rowIndex}:${columnIndex}`
  37632. },
  37633. rowCache: cache,
  37634. rowHeight: itemSize$1,
  37635. totalColumn: total,
  37636. totalRow: total,
  37637. hScrollbarSize: scrollbarSize,
  37638. vScrollbarSize: scrollbarSize,
  37639. scrollbarStartGap: startGap,
  37640. scrollbarEndGap: endGap,
  37641. role: String,
  37642. ...virtualizedProps
  37643. });
  37644. const virtualizedScrollbarProps = buildProps({
  37645. alwaysOn: Boolean,
  37646. class: String,
  37647. layout,
  37648. total,
  37649. ratio: {
  37650. type: Number,
  37651. required: true
  37652. },
  37653. clientSize: {
  37654. type: Number,
  37655. required: true
  37656. },
  37657. scrollFrom: {
  37658. type: Number,
  37659. required: true
  37660. },
  37661. scrollbarSize,
  37662. startGap,
  37663. endGap,
  37664. visible: Boolean
  37665. });
  37666. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  37667. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  37668. const isRTL = (dir) => dir === RTL;
  37669. let cachedRTLResult = null;
  37670. function getRTLOffsetType(recalculate = false) {
  37671. if (cachedRTLResult === null || recalculate) {
  37672. const outerDiv = document.createElement("div");
  37673. const outerStyle = outerDiv.style;
  37674. outerStyle.width = "50px";
  37675. outerStyle.height = "50px";
  37676. outerStyle.overflow = "scroll";
  37677. outerStyle.direction = "rtl";
  37678. const innerDiv = document.createElement("div");
  37679. const innerStyle = innerDiv.style;
  37680. innerStyle.width = "100px";
  37681. innerStyle.height = "100px";
  37682. outerDiv.appendChild(innerDiv);
  37683. document.body.appendChild(outerDiv);
  37684. if (outerDiv.scrollLeft > 0) {
  37685. cachedRTLResult = RTL_OFFSET_POS_DESC;
  37686. } else {
  37687. outerDiv.scrollLeft = 1;
  37688. if (outerDiv.scrollLeft === 0) {
  37689. cachedRTLResult = RTL_OFFSET_NAG;
  37690. } else {
  37691. cachedRTLResult = RTL_OFFSET_POS_ASC;
  37692. }
  37693. }
  37694. document.body.removeChild(outerDiv);
  37695. return cachedRTLResult;
  37696. }
  37697. return cachedRTLResult;
  37698. }
  37699. function renderThumbStyle({ move, size, bar }, layout) {
  37700. const style = {};
  37701. const translate = `translate${bar.axis}(${move}px)`;
  37702. style[bar.size] = size;
  37703. style.transform = translate;
  37704. if (layout === "horizontal") {
  37705. style.height = "100%";
  37706. } else {
  37707. style.width = "100%";
  37708. }
  37709. return style;
  37710. }
  37711. const ScrollBar = vue.defineComponent({
  37712. name: "ElVirtualScrollBar",
  37713. props: virtualizedScrollbarProps,
  37714. emits: ["scroll", "start-move", "stop-move"],
  37715. setup(props, { emit }) {
  37716. const GAP = vue.computed(() => props.startGap + props.endGap);
  37717. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  37718. const nsScrollbar = useNamespace("scrollbar");
  37719. const trackRef = vue.ref();
  37720. const thumbRef = vue.ref();
  37721. let frameHandle = null;
  37722. let onselectstartStore = null;
  37723. const state = vue.reactive({
  37724. isDragging: false,
  37725. traveled: 0
  37726. });
  37727. const bar = vue.computed(() => BAR_MAP[props.layout]);
  37728. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  37729. const trackStyle = vue.computed(() => ({
  37730. position: "absolute",
  37731. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  37732. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  37733. [ScrollbarDirKey[props.layout]]: "2px",
  37734. right: "2px",
  37735. bottom: "2px",
  37736. borderRadius: "4px"
  37737. }));
  37738. const thumbSize = vue.computed(() => {
  37739. const ratio = props.ratio;
  37740. const clientSize = props.clientSize;
  37741. if (ratio >= 100) {
  37742. return Number.POSITIVE_INFINITY;
  37743. }
  37744. if (ratio >= 50) {
  37745. return ratio * clientSize / 100;
  37746. }
  37747. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  37748. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  37749. });
  37750. const thumbStyle = vue.computed(() => {
  37751. if (!Number.isFinite(thumbSize.value)) {
  37752. return {
  37753. display: "none"
  37754. };
  37755. }
  37756. const thumb = `${thumbSize.value}px`;
  37757. const style = renderThumbStyle({
  37758. bar: bar.value,
  37759. size: thumb,
  37760. move: state.traveled
  37761. }, props.layout);
  37762. return style;
  37763. });
  37764. const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP)));
  37765. const attachEvents = () => {
  37766. window.addEventListener("mousemove", onMouseMove);
  37767. window.addEventListener("mouseup", onMouseUp);
  37768. const thumbEl = vue.unref(thumbRef);
  37769. if (!thumbEl)
  37770. return;
  37771. onselectstartStore = document.onselectstart;
  37772. document.onselectstart = () => false;
  37773. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  37774. thumbEl.addEventListener("touchend", onMouseUp);
  37775. };
  37776. const detachEvents = () => {
  37777. window.removeEventListener("mousemove", onMouseMove);
  37778. window.removeEventListener("mouseup", onMouseUp);
  37779. document.onselectstart = onselectstartStore;
  37780. onselectstartStore = null;
  37781. const thumbEl = vue.unref(thumbRef);
  37782. if (!thumbEl)
  37783. return;
  37784. thumbEl.removeEventListener("touchmove", onMouseMove);
  37785. thumbEl.removeEventListener("touchend", onMouseUp);
  37786. };
  37787. const onThumbMouseDown = (e) => {
  37788. e.stopImmediatePropagation();
  37789. if (e.ctrlKey || [1, 2].includes(e.button)) {
  37790. return;
  37791. }
  37792. state.isDragging = true;
  37793. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  37794. emit("start-move");
  37795. attachEvents();
  37796. };
  37797. const onMouseUp = () => {
  37798. state.isDragging = false;
  37799. state[bar.value.axis] = 0;
  37800. emit("stop-move");
  37801. detachEvents();
  37802. };
  37803. const onMouseMove = (e) => {
  37804. const { isDragging } = state;
  37805. if (!isDragging)
  37806. return;
  37807. if (!thumbRef.value || !trackRef.value)
  37808. return;
  37809. const prevPage = state[bar.value.axis];
  37810. if (!prevPage)
  37811. return;
  37812. cAF(frameHandle);
  37813. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  37814. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  37815. const distance = offset - thumbClickPosition;
  37816. frameHandle = rAF(() => {
  37817. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  37818. emit("scroll", distance, totalSteps.value);
  37819. });
  37820. };
  37821. const clickTrackHandler = (e) => {
  37822. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  37823. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  37824. const distance = offset - thumbHalf;
  37825. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  37826. emit("scroll", distance, totalSteps.value);
  37827. };
  37828. vue.watch(() => props.scrollFrom, (v) => {
  37829. if (state.isDragging)
  37830. return;
  37831. state.traveled = Math.ceil(v * totalSteps.value);
  37832. });
  37833. vue.onBeforeUnmount(() => {
  37834. detachEvents();
  37835. });
  37836. return () => {
  37837. return vue.h("div", {
  37838. role: "presentation",
  37839. ref: trackRef,
  37840. class: [
  37841. nsVirtualScrollbar.b(),
  37842. props.class,
  37843. (props.alwaysOn || state.isDragging) && "always-on"
  37844. ],
  37845. style: trackStyle.value,
  37846. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  37847. onTouchstartPrevent: onThumbMouseDown
  37848. }, vue.h("div", {
  37849. ref: thumbRef,
  37850. class: nsScrollbar.e("thumb"),
  37851. style: thumbStyle.value,
  37852. onMousedown: onThumbMouseDown
  37853. }, []));
  37854. };
  37855. }
  37856. });
  37857. var Scrollbar = ScrollBar;
  37858. const createList = ({
  37859. name,
  37860. getOffset,
  37861. getItemSize,
  37862. getItemOffset,
  37863. getEstimatedTotalSize,
  37864. getStartIndexForOffset,
  37865. getStopIndexForStartIndex,
  37866. initCache,
  37867. clearCache,
  37868. validateProps
  37869. }) => {
  37870. return vue.defineComponent({
  37871. name: name != null ? name : "ElVirtualList",
  37872. props: virtualizedListProps,
  37873. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  37874. setup(props, { emit, expose }) {
  37875. validateProps(props);
  37876. const instance = vue.getCurrentInstance();
  37877. const ns = useNamespace("vl");
  37878. const dynamicSizeCache = vue.ref(initCache(props, instance));
  37879. const getItemStyleCache = useCache();
  37880. const windowRef = vue.ref();
  37881. const innerRef = vue.ref();
  37882. const scrollbarRef = vue.ref();
  37883. const states = vue.ref({
  37884. isScrolling: false,
  37885. scrollDir: "forward",
  37886. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  37887. updateRequested: false,
  37888. isScrollbarDragging: false,
  37889. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  37890. });
  37891. const itemsToRender = vue.computed(() => {
  37892. const { total, cache } = props;
  37893. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  37894. if (total === 0) {
  37895. return [0, 0, 0, 0];
  37896. }
  37897. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  37898. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  37899. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  37900. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  37901. return [
  37902. Math.max(0, startIndex - cacheBackward),
  37903. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  37904. startIndex,
  37905. stopIndex
  37906. ];
  37907. });
  37908. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  37909. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  37910. const windowStyle = vue.computed(() => [
  37911. {
  37912. position: "relative",
  37913. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  37914. WebkitOverflowScrolling: "touch",
  37915. willChange: "transform"
  37916. },
  37917. {
  37918. direction: props.direction,
  37919. height: isNumber(props.height) ? `${props.height}px` : props.height,
  37920. width: isNumber(props.width) ? `${props.width}px` : props.width
  37921. },
  37922. props.style
  37923. ]);
  37924. const innerStyle = vue.computed(() => {
  37925. const size = vue.unref(estimatedTotalSize);
  37926. const horizontal = vue.unref(_isHorizontal);
  37927. return {
  37928. height: horizontal ? "100%" : `${size}px`,
  37929. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  37930. width: horizontal ? `${size}px` : "100%"
  37931. };
  37932. });
  37933. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  37934. const { onWheel } = useWheel$1({
  37935. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  37936. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  37937. layout: vue.computed(() => props.layout)
  37938. }, (offset) => {
  37939. var _a, _b;
  37940. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  37941. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  37942. });
  37943. useEventListener(windowRef, "wheel", onWheel, {
  37944. passive: false
  37945. });
  37946. const emitEvents = () => {
  37947. const { total } = props;
  37948. if (total > 0) {
  37949. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  37950. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  37951. }
  37952. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  37953. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  37954. };
  37955. const scrollVertically = (e) => {
  37956. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  37957. const _states = vue.unref(states);
  37958. if (_states.scrollOffset === scrollTop) {
  37959. return;
  37960. }
  37961. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  37962. states.value = {
  37963. ..._states,
  37964. isScrolling: true,
  37965. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37966. scrollOffset,
  37967. updateRequested: false
  37968. };
  37969. vue.nextTick(resetIsScrolling);
  37970. };
  37971. const scrollHorizontally = (e) => {
  37972. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  37973. const _states = vue.unref(states);
  37974. if (_states.scrollOffset === scrollLeft) {
  37975. return;
  37976. }
  37977. const { direction } = props;
  37978. let scrollOffset = scrollLeft;
  37979. if (direction === RTL) {
  37980. switch (getRTLOffsetType()) {
  37981. case RTL_OFFSET_NAG: {
  37982. scrollOffset = -scrollLeft;
  37983. break;
  37984. }
  37985. case RTL_OFFSET_POS_DESC: {
  37986. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  37987. break;
  37988. }
  37989. }
  37990. }
  37991. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  37992. states.value = {
  37993. ..._states,
  37994. isScrolling: true,
  37995. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37996. scrollOffset,
  37997. updateRequested: false
  37998. };
  37999. vue.nextTick(resetIsScrolling);
  38000. };
  38001. const onScroll = (e) => {
  38002. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  38003. emitEvents();
  38004. };
  38005. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  38006. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  38007. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  38008. };
  38009. const scrollTo = (offset) => {
  38010. offset = Math.max(offset, 0);
  38011. if (offset === vue.unref(states).scrollOffset) {
  38012. return;
  38013. }
  38014. states.value = {
  38015. ...vue.unref(states),
  38016. scrollOffset: offset,
  38017. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  38018. updateRequested: true
  38019. };
  38020. vue.nextTick(resetIsScrolling);
  38021. };
  38022. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  38023. const { scrollOffset } = vue.unref(states);
  38024. idx = Math.max(0, Math.min(idx, props.total - 1));
  38025. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  38026. };
  38027. const getItemStyle = (idx) => {
  38028. const { direction, itemSize, layout } = props;
  38029. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  38030. let style;
  38031. if (hasOwn(itemStyleCache, String(idx))) {
  38032. style = itemStyleCache[idx];
  38033. } else {
  38034. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  38035. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  38036. const horizontal = vue.unref(_isHorizontal);
  38037. const isRtl = direction === RTL;
  38038. const offsetHorizontal = horizontal ? offset : 0;
  38039. itemStyleCache[idx] = style = {
  38040. position: "absolute",
  38041. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  38042. right: isRtl ? `${offsetHorizontal}px` : void 0,
  38043. top: !horizontal ? `${offset}px` : 0,
  38044. height: !horizontal ? `${size}px` : "100%",
  38045. width: horizontal ? `${size}px` : "100%"
  38046. };
  38047. }
  38048. return style;
  38049. };
  38050. const resetIsScrolling = () => {
  38051. states.value.isScrolling = false;
  38052. vue.nextTick(() => {
  38053. getItemStyleCache.value(-1, null, null);
  38054. });
  38055. };
  38056. const resetScrollTop = () => {
  38057. const window = windowRef.value;
  38058. if (window) {
  38059. window.scrollTop = 0;
  38060. }
  38061. };
  38062. vue.onMounted(() => {
  38063. if (!isClient)
  38064. return;
  38065. const { initScrollOffset } = props;
  38066. const windowElement = vue.unref(windowRef);
  38067. if (isNumber(initScrollOffset) && windowElement) {
  38068. if (vue.unref(_isHorizontal)) {
  38069. windowElement.scrollLeft = initScrollOffset;
  38070. } else {
  38071. windowElement.scrollTop = initScrollOffset;
  38072. }
  38073. }
  38074. emitEvents();
  38075. });
  38076. vue.onUpdated(() => {
  38077. const { direction, layout } = props;
  38078. const { scrollOffset, updateRequested } = vue.unref(states);
  38079. const windowElement = vue.unref(windowRef);
  38080. if (updateRequested && windowElement) {
  38081. if (layout === HORIZONTAL) {
  38082. if (direction === RTL) {
  38083. switch (getRTLOffsetType()) {
  38084. case RTL_OFFSET_NAG: {
  38085. windowElement.scrollLeft = -scrollOffset;
  38086. break;
  38087. }
  38088. case RTL_OFFSET_POS_ASC: {
  38089. windowElement.scrollLeft = scrollOffset;
  38090. break;
  38091. }
  38092. default: {
  38093. const { clientWidth, scrollWidth } = windowElement;
  38094. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  38095. break;
  38096. }
  38097. }
  38098. } else {
  38099. windowElement.scrollLeft = scrollOffset;
  38100. }
  38101. } else {
  38102. windowElement.scrollTop = scrollOffset;
  38103. }
  38104. }
  38105. });
  38106. vue.onActivated(() => {
  38107. vue.unref(windowRef).scrollTop = vue.unref(states).scrollOffset;
  38108. });
  38109. const api = {
  38110. ns,
  38111. clientSize,
  38112. estimatedTotalSize,
  38113. windowStyle,
  38114. windowRef,
  38115. innerRef,
  38116. innerStyle,
  38117. itemsToRender,
  38118. scrollbarRef,
  38119. states,
  38120. getItemStyle,
  38121. onScroll,
  38122. onScrollbarScroll,
  38123. onWheel,
  38124. scrollTo,
  38125. scrollToItem,
  38126. resetScrollTop
  38127. };
  38128. expose({
  38129. windowRef,
  38130. innerRef,
  38131. getItemStyleCache,
  38132. scrollTo,
  38133. scrollToItem,
  38134. resetScrollTop,
  38135. states
  38136. });
  38137. return api;
  38138. },
  38139. render(ctx) {
  38140. var _a;
  38141. const {
  38142. $slots,
  38143. className,
  38144. clientSize,
  38145. containerElement,
  38146. data,
  38147. getItemStyle,
  38148. innerElement,
  38149. itemsToRender,
  38150. innerStyle,
  38151. layout,
  38152. total,
  38153. onScroll,
  38154. onScrollbarScroll,
  38155. states,
  38156. useIsScrolling,
  38157. windowStyle,
  38158. ns
  38159. } = ctx;
  38160. const [start, end] = itemsToRender;
  38161. const Container = vue.resolveDynamicComponent(containerElement);
  38162. const Inner = vue.resolveDynamicComponent(innerElement);
  38163. const children = [];
  38164. if (total > 0) {
  38165. for (let i = start; i <= end; i++) {
  38166. children.push(vue.h(vue.Fragment, { key: i }, (_a = $slots.default) == null ? void 0 : _a.call($slots, {
  38167. data,
  38168. index: i,
  38169. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  38170. style: getItemStyle(i)
  38171. })));
  38172. }
  38173. }
  38174. const InnerNode = [
  38175. vue.h(Inner, {
  38176. style: innerStyle,
  38177. ref: "innerRef"
  38178. }, !isString$1(Inner) ? {
  38179. default: () => children
  38180. } : children)
  38181. ];
  38182. const scrollbar = vue.h(Scrollbar, {
  38183. ref: "scrollbarRef",
  38184. clientSize,
  38185. layout,
  38186. onScroll: onScrollbarScroll,
  38187. ratio: clientSize * 100 / this.estimatedTotalSize,
  38188. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  38189. total
  38190. });
  38191. const listContainer = vue.h(Container, {
  38192. class: [ns.e("window"), className],
  38193. style: windowStyle,
  38194. onScroll,
  38195. ref: "windowRef",
  38196. key: 0
  38197. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  38198. return vue.h("div", {
  38199. key: 0,
  38200. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  38201. }, [listContainer, scrollbar]);
  38202. }
  38203. });
  38204. };
  38205. var createList$1 = createList;
  38206. const FixedSizeList = createList$1({
  38207. name: "ElFixedSizeList",
  38208. getItemOffset: ({ itemSize }, index) => index * itemSize,
  38209. getItemSize: ({ itemSize }) => itemSize,
  38210. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  38211. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  38212. const size = isHorizontal(layout) ? width : height;
  38213. const lastItemOffset = Math.max(0, total * itemSize - size);
  38214. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  38215. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  38216. if (alignment === SMART_ALIGNMENT) {
  38217. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38218. alignment = AUTO_ALIGNMENT;
  38219. } else {
  38220. alignment = CENTERED_ALIGNMENT;
  38221. }
  38222. }
  38223. switch (alignment) {
  38224. case START_ALIGNMENT: {
  38225. return maxOffset;
  38226. }
  38227. case END_ALIGNMENT: {
  38228. return minOffset;
  38229. }
  38230. case CENTERED_ALIGNMENT: {
  38231. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38232. if (middleOffset < Math.ceil(size / 2)) {
  38233. return 0;
  38234. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  38235. return lastItemOffset;
  38236. } else {
  38237. return middleOffset;
  38238. }
  38239. }
  38240. case AUTO_ALIGNMENT:
  38241. default: {
  38242. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38243. return scrollOffset;
  38244. } else if (scrollOffset < minOffset) {
  38245. return minOffset;
  38246. } else {
  38247. return maxOffset;
  38248. }
  38249. }
  38250. }
  38251. },
  38252. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  38253. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  38254. const offset = startIndex * itemSize;
  38255. const size = isHorizontal(layout) ? width : height;
  38256. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  38257. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  38258. },
  38259. initCache() {
  38260. return void 0;
  38261. },
  38262. clearCache: true,
  38263. validateProps() {
  38264. }
  38265. });
  38266. var FixedSizeList$1 = FixedSizeList;
  38267. const getItemFromCache$1 = (props, index, listCache) => {
  38268. const { itemSize } = props;
  38269. const { items, lastVisitedIndex } = listCache;
  38270. if (index > lastVisitedIndex) {
  38271. let offset = 0;
  38272. if (lastVisitedIndex >= 0) {
  38273. const item = items[lastVisitedIndex];
  38274. offset = item.offset + item.size;
  38275. }
  38276. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  38277. const size = itemSize(i);
  38278. items[i] = {
  38279. offset,
  38280. size
  38281. };
  38282. offset += size;
  38283. }
  38284. listCache.lastVisitedIndex = index;
  38285. }
  38286. return items[index];
  38287. };
  38288. const findItem$1 = (props, listCache, offset) => {
  38289. const { items, lastVisitedIndex } = listCache;
  38290. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  38291. if (lastVisitedOffset >= offset) {
  38292. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  38293. }
  38294. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  38295. };
  38296. const bs$1 = (props, listCache, low, high, offset) => {
  38297. while (low <= high) {
  38298. const mid = low + Math.floor((high - low) / 2);
  38299. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  38300. if (currentOffset === offset) {
  38301. return mid;
  38302. } else if (currentOffset < offset) {
  38303. low = mid + 1;
  38304. } else if (currentOffset > offset) {
  38305. high = mid - 1;
  38306. }
  38307. }
  38308. return Math.max(0, low - 1);
  38309. };
  38310. const es$1 = (props, listCache, index, offset) => {
  38311. const { total } = props;
  38312. let exponent = 1;
  38313. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  38314. index += exponent;
  38315. exponent *= 2;
  38316. }
  38317. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  38318. };
  38319. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  38320. let totalSizeOfMeasuredItems = 0;
  38321. if (lastVisitedIndex >= total) {
  38322. lastVisitedIndex = total - 1;
  38323. }
  38324. if (lastVisitedIndex >= 0) {
  38325. const item = items[lastVisitedIndex];
  38326. totalSizeOfMeasuredItems = item.offset + item.size;
  38327. }
  38328. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  38329. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  38330. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  38331. };
  38332. const DynamicSizeList = createList$1({
  38333. name: "ElDynamicSizeList",
  38334. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  38335. getItemSize: (_, index, { items }) => items[index].size,
  38336. getEstimatedTotalSize,
  38337. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  38338. const { height, layout, width } = props;
  38339. const size = isHorizontal(layout) ? width : height;
  38340. const item = getItemFromCache$1(props, index, listCache);
  38341. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  38342. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  38343. const minOffset = Math.max(0, item.offset - size + item.size);
  38344. if (alignment === SMART_ALIGNMENT) {
  38345. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38346. alignment = AUTO_ALIGNMENT;
  38347. } else {
  38348. alignment = CENTERED_ALIGNMENT;
  38349. }
  38350. }
  38351. switch (alignment) {
  38352. case START_ALIGNMENT: {
  38353. return maxOffset;
  38354. }
  38355. case END_ALIGNMENT: {
  38356. return minOffset;
  38357. }
  38358. case CENTERED_ALIGNMENT: {
  38359. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38360. }
  38361. case AUTO_ALIGNMENT:
  38362. default: {
  38363. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38364. return scrollOffset;
  38365. } else if (scrollOffset < minOffset) {
  38366. return minOffset;
  38367. } else {
  38368. return maxOffset;
  38369. }
  38370. }
  38371. }
  38372. },
  38373. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  38374. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  38375. const { height, total, layout, width } = props;
  38376. const size = isHorizontal(layout) ? width : height;
  38377. const item = getItemFromCache$1(props, startIndex, listCache);
  38378. const maxOffset = scrollOffset + size;
  38379. let offset = item.offset + item.size;
  38380. let stopIndex = startIndex;
  38381. while (stopIndex < total - 1 && offset < maxOffset) {
  38382. stopIndex++;
  38383. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  38384. }
  38385. return stopIndex;
  38386. },
  38387. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  38388. const cache = {
  38389. items: {},
  38390. estimatedItemSize,
  38391. lastVisitedIndex: -1
  38392. };
  38393. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  38394. var _a, _b;
  38395. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  38396. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  38397. if (forceUpdate) {
  38398. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  38399. }
  38400. };
  38401. return cache;
  38402. },
  38403. clearCache: false,
  38404. validateProps: ({ itemSize }) => {
  38405. }
  38406. });
  38407. var DynamicSizeList$1 = DynamicSizeList;
  38408. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  38409. let frameHandle = null;
  38410. let xOffset = 0;
  38411. let yOffset = 0;
  38412. const hasReachedEdge = (x, y) => {
  38413. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  38414. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  38415. return xEdgeReached && yEdgeReached;
  38416. };
  38417. const onWheel = (e) => {
  38418. cAF(frameHandle);
  38419. let x = e.deltaX;
  38420. let y = e.deltaY;
  38421. if (Math.abs(x) > Math.abs(y)) {
  38422. y = 0;
  38423. } else {
  38424. x = 0;
  38425. }
  38426. if (e.shiftKey && y !== 0) {
  38427. x = y;
  38428. y = 0;
  38429. }
  38430. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  38431. return;
  38432. xOffset += x;
  38433. yOffset += y;
  38434. e.preventDefault();
  38435. frameHandle = rAF(() => {
  38436. onWheelDelta(xOffset, yOffset);
  38437. xOffset = 0;
  38438. yOffset = 0;
  38439. });
  38440. };
  38441. return {
  38442. hasReachedEdge,
  38443. onWheel
  38444. };
  38445. };
  38446. const createGrid = ({
  38447. name,
  38448. clearCache,
  38449. getColumnPosition,
  38450. getColumnStartIndexForOffset,
  38451. getColumnStopIndexForStartIndex,
  38452. getEstimatedTotalHeight,
  38453. getEstimatedTotalWidth,
  38454. getColumnOffset,
  38455. getRowOffset,
  38456. getRowPosition,
  38457. getRowStartIndexForOffset,
  38458. getRowStopIndexForStartIndex,
  38459. initCache,
  38460. injectToInstance,
  38461. validateProps
  38462. }) => {
  38463. return vue.defineComponent({
  38464. name: name != null ? name : "ElVirtualList",
  38465. props: virtualizedGridProps,
  38466. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  38467. setup(props, { emit, expose, slots }) {
  38468. const ns = useNamespace("vl");
  38469. validateProps(props);
  38470. const instance = vue.getCurrentInstance();
  38471. const cache = vue.ref(initCache(props, instance));
  38472. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  38473. const windowRef = vue.ref();
  38474. const hScrollbar = vue.ref();
  38475. const vScrollbar = vue.ref();
  38476. const innerRef = vue.ref(null);
  38477. const states = vue.ref({
  38478. isScrolling: false,
  38479. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  38480. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  38481. updateRequested: false,
  38482. xAxisScrollDir: FORWARD,
  38483. yAxisScrollDir: FORWARD
  38484. });
  38485. const getItemStyleCache = useCache();
  38486. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  38487. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  38488. const columnsToRender = vue.computed(() => {
  38489. const { totalColumn, totalRow, columnCache } = props;
  38490. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  38491. if (totalColumn === 0 || totalRow === 0) {
  38492. return [0, 0, 0, 0];
  38493. }
  38494. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  38495. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  38496. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  38497. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  38498. return [
  38499. Math.max(0, startIndex - cacheBackward),
  38500. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  38501. startIndex,
  38502. stopIndex
  38503. ];
  38504. });
  38505. const rowsToRender = vue.computed(() => {
  38506. const { totalColumn, totalRow, rowCache } = props;
  38507. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  38508. if (totalColumn === 0 || totalRow === 0) {
  38509. return [0, 0, 0, 0];
  38510. }
  38511. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  38512. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  38513. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  38514. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  38515. return [
  38516. Math.max(0, startIndex - cacheBackward),
  38517. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  38518. startIndex,
  38519. stopIndex
  38520. ];
  38521. });
  38522. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  38523. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  38524. const windowStyle = vue.computed(() => {
  38525. var _a;
  38526. return [
  38527. {
  38528. position: "relative",
  38529. overflow: "hidden",
  38530. WebkitOverflowScrolling: "touch",
  38531. willChange: "transform"
  38532. },
  38533. {
  38534. direction: props.direction,
  38535. height: isNumber(props.height) ? `${props.height}px` : props.height,
  38536. width: isNumber(props.width) ? `${props.width}px` : props.width
  38537. },
  38538. (_a = props.style) != null ? _a : {}
  38539. ];
  38540. });
  38541. const innerStyle = vue.computed(() => {
  38542. const width = `${vue.unref(estimatedTotalWidth)}px`;
  38543. const height = `${vue.unref(estimatedTotalHeight)}px`;
  38544. return {
  38545. height,
  38546. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  38547. width
  38548. };
  38549. });
  38550. const emitEvents = () => {
  38551. const { totalColumn, totalRow } = props;
  38552. if (totalColumn > 0 && totalRow > 0) {
  38553. const [
  38554. columnCacheStart,
  38555. columnCacheEnd,
  38556. columnVisibleStart,
  38557. columnVisibleEnd
  38558. ] = vue.unref(columnsToRender);
  38559. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  38560. emit(ITEM_RENDER_EVT, {
  38561. columnCacheStart,
  38562. columnCacheEnd,
  38563. rowCacheStart,
  38564. rowCacheEnd,
  38565. columnVisibleStart,
  38566. columnVisibleEnd,
  38567. rowVisibleStart,
  38568. rowVisibleEnd
  38569. });
  38570. }
  38571. const {
  38572. scrollLeft,
  38573. scrollTop,
  38574. updateRequested,
  38575. xAxisScrollDir,
  38576. yAxisScrollDir
  38577. } = vue.unref(states);
  38578. emit(SCROLL_EVT, {
  38579. xAxisScrollDir,
  38580. scrollLeft,
  38581. yAxisScrollDir,
  38582. scrollTop,
  38583. updateRequested
  38584. });
  38585. };
  38586. const onScroll = (e) => {
  38587. const {
  38588. clientHeight,
  38589. clientWidth,
  38590. scrollHeight,
  38591. scrollLeft,
  38592. scrollTop,
  38593. scrollWidth
  38594. } = e.currentTarget;
  38595. const _states = vue.unref(states);
  38596. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  38597. return;
  38598. }
  38599. let _scrollLeft = scrollLeft;
  38600. if (isRTL(props.direction)) {
  38601. switch (getRTLOffsetType()) {
  38602. case RTL_OFFSET_NAG:
  38603. _scrollLeft = -scrollLeft;
  38604. break;
  38605. case RTL_OFFSET_POS_DESC:
  38606. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38607. break;
  38608. }
  38609. }
  38610. states.value = {
  38611. ..._states,
  38612. isScrolling: true,
  38613. scrollLeft: _scrollLeft,
  38614. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  38615. updateRequested: true,
  38616. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  38617. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  38618. };
  38619. vue.nextTick(() => resetIsScrolling());
  38620. onUpdated();
  38621. emitEvents();
  38622. };
  38623. const onVerticalScroll = (distance, totalSteps) => {
  38624. const height = vue.unref(parsedHeight);
  38625. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  38626. scrollTo({
  38627. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  38628. });
  38629. };
  38630. const onHorizontalScroll = (distance, totalSteps) => {
  38631. const width = vue.unref(parsedWidth);
  38632. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  38633. scrollTo({
  38634. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  38635. });
  38636. };
  38637. const { onWheel } = useGridWheel({
  38638. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  38639. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - vue.unref(parsedWidth)),
  38640. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  38641. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value - vue.unref(parsedHeight))
  38642. }, (x, y) => {
  38643. var _a, _b, _c, _d;
  38644. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  38645. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  38646. const width = vue.unref(parsedWidth);
  38647. const height = vue.unref(parsedHeight);
  38648. scrollTo({
  38649. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  38650. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  38651. });
  38652. });
  38653. useEventListener(windowRef, "wheel", onWheel, {
  38654. passive: false
  38655. });
  38656. const scrollTo = ({
  38657. scrollLeft = states.value.scrollLeft,
  38658. scrollTop = states.value.scrollTop
  38659. }) => {
  38660. scrollLeft = Math.max(scrollLeft, 0);
  38661. scrollTop = Math.max(scrollTop, 0);
  38662. const _states = vue.unref(states);
  38663. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  38664. return;
  38665. }
  38666. states.value = {
  38667. ..._states,
  38668. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  38669. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  38670. scrollLeft,
  38671. scrollTop,
  38672. updateRequested: true
  38673. };
  38674. vue.nextTick(() => resetIsScrolling());
  38675. onUpdated();
  38676. emitEvents();
  38677. };
  38678. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  38679. const _states = vue.unref(states);
  38680. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  38681. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  38682. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  38683. const _cache = vue.unref(cache);
  38684. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  38685. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  38686. scrollTo({
  38687. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  38688. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  38689. });
  38690. };
  38691. const getItemStyle = (rowIndex, columnIndex) => {
  38692. const { columnWidth, direction, rowHeight } = props;
  38693. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  38694. const key = `${rowIndex},${columnIndex}`;
  38695. if (hasOwn(itemStyleCache, key)) {
  38696. return itemStyleCache[key];
  38697. } else {
  38698. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  38699. const _cache = vue.unref(cache);
  38700. const rtl = isRTL(direction);
  38701. const [height, top] = getRowPosition(props, rowIndex, _cache);
  38702. const [width] = getColumnPosition(props, columnIndex, _cache);
  38703. itemStyleCache[key] = {
  38704. position: "absolute",
  38705. left: rtl ? void 0 : `${left}px`,
  38706. right: rtl ? `${left}px` : void 0,
  38707. top: `${top}px`,
  38708. height: `${height}px`,
  38709. width: `${width}px`
  38710. };
  38711. return itemStyleCache[key];
  38712. }
  38713. };
  38714. const resetIsScrolling = () => {
  38715. states.value.isScrolling = false;
  38716. vue.nextTick(() => {
  38717. getItemStyleCache.value(-1, null, null);
  38718. });
  38719. };
  38720. vue.onMounted(() => {
  38721. if (!isClient)
  38722. return;
  38723. const { initScrollLeft, initScrollTop } = props;
  38724. const windowElement = vue.unref(windowRef);
  38725. if (windowElement) {
  38726. if (isNumber(initScrollLeft)) {
  38727. windowElement.scrollLeft = initScrollLeft;
  38728. }
  38729. if (isNumber(initScrollTop)) {
  38730. windowElement.scrollTop = initScrollTop;
  38731. }
  38732. }
  38733. emitEvents();
  38734. });
  38735. const onUpdated = () => {
  38736. const { direction } = props;
  38737. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  38738. const windowElement = vue.unref(windowRef);
  38739. if (updateRequested && windowElement) {
  38740. if (direction === RTL) {
  38741. switch (getRTLOffsetType()) {
  38742. case RTL_OFFSET_NAG: {
  38743. windowElement.scrollLeft = -scrollLeft;
  38744. break;
  38745. }
  38746. case RTL_OFFSET_POS_ASC: {
  38747. windowElement.scrollLeft = scrollLeft;
  38748. break;
  38749. }
  38750. default: {
  38751. const { clientWidth, scrollWidth } = windowElement;
  38752. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38753. break;
  38754. }
  38755. }
  38756. } else {
  38757. windowElement.scrollLeft = Math.max(0, scrollLeft);
  38758. }
  38759. windowElement.scrollTop = Math.max(0, scrollTop);
  38760. }
  38761. };
  38762. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  38763. expose({
  38764. windowRef,
  38765. innerRef,
  38766. getItemStyleCache,
  38767. scrollTo,
  38768. scrollToItem,
  38769. states,
  38770. resetAfterColumnIndex,
  38771. resetAfterRowIndex,
  38772. resetAfter
  38773. });
  38774. const renderScrollbars = () => {
  38775. const {
  38776. scrollbarAlwaysOn,
  38777. scrollbarStartGap,
  38778. scrollbarEndGap,
  38779. totalColumn,
  38780. totalRow
  38781. } = props;
  38782. const width = vue.unref(parsedWidth);
  38783. const height = vue.unref(parsedHeight);
  38784. const estimatedWidth = vue.unref(estimatedTotalWidth);
  38785. const estimatedHeight = vue.unref(estimatedTotalHeight);
  38786. const { scrollLeft, scrollTop } = vue.unref(states);
  38787. const horizontalScrollbar = vue.h(Scrollbar, {
  38788. ref: hScrollbar,
  38789. alwaysOn: scrollbarAlwaysOn,
  38790. startGap: scrollbarStartGap,
  38791. endGap: scrollbarEndGap,
  38792. class: ns.e("horizontal"),
  38793. clientSize: width,
  38794. layout: "horizontal",
  38795. onScroll: onHorizontalScroll,
  38796. ratio: width * 100 / estimatedWidth,
  38797. scrollFrom: scrollLeft / (estimatedWidth - width),
  38798. total: totalRow,
  38799. visible: true
  38800. });
  38801. const verticalScrollbar = vue.h(Scrollbar, {
  38802. ref: vScrollbar,
  38803. alwaysOn: scrollbarAlwaysOn,
  38804. startGap: scrollbarStartGap,
  38805. endGap: scrollbarEndGap,
  38806. class: ns.e("vertical"),
  38807. clientSize: height,
  38808. layout: "vertical",
  38809. onScroll: onVerticalScroll,
  38810. ratio: height * 100 / estimatedHeight,
  38811. scrollFrom: scrollTop / (estimatedHeight - height),
  38812. total: totalColumn,
  38813. visible: true
  38814. });
  38815. return {
  38816. horizontalScrollbar,
  38817. verticalScrollbar
  38818. };
  38819. };
  38820. const renderItems = () => {
  38821. var _a;
  38822. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  38823. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  38824. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  38825. const children = [];
  38826. if (totalRow > 0 && totalColumn > 0) {
  38827. for (let row = rowStart; row <= rowEnd; row++) {
  38828. for (let column = columnStart; column <= columnEnd; column++) {
  38829. const key = itemKey({ columnIndex: column, data, rowIndex: row });
  38830. children.push(vue.h(vue.Fragment, { key }, (_a = slots.default) == null ? void 0 : _a.call(slots, {
  38831. columnIndex: column,
  38832. data,
  38833. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  38834. style: getItemStyle(row, column),
  38835. rowIndex: row
  38836. })));
  38837. }
  38838. }
  38839. }
  38840. return children;
  38841. };
  38842. const renderInner = () => {
  38843. const Inner = vue.resolveDynamicComponent(props.innerElement);
  38844. const children = renderItems();
  38845. return [
  38846. vue.h(Inner, {
  38847. style: vue.unref(innerStyle),
  38848. ref: innerRef
  38849. }, !isString$1(Inner) ? {
  38850. default: () => children
  38851. } : children)
  38852. ];
  38853. };
  38854. const renderWindow = () => {
  38855. const Container = vue.resolveDynamicComponent(props.containerElement);
  38856. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  38857. const Inner = renderInner();
  38858. return vue.h("div", {
  38859. key: 0,
  38860. class: ns.e("wrapper"),
  38861. role: props.role
  38862. }, [
  38863. vue.h(Container, {
  38864. class: props.className,
  38865. style: vue.unref(windowStyle),
  38866. onScroll,
  38867. ref: windowRef
  38868. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  38869. horizontalScrollbar,
  38870. verticalScrollbar
  38871. ]);
  38872. };
  38873. return renderWindow;
  38874. }
  38875. });
  38876. };
  38877. var createGrid$1 = createGrid;
  38878. const FixedSizeGrid = createGrid$1({
  38879. name: "ElFixedSizeGrid",
  38880. getColumnPosition: ({ columnWidth }, index) => [
  38881. columnWidth,
  38882. index * columnWidth
  38883. ],
  38884. getRowPosition: ({ rowHeight }, index) => [
  38885. rowHeight,
  38886. index * rowHeight
  38887. ],
  38888. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  38889. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  38890. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  38891. width = Number(width);
  38892. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  38893. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  38894. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  38895. if (alignment === "smart") {
  38896. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  38897. alignment = AUTO_ALIGNMENT;
  38898. } else {
  38899. alignment = CENTERED_ALIGNMENT;
  38900. }
  38901. }
  38902. switch (alignment) {
  38903. case START_ALIGNMENT:
  38904. return maxOffset;
  38905. case END_ALIGNMENT:
  38906. return minOffset;
  38907. case CENTERED_ALIGNMENT: {
  38908. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38909. if (middleOffset < Math.ceil(width / 2)) {
  38910. return 0;
  38911. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  38912. return lastColumnOffset;
  38913. } else {
  38914. return middleOffset;
  38915. }
  38916. }
  38917. case AUTO_ALIGNMENT:
  38918. default:
  38919. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  38920. return scrollLeft;
  38921. } else if (minOffset > maxOffset) {
  38922. return minOffset;
  38923. } else if (scrollLeft < minOffset) {
  38924. return minOffset;
  38925. } else {
  38926. return maxOffset;
  38927. }
  38928. }
  38929. },
  38930. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  38931. height = Number(height);
  38932. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  38933. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  38934. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  38935. if (align === SMART_ALIGNMENT) {
  38936. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  38937. align = AUTO_ALIGNMENT;
  38938. } else {
  38939. align = CENTERED_ALIGNMENT;
  38940. }
  38941. }
  38942. switch (align) {
  38943. case START_ALIGNMENT:
  38944. return maxOffset;
  38945. case END_ALIGNMENT:
  38946. return minOffset;
  38947. case CENTERED_ALIGNMENT: {
  38948. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38949. if (middleOffset < Math.ceil(height / 2)) {
  38950. return 0;
  38951. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  38952. return lastRowOffset;
  38953. } else {
  38954. return middleOffset;
  38955. }
  38956. }
  38957. case AUTO_ALIGNMENT:
  38958. default:
  38959. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  38960. return scrollTop;
  38961. } else if (minOffset > maxOffset) {
  38962. return minOffset;
  38963. } else if (scrollTop < minOffset) {
  38964. return minOffset;
  38965. } else {
  38966. return maxOffset;
  38967. }
  38968. }
  38969. },
  38970. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  38971. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  38972. const left = startIndex * columnWidth;
  38973. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  38974. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  38975. },
  38976. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  38977. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  38978. const top = startIndex * rowHeight;
  38979. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  38980. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  38981. },
  38982. initCache: () => void 0,
  38983. clearCache: true,
  38984. validateProps: ({ columnWidth, rowHeight }) => {
  38985. }
  38986. });
  38987. var FixedSizeGrid$1 = FixedSizeGrid;
  38988. const { max, min, floor } = Math;
  38989. const ACCESS_SIZER_KEY_MAP = {
  38990. column: "columnWidth",
  38991. row: "rowHeight"
  38992. };
  38993. const ACCESS_LAST_VISITED_KEY_MAP = {
  38994. column: "lastVisitedColumnIndex",
  38995. row: "lastVisitedRowIndex"
  38996. };
  38997. const getItemFromCache = (props, index, gridCache, type) => {
  38998. const [cachedItems, sizer, lastVisited] = [
  38999. gridCache[type],
  39000. props[ACCESS_SIZER_KEY_MAP[type]],
  39001. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  39002. ];
  39003. if (index > lastVisited) {
  39004. let offset = 0;
  39005. if (lastVisited >= 0) {
  39006. const item = cachedItems[lastVisited];
  39007. offset = item.offset + item.size;
  39008. }
  39009. for (let i = lastVisited + 1; i <= index; i++) {
  39010. const size = sizer(i);
  39011. cachedItems[i] = {
  39012. offset,
  39013. size
  39014. };
  39015. offset += size;
  39016. }
  39017. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  39018. }
  39019. return cachedItems[index];
  39020. };
  39021. const bs = (props, gridCache, low, high, offset, type) => {
  39022. while (low <= high) {
  39023. const mid = low + floor((high - low) / 2);
  39024. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  39025. if (currentOffset === offset) {
  39026. return mid;
  39027. } else if (currentOffset < offset) {
  39028. low = mid + 1;
  39029. } else {
  39030. high = mid - 1;
  39031. }
  39032. }
  39033. return max(0, low - 1);
  39034. };
  39035. const es = (props, gridCache, idx, offset, type) => {
  39036. const total = type === "column" ? props.totalColumn : props.totalRow;
  39037. let exponent = 1;
  39038. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  39039. idx += exponent;
  39040. exponent *= 2;
  39041. }
  39042. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  39043. };
  39044. const findItem = (props, gridCache, offset, type) => {
  39045. const [cache, lastVisitedIndex] = [
  39046. gridCache[type],
  39047. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  39048. ];
  39049. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  39050. if (lastVisitedItemOffset >= offset) {
  39051. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  39052. }
  39053. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  39054. };
  39055. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  39056. let sizeOfVisitedRows = 0;
  39057. if (lastVisitedRowIndex >= totalRow) {
  39058. lastVisitedRowIndex = totalRow - 1;
  39059. }
  39060. if (lastVisitedRowIndex >= 0) {
  39061. const item = row[lastVisitedRowIndex];
  39062. sizeOfVisitedRows = item.offset + item.size;
  39063. }
  39064. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  39065. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  39066. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  39067. };
  39068. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  39069. let sizeOfVisitedColumns = 0;
  39070. if (lastVisitedColumnIndex > totalColumn) {
  39071. lastVisitedColumnIndex = totalColumn - 1;
  39072. }
  39073. if (lastVisitedColumnIndex >= 0) {
  39074. const item = column[lastVisitedColumnIndex];
  39075. sizeOfVisitedColumns = item.offset + item.size;
  39076. }
  39077. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  39078. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  39079. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  39080. };
  39081. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  39082. column: getEstimatedTotalWidth,
  39083. row: getEstimatedTotalHeight
  39084. };
  39085. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  39086. const [size, estimatedSizeAssociates] = [
  39087. type === "row" ? props.height : props.width,
  39088. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  39089. ];
  39090. const item = getItemFromCache(props, index, cache, type);
  39091. const estimatedSize = estimatedSizeAssociates(props, cache);
  39092. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  39093. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  39094. if (alignment === SMART_ALIGNMENT) {
  39095. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  39096. alignment = AUTO_ALIGNMENT;
  39097. } else {
  39098. alignment = CENTERED_ALIGNMENT;
  39099. }
  39100. }
  39101. switch (alignment) {
  39102. case START_ALIGNMENT: {
  39103. return maxOffset;
  39104. }
  39105. case END_ALIGNMENT: {
  39106. return minOffset;
  39107. }
  39108. case CENTERED_ALIGNMENT: {
  39109. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  39110. }
  39111. case AUTO_ALIGNMENT:
  39112. default: {
  39113. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  39114. return scrollOffset;
  39115. } else if (minOffset > maxOffset) {
  39116. return minOffset;
  39117. } else if (scrollOffset < minOffset) {
  39118. return minOffset;
  39119. } else {
  39120. return maxOffset;
  39121. }
  39122. }
  39123. }
  39124. };
  39125. const DynamicSizeGrid = createGrid$1({
  39126. name: "ElDynamicSizeGrid",
  39127. getColumnPosition: (props, idx, cache) => {
  39128. const item = getItemFromCache(props, idx, cache, "column");
  39129. return [item.size, item.offset];
  39130. },
  39131. getRowPosition: (props, idx, cache) => {
  39132. const item = getItemFromCache(props, idx, cache, "row");
  39133. return [item.size, item.offset];
  39134. },
  39135. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  39136. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  39137. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  39138. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  39139. const item = getItemFromCache(props, startIndex, cache, "column");
  39140. const maxOffset = scrollLeft + props.width;
  39141. let offset = item.offset + item.size;
  39142. let stopIndex = startIndex;
  39143. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  39144. stopIndex++;
  39145. offset += getItemFromCache(props, startIndex, cache, "column").size;
  39146. }
  39147. return stopIndex;
  39148. },
  39149. getEstimatedTotalHeight,
  39150. getEstimatedTotalWidth,
  39151. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  39152. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  39153. const { totalRow, height } = props;
  39154. const item = getItemFromCache(props, startIndex, cache, "row");
  39155. const maxOffset = scrollTop + height;
  39156. let offset = item.size + item.offset;
  39157. let stopIndex = startIndex;
  39158. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  39159. stopIndex++;
  39160. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  39161. }
  39162. return stopIndex;
  39163. },
  39164. injectToInstance: (instance, cache) => {
  39165. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  39166. var _a, _b;
  39167. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  39168. if (isNumber(columnIndex)) {
  39169. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  39170. }
  39171. if (isNumber(rowIndex)) {
  39172. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  39173. }
  39174. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  39175. if (forceUpdate)
  39176. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  39177. };
  39178. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  39179. resetAfter({
  39180. columnIndex
  39181. }, forceUpdate);
  39182. };
  39183. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  39184. resetAfter({
  39185. rowIndex
  39186. }, forceUpdate);
  39187. };
  39188. Object.assign(instance.proxy, {
  39189. resetAfterColumnIndex,
  39190. resetAfterRowIndex,
  39191. resetAfter
  39192. });
  39193. },
  39194. initCache: ({
  39195. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  39196. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  39197. }) => {
  39198. const cache = {
  39199. column: {},
  39200. estimatedColumnWidth,
  39201. estimatedRowHeight,
  39202. lastVisitedColumnIndex: -1,
  39203. lastVisitedRowIndex: -1,
  39204. row: {}
  39205. };
  39206. return cache;
  39207. },
  39208. clearCache: false,
  39209. validateProps: ({ columnWidth, rowHeight }) => {
  39210. }
  39211. });
  39212. var DynamicSizeGrid$1 = DynamicSizeGrid;
  39213. const _sfc_main$O = vue.defineComponent({
  39214. props: {
  39215. item: {
  39216. type: Object,
  39217. required: true
  39218. },
  39219. style: {
  39220. type: Object
  39221. },
  39222. height: Number
  39223. },
  39224. setup() {
  39225. const ns = useNamespace("select");
  39226. return {
  39227. ns
  39228. };
  39229. }
  39230. });
  39231. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  39232. return vue.openBlock(), vue.createElementBlock("div", {
  39233. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  39234. style: vue.normalizeStyle({ ..._ctx.style, lineHeight: `${_ctx.height}px` })
  39235. }, vue.toDisplayString(_ctx.item.label), 7);
  39236. }
  39237. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  39238. function useOption(props, { emit }) {
  39239. return {
  39240. hoverItem: () => {
  39241. if (!props.disabled) {
  39242. emit("hover", props.index);
  39243. }
  39244. },
  39245. selectOptionClick: () => {
  39246. if (!props.disabled) {
  39247. emit("select", props.item, props.index);
  39248. }
  39249. }
  39250. };
  39251. }
  39252. const defaultProps$5 = {
  39253. label: "label",
  39254. value: "value",
  39255. disabled: "disabled",
  39256. options: "options"
  39257. };
  39258. function useProps(props) {
  39259. const aliasProps = vue.computed(() => ({ ...defaultProps$5, ...props.props }));
  39260. const getLabel = (option) => get(option, aliasProps.value.label);
  39261. const getValue = (option) => get(option, aliasProps.value.value);
  39262. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  39263. const getOptions = (option) => get(option, aliasProps.value.options);
  39264. return {
  39265. aliasProps,
  39266. getLabel,
  39267. getValue,
  39268. getDisabled,
  39269. getOptions
  39270. };
  39271. }
  39272. const SelectProps = buildProps({
  39273. allowCreate: Boolean,
  39274. autocomplete: {
  39275. type: definePropType(String),
  39276. default: "none"
  39277. },
  39278. automaticDropdown: Boolean,
  39279. clearable: Boolean,
  39280. clearIcon: {
  39281. type: iconPropType,
  39282. default: circle_close_default
  39283. },
  39284. effect: {
  39285. type: definePropType(String),
  39286. default: "light"
  39287. },
  39288. collapseTags: Boolean,
  39289. collapseTagsTooltip: Boolean,
  39290. maxCollapseTags: {
  39291. type: Number,
  39292. default: 1
  39293. },
  39294. defaultFirstOption: Boolean,
  39295. disabled: Boolean,
  39296. estimatedOptionHeight: {
  39297. type: Number,
  39298. default: void 0
  39299. },
  39300. filterable: Boolean,
  39301. filterMethod: Function,
  39302. height: {
  39303. type: Number,
  39304. default: 274
  39305. },
  39306. itemHeight: {
  39307. type: Number,
  39308. default: 34
  39309. },
  39310. id: String,
  39311. loading: Boolean,
  39312. loadingText: String,
  39313. modelValue: {
  39314. type: definePropType([Array, String, Number, Boolean, Object])
  39315. },
  39316. multiple: Boolean,
  39317. multipleLimit: {
  39318. type: Number,
  39319. default: 0
  39320. },
  39321. name: String,
  39322. noDataText: String,
  39323. noMatchText: String,
  39324. remoteMethod: Function,
  39325. reserveKeyword: {
  39326. type: Boolean,
  39327. default: true
  39328. },
  39329. options: {
  39330. type: definePropType(Array),
  39331. required: true
  39332. },
  39333. placeholder: {
  39334. type: String
  39335. },
  39336. teleported: useTooltipContentProps.teleported,
  39337. persistent: {
  39338. type: Boolean,
  39339. default: true
  39340. },
  39341. popperClass: {
  39342. type: String,
  39343. default: ""
  39344. },
  39345. popperOptions: {
  39346. type: definePropType(Object),
  39347. default: () => ({})
  39348. },
  39349. remote: Boolean,
  39350. size: useSizeProp,
  39351. props: {
  39352. type: definePropType(Object),
  39353. default: () => defaultProps$5
  39354. },
  39355. valueKey: {
  39356. type: String,
  39357. default: "value"
  39358. },
  39359. scrollbarAlwaysOn: Boolean,
  39360. validateEvent: {
  39361. type: Boolean,
  39362. default: true
  39363. },
  39364. offset: {
  39365. type: Number,
  39366. default: 12
  39367. },
  39368. showArrow: {
  39369. type: Boolean,
  39370. default: true
  39371. },
  39372. placement: {
  39373. type: definePropType(String),
  39374. values: Ee,
  39375. default: "bottom-start"
  39376. },
  39377. fallbackPlacements: {
  39378. type: definePropType(Array),
  39379. default: ["bottom-start", "top-start", "right", "left"]
  39380. },
  39381. tagType: { ...tagProps.type, default: "info" },
  39382. tagEffect: { ...tagProps.effect, default: "light" },
  39383. tabindex: {
  39384. type: [String, Number],
  39385. default: 0
  39386. },
  39387. appendTo: String,
  39388. fitInputWidth: {
  39389. type: [Boolean, Number],
  39390. default: true,
  39391. validator(val) {
  39392. return isBoolean(val) || isNumber(val);
  39393. }
  39394. },
  39395. suffixIcon: {
  39396. type: iconPropType,
  39397. default: arrow_down_default
  39398. },
  39399. ...useEmptyValuesProps,
  39400. ...useAriaProps(["ariaLabel"])
  39401. });
  39402. const OptionProps = buildProps({
  39403. data: Array,
  39404. disabled: Boolean,
  39405. hovering: Boolean,
  39406. item: {
  39407. type: definePropType(Object),
  39408. required: true
  39409. },
  39410. index: Number,
  39411. style: Object,
  39412. selected: Boolean,
  39413. created: Boolean
  39414. });
  39415. const selectEmits = {
  39416. [UPDATE_MODEL_EVENT]: (val) => true,
  39417. [CHANGE_EVENT]: (val) => true,
  39418. "remove-tag": (val) => true,
  39419. "visible-change": (visible) => true,
  39420. focus: (evt) => evt instanceof FocusEvent,
  39421. blur: (evt) => evt instanceof FocusEvent,
  39422. clear: () => true
  39423. };
  39424. const optionEmits = {
  39425. hover: (index) => isNumber(index),
  39426. select: (val, index) => true
  39427. };
  39428. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  39429. const _sfc_main$N = vue.defineComponent({
  39430. props: OptionProps,
  39431. emits: optionEmits,
  39432. setup(props, { emit }) {
  39433. const select = vue.inject(selectV2InjectionKey);
  39434. const ns = useNamespace("select");
  39435. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  39436. const { getLabel } = useProps(select.props);
  39437. return {
  39438. ns,
  39439. hoverItem,
  39440. selectOptionClick,
  39441. getLabel
  39442. };
  39443. }
  39444. });
  39445. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  39446. return vue.openBlock(), vue.createElementBlock("li", {
  39447. "aria-selected": _ctx.selected,
  39448. style: vue.normalizeStyle(_ctx.style),
  39449. class: vue.normalizeClass([
  39450. _ctx.ns.be("dropdown", "item"),
  39451. _ctx.ns.is("selected", _ctx.selected),
  39452. _ctx.ns.is("disabled", _ctx.disabled),
  39453. _ctx.ns.is("created", _ctx.created),
  39454. _ctx.ns.is("hovering", _ctx.hovering)
  39455. ]),
  39456. onMousemove: _ctx.hoverItem,
  39457. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  39458. }, [
  39459. vue.renderSlot(_ctx.$slots, "default", {
  39460. item: _ctx.item,
  39461. index: _ctx.index,
  39462. disabled: _ctx.disabled
  39463. }, () => [
  39464. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  39465. ])
  39466. ], 46, ["aria-selected", "onMousemove", "onClick"]);
  39467. }
  39468. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  39469. const props = {
  39470. loading: Boolean,
  39471. data: {
  39472. type: Array,
  39473. required: true
  39474. },
  39475. hoveringIndex: Number,
  39476. width: Number
  39477. };
  39478. var ElSelectMenu = vue.defineComponent({
  39479. name: "ElSelectDropdown",
  39480. props,
  39481. setup(props2, {
  39482. slots,
  39483. expose
  39484. }) {
  39485. const select = vue.inject(selectV2InjectionKey);
  39486. const ns = useNamespace("select");
  39487. const {
  39488. getLabel,
  39489. getValue,
  39490. getDisabled
  39491. } = useProps(select.props);
  39492. const cachedHeights = vue.ref([]);
  39493. const listRef = vue.ref();
  39494. const size = vue.computed(() => props2.data.length);
  39495. vue.watch(() => size.value, () => {
  39496. var _a, _b;
  39497. (_b = (_a = select.tooltipRef.value).updatePopper) == null ? void 0 : _b.call(_a);
  39498. });
  39499. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  39500. const listProps = vue.computed(() => {
  39501. if (isSized.value) {
  39502. return {
  39503. itemSize: select.props.itemHeight
  39504. };
  39505. }
  39506. return {
  39507. estimatedSize: select.props.estimatedOptionHeight,
  39508. itemSize: (idx) => cachedHeights.value[idx]
  39509. };
  39510. });
  39511. const contains = (arr = [], target) => {
  39512. const {
  39513. props: {
  39514. valueKey
  39515. }
  39516. } = select;
  39517. if (!isObject$1(target)) {
  39518. return arr.includes(target);
  39519. }
  39520. return arr && arr.some((item) => {
  39521. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  39522. });
  39523. };
  39524. const isEqual = (selected, target) => {
  39525. if (!isObject$1(target)) {
  39526. return selected === target;
  39527. } else {
  39528. const {
  39529. valueKey
  39530. } = select.props;
  39531. return get(selected, valueKey) === get(target, valueKey);
  39532. }
  39533. };
  39534. const isItemSelected = (modelValue, target) => {
  39535. if (select.props.multiple) {
  39536. return contains(modelValue, getValue(target));
  39537. }
  39538. return isEqual(modelValue, getValue(target));
  39539. };
  39540. const isItemDisabled = (modelValue, selected) => {
  39541. const {
  39542. disabled,
  39543. multiple,
  39544. multipleLimit
  39545. } = select.props;
  39546. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  39547. };
  39548. const isItemHovering = (target) => props2.hoveringIndex === target;
  39549. const scrollToItem = (index) => {
  39550. const list = listRef.value;
  39551. if (list) {
  39552. list.scrollToItem(index);
  39553. }
  39554. };
  39555. const resetScrollTop = () => {
  39556. const list = listRef.value;
  39557. if (list) {
  39558. list.resetScrollTop();
  39559. }
  39560. };
  39561. const exposed = {
  39562. listRef,
  39563. isSized,
  39564. isItemDisabled,
  39565. isItemHovering,
  39566. isItemSelected,
  39567. scrollToItem,
  39568. resetScrollTop
  39569. };
  39570. expose(exposed);
  39571. const Item = (itemProps) => {
  39572. const {
  39573. index,
  39574. data,
  39575. style
  39576. } = itemProps;
  39577. const sized = vue.unref(isSized);
  39578. const {
  39579. itemSize,
  39580. estimatedSize
  39581. } = vue.unref(listProps);
  39582. const {
  39583. modelValue
  39584. } = select.props;
  39585. const {
  39586. onSelect,
  39587. onHover
  39588. } = select;
  39589. const item = data[index];
  39590. if (item.type === "Group") {
  39591. return vue.createVNode(GroupItem, {
  39592. "item": item,
  39593. "style": style,
  39594. "height": sized ? itemSize : estimatedSize
  39595. }, null);
  39596. }
  39597. const isSelected = isItemSelected(modelValue, item);
  39598. const isDisabled = isItemDisabled(modelValue, isSelected);
  39599. const isHovering = isItemHovering(index);
  39600. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  39601. "selected": isSelected,
  39602. "disabled": getDisabled(item) || isDisabled,
  39603. "created": !!item.created,
  39604. "hovering": isHovering,
  39605. "item": item,
  39606. "onSelect": onSelect,
  39607. "onHover": onHover
  39608. }), {
  39609. default: (props3) => {
  39610. var _a;
  39611. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props3)) || vue.createVNode("span", null, [getLabel(item)]);
  39612. }
  39613. });
  39614. };
  39615. const {
  39616. onKeyboardNavigate,
  39617. onKeyboardSelect
  39618. } = select;
  39619. const onForward = () => {
  39620. onKeyboardNavigate("forward");
  39621. };
  39622. const onBackward = () => {
  39623. onKeyboardNavigate("backward");
  39624. };
  39625. const onKeydown = (e) => {
  39626. const {
  39627. code
  39628. } = e;
  39629. const {
  39630. tab,
  39631. esc,
  39632. down,
  39633. up,
  39634. enter,
  39635. numpadEnter
  39636. } = EVENT_CODE;
  39637. if ([esc, down, up, enter, numpadEnter].includes(code)) {
  39638. e.preventDefault();
  39639. e.stopPropagation();
  39640. }
  39641. switch (code) {
  39642. case tab:
  39643. case esc:
  39644. break;
  39645. case down:
  39646. onForward();
  39647. break;
  39648. case up:
  39649. onBackward();
  39650. break;
  39651. case enter:
  39652. case numpadEnter:
  39653. onKeyboardSelect();
  39654. break;
  39655. }
  39656. };
  39657. return () => {
  39658. var _a, _b, _c, _d;
  39659. const {
  39660. data,
  39661. width
  39662. } = props2;
  39663. const {
  39664. height,
  39665. multiple,
  39666. scrollbarAlwaysOn
  39667. } = select.props;
  39668. const isScrollbarAlwaysOn = vue.computed(() => {
  39669. return isIOS ? true : scrollbarAlwaysOn;
  39670. });
  39671. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  39672. return vue.createVNode("div", {
  39673. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  39674. "style": {
  39675. width: `${width}px`
  39676. }
  39677. }, [(_a = slots.header) == null ? void 0 : _a.call(slots), ((_b = slots.loading) == null ? void 0 : _b.call(slots)) || ((_c = slots.empty) == null ? void 0 : _c.call(slots)) || vue.createVNode(List, vue.mergeProps({
  39678. "ref": listRef
  39679. }, vue.unref(listProps), {
  39680. "className": ns.be("dropdown", "list"),
  39681. "scrollbarAlwaysOn": isScrollbarAlwaysOn.value,
  39682. "data": data,
  39683. "height": height,
  39684. "width": width,
  39685. "total": data.length,
  39686. "onKeydown": onKeydown
  39687. }), {
  39688. default: (props3) => vue.createVNode(Item, props3, null)
  39689. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  39690. };
  39691. }
  39692. });
  39693. function useAllowCreate(props, states) {
  39694. const { aliasProps, getLabel, getValue } = useProps(props);
  39695. const createOptionCount = vue.ref(0);
  39696. const cachedSelectedOption = vue.ref();
  39697. const enableAllowCreateMode = vue.computed(() => {
  39698. return props.allowCreate && props.filterable;
  39699. });
  39700. function hasExistingOption(query) {
  39701. const hasOption = (option) => getLabel(option) === query;
  39702. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  39703. }
  39704. function selectNewOption(option) {
  39705. if (!enableAllowCreateMode.value) {
  39706. return;
  39707. }
  39708. if (props.multiple && option.created) {
  39709. createOptionCount.value++;
  39710. } else {
  39711. cachedSelectedOption.value = option;
  39712. }
  39713. }
  39714. function createNewOption(query) {
  39715. if (enableAllowCreateMode.value) {
  39716. if (query && query.length > 0) {
  39717. if (hasExistingOption(query)) {
  39718. return;
  39719. }
  39720. const newOption = {
  39721. [aliasProps.value.value]: query,
  39722. [aliasProps.value.label]: query,
  39723. created: true,
  39724. [aliasProps.value.disabled]: false
  39725. };
  39726. if (states.createdOptions.length >= createOptionCount.value) {
  39727. states.createdOptions[createOptionCount.value] = newOption;
  39728. } else {
  39729. states.createdOptions.push(newOption);
  39730. }
  39731. } else {
  39732. if (props.multiple) {
  39733. states.createdOptions.length = createOptionCount.value;
  39734. } else {
  39735. const selectedOption = cachedSelectedOption.value;
  39736. states.createdOptions.length = 0;
  39737. if (selectedOption && selectedOption.created) {
  39738. states.createdOptions.push(selectedOption);
  39739. }
  39740. }
  39741. }
  39742. }
  39743. }
  39744. function removeNewOption(option) {
  39745. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  39746. return;
  39747. }
  39748. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  39749. if (~idx) {
  39750. states.createdOptions.splice(idx, 1);
  39751. createOptionCount.value--;
  39752. }
  39753. }
  39754. function clearAllNewOption() {
  39755. if (enableAllowCreateMode.value) {
  39756. states.createdOptions.length = 0;
  39757. createOptionCount.value = 0;
  39758. }
  39759. }
  39760. return {
  39761. createNewOption,
  39762. removeNewOption,
  39763. selectNewOption,
  39764. clearAllNewOption
  39765. };
  39766. }
  39767. const useSelect$1 = (props, emit) => {
  39768. const { t } = useLocale();
  39769. const nsSelect = useNamespace("select");
  39770. const nsInput = useNamespace("input");
  39771. const { form: elForm, formItem: elFormItem } = useFormItem();
  39772. const { inputId } = useFormItemInputId(props, {
  39773. formItemContext: elFormItem
  39774. });
  39775. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  39776. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  39777. const states = vue.reactive({
  39778. inputValue: "",
  39779. cachedOptions: [],
  39780. createdOptions: [],
  39781. hoveringIndex: -1,
  39782. inputHovering: false,
  39783. selectionWidth: 0,
  39784. collapseItemWidth: 0,
  39785. previousQuery: null,
  39786. previousValue: void 0,
  39787. selectedLabel: "",
  39788. menuVisibleOnFocus: false,
  39789. isBeforeHide: false
  39790. });
  39791. const popperSize = vue.ref(-1);
  39792. const selectRef = vue.ref();
  39793. const selectionRef = vue.ref();
  39794. const tooltipRef = vue.ref();
  39795. const tagTooltipRef = vue.ref();
  39796. const inputRef = vue.ref();
  39797. const prefixRef = vue.ref();
  39798. const suffixRef = vue.ref();
  39799. const menuRef = vue.ref();
  39800. const tagMenuRef = vue.ref();
  39801. const collapseItemRef = vue.ref();
  39802. const {
  39803. isComposing,
  39804. handleCompositionStart,
  39805. handleCompositionEnd,
  39806. handleCompositionUpdate
  39807. } = useComposition({
  39808. afterComposition: (e) => onInput(e)
  39809. });
  39810. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  39811. beforeFocus() {
  39812. return selectDisabled.value;
  39813. },
  39814. afterFocus() {
  39815. if (props.automaticDropdown && !expanded.value) {
  39816. expanded.value = true;
  39817. states.menuVisibleOnFocus = true;
  39818. }
  39819. },
  39820. beforeBlur(event) {
  39821. var _a, _b;
  39822. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  39823. },
  39824. afterBlur() {
  39825. var _a;
  39826. expanded.value = false;
  39827. states.menuVisibleOnFocus = false;
  39828. if (props.validateEvent) {
  39829. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  39830. }
  39831. }
  39832. });
  39833. const allOptions = vue.computed(() => filterOptions(""));
  39834. const hasOptions = vue.computed(() => {
  39835. if (props.loading)
  39836. return false;
  39837. return props.options.length > 0 || states.createdOptions.length > 0;
  39838. });
  39839. const filteredOptions = vue.ref([]);
  39840. const expanded = vue.ref(false);
  39841. const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  39842. const needStatusIcon = vue.computed(() => {
  39843. var _a;
  39844. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  39845. });
  39846. const popupHeight = vue.computed(() => {
  39847. const totalHeight = filteredOptions.value.length * props.itemHeight;
  39848. return totalHeight > props.height ? props.height : totalHeight;
  39849. });
  39850. const hasModelValue = vue.computed(() => {
  39851. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  39852. });
  39853. const showClearBtn = vue.computed(() => {
  39854. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  39855. });
  39856. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  39857. const iconReverse = vue.computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  39858. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  39859. const validateIcon = vue.computed(() => {
  39860. if (!validateState.value)
  39861. return;
  39862. return ValidateComponentsMap[validateState.value];
  39863. });
  39864. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  39865. const emptyText = vue.computed(() => {
  39866. if (props.loading) {
  39867. return props.loadingText || t("el.select.loading");
  39868. } else {
  39869. if (props.remote && !states.inputValue && !hasOptions.value)
  39870. return false;
  39871. if (props.filterable && states.inputValue && hasOptions.value && filteredOptions.value.length === 0) {
  39872. return props.noMatchText || t("el.select.noMatch");
  39873. }
  39874. if (!hasOptions.value) {
  39875. return props.noDataText || t("el.select.noData");
  39876. }
  39877. }
  39878. return null;
  39879. });
  39880. const filterOptions = (query) => {
  39881. const regexp = new RegExp(escapeStringRegexp(query), "i");
  39882. const isFilterMethodValid = props.filterable && isFunction$1(props.filterMethod);
  39883. const isRemoteMethodValid = props.filterable && props.remote && isFunction$1(props.remoteMethod);
  39884. const isValidOption = (o) => {
  39885. if (isFilterMethodValid || isRemoteMethodValid)
  39886. return true;
  39887. return query ? regexp.test(getLabel(o) || "") : true;
  39888. };
  39889. if (props.loading) {
  39890. return [];
  39891. }
  39892. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  39893. const options = getOptions(item);
  39894. if (isArray$1(options)) {
  39895. const filtered = options.filter(isValidOption);
  39896. if (filtered.length > 0) {
  39897. all.push({
  39898. label: getLabel(item),
  39899. type: "Group"
  39900. }, ...filtered);
  39901. }
  39902. } else if (props.remote || isValidOption(item)) {
  39903. all.push(item);
  39904. }
  39905. return all;
  39906. }, []);
  39907. };
  39908. const updateOptions = () => {
  39909. filteredOptions.value = filterOptions(states.inputValue);
  39910. };
  39911. const allOptionsValueMap = vue.computed(() => {
  39912. const valueMap = /* @__PURE__ */ new Map();
  39913. allOptions.value.forEach((option, index) => {
  39914. valueMap.set(getValueKey(getValue(option)), { option, index });
  39915. });
  39916. return valueMap;
  39917. });
  39918. const filteredOptionsValueMap = vue.computed(() => {
  39919. const valueMap = /* @__PURE__ */ new Map();
  39920. filteredOptions.value.forEach((option, index) => {
  39921. valueMap.set(getValueKey(getValue(option)), { option, index });
  39922. });
  39923. return valueMap;
  39924. });
  39925. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  39926. const selectSize = useFormSize();
  39927. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  39928. const calculatePopperSize = () => {
  39929. var _a;
  39930. if (isNumber(props.fitInputWidth)) {
  39931. popperSize.value = props.fitInputWidth;
  39932. return;
  39933. }
  39934. const width = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  39935. if (!props.fitInputWidth && hasOptions.value) {
  39936. vue.nextTick(() => {
  39937. popperSize.value = Math.max(width, calculateLabelMaxWidth());
  39938. });
  39939. } else {
  39940. popperSize.value = width;
  39941. }
  39942. };
  39943. const calculateLabelMaxWidth = () => {
  39944. var _a, _b;
  39945. const canvas = document.createElement("canvas");
  39946. const ctx = canvas.getContext("2d");
  39947. const selector = nsSelect.be("dropdown", "item");
  39948. const dom = ((_b = (_a = menuRef.value) == null ? void 0 : _a.listRef) == null ? void 0 : _b.innerRef) || document;
  39949. const dropdownItemEl = dom.querySelector(`.${selector}`);
  39950. if (dropdownItemEl === null || ctx === null)
  39951. return 0;
  39952. const style = getComputedStyle(dropdownItemEl);
  39953. const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
  39954. ctx.font = style.font;
  39955. const maxWidth = filteredOptions.value.reduce((max, option) => {
  39956. const metrics = ctx.measureText(getLabel(option));
  39957. return Math.max(metrics.width, max);
  39958. }, 0);
  39959. return maxWidth + padding;
  39960. };
  39961. const getGapWidth = () => {
  39962. if (!selectionRef.value)
  39963. return 0;
  39964. const style = window.getComputedStyle(selectionRef.value);
  39965. return Number.parseFloat(style.gap || "6px");
  39966. };
  39967. const tagStyle = vue.computed(() => {
  39968. const gapWidth = getGapWidth();
  39969. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  39970. return { maxWidth: `${maxWidth}px` };
  39971. });
  39972. const collapseTagStyle = vue.computed(() => {
  39973. return { maxWidth: `${states.selectionWidth}px` };
  39974. });
  39975. const shouldShowPlaceholder = vue.computed(() => {
  39976. if (isArray$1(props.modelValue)) {
  39977. return props.modelValue.length === 0 && !states.inputValue;
  39978. }
  39979. return props.filterable ? !states.inputValue : true;
  39980. });
  39981. const currentPlaceholder = vue.computed(() => {
  39982. var _a;
  39983. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  39984. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  39985. });
  39986. const popperRef = vue.computed(() => {
  39987. var _a, _b;
  39988. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  39989. });
  39990. const indexRef = vue.computed(() => {
  39991. if (props.multiple) {
  39992. const len = props.modelValue.length;
  39993. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  39994. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  39995. return index;
  39996. }
  39997. } else {
  39998. if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  39999. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  40000. return index;
  40001. }
  40002. }
  40003. return -1;
  40004. });
  40005. const dropdownMenuVisible = vue.computed({
  40006. get() {
  40007. return expanded.value && emptyText.value !== false;
  40008. },
  40009. set(val) {
  40010. expanded.value = val;
  40011. }
  40012. });
  40013. const showTagList = vue.computed(() => {
  40014. if (!props.multiple) {
  40015. return [];
  40016. }
  40017. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  40018. });
  40019. const collapseTagList = vue.computed(() => {
  40020. if (!props.multiple) {
  40021. return [];
  40022. }
  40023. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  40024. });
  40025. const {
  40026. createNewOption,
  40027. removeNewOption,
  40028. selectNewOption,
  40029. clearAllNewOption
  40030. } = useAllowCreate(props, states);
  40031. const toggleMenu = () => {
  40032. if (selectDisabled.value)
  40033. return;
  40034. if (states.menuVisibleOnFocus) {
  40035. states.menuVisibleOnFocus = false;
  40036. } else {
  40037. expanded.value = !expanded.value;
  40038. }
  40039. };
  40040. const onInputChange = () => {
  40041. if (states.inputValue.length > 0 && !expanded.value) {
  40042. expanded.value = true;
  40043. }
  40044. createNewOption(states.inputValue);
  40045. handleQueryChange(states.inputValue);
  40046. };
  40047. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  40048. const handleQueryChange = (val) => {
  40049. if (states.previousQuery === val || isComposing.value) {
  40050. return;
  40051. }
  40052. states.previousQuery = val;
  40053. if (props.filterable && isFunction$1(props.filterMethod)) {
  40054. props.filterMethod(val);
  40055. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  40056. props.remoteMethod(val);
  40057. }
  40058. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  40059. vue.nextTick(checkDefaultFirstOption);
  40060. } else {
  40061. vue.nextTick(updateHoveringIndex);
  40062. }
  40063. };
  40064. const checkDefaultFirstOption = () => {
  40065. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  40066. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  40067. const firstOriginOption = optionsInDropdown[0];
  40068. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  40069. };
  40070. const emitChange = (val) => {
  40071. if (!isEqual$1(props.modelValue, val)) {
  40072. emit(CHANGE_EVENT, val);
  40073. }
  40074. };
  40075. const update = (val) => {
  40076. emit(UPDATE_MODEL_EVENT, val);
  40077. emitChange(val);
  40078. states.previousValue = props.multiple ? String(val) : val;
  40079. vue.nextTick(() => {
  40080. if (props.multiple && isArray$1(props.modelValue)) {
  40081. const selectedOptions = props.modelValue.map((value) => getOption(value));
  40082. if (!isEqual$1(states.cachedOptions, selectedOptions)) {
  40083. states.cachedOptions = selectedOptions;
  40084. }
  40085. } else {
  40086. initStates(true);
  40087. }
  40088. });
  40089. };
  40090. const getValueIndex = (arr = [], value) => {
  40091. if (!isObject$1(value)) {
  40092. return arr.indexOf(value);
  40093. }
  40094. const valueKey = props.valueKey;
  40095. let index = -1;
  40096. arr.some((item, i) => {
  40097. if (get(item, valueKey) === get(value, valueKey)) {
  40098. index = i;
  40099. return true;
  40100. }
  40101. return false;
  40102. });
  40103. return index;
  40104. };
  40105. const getValueKey = (item) => {
  40106. return isObject$1(item) ? get(item, props.valueKey) : item;
  40107. };
  40108. const handleResize = () => {
  40109. calculatePopperSize();
  40110. };
  40111. const resetSelectionWidth = () => {
  40112. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  40113. };
  40114. const resetCollapseItemWidth = () => {
  40115. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  40116. };
  40117. const updateTooltip = () => {
  40118. var _a, _b;
  40119. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  40120. };
  40121. const updateTagTooltip = () => {
  40122. var _a, _b;
  40123. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  40124. };
  40125. const onSelect = (option) => {
  40126. if (props.multiple) {
  40127. let selectedOptions = props.modelValue.slice();
  40128. const index = getValueIndex(selectedOptions, getValue(option));
  40129. if (index > -1) {
  40130. selectedOptions = [
  40131. ...selectedOptions.slice(0, index),
  40132. ...selectedOptions.slice(index + 1)
  40133. ];
  40134. states.cachedOptions.splice(index, 1);
  40135. removeNewOption(option);
  40136. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  40137. selectedOptions = [...selectedOptions, getValue(option)];
  40138. states.cachedOptions.push(option);
  40139. selectNewOption(option);
  40140. }
  40141. update(selectedOptions);
  40142. if (option.created) {
  40143. handleQueryChange("");
  40144. }
  40145. if (props.filterable && !props.reserveKeyword) {
  40146. states.inputValue = "";
  40147. }
  40148. } else {
  40149. states.selectedLabel = getLabel(option);
  40150. update(getValue(option));
  40151. expanded.value = false;
  40152. selectNewOption(option);
  40153. if (!option.created) {
  40154. clearAllNewOption();
  40155. }
  40156. }
  40157. focus();
  40158. };
  40159. const deleteTag = (event, option) => {
  40160. let selectedOptions = props.modelValue.slice();
  40161. const index = getValueIndex(selectedOptions, getValue(option));
  40162. if (index > -1 && !selectDisabled.value) {
  40163. selectedOptions = [
  40164. ...props.modelValue.slice(0, index),
  40165. ...props.modelValue.slice(index + 1)
  40166. ];
  40167. states.cachedOptions.splice(index, 1);
  40168. update(selectedOptions);
  40169. emit("remove-tag", getValue(option));
  40170. removeNewOption(option);
  40171. }
  40172. event.stopPropagation();
  40173. focus();
  40174. };
  40175. const focus = () => {
  40176. var _a;
  40177. (_a = inputRef.value) == null ? void 0 : _a.focus();
  40178. };
  40179. const blur = () => {
  40180. var _a;
  40181. if (expanded.value) {
  40182. expanded.value = false;
  40183. vue.nextTick(() => {
  40184. var _a2;
  40185. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  40186. });
  40187. return;
  40188. }
  40189. (_a = inputRef.value) == null ? void 0 : _a.blur();
  40190. };
  40191. const handleEsc = () => {
  40192. if (states.inputValue.length > 0) {
  40193. states.inputValue = "";
  40194. } else {
  40195. expanded.value = false;
  40196. }
  40197. };
  40198. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  40199. const handleDel = (e) => {
  40200. if (!props.multiple)
  40201. return;
  40202. if (e.code === EVENT_CODE.delete)
  40203. return;
  40204. if (states.inputValue.length === 0) {
  40205. e.preventDefault();
  40206. const selected = props.modelValue.slice();
  40207. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  40208. if (lastNotDisabledIndex < 0)
  40209. return;
  40210. const removeTagValue = selected[lastNotDisabledIndex];
  40211. selected.splice(lastNotDisabledIndex, 1);
  40212. const option = states.cachedOptions[lastNotDisabledIndex];
  40213. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  40214. removeNewOption(option);
  40215. update(selected);
  40216. emit("remove-tag", removeTagValue);
  40217. }
  40218. };
  40219. const handleClear = () => {
  40220. let emptyValue;
  40221. if (isArray$1(props.modelValue)) {
  40222. emptyValue = [];
  40223. } else {
  40224. emptyValue = valueOnClear.value;
  40225. }
  40226. states.selectedLabel = "";
  40227. expanded.value = false;
  40228. update(emptyValue);
  40229. emit("clear");
  40230. clearAllNewOption();
  40231. focus();
  40232. };
  40233. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  40234. const options = filteredOptions.value;
  40235. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) {
  40236. return;
  40237. }
  40238. if (!expanded.value) {
  40239. return toggleMenu();
  40240. }
  40241. if (hoveringIndex === void 0) {
  40242. hoveringIndex = states.hoveringIndex;
  40243. }
  40244. let newIndex = -1;
  40245. if (direction === "forward") {
  40246. newIndex = hoveringIndex + 1;
  40247. if (newIndex >= options.length) {
  40248. newIndex = 0;
  40249. }
  40250. } else if (direction === "backward") {
  40251. newIndex = hoveringIndex - 1;
  40252. if (newIndex < 0 || newIndex >= options.length) {
  40253. newIndex = options.length - 1;
  40254. }
  40255. }
  40256. const option = options[newIndex];
  40257. if (getDisabled(option) || option.type === "Group") {
  40258. return onKeyboardNavigate(direction, newIndex);
  40259. } else {
  40260. states.hoveringIndex = newIndex;
  40261. scrollToItem(newIndex);
  40262. }
  40263. };
  40264. const onKeyboardSelect = () => {
  40265. if (!expanded.value) {
  40266. return toggleMenu();
  40267. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  40268. onSelect(filteredOptions.value[states.hoveringIndex]);
  40269. }
  40270. };
  40271. const onHoverOption = (idx) => {
  40272. states.hoveringIndex = idx != null ? idx : -1;
  40273. };
  40274. const updateHoveringIndex = () => {
  40275. if (!props.multiple) {
  40276. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  40277. return getValueKey(item) === getValueKey(props.modelValue);
  40278. });
  40279. } else {
  40280. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(item)));
  40281. }
  40282. };
  40283. const onInput = (event) => {
  40284. states.inputValue = event.target.value;
  40285. if (props.remote) {
  40286. debouncedOnInputChange();
  40287. } else {
  40288. return onInputChange();
  40289. }
  40290. };
  40291. const handleClickOutside = (event) => {
  40292. expanded.value = false;
  40293. if (isFocused.value) {
  40294. const _event = new FocusEvent("focus", event);
  40295. handleBlur(_event);
  40296. }
  40297. };
  40298. const handleMenuEnter = () => {
  40299. states.isBeforeHide = false;
  40300. return vue.nextTick(() => {
  40301. if (~indexRef.value) {
  40302. scrollToItem(states.hoveringIndex);
  40303. }
  40304. });
  40305. };
  40306. const scrollToItem = (index) => {
  40307. menuRef.value.scrollToItem(index);
  40308. };
  40309. const getOption = (value, cachedOptions) => {
  40310. const selectValue = getValueKey(value);
  40311. if (allOptionsValueMap.value.has(selectValue)) {
  40312. const { option } = allOptionsValueMap.value.get(selectValue);
  40313. return option;
  40314. }
  40315. if (cachedOptions && cachedOptions.length) {
  40316. const option = cachedOptions.find((option2) => getValueKey(getValue(option2)) === selectValue);
  40317. if (option) {
  40318. return option;
  40319. }
  40320. }
  40321. return {
  40322. [aliasProps.value.value]: value,
  40323. [aliasProps.value.label]: value
  40324. };
  40325. };
  40326. const initStates = (needUpdateSelectedLabel = false) => {
  40327. if (props.multiple) {
  40328. if (props.modelValue.length > 0) {
  40329. const cachedOptions = states.cachedOptions.slice();
  40330. states.cachedOptions.length = 0;
  40331. states.previousValue = props.modelValue.toString();
  40332. for (const value of props.modelValue) {
  40333. const option = getOption(value, cachedOptions);
  40334. states.cachedOptions.push(option);
  40335. }
  40336. } else {
  40337. states.cachedOptions = [];
  40338. states.previousValue = void 0;
  40339. }
  40340. } else {
  40341. if (hasModelValue.value) {
  40342. states.previousValue = props.modelValue;
  40343. const options = filteredOptions.value;
  40344. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  40345. if (~selectedItemIndex) {
  40346. states.selectedLabel = getLabel(options[selectedItemIndex]);
  40347. } else {
  40348. if (!states.selectedLabel || needUpdateSelectedLabel) {
  40349. states.selectedLabel = getValueKey(props.modelValue);
  40350. }
  40351. }
  40352. } else {
  40353. states.selectedLabel = "";
  40354. states.previousValue = void 0;
  40355. }
  40356. }
  40357. clearAllNewOption();
  40358. calculatePopperSize();
  40359. };
  40360. vue.watch(() => props.fitInputWidth, () => {
  40361. calculatePopperSize();
  40362. });
  40363. vue.watch(expanded, (val) => {
  40364. if (val) {
  40365. if (!props.persistent) {
  40366. calculatePopperSize();
  40367. }
  40368. handleQueryChange("");
  40369. } else {
  40370. states.inputValue = "";
  40371. states.previousQuery = null;
  40372. states.isBeforeHide = true;
  40373. createNewOption("");
  40374. }
  40375. emit("visible-change", val);
  40376. });
  40377. vue.watch(() => props.modelValue, (val, oldVal) => {
  40378. var _a;
  40379. const isValEmpty = !val || isArray$1(val) && val.length === 0;
  40380. if (isValEmpty || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  40381. initStates(true);
  40382. }
  40383. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  40384. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  40385. }
  40386. }, {
  40387. deep: true
  40388. });
  40389. vue.watch(() => props.options, () => {
  40390. const input = inputRef.value;
  40391. if (!input || input && document.activeElement !== input) {
  40392. initStates();
  40393. }
  40394. }, {
  40395. deep: true,
  40396. flush: "post"
  40397. });
  40398. vue.watch(() => filteredOptions.value, () => {
  40399. calculatePopperSize();
  40400. return menuRef.value && vue.nextTick(menuRef.value.resetScrollTop);
  40401. });
  40402. vue.watchEffect(() => {
  40403. if (states.isBeforeHide)
  40404. return;
  40405. updateOptions();
  40406. });
  40407. vue.watchEffect(() => {
  40408. const { valueKey, options } = props;
  40409. const duplicateValue = /* @__PURE__ */ new Map();
  40410. for (const item of options) {
  40411. const optionValue = getValue(item);
  40412. let v = optionValue;
  40413. if (isObject$1(v)) {
  40414. v = get(optionValue, valueKey);
  40415. }
  40416. if (duplicateValue.get(v)) {
  40417. break;
  40418. } else {
  40419. duplicateValue.set(v, true);
  40420. }
  40421. }
  40422. });
  40423. vue.onMounted(() => {
  40424. initStates();
  40425. });
  40426. useResizeObserver(selectRef, handleResize);
  40427. useResizeObserver(selectionRef, resetSelectionWidth);
  40428. useResizeObserver(menuRef, updateTooltip);
  40429. useResizeObserver(wrapperRef, updateTooltip);
  40430. useResizeObserver(tagMenuRef, updateTagTooltip);
  40431. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  40432. return {
  40433. inputId,
  40434. collapseTagSize,
  40435. currentPlaceholder,
  40436. expanded,
  40437. emptyText,
  40438. popupHeight,
  40439. debounce: debounce$1,
  40440. allOptions,
  40441. filteredOptions,
  40442. iconComponent,
  40443. iconReverse,
  40444. tagStyle,
  40445. collapseTagStyle,
  40446. popperSize,
  40447. dropdownMenuVisible,
  40448. hasModelValue,
  40449. shouldShowPlaceholder,
  40450. selectDisabled,
  40451. selectSize,
  40452. needStatusIcon,
  40453. showClearBtn,
  40454. states,
  40455. isFocused,
  40456. nsSelect,
  40457. nsInput,
  40458. inputRef,
  40459. menuRef,
  40460. tagMenuRef,
  40461. tooltipRef,
  40462. tagTooltipRef,
  40463. selectRef,
  40464. wrapperRef,
  40465. selectionRef,
  40466. prefixRef,
  40467. suffixRef,
  40468. collapseItemRef,
  40469. popperRef,
  40470. validateState,
  40471. validateIcon,
  40472. showTagList,
  40473. collapseTagList,
  40474. debouncedOnInputChange,
  40475. deleteTag,
  40476. getLabel,
  40477. getValue,
  40478. getDisabled,
  40479. getValueKey,
  40480. handleClear,
  40481. handleClickOutside,
  40482. handleDel,
  40483. handleEsc,
  40484. focus,
  40485. blur,
  40486. handleMenuEnter,
  40487. handleResize,
  40488. resetSelectionWidth,
  40489. updateTooltip,
  40490. updateTagTooltip,
  40491. updateOptions,
  40492. toggleMenu,
  40493. scrollTo: scrollToItem,
  40494. onInput,
  40495. onKeyboardNavigate,
  40496. onKeyboardSelect,
  40497. onSelect,
  40498. onHover: onHoverOption,
  40499. handleCompositionStart,
  40500. handleCompositionEnd,
  40501. handleCompositionUpdate
  40502. };
  40503. };
  40504. var useSelect$2 = useSelect$1;
  40505. const _sfc_main$M = vue.defineComponent({
  40506. name: "ElSelectV2",
  40507. components: {
  40508. ElSelectMenu,
  40509. ElTag,
  40510. ElTooltip,
  40511. ElIcon
  40512. },
  40513. directives: { ClickOutside },
  40514. props: SelectProps,
  40515. emits: selectEmits,
  40516. setup(props, { emit }) {
  40517. const modelValue = vue.computed(() => {
  40518. const { modelValue: rawModelValue, multiple } = props;
  40519. const fallback = multiple ? [] : void 0;
  40520. if (isArray$1(rawModelValue)) {
  40521. return multiple ? rawModelValue : fallback;
  40522. }
  40523. return multiple ? fallback : rawModelValue;
  40524. });
  40525. const API = useSelect$2(vue.reactive({
  40526. ...vue.toRefs(props),
  40527. modelValue
  40528. }), emit);
  40529. const { calculatorRef, inputStyle } = useCalcInputWidth();
  40530. vue.provide(selectV2InjectionKey, {
  40531. props: vue.reactive({
  40532. ...vue.toRefs(props),
  40533. height: API.popupHeight,
  40534. modelValue
  40535. }),
  40536. expanded: API.expanded,
  40537. tooltipRef: API.tooltipRef,
  40538. onSelect: API.onSelect,
  40539. onHover: API.onHover,
  40540. onKeyboardNavigate: API.onKeyboardNavigate,
  40541. onKeyboardSelect: API.onKeyboardSelect
  40542. });
  40543. const selectedLabel = vue.computed(() => {
  40544. if (!props.multiple) {
  40545. return API.states.selectedLabel;
  40546. }
  40547. return API.states.cachedOptions.map((i) => i.label);
  40548. });
  40549. return {
  40550. ...API,
  40551. modelValue,
  40552. selectedLabel,
  40553. calculatorRef,
  40554. inputStyle
  40555. };
  40556. }
  40557. });
  40558. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  40559. const _component_el_tag = vue.resolveComponent("el-tag");
  40560. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  40561. const _component_el_icon = vue.resolveComponent("el-icon");
  40562. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  40563. const _directive_click_outside = vue.resolveDirective("click-outside");
  40564. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  40565. ref: "selectRef",
  40566. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  40567. onMouseenter: ($event) => _ctx.states.inputHovering = true,
  40568. onMouseleave: ($event) => _ctx.states.inputHovering = false
  40569. }, [
  40570. vue.createVNode(_component_el_tooltip, {
  40571. ref: "tooltipRef",
  40572. visible: _ctx.dropdownMenuVisible,
  40573. teleported: _ctx.teleported,
  40574. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  40575. "gpu-acceleration": false,
  40576. "stop-popper-mouse-event": false,
  40577. "popper-options": _ctx.popperOptions,
  40578. "fallback-placements": _ctx.fallbackPlacements,
  40579. effect: _ctx.effect,
  40580. placement: _ctx.placement,
  40581. pure: "",
  40582. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  40583. trigger: "click",
  40584. persistent: _ctx.persistent,
  40585. "append-to": _ctx.appendTo,
  40586. "show-arrow": _ctx.showArrow,
  40587. offset: _ctx.offset,
  40588. onBeforeShow: _ctx.handleMenuEnter,
  40589. onHide: ($event) => _ctx.states.isBeforeHide = false
  40590. }, {
  40591. default: vue.withCtx(() => [
  40592. vue.createElementVNode("div", {
  40593. ref: "wrapperRef",
  40594. class: vue.normalizeClass([
  40595. _ctx.nsSelect.e("wrapper"),
  40596. _ctx.nsSelect.is("focused", _ctx.isFocused),
  40597. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  40598. _ctx.nsSelect.is("filterable", _ctx.filterable),
  40599. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  40600. ]),
  40601. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  40602. }, [
  40603. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  40604. key: 0,
  40605. ref: "prefixRef",
  40606. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  40607. }, [
  40608. vue.renderSlot(_ctx.$slots, "prefix")
  40609. ], 2)) : vue.createCommentVNode("v-if", true),
  40610. vue.createElementVNode("div", {
  40611. ref: "selectionRef",
  40612. class: vue.normalizeClass([
  40613. _ctx.nsSelect.e("selection"),
  40614. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  40615. ])
  40616. }, [
  40617. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  40618. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  40619. return vue.openBlock(), vue.createElementBlock("div", {
  40620. key: _ctx.getValueKey(_ctx.getValue(item)),
  40621. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  40622. }, [
  40623. vue.createVNode(_component_el_tag, {
  40624. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  40625. size: _ctx.collapseTagSize,
  40626. type: _ctx.tagType,
  40627. effect: _ctx.tagEffect,
  40628. "disable-transitions": "",
  40629. style: vue.normalizeStyle(_ctx.tagStyle),
  40630. onClose: ($event) => _ctx.deleteTag($event, item)
  40631. }, {
  40632. default: vue.withCtx(() => [
  40633. vue.createElementVNode("span", {
  40634. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  40635. }, [
  40636. vue.renderSlot(_ctx.$slots, "label", {
  40637. label: _ctx.getLabel(item),
  40638. value: _ctx.getValue(item)
  40639. }, () => [
  40640. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(item)), 1)
  40641. ])
  40642. ], 2)
  40643. ]),
  40644. _: 2
  40645. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  40646. ], 2);
  40647. }), 128)),
  40648. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  40649. key: 0,
  40650. ref: "tagTooltipRef",
  40651. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  40652. "fallback-placements": ["bottom", "top", "right", "left"],
  40653. effect: _ctx.effect,
  40654. placement: "bottom",
  40655. teleported: _ctx.teleported
  40656. }, {
  40657. default: vue.withCtx(() => [
  40658. vue.createElementVNode("div", {
  40659. ref: "collapseItemRef",
  40660. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  40661. }, [
  40662. vue.createVNode(_component_el_tag, {
  40663. closable: false,
  40664. size: _ctx.collapseTagSize,
  40665. type: _ctx.tagType,
  40666. effect: _ctx.tagEffect,
  40667. style: vue.normalizeStyle(_ctx.collapseTagStyle),
  40668. "disable-transitions": ""
  40669. }, {
  40670. default: vue.withCtx(() => [
  40671. vue.createElementVNode("span", {
  40672. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  40673. }, " + " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  40674. ]),
  40675. _: 1
  40676. }, 8, ["size", "type", "effect", "style"])
  40677. ], 2)
  40678. ]),
  40679. content: vue.withCtx(() => [
  40680. vue.createElementVNode("div", {
  40681. ref: "tagMenuRef",
  40682. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  40683. }, [
  40684. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (selected) => {
  40685. return vue.openBlock(), vue.createElementBlock("div", {
  40686. key: _ctx.getValueKey(_ctx.getValue(selected)),
  40687. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  40688. }, [
  40689. vue.createVNode(_component_el_tag, {
  40690. class: "in-tooltip",
  40691. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  40692. size: _ctx.collapseTagSize,
  40693. type: _ctx.tagType,
  40694. effect: _ctx.tagEffect,
  40695. "disable-transitions": "",
  40696. onClose: ($event) => _ctx.deleteTag($event, selected)
  40697. }, {
  40698. default: vue.withCtx(() => [
  40699. vue.createElementVNode("span", {
  40700. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  40701. }, [
  40702. vue.renderSlot(_ctx.$slots, "label", {
  40703. label: _ctx.getLabel(selected),
  40704. value: _ctx.getValue(selected)
  40705. }, () => [
  40706. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(selected)), 1)
  40707. ])
  40708. ], 2)
  40709. ]),
  40710. _: 2
  40711. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  40712. ], 2);
  40713. }), 128))
  40714. ], 2)
  40715. ]),
  40716. _: 3
  40717. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  40718. ]) : vue.createCommentVNode("v-if", true),
  40719. vue.createElementVNode("div", {
  40720. class: vue.normalizeClass([
  40721. _ctx.nsSelect.e("selected-item"),
  40722. _ctx.nsSelect.e("input-wrapper"),
  40723. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  40724. ])
  40725. }, [
  40726. vue.withDirectives(vue.createElementVNode("input", {
  40727. id: _ctx.inputId,
  40728. ref: "inputRef",
  40729. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  40730. style: vue.normalizeStyle(_ctx.inputStyle),
  40731. autocomplete: _ctx.autocomplete,
  40732. tabindex: _ctx.tabindex,
  40733. "aria-autocomplete": "list",
  40734. "aria-haspopup": "listbox",
  40735. autocapitalize: "off",
  40736. "aria-expanded": _ctx.expanded,
  40737. "aria-label": _ctx.ariaLabel,
  40738. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  40739. disabled: _ctx.selectDisabled,
  40740. role: "combobox",
  40741. readonly: !_ctx.filterable,
  40742. spellcheck: "false",
  40743. type: "text",
  40744. name: _ctx.name,
  40745. onInput: _ctx.onInput,
  40746. onCompositionstart: _ctx.handleCompositionStart,
  40747. onCompositionupdate: _ctx.handleCompositionUpdate,
  40748. onCompositionend: _ctx.handleCompositionEnd,
  40749. onKeydown: [
  40750. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"]),
  40751. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"]),
  40752. vue.withKeys(vue.withModifiers(_ctx.onKeyboardSelect, ["stop", "prevent"]), ["enter"]),
  40753. vue.withKeys(vue.withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  40754. vue.withKeys(vue.withModifiers(_ctx.handleDel, ["stop"]), ["delete"])
  40755. ],
  40756. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  40757. }, null, 46, ["id", "onUpdate:modelValue", "autocomplete", "tabindex", "aria-expanded", "aria-label", "disabled", "readonly", "name", "onInput", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown", "onClick"]), [
  40758. [vue.vModelText, _ctx.states.inputValue]
  40759. ]),
  40760. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  40761. key: 0,
  40762. ref: "calculatorRef",
  40763. "aria-hidden": "true",
  40764. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  40765. textContent: vue.toDisplayString(_ctx.states.inputValue)
  40766. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  40767. ], 2),
  40768. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  40769. key: 1,
  40770. class: vue.normalizeClass([
  40771. _ctx.nsSelect.e("selected-item"),
  40772. _ctx.nsSelect.e("placeholder"),
  40773. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  40774. ])
  40775. }, [
  40776. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  40777. key: 0,
  40778. label: _ctx.currentPlaceholder,
  40779. value: _ctx.modelValue
  40780. }, () => [
  40781. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  40782. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  40783. ], 2)) : vue.createCommentVNode("v-if", true)
  40784. ], 2),
  40785. vue.createElementVNode("div", {
  40786. ref: "suffixRef",
  40787. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  40788. }, [
  40789. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  40790. key: 0,
  40791. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  40792. }, {
  40793. default: vue.withCtx(() => [
  40794. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  40795. ]),
  40796. _: 1
  40797. }, 8, ["class"])), [
  40798. [vue.vShow, !_ctx.showClearBtn]
  40799. ]) : vue.createCommentVNode("v-if", true),
  40800. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  40801. key: 1,
  40802. class: vue.normalizeClass([
  40803. _ctx.nsSelect.e("caret"),
  40804. _ctx.nsInput.e("icon"),
  40805. _ctx.nsSelect.e("clear")
  40806. ]),
  40807. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  40808. }, {
  40809. default: vue.withCtx(() => [
  40810. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  40811. ]),
  40812. _: 1
  40813. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  40814. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  40815. key: 2,
  40816. class: vue.normalizeClass([
  40817. _ctx.nsInput.e("icon"),
  40818. _ctx.nsInput.e("validateIcon"),
  40819. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  40820. ])
  40821. }, {
  40822. default: vue.withCtx(() => [
  40823. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  40824. ]),
  40825. _: 1
  40826. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  40827. ], 2)
  40828. ], 10, ["onClick"])
  40829. ]),
  40830. content: vue.withCtx(() => [
  40831. vue.createVNode(_component_el_select_menu, {
  40832. ref: "menuRef",
  40833. data: _ctx.filteredOptions,
  40834. width: _ctx.popperSize,
  40835. "hovering-index": _ctx.states.hoveringIndex,
  40836. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  40837. }, vue.createSlots({
  40838. default: vue.withCtx((scope) => [
  40839. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  40840. ]),
  40841. _: 2
  40842. }, [
  40843. _ctx.$slots.header ? {
  40844. name: "header",
  40845. fn: vue.withCtx(() => [
  40846. vue.createElementVNode("div", {
  40847. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header"))
  40848. }, [
  40849. vue.renderSlot(_ctx.$slots, "header")
  40850. ], 2)
  40851. ])
  40852. } : void 0,
  40853. _ctx.$slots.loading && _ctx.loading ? {
  40854. name: "loading",
  40855. fn: vue.withCtx(() => [
  40856. vue.createElementVNode("div", {
  40857. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  40858. }, [
  40859. vue.renderSlot(_ctx.$slots, "loading")
  40860. ], 2)
  40861. ])
  40862. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  40863. name: "empty",
  40864. fn: vue.withCtx(() => [
  40865. vue.createElementVNode("div", {
  40866. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  40867. }, [
  40868. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  40869. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  40870. ])
  40871. ], 2)
  40872. ])
  40873. } : void 0,
  40874. _ctx.$slots.footer ? {
  40875. name: "footer",
  40876. fn: vue.withCtx(() => [
  40877. vue.createElementVNode("div", {
  40878. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer"))
  40879. }, [
  40880. vue.renderSlot(_ctx.$slots, "footer")
  40881. ], 2)
  40882. ])
  40883. } : void 0
  40884. ]), 1032, ["data", "width", "hovering-index", "scrollbar-always-on"])
  40885. ]),
  40886. _: 3
  40887. }, 8, ["visible", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  40888. ], 42, ["onMouseenter", "onMouseleave"])), [
  40889. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  40890. ]);
  40891. }
  40892. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  40893. const ElSelectV2 = withInstall(Select);
  40894. const skeletonProps = buildProps({
  40895. animated: {
  40896. type: Boolean,
  40897. default: false
  40898. },
  40899. count: {
  40900. type: Number,
  40901. default: 1
  40902. },
  40903. rows: {
  40904. type: Number,
  40905. default: 3
  40906. },
  40907. loading: {
  40908. type: Boolean,
  40909. default: true
  40910. },
  40911. throttle: {
  40912. type: definePropType([Number, Object])
  40913. }
  40914. });
  40915. const skeletonItemProps = buildProps({
  40916. variant: {
  40917. type: String,
  40918. values: [
  40919. "circle",
  40920. "rect",
  40921. "h1",
  40922. "h3",
  40923. "text",
  40924. "caption",
  40925. "p",
  40926. "image",
  40927. "button"
  40928. ],
  40929. default: "text"
  40930. }
  40931. });
  40932. const __default__$E = vue.defineComponent({
  40933. name: "ElSkeletonItem"
  40934. });
  40935. const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
  40936. ...__default__$E,
  40937. props: skeletonItemProps,
  40938. setup(__props) {
  40939. const ns = useNamespace("skeleton");
  40940. return (_ctx, _cache) => {
  40941. return vue.openBlock(), vue.createElementBlock("div", {
  40942. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  40943. }, [
  40944. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  40945. ], 2);
  40946. };
  40947. }
  40948. });
  40949. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__file", "skeleton-item.vue"]]);
  40950. const __default__$D = vue.defineComponent({
  40951. name: "ElSkeleton"
  40952. });
  40953. const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
  40954. ...__default__$D,
  40955. props: skeletonProps,
  40956. setup(__props, { expose }) {
  40957. const props = __props;
  40958. const ns = useNamespace("skeleton");
  40959. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  40960. expose({
  40961. uiLoading
  40962. });
  40963. return (_ctx, _cache) => {
  40964. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  40965. key: 0,
  40966. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  40967. }, _ctx.$attrs), [
  40968. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  40969. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  40970. vue.unref(uiLoading) ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  40971. vue.createVNode(SkeletonItem, {
  40972. class: vue.normalizeClass(vue.unref(ns).is("first")),
  40973. variant: "p"
  40974. }, null, 8, ["class"]),
  40975. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  40976. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  40977. key: item,
  40978. class: vue.normalizeClass([
  40979. vue.unref(ns).e("paragraph"),
  40980. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  40981. ]),
  40982. variant: "p"
  40983. }, null, 8, ["class"]);
  40984. }), 128))
  40985. ]) : vue.createCommentVNode("v-if", true)
  40986. ], 64);
  40987. }), 128))
  40988. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  40989. };
  40990. }
  40991. });
  40992. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "skeleton.vue"]]);
  40993. const ElSkeleton = withInstall(Skeleton, {
  40994. SkeletonItem
  40995. });
  40996. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  40997. const sliderContextKey = Symbol("sliderContextKey");
  40998. const sliderProps = buildProps({
  40999. modelValue: {
  41000. type: definePropType([Number, Array]),
  41001. default: 0
  41002. },
  41003. id: {
  41004. type: String,
  41005. default: void 0
  41006. },
  41007. min: {
  41008. type: Number,
  41009. default: 0
  41010. },
  41011. max: {
  41012. type: Number,
  41013. default: 100
  41014. },
  41015. step: {
  41016. type: Number,
  41017. default: 1
  41018. },
  41019. showInput: Boolean,
  41020. showInputControls: {
  41021. type: Boolean,
  41022. default: true
  41023. },
  41024. size: useSizeProp,
  41025. inputSize: useSizeProp,
  41026. showStops: Boolean,
  41027. showTooltip: {
  41028. type: Boolean,
  41029. default: true
  41030. },
  41031. formatTooltip: {
  41032. type: definePropType(Function),
  41033. default: void 0
  41034. },
  41035. disabled: Boolean,
  41036. range: Boolean,
  41037. vertical: Boolean,
  41038. height: String,
  41039. debounce: {
  41040. type: Number,
  41041. default: 300
  41042. },
  41043. rangeStartLabel: {
  41044. type: String,
  41045. default: void 0
  41046. },
  41047. rangeEndLabel: {
  41048. type: String,
  41049. default: void 0
  41050. },
  41051. formatValueText: {
  41052. type: definePropType(Function),
  41053. default: void 0
  41054. },
  41055. tooltipClass: {
  41056. type: String,
  41057. default: void 0
  41058. },
  41059. placement: {
  41060. type: String,
  41061. values: Ee,
  41062. default: "top"
  41063. },
  41064. marks: {
  41065. type: definePropType(Object)
  41066. },
  41067. validateEvent: {
  41068. type: Boolean,
  41069. default: true
  41070. },
  41071. persistent: {
  41072. type: Boolean,
  41073. default: true
  41074. },
  41075. ...useAriaProps(["ariaLabel"])
  41076. });
  41077. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  41078. const sliderEmits = {
  41079. [UPDATE_MODEL_EVENT]: isValidValue$1,
  41080. [INPUT_EVENT]: isValidValue$1,
  41081. [CHANGE_EVENT]: isValidValue$1
  41082. };
  41083. const useLifecycle = (props, initData, resetSize) => {
  41084. const sliderWrapper = vue.ref();
  41085. vue.onMounted(async () => {
  41086. if (props.range) {
  41087. if (isArray$1(props.modelValue)) {
  41088. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  41089. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  41090. } else {
  41091. initData.firstValue = props.min;
  41092. initData.secondValue = props.max;
  41093. }
  41094. initData.oldValue = [initData.firstValue, initData.secondValue];
  41095. } else {
  41096. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) {
  41097. initData.firstValue = props.min;
  41098. } else {
  41099. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  41100. }
  41101. initData.oldValue = initData.firstValue;
  41102. }
  41103. useEventListener(window, "resize", resetSize);
  41104. await vue.nextTick();
  41105. resetSize();
  41106. });
  41107. return {
  41108. sliderWrapper
  41109. };
  41110. };
  41111. const useMarks = (props) => {
  41112. return vue.computed(() => {
  41113. if (!props.marks) {
  41114. return [];
  41115. }
  41116. const marksKeys = Object.keys(props.marks);
  41117. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  41118. point,
  41119. position: (point - props.min) * 100 / (props.max - props.min),
  41120. mark: props.marks[point]
  41121. }));
  41122. });
  41123. };
  41124. const useSlide = (props, initData, emit) => {
  41125. const { form: elForm, formItem: elFormItem } = useFormItem();
  41126. const slider = vue.shallowRef();
  41127. const firstButton = vue.ref();
  41128. const secondButton = vue.ref();
  41129. const buttonRefs = {
  41130. firstButton,
  41131. secondButton
  41132. };
  41133. const sliderDisabled = vue.computed(() => {
  41134. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  41135. });
  41136. const minValue = vue.computed(() => {
  41137. return Math.min(initData.firstValue, initData.secondValue);
  41138. });
  41139. const maxValue = vue.computed(() => {
  41140. return Math.max(initData.firstValue, initData.secondValue);
  41141. });
  41142. const barSize = vue.computed(() => {
  41143. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  41144. });
  41145. const barStart = vue.computed(() => {
  41146. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  41147. });
  41148. const runwayStyle = vue.computed(() => {
  41149. return props.vertical ? { height: props.height } : {};
  41150. });
  41151. const barStyle = vue.computed(() => {
  41152. return props.vertical ? {
  41153. height: barSize.value,
  41154. bottom: barStart.value
  41155. } : {
  41156. width: barSize.value,
  41157. left: barStart.value
  41158. };
  41159. });
  41160. const resetSize = () => {
  41161. if (slider.value) {
  41162. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  41163. }
  41164. };
  41165. const getButtonRefByPercent = (percent) => {
  41166. const targetValue = props.min + percent * (props.max - props.min) / 100;
  41167. if (!props.range) {
  41168. return firstButton;
  41169. }
  41170. let buttonRefName;
  41171. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  41172. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  41173. } else {
  41174. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  41175. }
  41176. return buttonRefs[buttonRefName];
  41177. };
  41178. const setPosition = (percent) => {
  41179. const buttonRef = getButtonRefByPercent(percent);
  41180. buttonRef.value.setPosition(percent);
  41181. return buttonRef;
  41182. };
  41183. const setFirstValue = (firstValue) => {
  41184. initData.firstValue = firstValue != null ? firstValue : props.min;
  41185. _emit(props.range ? [minValue.value, maxValue.value] : firstValue != null ? firstValue : props.min);
  41186. };
  41187. const setSecondValue = (secondValue) => {
  41188. initData.secondValue = secondValue;
  41189. if (props.range) {
  41190. _emit([minValue.value, maxValue.value]);
  41191. }
  41192. };
  41193. const _emit = (val) => {
  41194. emit(UPDATE_MODEL_EVENT, val);
  41195. emit(INPUT_EVENT, val);
  41196. };
  41197. const emitChange = async () => {
  41198. await vue.nextTick();
  41199. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  41200. };
  41201. const handleSliderPointerEvent = (event) => {
  41202. var _a, _b, _c, _d, _e, _f;
  41203. if (sliderDisabled.value || initData.dragging)
  41204. return;
  41205. resetSize();
  41206. let newPercent = 0;
  41207. if (props.vertical) {
  41208. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  41209. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  41210. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  41211. } else {
  41212. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  41213. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  41214. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  41215. }
  41216. if (newPercent < 0 || newPercent > 100)
  41217. return;
  41218. return setPosition(newPercent);
  41219. };
  41220. const onSliderWrapperPrevent = (event) => {
  41221. var _a, _b;
  41222. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  41223. event.preventDefault();
  41224. }
  41225. };
  41226. const onSliderDown = async (event) => {
  41227. const buttonRef = handleSliderPointerEvent(event);
  41228. if (buttonRef) {
  41229. await vue.nextTick();
  41230. buttonRef.value.onButtonDown(event);
  41231. }
  41232. };
  41233. const onSliderClick = (event) => {
  41234. const buttonRef = handleSliderPointerEvent(event);
  41235. if (buttonRef) {
  41236. emitChange();
  41237. }
  41238. };
  41239. const onSliderMarkerDown = (position) => {
  41240. if (sliderDisabled.value || initData.dragging)
  41241. return;
  41242. const buttonRef = setPosition(position);
  41243. if (buttonRef) {
  41244. emitChange();
  41245. }
  41246. };
  41247. return {
  41248. elFormItem,
  41249. slider,
  41250. firstButton,
  41251. secondButton,
  41252. sliderDisabled,
  41253. minValue,
  41254. maxValue,
  41255. runwayStyle,
  41256. barStyle,
  41257. resetSize,
  41258. setPosition,
  41259. emitChange,
  41260. onSliderWrapperPrevent,
  41261. onSliderClick,
  41262. onSliderDown,
  41263. onSliderMarkerDown,
  41264. setFirstValue,
  41265. setSecondValue
  41266. };
  41267. };
  41268. const useTooltip = (props, formatTooltip, showTooltip) => {
  41269. const tooltip = vue.ref();
  41270. const tooltipVisible = vue.ref(false);
  41271. const enableFormat = vue.computed(() => {
  41272. return formatTooltip.value instanceof Function;
  41273. });
  41274. const formatValue = vue.computed(() => {
  41275. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  41276. });
  41277. const displayTooltip = debounce(() => {
  41278. showTooltip.value && (tooltipVisible.value = true);
  41279. }, 50);
  41280. const hideTooltip = debounce(() => {
  41281. showTooltip.value && (tooltipVisible.value = false);
  41282. }, 50);
  41283. return {
  41284. tooltip,
  41285. tooltipVisible,
  41286. formatValue,
  41287. displayTooltip,
  41288. hideTooltip
  41289. };
  41290. };
  41291. const useSliderButton = (props, initData, emit) => {
  41292. const {
  41293. disabled,
  41294. min,
  41295. max,
  41296. step,
  41297. showTooltip,
  41298. persistent,
  41299. precision,
  41300. sliderSize,
  41301. formatTooltip,
  41302. emitChange,
  41303. resetSize,
  41304. updateDragging
  41305. } = vue.inject(sliderContextKey);
  41306. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  41307. const button = vue.ref();
  41308. const currentPosition = vue.computed(() => {
  41309. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  41310. });
  41311. const wrapperStyle = vue.computed(() => {
  41312. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  41313. });
  41314. const handleMouseEnter = () => {
  41315. initData.hovering = true;
  41316. displayTooltip();
  41317. };
  41318. const handleMouseLeave = () => {
  41319. initData.hovering = false;
  41320. if (!initData.dragging) {
  41321. hideTooltip();
  41322. }
  41323. };
  41324. const onButtonDown = (event) => {
  41325. if (disabled.value)
  41326. return;
  41327. event.preventDefault();
  41328. onDragStart(event);
  41329. window.addEventListener("mousemove", onDragging);
  41330. window.addEventListener("touchmove", onDragging);
  41331. window.addEventListener("mouseup", onDragEnd);
  41332. window.addEventListener("touchend", onDragEnd);
  41333. window.addEventListener("contextmenu", onDragEnd);
  41334. button.value.focus();
  41335. };
  41336. const incrementPosition = (amount) => {
  41337. if (disabled.value)
  41338. return;
  41339. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  41340. setPosition(initData.newPosition);
  41341. emitChange();
  41342. };
  41343. const onLeftKeyDown = () => {
  41344. incrementPosition(-step.value);
  41345. };
  41346. const onRightKeyDown = () => {
  41347. incrementPosition(step.value);
  41348. };
  41349. const onPageDownKeyDown = () => {
  41350. incrementPosition(-step.value * 4);
  41351. };
  41352. const onPageUpKeyDown = () => {
  41353. incrementPosition(step.value * 4);
  41354. };
  41355. const onHomeKeyDown = () => {
  41356. if (disabled.value)
  41357. return;
  41358. setPosition(0);
  41359. emitChange();
  41360. };
  41361. const onEndKeyDown = () => {
  41362. if (disabled.value)
  41363. return;
  41364. setPosition(100);
  41365. emitChange();
  41366. };
  41367. const onKeyDown = (event) => {
  41368. let isPreventDefault = true;
  41369. switch (event.code) {
  41370. case EVENT_CODE.left:
  41371. case EVENT_CODE.down:
  41372. onLeftKeyDown();
  41373. break;
  41374. case EVENT_CODE.right:
  41375. case EVENT_CODE.up:
  41376. onRightKeyDown();
  41377. break;
  41378. case EVENT_CODE.home:
  41379. onHomeKeyDown();
  41380. break;
  41381. case EVENT_CODE.end:
  41382. onEndKeyDown();
  41383. break;
  41384. case EVENT_CODE.pageDown:
  41385. onPageDownKeyDown();
  41386. break;
  41387. case EVENT_CODE.pageUp:
  41388. onPageUpKeyDown();
  41389. break;
  41390. default:
  41391. isPreventDefault = false;
  41392. break;
  41393. }
  41394. isPreventDefault && event.preventDefault();
  41395. };
  41396. const getClientXY = (event) => {
  41397. let clientX;
  41398. let clientY;
  41399. if (event.type.startsWith("touch")) {
  41400. clientY = event.touches[0].clientY;
  41401. clientX = event.touches[0].clientX;
  41402. } else {
  41403. clientY = event.clientY;
  41404. clientX = event.clientX;
  41405. }
  41406. return {
  41407. clientX,
  41408. clientY
  41409. };
  41410. };
  41411. const onDragStart = (event) => {
  41412. initData.dragging = true;
  41413. initData.isClick = true;
  41414. const { clientX, clientY } = getClientXY(event);
  41415. if (props.vertical) {
  41416. initData.startY = clientY;
  41417. } else {
  41418. initData.startX = clientX;
  41419. }
  41420. initData.startPosition = Number.parseFloat(currentPosition.value);
  41421. initData.newPosition = initData.startPosition;
  41422. };
  41423. const onDragging = (event) => {
  41424. if (initData.dragging) {
  41425. initData.isClick = false;
  41426. displayTooltip();
  41427. resetSize();
  41428. let diff;
  41429. const { clientX, clientY } = getClientXY(event);
  41430. if (props.vertical) {
  41431. initData.currentY = clientY;
  41432. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  41433. } else {
  41434. initData.currentX = clientX;
  41435. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  41436. }
  41437. initData.newPosition = initData.startPosition + diff;
  41438. setPosition(initData.newPosition);
  41439. }
  41440. };
  41441. const onDragEnd = () => {
  41442. if (initData.dragging) {
  41443. setTimeout(() => {
  41444. initData.dragging = false;
  41445. if (!initData.hovering) {
  41446. hideTooltip();
  41447. }
  41448. if (!initData.isClick) {
  41449. setPosition(initData.newPosition);
  41450. }
  41451. emitChange();
  41452. }, 0);
  41453. window.removeEventListener("mousemove", onDragging);
  41454. window.removeEventListener("touchmove", onDragging);
  41455. window.removeEventListener("mouseup", onDragEnd);
  41456. window.removeEventListener("touchend", onDragEnd);
  41457. window.removeEventListener("contextmenu", onDragEnd);
  41458. }
  41459. };
  41460. const setPosition = async (newPosition) => {
  41461. if (newPosition === null || Number.isNaN(+newPosition))
  41462. return;
  41463. if (newPosition < 0) {
  41464. newPosition = 0;
  41465. } else if (newPosition > 100) {
  41466. newPosition = 100;
  41467. }
  41468. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  41469. const steps = Math.round(newPosition / lengthPerStep);
  41470. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  41471. value = Number.parseFloat(value.toFixed(precision.value));
  41472. if (value !== props.modelValue) {
  41473. emit(UPDATE_MODEL_EVENT, value);
  41474. }
  41475. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  41476. initData.oldValue = props.modelValue;
  41477. }
  41478. await vue.nextTick();
  41479. initData.dragging && displayTooltip();
  41480. tooltip.value.updatePopper();
  41481. };
  41482. vue.watch(() => initData.dragging, (val) => {
  41483. updateDragging(val);
  41484. });
  41485. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  41486. return {
  41487. disabled,
  41488. button,
  41489. tooltip,
  41490. tooltipVisible,
  41491. showTooltip,
  41492. persistent,
  41493. wrapperStyle,
  41494. formatValue,
  41495. handleMouseEnter,
  41496. handleMouseLeave,
  41497. onButtonDown,
  41498. onKeyDown,
  41499. setPosition
  41500. };
  41501. };
  41502. const useStops = (props, initData, minValue, maxValue) => {
  41503. const stops = vue.computed(() => {
  41504. if (!props.showStops || props.min > props.max)
  41505. return [];
  41506. if (props.step === 0) {
  41507. return [];
  41508. }
  41509. const stopCount = (props.max - props.min) / props.step;
  41510. const stepWidth = 100 * props.step / (props.max - props.min);
  41511. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  41512. if (props.range) {
  41513. return result.filter((step) => {
  41514. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  41515. });
  41516. } else {
  41517. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  41518. }
  41519. });
  41520. const getStopStyle = (position) => {
  41521. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  41522. };
  41523. return {
  41524. stops,
  41525. getStopStyle
  41526. };
  41527. };
  41528. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  41529. const _emit = (val) => {
  41530. emit(UPDATE_MODEL_EVENT, val);
  41531. emit(INPUT_EVENT, val);
  41532. };
  41533. const valueChanged = () => {
  41534. if (props.range) {
  41535. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  41536. } else {
  41537. return props.modelValue !== initData.oldValue;
  41538. }
  41539. };
  41540. const setValues = () => {
  41541. var _a, _b;
  41542. if (props.min > props.max) {
  41543. throwError("Slider", "min should not be greater than max.");
  41544. }
  41545. const val = props.modelValue;
  41546. if (props.range && isArray$1(val)) {
  41547. if (val[1] < props.min) {
  41548. _emit([props.min, props.min]);
  41549. } else if (val[0] > props.max) {
  41550. _emit([props.max, props.max]);
  41551. } else if (val[0] < props.min) {
  41552. _emit([props.min, val[1]]);
  41553. } else if (val[1] > props.max) {
  41554. _emit([val[0], props.max]);
  41555. } else {
  41556. initData.firstValue = val[0];
  41557. initData.secondValue = val[1];
  41558. if (valueChanged()) {
  41559. if (props.validateEvent) {
  41560. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  41561. }
  41562. initData.oldValue = val.slice();
  41563. }
  41564. }
  41565. } else if (!props.range && isNumber(val) && !Number.isNaN(val)) {
  41566. if (val < props.min) {
  41567. _emit(props.min);
  41568. } else if (val > props.max) {
  41569. _emit(props.max);
  41570. } else {
  41571. initData.firstValue = val;
  41572. if (valueChanged()) {
  41573. if (props.validateEvent) {
  41574. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  41575. }
  41576. initData.oldValue = val;
  41577. }
  41578. }
  41579. }
  41580. };
  41581. setValues();
  41582. vue.watch(() => initData.dragging, (val) => {
  41583. if (!val) {
  41584. setValues();
  41585. }
  41586. });
  41587. vue.watch(() => props.modelValue, (val, oldVal) => {
  41588. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  41589. return;
  41590. }
  41591. setValues();
  41592. }, {
  41593. deep: true
  41594. });
  41595. vue.watch(() => [props.min, props.max], () => {
  41596. setValues();
  41597. });
  41598. };
  41599. const sliderButtonProps = buildProps({
  41600. modelValue: {
  41601. type: Number,
  41602. default: 0
  41603. },
  41604. vertical: Boolean,
  41605. tooltipClass: String,
  41606. placement: {
  41607. type: String,
  41608. values: Ee,
  41609. default: "top"
  41610. }
  41611. });
  41612. const sliderButtonEmits = {
  41613. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  41614. };
  41615. const __default__$C = vue.defineComponent({
  41616. name: "ElSliderButton"
  41617. });
  41618. const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
  41619. ...__default__$C,
  41620. props: sliderButtonProps,
  41621. emits: sliderButtonEmits,
  41622. setup(__props, { expose, emit }) {
  41623. const props = __props;
  41624. const ns = useNamespace("slider");
  41625. const initData = vue.reactive({
  41626. hovering: false,
  41627. dragging: false,
  41628. isClick: false,
  41629. startX: 0,
  41630. currentX: 0,
  41631. startY: 0,
  41632. currentY: 0,
  41633. startPosition: 0,
  41634. newPosition: 0,
  41635. oldValue: props.modelValue
  41636. });
  41637. const tooltipPersistent = vue.computed(() => !showTooltip.value ? false : persistent.value);
  41638. const {
  41639. disabled,
  41640. button,
  41641. tooltip,
  41642. showTooltip,
  41643. persistent,
  41644. tooltipVisible,
  41645. wrapperStyle,
  41646. formatValue,
  41647. handleMouseEnter,
  41648. handleMouseLeave,
  41649. onButtonDown,
  41650. onKeyDown,
  41651. setPosition
  41652. } = useSliderButton(props, initData, emit);
  41653. const { hovering, dragging } = vue.toRefs(initData);
  41654. expose({
  41655. onButtonDown,
  41656. onKeyDown,
  41657. setPosition,
  41658. hovering,
  41659. dragging
  41660. });
  41661. return (_ctx, _cache) => {
  41662. return vue.openBlock(), vue.createElementBlock("div", {
  41663. ref_key: "button",
  41664. ref: button,
  41665. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  41666. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  41667. tabindex: vue.unref(disabled) ? -1 : 0,
  41668. onMouseenter: vue.unref(handleMouseEnter),
  41669. onMouseleave: vue.unref(handleMouseLeave),
  41670. onMousedown: vue.unref(onButtonDown),
  41671. onFocus: vue.unref(handleMouseEnter),
  41672. onBlur: vue.unref(handleMouseLeave),
  41673. onKeydown: vue.unref(onKeyDown)
  41674. }, [
  41675. vue.createVNode(vue.unref(ElTooltip), {
  41676. ref_key: "tooltip",
  41677. ref: tooltip,
  41678. visible: vue.unref(tooltipVisible),
  41679. placement: _ctx.placement,
  41680. "fallback-placements": ["top", "bottom", "right", "left"],
  41681. "stop-popper-mouse-event": false,
  41682. "popper-class": _ctx.tooltipClass,
  41683. disabled: !vue.unref(showTooltip),
  41684. persistent: vue.unref(tooltipPersistent)
  41685. }, {
  41686. content: vue.withCtx(() => [
  41687. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  41688. ]),
  41689. default: vue.withCtx(() => [
  41690. vue.createElementVNode("div", {
  41691. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  41692. }, null, 2)
  41693. ]),
  41694. _: 1
  41695. }, 8, ["visible", "placement", "popper-class", "disabled", "persistent"])
  41696. ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]);
  41697. };
  41698. }
  41699. });
  41700. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "button.vue"]]);
  41701. const sliderMarkerProps = buildProps({
  41702. mark: {
  41703. type: definePropType([String, Object]),
  41704. default: void 0
  41705. }
  41706. });
  41707. var SliderMarker = vue.defineComponent({
  41708. name: "ElSliderMarker",
  41709. props: sliderMarkerProps,
  41710. setup(props) {
  41711. const ns = useNamespace("slider");
  41712. const label = vue.computed(() => {
  41713. return isString$1(props.mark) ? props.mark : props.mark.label;
  41714. });
  41715. const style = vue.computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  41716. return () => vue.h("div", {
  41717. class: ns.e("marks-text"),
  41718. style: style.value
  41719. }, label.value);
  41720. }
  41721. });
  41722. const __default__$B = vue.defineComponent({
  41723. name: "ElSlider"
  41724. });
  41725. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  41726. ...__default__$B,
  41727. props: sliderProps,
  41728. emits: sliderEmits,
  41729. setup(__props, { expose, emit }) {
  41730. const props = __props;
  41731. const ns = useNamespace("slider");
  41732. const { t } = useLocale();
  41733. const initData = vue.reactive({
  41734. firstValue: 0,
  41735. secondValue: 0,
  41736. oldValue: 0,
  41737. dragging: false,
  41738. sliderSize: 1
  41739. });
  41740. const {
  41741. elFormItem,
  41742. slider,
  41743. firstButton,
  41744. secondButton,
  41745. sliderDisabled,
  41746. minValue,
  41747. maxValue,
  41748. runwayStyle,
  41749. barStyle,
  41750. resetSize,
  41751. emitChange,
  41752. onSliderWrapperPrevent,
  41753. onSliderClick,
  41754. onSliderDown,
  41755. onSliderMarkerDown,
  41756. setFirstValue,
  41757. setSecondValue
  41758. } = useSlide(props, initData, emit);
  41759. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  41760. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  41761. formItemContext: elFormItem
  41762. });
  41763. const sliderWrapperSize = useFormSize();
  41764. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  41765. const groupLabel = vue.computed(() => {
  41766. return props.ariaLabel || t("el.slider.defaultLabel", {
  41767. min: props.min,
  41768. max: props.max
  41769. });
  41770. });
  41771. const firstButtonLabel = vue.computed(() => {
  41772. if (props.range) {
  41773. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  41774. } else {
  41775. return groupLabel.value;
  41776. }
  41777. });
  41778. const firstValueText = vue.computed(() => {
  41779. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  41780. });
  41781. const secondButtonLabel = vue.computed(() => {
  41782. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  41783. });
  41784. const secondValueText = vue.computed(() => {
  41785. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  41786. });
  41787. const sliderKls = vue.computed(() => [
  41788. ns.b(),
  41789. ns.m(sliderWrapperSize.value),
  41790. ns.is("vertical", props.vertical),
  41791. { [ns.m("with-input")]: props.showInput }
  41792. ]);
  41793. const markList = useMarks(props);
  41794. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  41795. const precision = vue.computed(() => {
  41796. const precisions = [props.min, props.max, props.step].map((item) => {
  41797. const decimal = `${item}`.split(".")[1];
  41798. return decimal ? decimal.length : 0;
  41799. });
  41800. return Math.max.apply(null, precisions);
  41801. });
  41802. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  41803. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  41804. const updateDragging = (val) => {
  41805. initData.dragging = val;
  41806. };
  41807. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, {
  41808. passive: false
  41809. });
  41810. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, {
  41811. passive: false
  41812. });
  41813. vue.provide(sliderContextKey, {
  41814. ...vue.toRefs(props),
  41815. sliderSize,
  41816. disabled: sliderDisabled,
  41817. precision,
  41818. emitChange,
  41819. resetSize,
  41820. updateDragging
  41821. });
  41822. expose({
  41823. onSliderClick
  41824. });
  41825. return (_ctx, _cache) => {
  41826. var _a, _b;
  41827. return vue.openBlock(), vue.createElementBlock("div", {
  41828. id: _ctx.range ? vue.unref(inputId) : void 0,
  41829. ref_key: "sliderWrapper",
  41830. ref: sliderWrapper,
  41831. class: vue.normalizeClass(vue.unref(sliderKls)),
  41832. role: _ctx.range ? "group" : void 0,
  41833. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  41834. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0
  41835. }, [
  41836. vue.createElementVNode("div", {
  41837. ref_key: "slider",
  41838. ref: slider,
  41839. class: vue.normalizeClass([
  41840. vue.unref(ns).e("runway"),
  41841. { "show-input": _ctx.showInput && !_ctx.range },
  41842. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  41843. ]),
  41844. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  41845. onMousedown: vue.unref(onSliderDown),
  41846. onTouchstartPassive: vue.unref(onSliderDown)
  41847. }, [
  41848. vue.createElementVNode("div", {
  41849. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  41850. style: vue.normalizeStyle(vue.unref(barStyle))
  41851. }, null, 6),
  41852. vue.createVNode(SliderButton, {
  41853. id: !_ctx.range ? vue.unref(inputId) : void 0,
  41854. ref_key: "firstButton",
  41855. ref: firstButton,
  41856. "model-value": vue.unref(firstValue),
  41857. vertical: _ctx.vertical,
  41858. "tooltip-class": _ctx.tooltipClass,
  41859. placement: _ctx.placement,
  41860. role: "slider",
  41861. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  41862. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  41863. "aria-valuemin": _ctx.min,
  41864. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  41865. "aria-valuenow": vue.unref(firstValue),
  41866. "aria-valuetext": vue.unref(firstValueText),
  41867. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41868. "aria-disabled": vue.unref(sliderDisabled),
  41869. "onUpdate:modelValue": vue.unref(setFirstValue)
  41870. }, 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"]),
  41871. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  41872. key: 0,
  41873. ref_key: "secondButton",
  41874. ref: secondButton,
  41875. "model-value": vue.unref(secondValue),
  41876. vertical: _ctx.vertical,
  41877. "tooltip-class": _ctx.tooltipClass,
  41878. placement: _ctx.placement,
  41879. role: "slider",
  41880. "aria-label": vue.unref(secondButtonLabel),
  41881. "aria-valuemin": vue.unref(firstValue),
  41882. "aria-valuemax": _ctx.max,
  41883. "aria-valuenow": vue.unref(secondValue),
  41884. "aria-valuetext": vue.unref(secondValueText),
  41885. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41886. "aria-disabled": vue.unref(sliderDisabled),
  41887. "onUpdate:modelValue": vue.unref(setSecondValue)
  41888. }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : vue.createCommentVNode("v-if", true),
  41889. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", { key: 1 }, [
  41890. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  41891. return vue.openBlock(), vue.createElementBlock("div", {
  41892. key,
  41893. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  41894. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  41895. }, null, 6);
  41896. }), 128))
  41897. ])) : vue.createCommentVNode("v-if", true),
  41898. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  41899. vue.createElementVNode("div", null, [
  41900. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  41901. return vue.openBlock(), vue.createElementBlock("div", {
  41902. key,
  41903. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  41904. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  41905. }, null, 6);
  41906. }), 128))
  41907. ]),
  41908. vue.createElementVNode("div", {
  41909. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  41910. }, [
  41911. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  41912. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  41913. key,
  41914. mark: item.mark,
  41915. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  41916. onMousedown: vue.withModifiers(($event) => vue.unref(onSliderMarkerDown)(item.position), ["stop"])
  41917. }, null, 8, ["mark", "style", "onMousedown"]);
  41918. }), 128))
  41919. ], 2)
  41920. ], 64)) : vue.createCommentVNode("v-if", true)
  41921. ], 46, ["onMousedown", "onTouchstartPassive"]),
  41922. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  41923. key: 0,
  41924. ref: "input",
  41925. "model-value": vue.unref(firstValue),
  41926. class: vue.normalizeClass(vue.unref(ns).e("input")),
  41927. step: _ctx.step,
  41928. disabled: vue.unref(sliderDisabled),
  41929. controls: _ctx.showInputControls,
  41930. min: _ctx.min,
  41931. max: _ctx.max,
  41932. precision: vue.unref(precision),
  41933. debounce: _ctx.debounce,
  41934. size: vue.unref(sliderInputSize),
  41935. "onUpdate:modelValue": vue.unref(setFirstValue),
  41936. onChange: vue.unref(emitChange)
  41937. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  41938. ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
  41939. };
  41940. }
  41941. });
  41942. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "slider.vue"]]);
  41943. const ElSlider = withInstall(Slider);
  41944. const spaceItemProps = buildProps({
  41945. prefixCls: {
  41946. type: String
  41947. }
  41948. });
  41949. const SpaceItem = vue.defineComponent({
  41950. name: "ElSpaceItem",
  41951. props: spaceItemProps,
  41952. setup(props, { slots }) {
  41953. const ns = useNamespace("space");
  41954. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  41955. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  41956. }
  41957. });
  41958. const SIZE_MAP = {
  41959. small: 8,
  41960. default: 12,
  41961. large: 16
  41962. };
  41963. function useSpace(props) {
  41964. const ns = useNamespace("space");
  41965. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  41966. const horizontalSize = vue.ref(0);
  41967. const verticalSize = vue.ref(0);
  41968. const containerStyle = vue.computed(() => {
  41969. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  41970. const alignment = {
  41971. alignItems: props.alignment
  41972. };
  41973. const gap = {
  41974. rowGap: `${verticalSize.value}px`,
  41975. columnGap: `${horizontalSize.value}px`
  41976. };
  41977. return [wrapKls, alignment, gap, props.style];
  41978. });
  41979. const itemStyle = vue.computed(() => {
  41980. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  41981. });
  41982. vue.watchEffect(() => {
  41983. const { size = "small", wrap, direction: dir, fill } = props;
  41984. if (isArray$1(size)) {
  41985. const [h = 0, v = 0] = size;
  41986. horizontalSize.value = h;
  41987. verticalSize.value = v;
  41988. } else {
  41989. let val;
  41990. if (isNumber(size)) {
  41991. val = size;
  41992. } else {
  41993. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  41994. }
  41995. if ((wrap || fill) && dir === "horizontal") {
  41996. horizontalSize.value = verticalSize.value = val;
  41997. } else {
  41998. if (dir === "horizontal") {
  41999. horizontalSize.value = val;
  42000. verticalSize.value = 0;
  42001. } else {
  42002. verticalSize.value = val;
  42003. horizontalSize.value = 0;
  42004. }
  42005. }
  42006. }
  42007. });
  42008. return {
  42009. classes,
  42010. containerStyle,
  42011. itemStyle
  42012. };
  42013. }
  42014. const spaceProps = buildProps({
  42015. direction: {
  42016. type: String,
  42017. values: ["horizontal", "vertical"],
  42018. default: "horizontal"
  42019. },
  42020. class: {
  42021. type: definePropType([
  42022. String,
  42023. Object,
  42024. Array
  42025. ]),
  42026. default: ""
  42027. },
  42028. style: {
  42029. type: definePropType([String, Array, Object]),
  42030. default: ""
  42031. },
  42032. alignment: {
  42033. type: definePropType(String),
  42034. default: "center"
  42035. },
  42036. prefixCls: {
  42037. type: String
  42038. },
  42039. spacer: {
  42040. type: definePropType([Object, String, Number, Array]),
  42041. default: null,
  42042. validator: (val) => vue.isVNode(val) || isNumber(val) || isString$1(val)
  42043. },
  42044. wrap: Boolean,
  42045. fill: Boolean,
  42046. fillRatio: {
  42047. type: Number,
  42048. default: 100
  42049. },
  42050. size: {
  42051. type: [String, Array, Number],
  42052. values: componentSizes,
  42053. validator: (val) => {
  42054. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  42055. }
  42056. }
  42057. });
  42058. const Space = vue.defineComponent({
  42059. name: "ElSpace",
  42060. props: spaceProps,
  42061. setup(props, { slots }) {
  42062. const { classes, containerStyle, itemStyle } = useSpace(props);
  42063. function extractChildren(children, parentKey = "", extractedChildren = []) {
  42064. const { prefixCls } = props;
  42065. children.forEach((child, loopKey) => {
  42066. if (isFragment(child)) {
  42067. if (isArray$1(child.children)) {
  42068. child.children.forEach((nested, key) => {
  42069. if (isFragment(nested) && isArray$1(nested.children)) {
  42070. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  42071. } else {
  42072. extractedChildren.push(vue.createVNode(SpaceItem, {
  42073. style: itemStyle.value,
  42074. prefixCls,
  42075. key: `nested-${parentKey + key}`
  42076. }, {
  42077. default: () => [nested]
  42078. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  42079. }
  42080. });
  42081. }
  42082. } else if (isValidElementNode(child)) {
  42083. extractedChildren.push(vue.createVNode(SpaceItem, {
  42084. style: itemStyle.value,
  42085. prefixCls,
  42086. key: `LoopKey${parentKey + loopKey}`
  42087. }, {
  42088. default: () => [child]
  42089. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  42090. }
  42091. });
  42092. return extractedChildren;
  42093. }
  42094. return () => {
  42095. var _a;
  42096. const { spacer, direction } = props;
  42097. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  42098. if (((_a = children.children) != null ? _a : []).length === 0)
  42099. return null;
  42100. if (isArray$1(children.children)) {
  42101. let extractedChildren = extractChildren(children.children);
  42102. if (spacer) {
  42103. const len = extractedChildren.length - 1;
  42104. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  42105. const children2 = [...acc, child];
  42106. if (idx !== len) {
  42107. children2.push(vue.createVNode("span", {
  42108. style: [
  42109. itemStyle.value,
  42110. direction === "vertical" ? "width: 100%" : null
  42111. ],
  42112. key: idx
  42113. }, [
  42114. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  42115. ], PatchFlags.STYLE));
  42116. }
  42117. return children2;
  42118. }, []);
  42119. }
  42120. return vue.createVNode("div", {
  42121. class: classes.value,
  42122. style: containerStyle.value
  42123. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  42124. }
  42125. return children.children;
  42126. };
  42127. }
  42128. });
  42129. const ElSpace = withInstall(Space);
  42130. const statisticProps = buildProps({
  42131. decimalSeparator: {
  42132. type: String,
  42133. default: "."
  42134. },
  42135. groupSeparator: {
  42136. type: String,
  42137. default: ","
  42138. },
  42139. precision: {
  42140. type: Number,
  42141. default: 0
  42142. },
  42143. formatter: Function,
  42144. value: {
  42145. type: definePropType([Number, Object]),
  42146. default: 0
  42147. },
  42148. prefix: String,
  42149. suffix: String,
  42150. title: String,
  42151. valueStyle: {
  42152. type: definePropType([String, Object, Array])
  42153. }
  42154. });
  42155. const __default__$A = vue.defineComponent({
  42156. name: "ElStatistic"
  42157. });
  42158. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  42159. ...__default__$A,
  42160. props: statisticProps,
  42161. setup(__props, { expose }) {
  42162. const props = __props;
  42163. const ns = useNamespace("statistic");
  42164. const displayValue = vue.computed(() => {
  42165. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  42166. if (isFunction$1(formatter))
  42167. return formatter(value);
  42168. if (!isNumber(value) || Number.isNaN(value))
  42169. return value;
  42170. let [integer, decimal = ""] = String(value).split(".");
  42171. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  42172. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  42173. return [integer, decimal].join(decimal ? decimalSeparator : "");
  42174. });
  42175. expose({
  42176. displayValue
  42177. });
  42178. return (_ctx, _cache) => {
  42179. return vue.openBlock(), vue.createElementBlock("div", {
  42180. class: vue.normalizeClass(vue.unref(ns).b())
  42181. }, [
  42182. _ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  42183. key: 0,
  42184. class: vue.normalizeClass(vue.unref(ns).e("head"))
  42185. }, [
  42186. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  42187. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  42188. ])
  42189. ], 2)) : vue.createCommentVNode("v-if", true),
  42190. vue.createElementVNode("div", {
  42191. class: vue.normalizeClass(vue.unref(ns).e("content"))
  42192. }, [
  42193. _ctx.$slots.prefix || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  42194. key: 0,
  42195. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  42196. }, [
  42197. vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
  42198. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.prefix), 1)
  42199. ])
  42200. ], 2)) : vue.createCommentVNode("v-if", true),
  42201. vue.createElementVNode("span", {
  42202. class: vue.normalizeClass(vue.unref(ns).e("number")),
  42203. style: vue.normalizeStyle(_ctx.valueStyle)
  42204. }, vue.toDisplayString(vue.unref(displayValue)), 7),
  42205. _ctx.$slots.suffix || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("div", {
  42206. key: 1,
  42207. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  42208. }, [
  42209. vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
  42210. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.suffix), 1)
  42211. ])
  42212. ], 2)) : vue.createCommentVNode("v-if", true)
  42213. ], 2)
  42214. ], 2);
  42215. };
  42216. }
  42217. });
  42218. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "statistic.vue"]]);
  42219. const ElStatistic = withInstall(Statistic);
  42220. const countdownProps = buildProps({
  42221. format: {
  42222. type: String,
  42223. default: "HH:mm:ss"
  42224. },
  42225. prefix: String,
  42226. suffix: String,
  42227. title: String,
  42228. value: {
  42229. type: definePropType([Number, Object]),
  42230. default: 0
  42231. },
  42232. valueStyle: {
  42233. type: definePropType([String, Object, Array])
  42234. }
  42235. });
  42236. const countdownEmits = {
  42237. finish: () => true,
  42238. [CHANGE_EVENT]: (value) => isNumber(value)
  42239. };
  42240. const timeUnits = [
  42241. ["Y", 1e3 * 60 * 60 * 24 * 365],
  42242. ["M", 1e3 * 60 * 60 * 24 * 30],
  42243. ["D", 1e3 * 60 * 60 * 24],
  42244. ["H", 1e3 * 60 * 60],
  42245. ["m", 1e3 * 60],
  42246. ["s", 1e3],
  42247. ["S", 1]
  42248. ];
  42249. const getTime = (value) => {
  42250. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  42251. };
  42252. const formatTime$1 = (timestamp, format) => {
  42253. let timeLeft = timestamp;
  42254. const escapeRegex = /\[([^\]]*)]/g;
  42255. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  42256. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  42257. if (replaceRegex.test(current)) {
  42258. const value = Math.floor(timeLeft / unit);
  42259. timeLeft -= value * unit;
  42260. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  42261. }
  42262. return current;
  42263. }, format);
  42264. return replacedText.replace(escapeRegex, "$1");
  42265. };
  42266. const __default__$z = vue.defineComponent({
  42267. name: "ElCountdown"
  42268. });
  42269. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  42270. ...__default__$z,
  42271. props: countdownProps,
  42272. emits: countdownEmits,
  42273. setup(__props, { expose, emit }) {
  42274. const props = __props;
  42275. let timer;
  42276. const rawValue = vue.ref(0);
  42277. const displayValue = vue.computed(() => formatTime$1(rawValue.value, props.format));
  42278. const formatter = (val) => formatTime$1(val, props.format);
  42279. const stopTimer = () => {
  42280. if (timer) {
  42281. cAF(timer);
  42282. timer = void 0;
  42283. }
  42284. };
  42285. const startTimer = () => {
  42286. const timestamp = getTime(props.value);
  42287. const frameFunc = () => {
  42288. let diff = timestamp - Date.now();
  42289. emit(CHANGE_EVENT, diff);
  42290. if (diff <= 0) {
  42291. diff = 0;
  42292. stopTimer();
  42293. emit("finish");
  42294. } else {
  42295. timer = rAF(frameFunc);
  42296. }
  42297. rawValue.value = diff;
  42298. };
  42299. timer = rAF(frameFunc);
  42300. };
  42301. vue.onMounted(() => {
  42302. rawValue.value = getTime(props.value) - Date.now();
  42303. vue.watch(() => [props.value, props.format], () => {
  42304. stopTimer();
  42305. startTimer();
  42306. }, {
  42307. immediate: true
  42308. });
  42309. });
  42310. vue.onBeforeUnmount(() => {
  42311. stopTimer();
  42312. });
  42313. expose({
  42314. displayValue
  42315. });
  42316. return (_ctx, _cache) => {
  42317. return vue.openBlock(), vue.createBlock(vue.unref(ElStatistic), {
  42318. value: rawValue.value,
  42319. title: _ctx.title,
  42320. prefix: _ctx.prefix,
  42321. suffix: _ctx.suffix,
  42322. "value-style": _ctx.valueStyle,
  42323. formatter
  42324. }, vue.createSlots({
  42325. _: 2
  42326. }, [
  42327. vue.renderList(_ctx.$slots, (_, name) => {
  42328. return {
  42329. name,
  42330. fn: vue.withCtx(() => [
  42331. vue.renderSlot(_ctx.$slots, name)
  42332. ])
  42333. };
  42334. })
  42335. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  42336. };
  42337. }
  42338. });
  42339. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "countdown.vue"]]);
  42340. const ElCountdown = withInstall(Countdown);
  42341. const stepsProps = buildProps({
  42342. space: {
  42343. type: [Number, String],
  42344. default: ""
  42345. },
  42346. active: {
  42347. type: Number,
  42348. default: 0
  42349. },
  42350. direction: {
  42351. type: String,
  42352. default: "horizontal",
  42353. values: ["horizontal", "vertical"]
  42354. },
  42355. alignCenter: {
  42356. type: Boolean
  42357. },
  42358. simple: {
  42359. type: Boolean
  42360. },
  42361. finishStatus: {
  42362. type: String,
  42363. values: ["wait", "process", "finish", "error", "success"],
  42364. default: "finish"
  42365. },
  42366. processStatus: {
  42367. type: String,
  42368. values: ["wait", "process", "finish", "error", "success"],
  42369. default: "process"
  42370. }
  42371. });
  42372. const stepsEmits = {
  42373. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  42374. };
  42375. const __default__$y = vue.defineComponent({
  42376. name: "ElSteps"
  42377. });
  42378. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  42379. ...__default__$y,
  42380. props: stepsProps,
  42381. emits: stepsEmits,
  42382. setup(__props, { emit }) {
  42383. const props = __props;
  42384. const ns = useNamespace("steps");
  42385. const {
  42386. children: steps,
  42387. addChild: addStep,
  42388. removeChild: removeStep
  42389. } = useOrderedChildren(vue.getCurrentInstance(), "ElStep");
  42390. vue.watch(steps, () => {
  42391. steps.value.forEach((instance, index) => {
  42392. instance.setIndex(index);
  42393. });
  42394. });
  42395. vue.provide("ElSteps", { props, steps, addStep, removeStep });
  42396. vue.watch(() => props.active, (newVal, oldVal) => {
  42397. emit(CHANGE_EVENT, newVal, oldVal);
  42398. });
  42399. return (_ctx, _cache) => {
  42400. return vue.openBlock(), vue.createElementBlock("div", {
  42401. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  42402. }, [
  42403. vue.renderSlot(_ctx.$slots, "default")
  42404. ], 2);
  42405. };
  42406. }
  42407. });
  42408. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "steps.vue"]]);
  42409. const stepProps = buildProps({
  42410. title: {
  42411. type: String,
  42412. default: ""
  42413. },
  42414. icon: {
  42415. type: iconPropType
  42416. },
  42417. description: {
  42418. type: String,
  42419. default: ""
  42420. },
  42421. status: {
  42422. type: String,
  42423. values: ["", "wait", "process", "finish", "error", "success"],
  42424. default: ""
  42425. }
  42426. });
  42427. const __default__$x = vue.defineComponent({
  42428. name: "ElStep"
  42429. });
  42430. const _sfc_main$E = vue.defineComponent({
  42431. ...__default__$x,
  42432. props: stepProps,
  42433. setup(__props) {
  42434. const props = __props;
  42435. const ns = useNamespace("step");
  42436. const index = vue.ref(-1);
  42437. const lineStyle = vue.ref({});
  42438. const internalStatus = vue.ref("");
  42439. const parent = vue.inject("ElSteps");
  42440. const currentInstance = vue.getCurrentInstance();
  42441. vue.onMounted(() => {
  42442. vue.watch([
  42443. () => parent.props.active,
  42444. () => parent.props.processStatus,
  42445. () => parent.props.finishStatus
  42446. ], ([active]) => {
  42447. updateStatus(active);
  42448. }, { immediate: true });
  42449. });
  42450. vue.onBeforeUnmount(() => {
  42451. parent.removeStep(stepItemState.uid);
  42452. });
  42453. const currentStatus = vue.computed(() => {
  42454. return props.status || internalStatus.value;
  42455. });
  42456. const prevStatus = vue.computed(() => {
  42457. const prevStep = parent.steps.value[index.value - 1];
  42458. return prevStep ? prevStep.currentStatus : "wait";
  42459. });
  42460. const isCenter = vue.computed(() => {
  42461. return parent.props.alignCenter;
  42462. });
  42463. const isVertical = vue.computed(() => {
  42464. return parent.props.direction === "vertical";
  42465. });
  42466. const isSimple = vue.computed(() => {
  42467. return parent.props.simple;
  42468. });
  42469. const stepsCount = vue.computed(() => {
  42470. return parent.steps.value.length;
  42471. });
  42472. const isLast = vue.computed(() => {
  42473. var _a;
  42474. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  42475. });
  42476. const space = vue.computed(() => {
  42477. return isSimple.value ? "" : parent.props.space;
  42478. });
  42479. const containerKls = vue.computed(() => {
  42480. return [
  42481. ns.b(),
  42482. ns.is(isSimple.value ? "simple" : parent.props.direction),
  42483. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  42484. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  42485. ];
  42486. });
  42487. const style = vue.computed(() => {
  42488. const style2 = {
  42489. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  42490. };
  42491. if (isVertical.value)
  42492. return style2;
  42493. if (isLast.value) {
  42494. style2.maxWidth = `${100 / stepsCount.value}%`;
  42495. }
  42496. return style2;
  42497. });
  42498. const setIndex = (val) => {
  42499. index.value = val;
  42500. };
  42501. const calcProgress = (status) => {
  42502. const isWait = status === "wait";
  42503. const style2 = {
  42504. transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
  42505. };
  42506. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  42507. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  42508. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  42509. lineStyle.value = style2;
  42510. };
  42511. const updateStatus = (activeIndex) => {
  42512. if (activeIndex > index.value) {
  42513. internalStatus.value = parent.props.finishStatus;
  42514. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  42515. internalStatus.value = parent.props.processStatus;
  42516. } else {
  42517. internalStatus.value = "wait";
  42518. }
  42519. const prevChild = parent.steps.value[index.value - 1];
  42520. if (prevChild)
  42521. prevChild.calcProgress(internalStatus.value);
  42522. };
  42523. const stepItemState = vue.reactive({
  42524. uid: currentInstance.uid,
  42525. currentStatus,
  42526. setIndex,
  42527. calcProgress
  42528. });
  42529. parent.addStep(stepItemState);
  42530. return (_ctx, _cache) => {
  42531. return vue.openBlock(), vue.createElementBlock("div", {
  42532. style: vue.normalizeStyle(vue.unref(style)),
  42533. class: vue.normalizeClass(vue.unref(containerKls))
  42534. }, [
  42535. vue.createCommentVNode(" icon & line "),
  42536. vue.createElementVNode("div", {
  42537. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  42538. }, [
  42539. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  42540. key: 0,
  42541. class: vue.normalizeClass(vue.unref(ns).e("line"))
  42542. }, [
  42543. vue.createElementVNode("i", {
  42544. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  42545. style: vue.normalizeStyle(lineStyle.value)
  42546. }, null, 6)
  42547. ], 2)) : vue.createCommentVNode("v-if", true),
  42548. vue.createElementVNode("div", {
  42549. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  42550. }, [
  42551. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  42552. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42553. key: 0,
  42554. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  42555. }, {
  42556. default: vue.withCtx(() => [
  42557. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  42558. ]),
  42559. _: 1
  42560. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42561. key: 1,
  42562. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  42563. }, {
  42564. default: vue.withCtx(() => [
  42565. vue.createVNode(vue.unref(check_default))
  42566. ]),
  42567. _: 1
  42568. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42569. key: 2,
  42570. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  42571. }, {
  42572. default: vue.withCtx(() => [
  42573. vue.createVNode(vue.unref(close_default))
  42574. ]),
  42575. _: 1
  42576. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  42577. key: 3,
  42578. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  42579. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  42580. ])
  42581. ], 2)
  42582. ], 2),
  42583. vue.createCommentVNode(" title & description "),
  42584. vue.createElementVNode("div", {
  42585. class: vue.normalizeClass(vue.unref(ns).e("main"))
  42586. }, [
  42587. vue.createElementVNode("div", {
  42588. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  42589. }, [
  42590. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  42591. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  42592. ])
  42593. ], 2),
  42594. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  42595. key: 0,
  42596. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  42597. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  42598. key: 1,
  42599. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  42600. }, [
  42601. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  42602. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  42603. ])
  42604. ], 2))
  42605. ], 2)
  42606. ], 6);
  42607. };
  42608. }
  42609. });
  42610. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "item.vue"]]);
  42611. const ElSteps = withInstall(Steps, {
  42612. Step
  42613. });
  42614. const ElStep = withNoopInstall(Step);
  42615. const switchProps = buildProps({
  42616. modelValue: {
  42617. type: [Boolean, String, Number],
  42618. default: false
  42619. },
  42620. disabled: Boolean,
  42621. loading: Boolean,
  42622. size: {
  42623. type: String,
  42624. validator: isValidComponentSize
  42625. },
  42626. width: {
  42627. type: [String, Number],
  42628. default: ""
  42629. },
  42630. inlinePrompt: Boolean,
  42631. inactiveActionIcon: {
  42632. type: iconPropType
  42633. },
  42634. activeActionIcon: {
  42635. type: iconPropType
  42636. },
  42637. activeIcon: {
  42638. type: iconPropType
  42639. },
  42640. inactiveIcon: {
  42641. type: iconPropType
  42642. },
  42643. activeText: {
  42644. type: String,
  42645. default: ""
  42646. },
  42647. inactiveText: {
  42648. type: String,
  42649. default: ""
  42650. },
  42651. activeValue: {
  42652. type: [Boolean, String, Number],
  42653. default: true
  42654. },
  42655. inactiveValue: {
  42656. type: [Boolean, String, Number],
  42657. default: false
  42658. },
  42659. name: {
  42660. type: String,
  42661. default: ""
  42662. },
  42663. validateEvent: {
  42664. type: Boolean,
  42665. default: true
  42666. },
  42667. beforeChange: {
  42668. type: definePropType(Function)
  42669. },
  42670. id: String,
  42671. tabindex: {
  42672. type: [String, Number]
  42673. },
  42674. ...useAriaProps(["ariaLabel"])
  42675. });
  42676. const switchEmits = {
  42677. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42678. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42679. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  42680. };
  42681. const COMPONENT_NAME$8 = "ElSwitch";
  42682. const __default__$w = vue.defineComponent({
  42683. name: COMPONENT_NAME$8
  42684. });
  42685. const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
  42686. ...__default__$w,
  42687. props: switchProps,
  42688. emits: switchEmits,
  42689. setup(__props, { expose, emit }) {
  42690. const props = __props;
  42691. const { formItem } = useFormItem();
  42692. const switchSize = useFormSize();
  42693. const ns = useNamespace("switch");
  42694. const { inputId } = useFormItemInputId(props, {
  42695. formItemContext: formItem
  42696. });
  42697. const switchDisabled = useFormDisabled(vue.computed(() => props.loading));
  42698. const isControlled = vue.ref(props.modelValue !== false);
  42699. const input = vue.ref();
  42700. const core = vue.ref();
  42701. const switchKls = vue.computed(() => [
  42702. ns.b(),
  42703. ns.m(switchSize.value),
  42704. ns.is("disabled", switchDisabled.value),
  42705. ns.is("checked", checked.value)
  42706. ]);
  42707. const labelLeftKls = vue.computed(() => [
  42708. ns.e("label"),
  42709. ns.em("label", "left"),
  42710. ns.is("active", !checked.value)
  42711. ]);
  42712. const labelRightKls = vue.computed(() => [
  42713. ns.e("label"),
  42714. ns.em("label", "right"),
  42715. ns.is("active", checked.value)
  42716. ]);
  42717. const coreStyle = vue.computed(() => ({
  42718. width: addUnit(props.width)
  42719. }));
  42720. vue.watch(() => props.modelValue, () => {
  42721. isControlled.value = true;
  42722. });
  42723. const actualValue = vue.computed(() => {
  42724. return isControlled.value ? props.modelValue : false;
  42725. });
  42726. const checked = vue.computed(() => actualValue.value === props.activeValue);
  42727. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  42728. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  42729. emit(CHANGE_EVENT, props.inactiveValue);
  42730. emit(INPUT_EVENT, props.inactiveValue);
  42731. }
  42732. vue.watch(checked, (val) => {
  42733. var _a;
  42734. input.value.checked = val;
  42735. if (props.validateEvent) {
  42736. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  42737. }
  42738. });
  42739. const handleChange = () => {
  42740. const val = checked.value ? props.inactiveValue : props.activeValue;
  42741. emit(UPDATE_MODEL_EVENT, val);
  42742. emit(CHANGE_EVENT, val);
  42743. emit(INPUT_EVENT, val);
  42744. vue.nextTick(() => {
  42745. input.value.checked = checked.value;
  42746. });
  42747. };
  42748. const switchValue = () => {
  42749. if (switchDisabled.value)
  42750. return;
  42751. const { beforeChange } = props;
  42752. if (!beforeChange) {
  42753. handleChange();
  42754. return;
  42755. }
  42756. const shouldChange = beforeChange();
  42757. const isPromiseOrBool = [
  42758. isPromise(shouldChange),
  42759. isBoolean(shouldChange)
  42760. ].includes(true);
  42761. if (!isPromiseOrBool) {
  42762. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  42763. }
  42764. if (isPromise(shouldChange)) {
  42765. shouldChange.then((result) => {
  42766. if (result) {
  42767. handleChange();
  42768. }
  42769. }).catch((e) => {
  42770. });
  42771. } else if (shouldChange) {
  42772. handleChange();
  42773. }
  42774. };
  42775. const focus = () => {
  42776. var _a, _b;
  42777. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  42778. };
  42779. vue.onMounted(() => {
  42780. input.value.checked = checked.value;
  42781. });
  42782. expose({
  42783. focus,
  42784. checked
  42785. });
  42786. return (_ctx, _cache) => {
  42787. return vue.openBlock(), vue.createElementBlock("div", {
  42788. class: vue.normalizeClass(vue.unref(switchKls)),
  42789. onClick: vue.withModifiers(switchValue, ["prevent"])
  42790. }, [
  42791. vue.createElementVNode("input", {
  42792. id: vue.unref(inputId),
  42793. ref_key: "input",
  42794. ref: input,
  42795. class: vue.normalizeClass(vue.unref(ns).e("input")),
  42796. type: "checkbox",
  42797. role: "switch",
  42798. "aria-checked": vue.unref(checked),
  42799. "aria-disabled": vue.unref(switchDisabled),
  42800. "aria-label": _ctx.ariaLabel,
  42801. name: _ctx.name,
  42802. "true-value": _ctx.activeValue,
  42803. "false-value": _ctx.inactiveValue,
  42804. disabled: vue.unref(switchDisabled),
  42805. tabindex: _ctx.tabindex,
  42806. onChange: handleChange,
  42807. onKeydown: vue.withKeys(switchValue, ["enter"])
  42808. }, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
  42809. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  42810. key: 0,
  42811. class: vue.normalizeClass(vue.unref(labelLeftKls))
  42812. }, [
  42813. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42814. default: vue.withCtx(() => [
  42815. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  42816. ]),
  42817. _: 1
  42818. })) : vue.createCommentVNode("v-if", true),
  42819. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  42820. key: 1,
  42821. "aria-hidden": vue.unref(checked)
  42822. }, vue.toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  42823. ], 2)) : vue.createCommentVNode("v-if", true),
  42824. vue.createElementVNode("span", {
  42825. ref_key: "core",
  42826. ref: core,
  42827. class: vue.normalizeClass(vue.unref(ns).e("core")),
  42828. style: vue.normalizeStyle(vue.unref(coreStyle))
  42829. }, [
  42830. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  42831. key: 0,
  42832. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  42833. }, [
  42834. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42835. key: 0,
  42836. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  42837. }, {
  42838. default: vue.withCtx(() => [
  42839. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  42840. ]),
  42841. _: 1
  42842. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  42843. key: 1,
  42844. class: vue.normalizeClass(vue.unref(ns).is("text")),
  42845. "aria-hidden": !vue.unref(checked)
  42846. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  42847. ], 2)) : vue.createCommentVNode("v-if", true),
  42848. vue.createElementVNode("div", {
  42849. class: vue.normalizeClass(vue.unref(ns).e("action"))
  42850. }, [
  42851. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42852. key: 0,
  42853. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  42854. }, {
  42855. default: vue.withCtx(() => [
  42856. vue.createVNode(vue.unref(loading_default))
  42857. ]),
  42858. _: 1
  42859. }, 8, ["class"])) : vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  42860. _ctx.activeActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42861. default: vue.withCtx(() => [
  42862. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeActionIcon)))
  42863. ]),
  42864. _: 1
  42865. })) : vue.createCommentVNode("v-if", true)
  42866. ]) : !vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  42867. _ctx.inactiveActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42868. default: vue.withCtx(() => [
  42869. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveActionIcon)))
  42870. ]),
  42871. _: 1
  42872. })) : vue.createCommentVNode("v-if", true)
  42873. ]) : vue.createCommentVNode("v-if", true)
  42874. ], 2)
  42875. ], 6),
  42876. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  42877. key: 1,
  42878. class: vue.normalizeClass(vue.unref(labelRightKls))
  42879. }, [
  42880. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42881. default: vue.withCtx(() => [
  42882. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  42883. ]),
  42884. _: 1
  42885. })) : vue.createCommentVNode("v-if", true),
  42886. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  42887. key: 1,
  42888. "aria-hidden": !vue.unref(checked)
  42889. }, vue.toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  42890. ], 2)) : vue.createCommentVNode("v-if", true)
  42891. ], 10, ["onClick"]);
  42892. };
  42893. }
  42894. });
  42895. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "switch.vue"]]);
  42896. const ElSwitch = withInstall(Switch);
  42897. const getCell = function(event) {
  42898. var _a;
  42899. return (_a = event.target) == null ? void 0 : _a.closest("td");
  42900. };
  42901. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  42902. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) {
  42903. return array;
  42904. }
  42905. if (isString$1(reverse)) {
  42906. reverse = reverse === "descending" ? -1 : 1;
  42907. } else {
  42908. reverse = reverse && reverse < 0 ? -1 : 1;
  42909. }
  42910. const getKey = sortMethod ? null : function(value, index) {
  42911. if (sortBy) {
  42912. if (!isArray$1(sortBy)) {
  42913. sortBy = [sortBy];
  42914. }
  42915. return sortBy.map((by) => {
  42916. if (isString$1(by)) {
  42917. return get(value, by);
  42918. } else {
  42919. return by(value, index, array);
  42920. }
  42921. });
  42922. }
  42923. if (sortKey !== "$key") {
  42924. if (isObject$1(value) && "$value" in value)
  42925. value = value.$value;
  42926. }
  42927. return [isObject$1(value) ? get(value, sortKey) : value];
  42928. };
  42929. const compare = function(a, b) {
  42930. if (sortMethod) {
  42931. return sortMethod(a.value, b.value);
  42932. }
  42933. for (let i = 0, len = a.key.length; i < len; i++) {
  42934. if (a.key[i] < b.key[i]) {
  42935. return -1;
  42936. }
  42937. if (a.key[i] > b.key[i]) {
  42938. return 1;
  42939. }
  42940. }
  42941. return 0;
  42942. };
  42943. return array.map((value, index) => {
  42944. return {
  42945. value,
  42946. index,
  42947. key: getKey ? getKey(value, index) : null
  42948. };
  42949. }).sort((a, b) => {
  42950. let order = compare(a, b);
  42951. if (!order) {
  42952. order = a.index - b.index;
  42953. }
  42954. return order * +reverse;
  42955. }).map((item) => item.value);
  42956. };
  42957. const getColumnById = function(table, columnId) {
  42958. let column = null;
  42959. table.columns.forEach((item) => {
  42960. if (item.id === columnId) {
  42961. column = item;
  42962. }
  42963. });
  42964. return column;
  42965. };
  42966. const getColumnByKey = function(table, columnKey) {
  42967. let column = null;
  42968. for (let i = 0; i < table.columns.length; i++) {
  42969. const item = table.columns[i];
  42970. if (item.columnKey === columnKey) {
  42971. column = item;
  42972. break;
  42973. }
  42974. }
  42975. if (!column)
  42976. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  42977. return column;
  42978. };
  42979. const getColumnByCell = function(table, cell, namespace) {
  42980. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  42981. if (matches) {
  42982. return getColumnById(table, matches[0]);
  42983. }
  42984. return null;
  42985. };
  42986. const getRowIdentity = (row, rowKey) => {
  42987. if (!row)
  42988. throw new Error("Row is required when get row identity");
  42989. if (isString$1(rowKey)) {
  42990. if (!rowKey.includes(".")) {
  42991. return `${row[rowKey]}`;
  42992. }
  42993. const key = rowKey.split(".");
  42994. let current = row;
  42995. for (const element of key) {
  42996. current = current[element];
  42997. }
  42998. return `${current}`;
  42999. } else if (isFunction$1(rowKey)) {
  43000. return rowKey.call(null, row);
  43001. }
  43002. };
  43003. const getKeysMap = function(array, rowKey, flatten = false, childrenKey = "children") {
  43004. const data = array || [];
  43005. const arrayMap = {};
  43006. data.forEach((row, index) => {
  43007. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  43008. if (flatten) {
  43009. const children = row[childrenKey];
  43010. if (isArray$1(children)) {
  43011. Object.assign(arrayMap, getKeysMap(children, rowKey, true, childrenKey));
  43012. }
  43013. }
  43014. });
  43015. return arrayMap;
  43016. };
  43017. function mergeOptions(defaults, config) {
  43018. const options = {};
  43019. let key;
  43020. for (key in defaults) {
  43021. options[key] = defaults[key];
  43022. }
  43023. for (key in config) {
  43024. if (hasOwn(config, key)) {
  43025. const value = config[key];
  43026. if (!isUndefined(value)) {
  43027. options[key] = value;
  43028. }
  43029. }
  43030. }
  43031. return options;
  43032. }
  43033. function parseWidth(width) {
  43034. if (width === "")
  43035. return width;
  43036. if (!isUndefined(width)) {
  43037. width = Number.parseInt(width, 10);
  43038. if (Number.isNaN(width)) {
  43039. width = "";
  43040. }
  43041. }
  43042. return width;
  43043. }
  43044. function parseMinWidth(minWidth) {
  43045. if (minWidth === "")
  43046. return minWidth;
  43047. if (!isUndefined(minWidth)) {
  43048. minWidth = parseWidth(minWidth);
  43049. if (Number.isNaN(minWidth)) {
  43050. minWidth = 80;
  43051. }
  43052. }
  43053. return minWidth;
  43054. }
  43055. function parseHeight(height) {
  43056. if (isNumber(height)) {
  43057. return height;
  43058. }
  43059. if (isString$1(height)) {
  43060. if (/^\d+(?:px)?$/.test(height)) {
  43061. return Number.parseInt(height, 10);
  43062. } else {
  43063. return height;
  43064. }
  43065. }
  43066. return null;
  43067. }
  43068. function compose(...funcs) {
  43069. if (funcs.length === 0) {
  43070. return (arg) => arg;
  43071. }
  43072. if (funcs.length === 1) {
  43073. return funcs[0];
  43074. }
  43075. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  43076. }
  43077. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex) {
  43078. let _rowIndex = rowIndex != null ? rowIndex : 0;
  43079. let changed = false;
  43080. const index = statusArr.indexOf(row);
  43081. const included = index !== -1;
  43082. const isRowSelectable = selectable == null ? void 0 : selectable.call(null, row, _rowIndex);
  43083. const toggleStatus = (type) => {
  43084. if (type === "add") {
  43085. statusArr.push(row);
  43086. } else {
  43087. statusArr.splice(index, 1);
  43088. }
  43089. changed = true;
  43090. };
  43091. const getChildrenCount = (row2) => {
  43092. let count = 0;
  43093. const children = (tableTreeProps == null ? void 0 : tableTreeProps.children) && row2[tableTreeProps.children];
  43094. if (children && isArray$1(children)) {
  43095. count += children.length;
  43096. children.forEach((item) => {
  43097. count += getChildrenCount(item);
  43098. });
  43099. }
  43100. return count;
  43101. };
  43102. if (!selectable || isRowSelectable) {
  43103. if (isBoolean(newVal)) {
  43104. if (newVal && !included) {
  43105. toggleStatus("add");
  43106. } else if (!newVal && included) {
  43107. toggleStatus("remove");
  43108. }
  43109. } else {
  43110. included ? toggleStatus("remove") : toggleStatus("add");
  43111. }
  43112. }
  43113. if (!(tableTreeProps == null ? void 0 : tableTreeProps.checkStrictly) && (tableTreeProps == null ? void 0 : tableTreeProps.children) && isArray$1(row[tableTreeProps.children])) {
  43114. row[tableTreeProps.children].forEach((item) => {
  43115. const childChanged = toggleRowStatus(statusArr, item, newVal != null ? newVal : !included, tableTreeProps, selectable, _rowIndex + 1);
  43116. _rowIndex += getChildrenCount(item) + 1;
  43117. if (childChanged) {
  43118. changed = childChanged;
  43119. }
  43120. });
  43121. }
  43122. return changed;
  43123. }
  43124. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  43125. const isNil = (array) => !(isArray$1(array) && array.length);
  43126. function _walker(parent, children, level) {
  43127. cb(parent, children, level);
  43128. children.forEach((item) => {
  43129. if (item[lazyKey]) {
  43130. cb(item, null, level + 1);
  43131. return;
  43132. }
  43133. const children2 = item[childrenKey];
  43134. if (!isNil(children2)) {
  43135. _walker(item, children2, level + 1);
  43136. }
  43137. });
  43138. }
  43139. root.forEach((item) => {
  43140. if (item[lazyKey]) {
  43141. cb(item, null, 0);
  43142. return;
  43143. }
  43144. const children = item[childrenKey];
  43145. if (!isNil(children)) {
  43146. _walker(item, children, 0);
  43147. }
  43148. });
  43149. }
  43150. const getTableOverflowTooltipProps = (props, innerText, row, column) => {
  43151. const popperOptions = {
  43152. strategy: "fixed",
  43153. ...props.popperOptions
  43154. };
  43155. const tooltipFormatterContent = isFunction$1(column.tooltipFormatter) ? column.tooltipFormatter({
  43156. row,
  43157. column,
  43158. cellValue: getProp(row, column.property).value
  43159. }) : void 0;
  43160. if (vue.isVNode(tooltipFormatterContent)) {
  43161. return {
  43162. slotContent: tooltipFormatterContent,
  43163. content: null,
  43164. ...props,
  43165. popperOptions
  43166. };
  43167. }
  43168. return {
  43169. slotContent: null,
  43170. content: tooltipFormatterContent != null ? tooltipFormatterContent : innerText,
  43171. ...props,
  43172. popperOptions
  43173. };
  43174. };
  43175. let removePopper = null;
  43176. function createTablePopper(props, popperContent, row, column, trigger, table) {
  43177. const tableOverflowTooltipProps = getTableOverflowTooltipProps(props, popperContent, row, column);
  43178. const mergedProps = {
  43179. ...tableOverflowTooltipProps,
  43180. slotContent: void 0
  43181. };
  43182. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  43183. const comp = removePopper.vm.component;
  43184. merge(comp.props, mergedProps);
  43185. if (tableOverflowTooltipProps.slotContent) {
  43186. comp.slots.content = () => [tableOverflowTooltipProps.slotContent];
  43187. }
  43188. return;
  43189. }
  43190. removePopper == null ? void 0 : removePopper();
  43191. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  43192. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  43193. const vm = vue.createVNode(ElTooltip, {
  43194. virtualTriggering: true,
  43195. virtualRef: trigger,
  43196. appendTo: parentNode,
  43197. placement: "top",
  43198. transition: "none",
  43199. offset: 0,
  43200. hideAfter: 0,
  43201. ...mergedProps
  43202. }, tableOverflowTooltipProps.slotContent ? {
  43203. content: () => tableOverflowTooltipProps.slotContent
  43204. } : void 0);
  43205. vm.appContext = { ...table.appContext, ...table };
  43206. const container = document.createElement("div");
  43207. vue.render(vm, container);
  43208. vm.component.exposed.onOpen();
  43209. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  43210. removePopper = () => {
  43211. vue.render(null, container);
  43212. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  43213. removePopper = null;
  43214. };
  43215. removePopper.trigger = trigger;
  43216. removePopper.vm = vm;
  43217. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  43218. }
  43219. function getCurrentColumns(column) {
  43220. if (column.children) {
  43221. return flatMap(column.children, getCurrentColumns);
  43222. } else {
  43223. return [column];
  43224. }
  43225. }
  43226. function getColSpan(colSpan, column) {
  43227. return colSpan + column.colSpan;
  43228. }
  43229. const isFixedColumn = (index, fixed, store, realColumns) => {
  43230. let start = 0;
  43231. let after = index;
  43232. const columns = store.states.columns.value;
  43233. if (realColumns) {
  43234. const curColumns = getCurrentColumns(realColumns[index]);
  43235. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  43236. start = preColumns.reduce(getColSpan, 0);
  43237. after = start + curColumns.reduce(getColSpan, 0) - 1;
  43238. } else {
  43239. start = index;
  43240. }
  43241. let fixedLayout;
  43242. switch (fixed) {
  43243. case "left":
  43244. if (after < store.states.fixedLeafColumnsLength.value) {
  43245. fixedLayout = "left";
  43246. }
  43247. break;
  43248. case "right":
  43249. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  43250. fixedLayout = "right";
  43251. }
  43252. break;
  43253. default:
  43254. if (after < store.states.fixedLeafColumnsLength.value) {
  43255. fixedLayout = "left";
  43256. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  43257. fixedLayout = "right";
  43258. }
  43259. }
  43260. return fixedLayout ? {
  43261. direction: fixedLayout,
  43262. start,
  43263. after
  43264. } : {};
  43265. };
  43266. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  43267. const classes = [];
  43268. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  43269. if (direction) {
  43270. const isLeft = direction === "left";
  43271. classes.push(`${namespace}-fixed-column--${direction}`);
  43272. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  43273. classes.push("is-last-column");
  43274. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  43275. classes.push("is-first-column");
  43276. }
  43277. }
  43278. return classes;
  43279. };
  43280. function getOffset(offset, column) {
  43281. return offset + (isNull(column.realWidth) || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  43282. }
  43283. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  43284. const {
  43285. direction,
  43286. start = 0,
  43287. after = 0
  43288. } = isFixedColumn(index, fixed, store, realColumns);
  43289. if (!direction) {
  43290. return;
  43291. }
  43292. const styles = {};
  43293. const isLeft = direction === "left";
  43294. const columns = store.states.columns.value;
  43295. if (isLeft) {
  43296. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  43297. } else {
  43298. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  43299. }
  43300. return styles;
  43301. };
  43302. const ensurePosition = (style, key) => {
  43303. if (!style)
  43304. return;
  43305. if (!Number.isNaN(style[key])) {
  43306. style[key] = `${style[key]}px`;
  43307. }
  43308. };
  43309. function useExpand(watcherData) {
  43310. const instance = vue.getCurrentInstance();
  43311. const defaultExpandAll = vue.ref(false);
  43312. const expandRows = vue.ref([]);
  43313. const updateExpandRows = () => {
  43314. const data = watcherData.data.value || [];
  43315. const rowKey = watcherData.rowKey.value;
  43316. if (defaultExpandAll.value) {
  43317. expandRows.value = data.slice();
  43318. } else if (rowKey) {
  43319. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  43320. expandRows.value = data.reduce((prev, row) => {
  43321. const rowId = getRowIdentity(row, rowKey);
  43322. const rowInfo = expandRowsMap[rowId];
  43323. if (rowInfo) {
  43324. prev.push(row);
  43325. }
  43326. return prev;
  43327. }, []);
  43328. } else {
  43329. expandRows.value = [];
  43330. }
  43331. };
  43332. const toggleRowExpansion = (row, expanded) => {
  43333. const changed = toggleRowStatus(expandRows.value, row, expanded);
  43334. if (changed) {
  43335. instance.emit("expand-change", row, expandRows.value.slice());
  43336. }
  43337. };
  43338. const setExpandRowKeys = (rowKeys) => {
  43339. instance.store.assertRowKey();
  43340. const data = watcherData.data.value || [];
  43341. const rowKey = watcherData.rowKey.value;
  43342. const keysMap = getKeysMap(data, rowKey);
  43343. expandRows.value = rowKeys.reduce((prev, cur) => {
  43344. const info = keysMap[cur];
  43345. if (info) {
  43346. prev.push(info.row);
  43347. }
  43348. return prev;
  43349. }, []);
  43350. };
  43351. const isRowExpanded = (row) => {
  43352. const rowKey = watcherData.rowKey.value;
  43353. if (rowKey) {
  43354. const expandMap = getKeysMap(expandRows.value, rowKey);
  43355. return !!expandMap[getRowIdentity(row, rowKey)];
  43356. }
  43357. return expandRows.value.includes(row);
  43358. };
  43359. return {
  43360. updateExpandRows,
  43361. toggleRowExpansion,
  43362. setExpandRowKeys,
  43363. isRowExpanded,
  43364. states: {
  43365. expandRows,
  43366. defaultExpandAll
  43367. }
  43368. };
  43369. }
  43370. function useCurrent(watcherData) {
  43371. const instance = vue.getCurrentInstance();
  43372. const _currentRowKey = vue.ref(null);
  43373. const currentRow = vue.ref(null);
  43374. const setCurrentRowKey = (key) => {
  43375. instance.store.assertRowKey();
  43376. _currentRowKey.value = key;
  43377. setCurrentRowByKey(key);
  43378. };
  43379. const restoreCurrentRowKey = () => {
  43380. _currentRowKey.value = null;
  43381. };
  43382. const setCurrentRowByKey = (key) => {
  43383. const { data, rowKey } = watcherData;
  43384. let _currentRow = null;
  43385. if (rowKey.value) {
  43386. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  43387. }
  43388. currentRow.value = _currentRow;
  43389. instance.emit("current-change", currentRow.value, null);
  43390. };
  43391. const updateCurrentRow = (_currentRow) => {
  43392. const oldCurrentRow = currentRow.value;
  43393. if (_currentRow && _currentRow !== oldCurrentRow) {
  43394. currentRow.value = _currentRow;
  43395. instance.emit("current-change", currentRow.value, oldCurrentRow);
  43396. return;
  43397. }
  43398. if (!_currentRow && oldCurrentRow) {
  43399. currentRow.value = null;
  43400. instance.emit("current-change", null, oldCurrentRow);
  43401. }
  43402. };
  43403. const updateCurrentRowData = () => {
  43404. const rowKey = watcherData.rowKey.value;
  43405. const data = watcherData.data.value || [];
  43406. const oldCurrentRow = currentRow.value;
  43407. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  43408. if (rowKey) {
  43409. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  43410. setCurrentRowByKey(currentRowKey);
  43411. } else {
  43412. currentRow.value = null;
  43413. }
  43414. if (isNull(currentRow.value)) {
  43415. instance.emit("current-change", null, oldCurrentRow);
  43416. }
  43417. } else if (_currentRowKey.value) {
  43418. setCurrentRowByKey(_currentRowKey.value);
  43419. restoreCurrentRowKey();
  43420. }
  43421. };
  43422. return {
  43423. setCurrentRowKey,
  43424. restoreCurrentRowKey,
  43425. setCurrentRowByKey,
  43426. updateCurrentRow,
  43427. updateCurrentRowData,
  43428. states: {
  43429. _currentRowKey,
  43430. currentRow
  43431. }
  43432. };
  43433. }
  43434. function useTree$2(watcherData) {
  43435. const expandRowKeys = vue.ref([]);
  43436. const treeData = vue.ref({});
  43437. const indent = vue.ref(16);
  43438. const lazy = vue.ref(false);
  43439. const lazyTreeNodeMap = vue.ref({});
  43440. const lazyColumnIdentifier = vue.ref("hasChildren");
  43441. const childrenColumnName = vue.ref("children");
  43442. const checkStrictly = vue.ref(false);
  43443. const instance = vue.getCurrentInstance();
  43444. const normalizedData = vue.computed(() => {
  43445. if (!watcherData.rowKey.value)
  43446. return {};
  43447. const data = watcherData.data.value || [];
  43448. return normalize(data);
  43449. });
  43450. const normalizedLazyNode = vue.computed(() => {
  43451. const rowKey = watcherData.rowKey.value;
  43452. const keys = Object.keys(lazyTreeNodeMap.value);
  43453. const res = {};
  43454. if (!keys.length)
  43455. return res;
  43456. keys.forEach((key) => {
  43457. if (lazyTreeNodeMap.value[key].length) {
  43458. const item = { children: [] };
  43459. lazyTreeNodeMap.value[key].forEach((row) => {
  43460. const currentRowKey = getRowIdentity(row, rowKey);
  43461. item.children.push(currentRowKey);
  43462. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  43463. res[currentRowKey] = { children: [] };
  43464. }
  43465. });
  43466. res[key] = item;
  43467. }
  43468. });
  43469. return res;
  43470. });
  43471. const normalize = (data) => {
  43472. const rowKey = watcherData.rowKey.value;
  43473. const res = {};
  43474. walkTreeNode(data, (parent, children, level) => {
  43475. const parentId = getRowIdentity(parent, rowKey);
  43476. if (isArray$1(children)) {
  43477. res[parentId] = {
  43478. children: children.map((row) => getRowIdentity(row, rowKey)),
  43479. level
  43480. };
  43481. } else if (lazy.value) {
  43482. res[parentId] = {
  43483. children: [],
  43484. lazy: true,
  43485. level
  43486. };
  43487. }
  43488. }, childrenColumnName.value, lazyColumnIdentifier.value);
  43489. return res;
  43490. };
  43491. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  43492. var _a2;
  43493. const nested = normalizedData.value;
  43494. const normalizedLazyNode_ = normalizedLazyNode.value;
  43495. const keys = Object.keys(nested);
  43496. const newTreeData = {};
  43497. if (keys.length) {
  43498. const oldTreeData = vue.unref(treeData);
  43499. const rootLazyRowKeys = [];
  43500. const getExpanded = (oldValue, key) => {
  43501. if (ifChangeExpandRowKeys) {
  43502. if (expandRowKeys.value) {
  43503. return ifExpandAll || expandRowKeys.value.includes(key);
  43504. } else {
  43505. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  43506. }
  43507. } else {
  43508. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  43509. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  43510. }
  43511. };
  43512. keys.forEach((key) => {
  43513. const oldValue = oldTreeData[key];
  43514. const newValue = { ...nested[key] };
  43515. newValue.expanded = getExpanded(oldValue, key);
  43516. if (newValue.lazy) {
  43517. const { loaded = false, loading = false } = oldValue || {};
  43518. newValue.loaded = !!loaded;
  43519. newValue.loading = !!loading;
  43520. rootLazyRowKeys.push(key);
  43521. }
  43522. newTreeData[key] = newValue;
  43523. });
  43524. const lazyKeys = Object.keys(normalizedLazyNode_);
  43525. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  43526. lazyKeys.forEach((key) => {
  43527. const oldValue = oldTreeData[key];
  43528. const lazyNodeChildren = normalizedLazyNode_[key].children;
  43529. if (rootLazyRowKeys.includes(key)) {
  43530. if (newTreeData[key].children.length !== 0) {
  43531. throw new Error("[ElTable]children must be an empty array.");
  43532. }
  43533. newTreeData[key].children = lazyNodeChildren;
  43534. } else {
  43535. const { loaded = false, loading = false } = oldValue || {};
  43536. newTreeData[key] = {
  43537. lazy: true,
  43538. loaded: !!loaded,
  43539. loading: !!loading,
  43540. expanded: getExpanded(oldValue, key),
  43541. children: lazyNodeChildren,
  43542. level: ""
  43543. };
  43544. }
  43545. });
  43546. }
  43547. }
  43548. treeData.value = newTreeData;
  43549. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  43550. };
  43551. vue.watch(() => expandRowKeys.value, () => {
  43552. updateTreeData(true);
  43553. });
  43554. vue.watch(() => normalizedData.value, () => {
  43555. updateTreeData();
  43556. });
  43557. vue.watch(() => normalizedLazyNode.value, () => {
  43558. updateTreeData();
  43559. });
  43560. const updateTreeExpandKeys = (value) => {
  43561. expandRowKeys.value = value;
  43562. updateTreeData();
  43563. };
  43564. const isUseLazy = (data) => {
  43565. return lazy.value && data && "loaded" in data && !data.loaded;
  43566. };
  43567. const toggleTreeExpansion = (row, expanded) => {
  43568. instance.store.assertRowKey();
  43569. const rowKey = watcherData.rowKey.value;
  43570. const id = getRowIdentity(row, rowKey);
  43571. const data = id && treeData.value[id];
  43572. if (id && data && "expanded" in data) {
  43573. const oldExpanded = data.expanded;
  43574. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  43575. treeData.value[id].expanded = expanded;
  43576. if (oldExpanded !== expanded) {
  43577. instance.emit("expand-change", row, expanded);
  43578. }
  43579. isUseLazy(data) && loadData(row, id, data);
  43580. instance.store.updateTableScrollY();
  43581. }
  43582. };
  43583. const loadOrToggle = (row) => {
  43584. instance.store.assertRowKey();
  43585. const rowKey = watcherData.rowKey.value;
  43586. const id = getRowIdentity(row, rowKey);
  43587. const data = treeData.value[id];
  43588. if (isUseLazy(data)) {
  43589. loadData(row, id, data);
  43590. } else {
  43591. toggleTreeExpansion(row, void 0);
  43592. }
  43593. };
  43594. const loadData = (row, key, treeNode) => {
  43595. const { load } = instance.props;
  43596. if (load && !treeData.value[key].loaded) {
  43597. treeData.value[key].loading = true;
  43598. load(row, treeNode, (data) => {
  43599. if (!isArray$1(data)) {
  43600. throw new TypeError("[ElTable] data must be an array");
  43601. }
  43602. treeData.value[key].loading = false;
  43603. treeData.value[key].loaded = true;
  43604. treeData.value[key].expanded = true;
  43605. if (data.length) {
  43606. lazyTreeNodeMap.value[key] = data;
  43607. }
  43608. instance.emit("expand-change", row, true);
  43609. });
  43610. }
  43611. };
  43612. const updateKeyChildren = (key, data) => {
  43613. const { lazy: lazy2, rowKey } = instance.props;
  43614. if (!lazy2)
  43615. return;
  43616. if (!rowKey)
  43617. throw new Error("[Table] rowKey is required in updateKeyChild");
  43618. if (lazyTreeNodeMap.value[key]) {
  43619. lazyTreeNodeMap.value[key] = data;
  43620. }
  43621. };
  43622. return {
  43623. loadData,
  43624. loadOrToggle,
  43625. toggleTreeExpansion,
  43626. updateTreeExpandKeys,
  43627. updateTreeData,
  43628. updateKeyChildren,
  43629. normalize,
  43630. states: {
  43631. expandRowKeys,
  43632. treeData,
  43633. indent,
  43634. lazy,
  43635. lazyTreeNodeMap,
  43636. lazyColumnIdentifier,
  43637. childrenColumnName,
  43638. checkStrictly
  43639. }
  43640. };
  43641. }
  43642. const sortData = (data, states) => {
  43643. const sortingColumn = states.sortingColumn;
  43644. if (!sortingColumn || isString$1(sortingColumn.sortable)) {
  43645. return data;
  43646. }
  43647. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  43648. };
  43649. const doFlattenColumns = (columns) => {
  43650. const result = [];
  43651. columns.forEach((column) => {
  43652. if (column.children && column.children.length > 0) {
  43653. result.push.apply(result, doFlattenColumns(column.children));
  43654. } else {
  43655. result.push(column);
  43656. }
  43657. });
  43658. return result;
  43659. };
  43660. function useWatcher$1() {
  43661. var _a;
  43662. const instance = vue.getCurrentInstance();
  43663. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  43664. const rowKey = vue.ref(null);
  43665. const data = vue.ref([]);
  43666. const _data = vue.ref([]);
  43667. const isComplex = vue.ref(false);
  43668. const _columns = vue.ref([]);
  43669. const originColumns = vue.ref([]);
  43670. const columns = vue.ref([]);
  43671. const fixedColumns = vue.ref([]);
  43672. const rightFixedColumns = vue.ref([]);
  43673. const leafColumns = vue.ref([]);
  43674. const fixedLeafColumns = vue.ref([]);
  43675. const rightFixedLeafColumns = vue.ref([]);
  43676. const updateOrderFns = [];
  43677. const leafColumnsLength = vue.ref(0);
  43678. const fixedLeafColumnsLength = vue.ref(0);
  43679. const rightFixedLeafColumnsLength = vue.ref(0);
  43680. const isAllSelected = vue.ref(false);
  43681. const selection = vue.ref([]);
  43682. const reserveSelection = vue.ref(false);
  43683. const selectOnIndeterminate = vue.ref(false);
  43684. const selectable = vue.ref(null);
  43685. const filters = vue.ref({});
  43686. const filteredData = vue.ref(null);
  43687. const sortingColumn = vue.ref(null);
  43688. const sortProp = vue.ref(null);
  43689. const sortOrder = vue.ref(null);
  43690. const hoverRow = vue.ref(null);
  43691. const selectedMap = vue.computed(() => {
  43692. return rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  43693. });
  43694. vue.watch(data, () => {
  43695. var _a2;
  43696. if (instance.state) {
  43697. scheduleLayout(false);
  43698. const needUpdateFixed = instance.props.tableLayout === "auto";
  43699. if (needUpdateFixed) {
  43700. (_a2 = instance.refs.tableHeaderRef) == null ? void 0 : _a2.updateFixedColumnStyle();
  43701. }
  43702. }
  43703. }, {
  43704. deep: true
  43705. });
  43706. const assertRowKey = () => {
  43707. if (!rowKey.value)
  43708. throw new Error("[ElTable] prop row-key is required");
  43709. };
  43710. const updateChildFixed = (column) => {
  43711. var _a2;
  43712. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  43713. childColumn.fixed = column.fixed;
  43714. updateChildFixed(childColumn);
  43715. });
  43716. };
  43717. const updateColumns = () => {
  43718. var _a2, _b;
  43719. _columns.value.forEach((column) => {
  43720. updateChildFixed(column);
  43721. });
  43722. fixedColumns.value = _columns.value.filter((column) => column.type !== "selection" && [true, "left"].includes(column.fixed));
  43723. let selectColFixLeft;
  43724. if (((_b = (_a2 = _columns.value) == null ? void 0 : _a2[0]) == null ? void 0 : _b.type) === "selection") {
  43725. const selectColumn = _columns.value[0];
  43726. selectColFixLeft = [true, "left"].includes(selectColumn.fixed) || fixedColumns.value.length && selectColumn.fixed !== "right";
  43727. if (selectColFixLeft) {
  43728. fixedColumns.value.unshift(selectColumn);
  43729. }
  43730. }
  43731. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  43732. const notFixedColumns = _columns.value.filter((column) => (selectColFixLeft ? column.type !== "selection" : true) && !column.fixed);
  43733. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  43734. const leafColumns2 = doFlattenColumns(notFixedColumns);
  43735. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  43736. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  43737. leafColumnsLength.value = leafColumns2.length;
  43738. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  43739. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  43740. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  43741. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  43742. };
  43743. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  43744. if (needUpdateColumns) {
  43745. updateColumns();
  43746. }
  43747. if (immediate) {
  43748. instance.state.doLayout();
  43749. } else {
  43750. instance.state.debouncedUpdateLayout();
  43751. }
  43752. };
  43753. const isSelected = (row) => {
  43754. if (selectedMap.value) {
  43755. return !!selectedMap.value[getRowIdentity(row, rowKey.value)];
  43756. } else {
  43757. return selection.value.includes(row);
  43758. }
  43759. };
  43760. const clearSelection = () => {
  43761. isAllSelected.value = false;
  43762. const oldSelection = selection.value;
  43763. selection.value = [];
  43764. if (oldSelection.length) {
  43765. instance.emit("selection-change", []);
  43766. }
  43767. };
  43768. const cleanSelection = () => {
  43769. var _a2, _b;
  43770. let deleted;
  43771. if (rowKey.value) {
  43772. deleted = [];
  43773. const childrenKey = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value;
  43774. const dataMap = getKeysMap(data.value, rowKey.value, true, childrenKey);
  43775. for (const key in selectedMap.value) {
  43776. if (hasOwn(selectedMap.value, key) && !dataMap[key]) {
  43777. deleted.push(selectedMap.value[key].row);
  43778. }
  43779. }
  43780. } else {
  43781. deleted = selection.value.filter((item) => !data.value.includes(item));
  43782. }
  43783. if (deleted.length) {
  43784. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  43785. selection.value = newSelection;
  43786. instance.emit("selection-change", newSelection.slice());
  43787. }
  43788. };
  43789. const getSelectionRows = () => {
  43790. return (selection.value || []).slice();
  43791. };
  43792. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  43793. var _a2, _b, _c, _d;
  43794. const treeProps = {
  43795. children: (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value,
  43796. checkStrictly: (_d = (_c = instance == null ? void 0 : instance.store) == null ? void 0 : _c.states) == null ? void 0 : _d.checkStrictly.value
  43797. };
  43798. const changed = toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value, data.value.indexOf(row));
  43799. if (changed) {
  43800. const newSelection = (selection.value || []).slice();
  43801. if (emitChange) {
  43802. instance.emit("select", newSelection, row);
  43803. }
  43804. instance.emit("selection-change", newSelection);
  43805. }
  43806. };
  43807. const _toggleAllSelection = () => {
  43808. var _a2, _b;
  43809. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  43810. isAllSelected.value = value;
  43811. let selectionChanged = false;
  43812. let childrenCount = 0;
  43813. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  43814. const { childrenColumnName } = instance.store.states;
  43815. const treeProps = {
  43816. children: childrenColumnName.value,
  43817. checkStrictly: false
  43818. };
  43819. data.value.forEach((row, index) => {
  43820. const rowIndex = index + childrenCount;
  43821. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex)) {
  43822. selectionChanged = true;
  43823. }
  43824. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  43825. });
  43826. if (selectionChanged) {
  43827. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  43828. }
  43829. instance.emit("select-all", (selection.value || []).slice());
  43830. };
  43831. const updateSelectionByRowKey = () => {
  43832. data.value.forEach((row) => {
  43833. const rowId = getRowIdentity(row, rowKey.value);
  43834. const rowInfo = selectedMap.value[rowId];
  43835. if (rowInfo) {
  43836. selection.value[rowInfo.index] = row;
  43837. }
  43838. });
  43839. };
  43840. const updateAllSelected = () => {
  43841. var _a2;
  43842. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  43843. isAllSelected.value = false;
  43844. return;
  43845. }
  43846. const { childrenColumnName } = instance.store.states;
  43847. let rowIndex = 0;
  43848. let selectedCount = 0;
  43849. const checkSelectedStatus = (data2) => {
  43850. var _a3;
  43851. for (const row of data2) {
  43852. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  43853. if (!isSelected(row)) {
  43854. if (!selectable.value || isRowSelectable) {
  43855. return false;
  43856. }
  43857. } else {
  43858. selectedCount++;
  43859. }
  43860. rowIndex++;
  43861. if (((_a3 = row[childrenColumnName.value]) == null ? void 0 : _a3.length) && !checkSelectedStatus(row[childrenColumnName.value])) {
  43862. return false;
  43863. }
  43864. }
  43865. return true;
  43866. };
  43867. const isAllSelected_ = checkSelectedStatus(data.value || []);
  43868. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  43869. };
  43870. const getChildrenCount = (rowKey2) => {
  43871. var _a2;
  43872. if (!instance || !instance.store)
  43873. return 0;
  43874. const { treeData } = instance.store.states;
  43875. let count = 0;
  43876. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  43877. if (children) {
  43878. count += children.length;
  43879. children.forEach((childKey) => {
  43880. count += getChildrenCount(childKey);
  43881. });
  43882. }
  43883. return count;
  43884. };
  43885. const updateFilters = (columns2, values) => {
  43886. if (!isArray$1(columns2)) {
  43887. columns2 = [columns2];
  43888. }
  43889. const filters_ = {};
  43890. columns2.forEach((col) => {
  43891. filters.value[col.id] = values;
  43892. filters_[col.columnKey || col.id] = values;
  43893. });
  43894. return filters_;
  43895. };
  43896. const updateSort = (column, prop, order) => {
  43897. if (sortingColumn.value && sortingColumn.value !== column) {
  43898. sortingColumn.value.order = null;
  43899. }
  43900. sortingColumn.value = column;
  43901. sortProp.value = prop;
  43902. sortOrder.value = order;
  43903. };
  43904. const execFilter = () => {
  43905. let sourceData = vue.unref(_data);
  43906. Object.keys(filters.value).forEach((columnId) => {
  43907. const values = filters.value[columnId];
  43908. if (!values || values.length === 0)
  43909. return;
  43910. const column = getColumnById({
  43911. columns: columns.value
  43912. }, columnId);
  43913. if (column && column.filterMethod) {
  43914. sourceData = sourceData.filter((row) => {
  43915. return values.some((value) => column.filterMethod.call(null, value, row, column));
  43916. });
  43917. }
  43918. });
  43919. filteredData.value = sourceData;
  43920. };
  43921. const execSort = () => {
  43922. data.value = sortData(filteredData.value, {
  43923. sortingColumn: sortingColumn.value,
  43924. sortProp: sortProp.value,
  43925. sortOrder: sortOrder.value
  43926. });
  43927. };
  43928. const execQuery = (ignore = void 0) => {
  43929. if (!(ignore && ignore.filter)) {
  43930. execFilter();
  43931. }
  43932. execSort();
  43933. };
  43934. const clearFilter = (columnKeys) => {
  43935. const { tableHeaderRef } = instance.refs;
  43936. if (!tableHeaderRef)
  43937. return;
  43938. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  43939. const keys = Object.keys(panels);
  43940. if (!keys.length)
  43941. return;
  43942. if (isString$1(columnKeys)) {
  43943. columnKeys = [columnKeys];
  43944. }
  43945. if (isArray$1(columnKeys)) {
  43946. const columns_ = columnKeys.map((key) => getColumnByKey({
  43947. columns: columns.value
  43948. }, key));
  43949. keys.forEach((key) => {
  43950. const column = columns_.find((col) => col.id === key);
  43951. if (column) {
  43952. column.filteredValue = [];
  43953. }
  43954. });
  43955. instance.store.commit("filterChange", {
  43956. column: columns_,
  43957. values: [],
  43958. silent: true,
  43959. multi: true
  43960. });
  43961. } else {
  43962. keys.forEach((key) => {
  43963. const column = columns.value.find((col) => col.id === key);
  43964. if (column) {
  43965. column.filteredValue = [];
  43966. }
  43967. });
  43968. filters.value = {};
  43969. instance.store.commit("filterChange", {
  43970. column: {},
  43971. values: [],
  43972. silent: true
  43973. });
  43974. }
  43975. };
  43976. const clearSort = () => {
  43977. if (!sortingColumn.value)
  43978. return;
  43979. updateSort(null, null, null);
  43980. instance.store.commit("changeSortCondition", {
  43981. silent: true
  43982. });
  43983. };
  43984. const {
  43985. setExpandRowKeys,
  43986. toggleRowExpansion,
  43987. updateExpandRows,
  43988. states: expandStates,
  43989. isRowExpanded
  43990. } = useExpand({
  43991. data,
  43992. rowKey
  43993. });
  43994. const {
  43995. updateTreeExpandKeys,
  43996. toggleTreeExpansion,
  43997. updateTreeData,
  43998. updateKeyChildren,
  43999. loadOrToggle,
  44000. states: treeStates
  44001. } = useTree$2({
  44002. data,
  44003. rowKey
  44004. });
  44005. const {
  44006. updateCurrentRowData,
  44007. updateCurrentRow,
  44008. setCurrentRowKey,
  44009. states: currentData
  44010. } = useCurrent({
  44011. data,
  44012. rowKey
  44013. });
  44014. const setExpandRowKeysAdapter = (val) => {
  44015. setExpandRowKeys(val);
  44016. updateTreeExpandKeys(val);
  44017. };
  44018. const toggleRowExpansionAdapter = (row, expanded) => {
  44019. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  44020. if (hasExpandColumn) {
  44021. toggleRowExpansion(row, expanded);
  44022. } else {
  44023. toggleTreeExpansion(row, expanded);
  44024. }
  44025. };
  44026. return {
  44027. assertRowKey,
  44028. updateColumns,
  44029. scheduleLayout,
  44030. isSelected,
  44031. clearSelection,
  44032. cleanSelection,
  44033. getSelectionRows,
  44034. toggleRowSelection,
  44035. _toggleAllSelection,
  44036. toggleAllSelection: null,
  44037. updateSelectionByRowKey,
  44038. updateAllSelected,
  44039. updateFilters,
  44040. updateCurrentRow,
  44041. updateSort,
  44042. execFilter,
  44043. execSort,
  44044. execQuery,
  44045. clearFilter,
  44046. clearSort,
  44047. toggleRowExpansion,
  44048. setExpandRowKeysAdapter,
  44049. setCurrentRowKey,
  44050. toggleRowExpansionAdapter,
  44051. isRowExpanded,
  44052. updateExpandRows,
  44053. updateCurrentRowData,
  44054. loadOrToggle,
  44055. updateTreeData,
  44056. updateKeyChildren,
  44057. states: {
  44058. tableSize,
  44059. rowKey,
  44060. data,
  44061. _data,
  44062. isComplex,
  44063. _columns,
  44064. originColumns,
  44065. columns,
  44066. fixedColumns,
  44067. rightFixedColumns,
  44068. leafColumns,
  44069. fixedLeafColumns,
  44070. rightFixedLeafColumns,
  44071. updateOrderFns,
  44072. leafColumnsLength,
  44073. fixedLeafColumnsLength,
  44074. rightFixedLeafColumnsLength,
  44075. isAllSelected,
  44076. selection,
  44077. reserveSelection,
  44078. selectOnIndeterminate,
  44079. selectable,
  44080. filters,
  44081. filteredData,
  44082. sortingColumn,
  44083. sortProp,
  44084. sortOrder,
  44085. hoverRow,
  44086. ...expandStates,
  44087. ...treeStates,
  44088. ...currentData
  44089. }
  44090. };
  44091. }
  44092. function replaceColumn(array, column) {
  44093. return array.map((item) => {
  44094. var _a;
  44095. if (item.id === column.id) {
  44096. return column;
  44097. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  44098. item.children = replaceColumn(item.children, column);
  44099. }
  44100. return item;
  44101. });
  44102. }
  44103. function sortColumn(array) {
  44104. array.forEach((item) => {
  44105. var _a, _b;
  44106. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  44107. if ((_b = item.children) == null ? void 0 : _b.length) {
  44108. sortColumn(item.children);
  44109. }
  44110. });
  44111. array.sort((cur, pre) => cur.no - pre.no);
  44112. }
  44113. function useStore() {
  44114. const instance = vue.getCurrentInstance();
  44115. const watcher = useWatcher$1();
  44116. const ns = useNamespace("table");
  44117. const mutations = {
  44118. setData(states, data) {
  44119. const dataInstanceChanged = vue.unref(states._data) !== data;
  44120. states.data.value = data;
  44121. states._data.value = data;
  44122. instance.store.execQuery();
  44123. instance.store.updateCurrentRowData();
  44124. instance.store.updateExpandRows();
  44125. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  44126. if (vue.unref(states.reserveSelection)) {
  44127. instance.store.assertRowKey();
  44128. instance.store.updateSelectionByRowKey();
  44129. } else {
  44130. if (dataInstanceChanged) {
  44131. instance.store.clearSelection();
  44132. } else {
  44133. instance.store.cleanSelection();
  44134. }
  44135. }
  44136. instance.store.updateAllSelected();
  44137. if (instance.$ready) {
  44138. instance.store.scheduleLayout();
  44139. }
  44140. },
  44141. insertColumn(states, column, parent, updateColumnOrder) {
  44142. const array = vue.unref(states._columns);
  44143. let newColumns = [];
  44144. if (!parent) {
  44145. array.push(column);
  44146. newColumns = array;
  44147. } else {
  44148. if (parent && !parent.children) {
  44149. parent.children = [];
  44150. }
  44151. parent.children.push(column);
  44152. newColumns = replaceColumn(array, parent);
  44153. }
  44154. sortColumn(newColumns);
  44155. states._columns.value = newColumns;
  44156. states.updateOrderFns.push(updateColumnOrder);
  44157. if (column.type === "selection") {
  44158. states.selectable.value = column.selectable;
  44159. states.reserveSelection.value = column.reserveSelection;
  44160. }
  44161. if (instance.$ready) {
  44162. instance.store.updateColumns();
  44163. instance.store.scheduleLayout();
  44164. }
  44165. },
  44166. updateColumnOrder(states, column) {
  44167. var _a;
  44168. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  44169. if (newColumnIndex === column.no)
  44170. return;
  44171. sortColumn(states._columns.value);
  44172. if (instance.$ready) {
  44173. instance.store.updateColumns();
  44174. }
  44175. },
  44176. removeColumn(states, column, parent, updateColumnOrder) {
  44177. const array = vue.unref(states._columns) || [];
  44178. if (parent) {
  44179. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  44180. vue.nextTick(() => {
  44181. var _a;
  44182. if (((_a = parent.children) == null ? void 0 : _a.length) === 0) {
  44183. delete parent.children;
  44184. }
  44185. });
  44186. states._columns.value = replaceColumn(array, parent);
  44187. } else {
  44188. const index = array.indexOf(column);
  44189. if (index > -1) {
  44190. array.splice(index, 1);
  44191. states._columns.value = array;
  44192. }
  44193. }
  44194. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  44195. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  44196. if (instance.$ready) {
  44197. instance.store.updateColumns();
  44198. instance.store.scheduleLayout();
  44199. }
  44200. },
  44201. sort(states, options) {
  44202. const { prop, order, init } = options;
  44203. if (prop) {
  44204. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  44205. if (column) {
  44206. column.order = order;
  44207. instance.store.updateSort(column, prop, order);
  44208. instance.store.commit("changeSortCondition", { init });
  44209. }
  44210. }
  44211. },
  44212. changeSortCondition(states, options) {
  44213. const { sortingColumn, sortProp, sortOrder } = states;
  44214. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  44215. if (isNull(orderValue)) {
  44216. states.sortingColumn.value = null;
  44217. states.sortProp.value = null;
  44218. }
  44219. const ignore = { filter: true };
  44220. instance.store.execQuery(ignore);
  44221. if (!options || !(options.silent || options.init)) {
  44222. instance.emit("sort-change", {
  44223. column: columnValue,
  44224. prop: propValue,
  44225. order: orderValue
  44226. });
  44227. }
  44228. instance.store.updateTableScrollY();
  44229. },
  44230. filterChange(_states, options) {
  44231. const { column, values, silent } = options;
  44232. const newFilters = instance.store.updateFilters(column, values);
  44233. instance.store.execQuery();
  44234. if (!silent) {
  44235. instance.emit("filter-change", newFilters);
  44236. }
  44237. instance.store.updateTableScrollY();
  44238. },
  44239. toggleAllSelection() {
  44240. instance.store.toggleAllSelection();
  44241. },
  44242. rowSelectedChanged(_states, row) {
  44243. instance.store.toggleRowSelection(row);
  44244. instance.store.updateAllSelected();
  44245. },
  44246. setHoverRow(states, row) {
  44247. states.hoverRow.value = row;
  44248. },
  44249. setCurrentRow(_states, row) {
  44250. instance.store.updateCurrentRow(row);
  44251. }
  44252. };
  44253. const commit = function(name, ...args) {
  44254. const mutations2 = instance.store.mutations;
  44255. if (mutations2[name]) {
  44256. mutations2[name].apply(instance, [instance.store.states].concat(args));
  44257. } else {
  44258. throw new Error(`Action not found: ${name}`);
  44259. }
  44260. };
  44261. const updateTableScrollY = function() {
  44262. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  44263. };
  44264. return {
  44265. ns,
  44266. ...watcher,
  44267. mutations,
  44268. commit,
  44269. updateTableScrollY
  44270. };
  44271. }
  44272. const InitialStateMap = {
  44273. rowKey: "rowKey",
  44274. defaultExpandAll: "defaultExpandAll",
  44275. selectOnIndeterminate: "selectOnIndeterminate",
  44276. indent: "indent",
  44277. lazy: "lazy",
  44278. data: "data",
  44279. ["treeProps.hasChildren"]: {
  44280. key: "lazyColumnIdentifier",
  44281. default: "hasChildren"
  44282. },
  44283. ["treeProps.children"]: {
  44284. key: "childrenColumnName",
  44285. default: "children"
  44286. },
  44287. ["treeProps.checkStrictly"]: {
  44288. key: "checkStrictly",
  44289. default: false
  44290. }
  44291. };
  44292. function createStore(table, props) {
  44293. if (!table) {
  44294. throw new Error("Table is required.");
  44295. }
  44296. const store = useStore();
  44297. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  44298. Object.keys(InitialStateMap).forEach((key) => {
  44299. handleValue(getArrKeysValue(props, key), key, store);
  44300. });
  44301. proxyTableProps(store, props);
  44302. return store;
  44303. }
  44304. function proxyTableProps(store, props) {
  44305. Object.keys(InitialStateMap).forEach((key) => {
  44306. vue.watch(() => getArrKeysValue(props, key), (value) => {
  44307. handleValue(value, key, store);
  44308. });
  44309. });
  44310. }
  44311. function handleValue(value, propsKey, store) {
  44312. let newVal = value;
  44313. let storeKey = InitialStateMap[propsKey];
  44314. if (isObject$1(InitialStateMap[propsKey])) {
  44315. storeKey = storeKey.key;
  44316. newVal = newVal || InitialStateMap[propsKey].default;
  44317. }
  44318. store.states[storeKey].value = newVal;
  44319. }
  44320. function getArrKeysValue(props, keys) {
  44321. if (keys.includes(".")) {
  44322. const keyList = keys.split(".");
  44323. let value = props;
  44324. keyList.forEach((key) => {
  44325. value = value[key];
  44326. });
  44327. return value;
  44328. } else {
  44329. return props[keys];
  44330. }
  44331. }
  44332. class TableLayout {
  44333. constructor(options) {
  44334. this.observers = [];
  44335. this.table = null;
  44336. this.store = null;
  44337. this.columns = [];
  44338. this.fit = true;
  44339. this.showHeader = true;
  44340. this.height = vue.ref(null);
  44341. this.scrollX = vue.ref(false);
  44342. this.scrollY = vue.ref(false);
  44343. this.bodyWidth = vue.ref(null);
  44344. this.fixedWidth = vue.ref(null);
  44345. this.rightFixedWidth = vue.ref(null);
  44346. this.gutterWidth = 0;
  44347. for (const name in options) {
  44348. if (hasOwn(options, name)) {
  44349. if (vue.isRef(this[name])) {
  44350. this[name].value = options[name];
  44351. } else {
  44352. this[name] = options[name];
  44353. }
  44354. }
  44355. }
  44356. if (!this.table) {
  44357. throw new Error("Table is required for Table Layout");
  44358. }
  44359. if (!this.store) {
  44360. throw new Error("Store is required for Table Layout");
  44361. }
  44362. }
  44363. updateScrollY() {
  44364. const height = this.height.value;
  44365. if (isNull(height))
  44366. return false;
  44367. const scrollBarRef = this.table.refs.scrollBarRef;
  44368. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  44369. let scrollY = true;
  44370. const prevScrollY = this.scrollY.value;
  44371. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  44372. this.scrollY.value = scrollY;
  44373. return prevScrollY !== scrollY;
  44374. }
  44375. return false;
  44376. }
  44377. setHeight(value, prop = "height") {
  44378. if (!isClient)
  44379. return;
  44380. const el = this.table.vnode.el;
  44381. value = parseHeight(value);
  44382. this.height.value = Number(value);
  44383. if (!el && (value || value === 0))
  44384. return vue.nextTick(() => this.setHeight(value, prop));
  44385. if (isNumber(value)) {
  44386. el.style[prop] = `${value}px`;
  44387. this.updateElsHeight();
  44388. } else if (isString$1(value)) {
  44389. el.style[prop] = value;
  44390. this.updateElsHeight();
  44391. }
  44392. }
  44393. setMaxHeight(value) {
  44394. this.setHeight(value, "max-height");
  44395. }
  44396. getFlattenColumns() {
  44397. const flattenColumns = [];
  44398. const columns = this.table.store.states.columns.value;
  44399. columns.forEach((column) => {
  44400. if (column.isColumnGroup) {
  44401. flattenColumns.push.apply(flattenColumns, column.columns);
  44402. } else {
  44403. flattenColumns.push(column);
  44404. }
  44405. });
  44406. return flattenColumns;
  44407. }
  44408. updateElsHeight() {
  44409. this.updateScrollY();
  44410. this.notifyObservers("scrollable");
  44411. }
  44412. headerDisplayNone(elm) {
  44413. if (!elm)
  44414. return true;
  44415. let headerChild = elm;
  44416. while (headerChild.tagName !== "DIV") {
  44417. if (getComputedStyle(headerChild).display === "none") {
  44418. return true;
  44419. }
  44420. headerChild = headerChild.parentElement;
  44421. }
  44422. return false;
  44423. }
  44424. updateColumnsWidth() {
  44425. if (!isClient)
  44426. return;
  44427. const fit = this.fit;
  44428. const bodyWidth = this.table.vnode.el.clientWidth;
  44429. let bodyMinWidth = 0;
  44430. const flattenColumns = this.getFlattenColumns();
  44431. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  44432. flattenColumns.forEach((column) => {
  44433. if (isNumber(column.width) && column.realWidth)
  44434. column.realWidth = null;
  44435. });
  44436. if (flexColumns.length > 0 && fit) {
  44437. flattenColumns.forEach((column) => {
  44438. bodyMinWidth += Number(column.width || column.minWidth || 80);
  44439. });
  44440. if (bodyMinWidth <= bodyWidth) {
  44441. this.scrollX.value = false;
  44442. const totalFlexWidth = bodyWidth - bodyMinWidth;
  44443. if (flexColumns.length === 1) {
  44444. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  44445. } else {
  44446. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  44447. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  44448. let noneFirstWidth = 0;
  44449. flexColumns.forEach((column, index) => {
  44450. if (index === 0)
  44451. return;
  44452. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  44453. noneFirstWidth += flexWidth;
  44454. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  44455. });
  44456. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  44457. }
  44458. } else {
  44459. this.scrollX.value = true;
  44460. flexColumns.forEach((column) => {
  44461. column.realWidth = Number(column.minWidth);
  44462. });
  44463. }
  44464. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  44465. this.table.state.resizeState.value.width = this.bodyWidth.value;
  44466. } else {
  44467. flattenColumns.forEach((column) => {
  44468. if (!column.width && !column.minWidth) {
  44469. column.realWidth = 80;
  44470. } else {
  44471. column.realWidth = Number(column.width || column.minWidth);
  44472. }
  44473. bodyMinWidth += column.realWidth;
  44474. });
  44475. this.scrollX.value = bodyMinWidth > bodyWidth;
  44476. this.bodyWidth.value = bodyMinWidth;
  44477. }
  44478. const fixedColumns = this.store.states.fixedColumns.value;
  44479. if (fixedColumns.length > 0) {
  44480. let fixedWidth = 0;
  44481. fixedColumns.forEach((column) => {
  44482. fixedWidth += Number(column.realWidth || column.width);
  44483. });
  44484. this.fixedWidth.value = fixedWidth;
  44485. }
  44486. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  44487. if (rightFixedColumns.length > 0) {
  44488. let rightFixedWidth = 0;
  44489. rightFixedColumns.forEach((column) => {
  44490. rightFixedWidth += Number(column.realWidth || column.width);
  44491. });
  44492. this.rightFixedWidth.value = rightFixedWidth;
  44493. }
  44494. this.notifyObservers("columns");
  44495. }
  44496. addObserver(observer) {
  44497. this.observers.push(observer);
  44498. }
  44499. removeObserver(observer) {
  44500. const index = this.observers.indexOf(observer);
  44501. if (index !== -1) {
  44502. this.observers.splice(index, 1);
  44503. }
  44504. }
  44505. notifyObservers(event) {
  44506. const observers = this.observers;
  44507. observers.forEach((observer) => {
  44508. var _a, _b;
  44509. switch (event) {
  44510. case "columns":
  44511. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  44512. break;
  44513. case "scrollable":
  44514. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  44515. break;
  44516. default:
  44517. throw new Error(`Table Layout don't have event ${event}.`);
  44518. }
  44519. });
  44520. }
  44521. }
  44522. var TableLayout$1 = TableLayout;
  44523. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  44524. const _sfc_main$C = vue.defineComponent({
  44525. name: "ElTableFilterPanel",
  44526. components: {
  44527. ElCheckbox,
  44528. ElCheckboxGroup,
  44529. ElScrollbar,
  44530. ElTooltip,
  44531. ElIcon,
  44532. ArrowDown: arrow_down_default,
  44533. ArrowUp: arrow_up_default
  44534. },
  44535. directives: { ClickOutside },
  44536. props: {
  44537. placement: {
  44538. type: String,
  44539. default: "bottom-start"
  44540. },
  44541. store: {
  44542. type: Object
  44543. },
  44544. column: {
  44545. type: Object
  44546. },
  44547. upDataColumn: {
  44548. type: Function
  44549. },
  44550. appendTo: {
  44551. type: String
  44552. }
  44553. },
  44554. setup(props) {
  44555. const instance = vue.getCurrentInstance();
  44556. const { t } = useLocale();
  44557. const ns = useNamespace("table-filter");
  44558. const parent = instance == null ? void 0 : instance.parent;
  44559. if (!parent.filterPanels.value[props.column.id]) {
  44560. parent.filterPanels.value[props.column.id] = instance;
  44561. }
  44562. const tooltipVisible = vue.ref(false);
  44563. const tooltip = vue.ref(null);
  44564. const filters = vue.computed(() => {
  44565. return props.column && props.column.filters;
  44566. });
  44567. const filterClassName = vue.computed(() => {
  44568. if (props.column.filterClassName) {
  44569. return `${ns.b()} ${props.column.filterClassName}`;
  44570. }
  44571. return ns.b();
  44572. });
  44573. const filterValue = vue.computed({
  44574. get: () => {
  44575. var _a;
  44576. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  44577. },
  44578. set: (value) => {
  44579. if (filteredValue.value) {
  44580. if (!isPropAbsent(value)) {
  44581. filteredValue.value.splice(0, 1, value);
  44582. } else {
  44583. filteredValue.value.splice(0, 1);
  44584. }
  44585. }
  44586. }
  44587. });
  44588. const filteredValue = vue.computed({
  44589. get() {
  44590. if (props.column) {
  44591. return props.column.filteredValue || [];
  44592. }
  44593. return [];
  44594. },
  44595. set(value) {
  44596. if (props.column) {
  44597. props.upDataColumn("filteredValue", value);
  44598. }
  44599. }
  44600. });
  44601. const multiple = vue.computed(() => {
  44602. if (props.column) {
  44603. return props.column.filterMultiple;
  44604. }
  44605. return true;
  44606. });
  44607. const isActive = (filter) => {
  44608. return filter.value === filterValue.value;
  44609. };
  44610. const hidden = () => {
  44611. tooltipVisible.value = false;
  44612. };
  44613. const showFilterPanel = (e) => {
  44614. e.stopPropagation();
  44615. tooltipVisible.value = !tooltipVisible.value;
  44616. };
  44617. const hideFilterPanel = () => {
  44618. tooltipVisible.value = false;
  44619. };
  44620. const handleConfirm = () => {
  44621. confirmFilter(filteredValue.value);
  44622. hidden();
  44623. };
  44624. const handleReset = () => {
  44625. filteredValue.value = [];
  44626. confirmFilter(filteredValue.value);
  44627. hidden();
  44628. };
  44629. const handleSelect = (_filterValue) => {
  44630. filterValue.value = _filterValue;
  44631. if (!isPropAbsent(_filterValue)) {
  44632. confirmFilter(filteredValue.value);
  44633. } else {
  44634. confirmFilter([]);
  44635. }
  44636. hidden();
  44637. };
  44638. const confirmFilter = (filteredValue2) => {
  44639. props.store.commit("filterChange", {
  44640. column: props.column,
  44641. values: filteredValue2
  44642. });
  44643. props.store.updateAllSelected();
  44644. };
  44645. vue.watch(tooltipVisible, (value) => {
  44646. if (props.column) {
  44647. props.upDataColumn("filterOpened", value);
  44648. }
  44649. }, {
  44650. immediate: true
  44651. });
  44652. const popperPaneRef = vue.computed(() => {
  44653. var _a, _b;
  44654. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  44655. });
  44656. return {
  44657. tooltipVisible,
  44658. multiple,
  44659. filterClassName,
  44660. filteredValue,
  44661. filterValue,
  44662. filters,
  44663. handleConfirm,
  44664. handleReset,
  44665. handleSelect,
  44666. isPropAbsent,
  44667. isActive,
  44668. t,
  44669. ns,
  44670. showFilterPanel,
  44671. hideFilterPanel,
  44672. popperPaneRef,
  44673. tooltip
  44674. };
  44675. }
  44676. });
  44677. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  44678. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  44679. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  44680. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  44681. const _component_arrow_up = vue.resolveComponent("arrow-up");
  44682. const _component_arrow_down = vue.resolveComponent("arrow-down");
  44683. const _component_el_icon = vue.resolveComponent("el-icon");
  44684. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  44685. const _directive_click_outside = vue.resolveDirective("click-outside");
  44686. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  44687. ref: "tooltip",
  44688. visible: _ctx.tooltipVisible,
  44689. offset: 0,
  44690. placement: _ctx.placement,
  44691. "show-arrow": false,
  44692. "stop-popper-mouse-event": false,
  44693. teleported: "",
  44694. effect: "light",
  44695. pure: "",
  44696. "popper-class": _ctx.filterClassName,
  44697. persistent: "",
  44698. "append-to": _ctx.appendTo
  44699. }, {
  44700. content: vue.withCtx(() => [
  44701. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  44702. vue.createElementVNode("div", {
  44703. class: vue.normalizeClass(_ctx.ns.e("content"))
  44704. }, [
  44705. vue.createVNode(_component_el_scrollbar, {
  44706. "wrap-class": _ctx.ns.e("wrap")
  44707. }, {
  44708. default: vue.withCtx(() => [
  44709. vue.createVNode(_component_el_checkbox_group, {
  44710. modelValue: _ctx.filteredValue,
  44711. "onUpdate:modelValue": ($event) => _ctx.filteredValue = $event,
  44712. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  44713. }, {
  44714. default: vue.withCtx(() => [
  44715. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  44716. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  44717. key: filter.value,
  44718. value: filter.value
  44719. }, {
  44720. default: vue.withCtx(() => [
  44721. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  44722. ]),
  44723. _: 2
  44724. }, 1032, ["value"]);
  44725. }), 128))
  44726. ]),
  44727. _: 1
  44728. }, 8, ["modelValue", "onUpdate:modelValue", "class"])
  44729. ]),
  44730. _: 1
  44731. }, 8, ["wrap-class"])
  44732. ], 2),
  44733. vue.createElementVNode("div", {
  44734. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  44735. }, [
  44736. vue.createElementVNode("button", {
  44737. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  44738. disabled: _ctx.filteredValue.length === 0,
  44739. type: "button",
  44740. onClick: _ctx.handleConfirm
  44741. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, ["disabled", "onClick"]),
  44742. vue.createElementVNode("button", {
  44743. type: "button",
  44744. onClick: _ctx.handleReset
  44745. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 9, ["onClick"])
  44746. ], 2)
  44747. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  44748. key: 1,
  44749. class: vue.normalizeClass(_ctx.ns.e("list"))
  44750. }, [
  44751. vue.createElementVNode("li", {
  44752. class: vue.normalizeClass([
  44753. _ctx.ns.e("list-item"),
  44754. {
  44755. [_ctx.ns.is("active")]: _ctx.isPropAbsent(_ctx.filterValue)
  44756. }
  44757. ]),
  44758. onClick: ($event) => _ctx.handleSelect(null)
  44759. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 11, ["onClick"]),
  44760. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  44761. return vue.openBlock(), vue.createElementBlock("li", {
  44762. key: filter.value,
  44763. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  44764. label: filter.value,
  44765. onClick: ($event) => _ctx.handleSelect(filter.value)
  44766. }, vue.toDisplayString(filter.text), 11, ["label", "onClick"]);
  44767. }), 128))
  44768. ], 2))
  44769. ]),
  44770. default: vue.withCtx(() => [
  44771. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  44772. class: vue.normalizeClass([
  44773. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  44774. `${_ctx.ns.namespace.value}-none-outline`
  44775. ]),
  44776. onClick: _ctx.showFilterPanel
  44777. }, [
  44778. vue.createVNode(_component_el_icon, null, {
  44779. default: vue.withCtx(() => [
  44780. vue.renderSlot(_ctx.$slots, "filter-icon", {}, () => [
  44781. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  44782. ])
  44783. ]),
  44784. _: 3
  44785. })
  44786. ], 10, ["onClick"])), [
  44787. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  44788. ])
  44789. ]),
  44790. _: 3
  44791. }, 8, ["visible", "placement", "popper-class", "append-to"]);
  44792. }
  44793. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  44794. function useLayoutObserver(root) {
  44795. const instance = vue.getCurrentInstance();
  44796. vue.onBeforeMount(() => {
  44797. tableLayout.value.addObserver(instance);
  44798. });
  44799. vue.onMounted(() => {
  44800. onColumnsChange(tableLayout.value);
  44801. onScrollableChange(tableLayout.value);
  44802. });
  44803. vue.onUpdated(() => {
  44804. onColumnsChange(tableLayout.value);
  44805. onScrollableChange(tableLayout.value);
  44806. });
  44807. vue.onUnmounted(() => {
  44808. tableLayout.value.removeObserver(instance);
  44809. });
  44810. const tableLayout = vue.computed(() => {
  44811. const layout = root.layout;
  44812. if (!layout) {
  44813. throw new Error("Can not find table layout.");
  44814. }
  44815. return layout;
  44816. });
  44817. const onColumnsChange = (layout) => {
  44818. var _a;
  44819. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  44820. if (!cols.length)
  44821. return;
  44822. const flattenColumns = layout.getFlattenColumns();
  44823. const columnsMap = {};
  44824. flattenColumns.forEach((column) => {
  44825. columnsMap[column.id] = column;
  44826. });
  44827. for (let i = 0, j = cols.length; i < j; i++) {
  44828. const col = cols[i];
  44829. const name = col.getAttribute("name");
  44830. const column = columnsMap[name];
  44831. if (column) {
  44832. col.setAttribute("width", column.realWidth || column.width);
  44833. }
  44834. }
  44835. };
  44836. const onScrollableChange = (layout) => {
  44837. var _a, _b;
  44838. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  44839. for (let i = 0, j = cols.length; i < j; i++) {
  44840. const col = cols[i];
  44841. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  44842. }
  44843. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  44844. for (let i = 0, j = ths.length; i < j; i++) {
  44845. const th = ths[i];
  44846. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  44847. th.style.display = layout.scrollY.value ? "" : "none";
  44848. }
  44849. };
  44850. return {
  44851. tableLayout: tableLayout.value,
  44852. onColumnsChange,
  44853. onScrollableChange
  44854. };
  44855. }
  44856. const TABLE_INJECTION_KEY = Symbol("ElTable");
  44857. function useEvent(props, emit) {
  44858. const instance = vue.getCurrentInstance();
  44859. const parent = vue.inject(TABLE_INJECTION_KEY);
  44860. const handleFilterClick = (event) => {
  44861. event.stopPropagation();
  44862. return;
  44863. };
  44864. const handleHeaderClick = (event, column) => {
  44865. if (!column.filters && column.sortable) {
  44866. handleSortClick(event, column, false);
  44867. } else if (column.filterable && !column.sortable) {
  44868. handleFilterClick(event);
  44869. }
  44870. parent == null ? void 0 : parent.emit("header-click", column, event);
  44871. };
  44872. const handleHeaderContextMenu = (event, column) => {
  44873. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  44874. };
  44875. const draggingColumn = vue.ref(null);
  44876. const dragging = vue.ref(false);
  44877. const dragState = vue.ref({});
  44878. const handleMouseDown = (event, column) => {
  44879. if (!isClient)
  44880. return;
  44881. if (column.children && column.children.length > 0)
  44882. return;
  44883. if (draggingColumn.value && props.border) {
  44884. dragging.value = true;
  44885. const table = parent;
  44886. emit("set-drag-visible", true);
  44887. const tableEl = table == null ? void 0 : table.vnode.el;
  44888. const tableLeft = tableEl.getBoundingClientRect().left;
  44889. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  44890. const columnRect = columnEl.getBoundingClientRect();
  44891. const minLeft = columnRect.left - tableLeft + 30;
  44892. addClass(columnEl, "noclick");
  44893. dragState.value = {
  44894. startMouseLeft: event.clientX,
  44895. startLeft: columnRect.right - tableLeft,
  44896. startColumnLeft: columnRect.left - tableLeft,
  44897. tableLeft
  44898. };
  44899. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  44900. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  44901. document.onselectstart = function() {
  44902. return false;
  44903. };
  44904. document.ondragstart = function() {
  44905. return false;
  44906. };
  44907. const handleMouseMove2 = (event2) => {
  44908. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  44909. const proxyLeft = dragState.value.startLeft + deltaLeft;
  44910. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  44911. };
  44912. const handleMouseUp = () => {
  44913. if (dragging.value) {
  44914. const { startColumnLeft, startLeft } = dragState.value;
  44915. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  44916. const columnWidth = finalLeft - startColumnLeft;
  44917. column.width = column.realWidth = columnWidth;
  44918. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  44919. requestAnimationFrame(() => {
  44920. props.store.scheduleLayout(false, true);
  44921. });
  44922. document.body.style.cursor = "";
  44923. dragging.value = false;
  44924. draggingColumn.value = null;
  44925. dragState.value = {};
  44926. emit("set-drag-visible", false);
  44927. }
  44928. document.removeEventListener("mousemove", handleMouseMove2);
  44929. document.removeEventListener("mouseup", handleMouseUp);
  44930. document.onselectstart = null;
  44931. document.ondragstart = null;
  44932. setTimeout(() => {
  44933. removeClass(columnEl, "noclick");
  44934. }, 0);
  44935. };
  44936. document.addEventListener("mousemove", handleMouseMove2);
  44937. document.addEventListener("mouseup", handleMouseUp);
  44938. }
  44939. };
  44940. const handleMouseMove = (event, column) => {
  44941. var _a;
  44942. if (column.children && column.children.length > 0)
  44943. return;
  44944. const el = event.target;
  44945. if (!isElement$1(el)) {
  44946. return;
  44947. }
  44948. const target = el == null ? void 0 : el.closest("th");
  44949. if (!column || !column.resizable || !target)
  44950. return;
  44951. if (!dragging.value && props.border) {
  44952. const rect = target.getBoundingClientRect();
  44953. const bodyStyle = document.body.style;
  44954. const isLastTh = ((_a = target.parentNode) == null ? void 0 : _a.lastElementChild) === target;
  44955. const allowDarg = props.allowDragLastColumn || !isLastTh;
  44956. if (rect.width > 12 && rect.right - event.clientX < 8 && allowDarg) {
  44957. bodyStyle.cursor = "col-resize";
  44958. if (hasClass(target, "is-sortable")) {
  44959. target.style.cursor = "col-resize";
  44960. }
  44961. draggingColumn.value = column;
  44962. } else if (!dragging.value) {
  44963. bodyStyle.cursor = "";
  44964. if (hasClass(target, "is-sortable")) {
  44965. target.style.cursor = "pointer";
  44966. }
  44967. draggingColumn.value = null;
  44968. }
  44969. }
  44970. };
  44971. const handleMouseOut = () => {
  44972. if (!isClient)
  44973. return;
  44974. document.body.style.cursor = "";
  44975. };
  44976. const toggleOrder = ({ order, sortOrders }) => {
  44977. if (order === "")
  44978. return sortOrders[0];
  44979. const index = sortOrders.indexOf(order || null);
  44980. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  44981. };
  44982. const handleSortClick = (event, column, givenOrder) => {
  44983. var _a;
  44984. event.stopPropagation();
  44985. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  44986. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  44987. if (target) {
  44988. if (hasClass(target, "noclick")) {
  44989. removeClass(target, "noclick");
  44990. return;
  44991. }
  44992. }
  44993. if (!column.sortable)
  44994. return;
  44995. const clickTarget = event.currentTarget;
  44996. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) {
  44997. return;
  44998. }
  44999. const states = props.store.states;
  45000. let sortProp = states.sortProp.value;
  45001. let sortOrder;
  45002. const sortingColumn = states.sortingColumn.value;
  45003. if (sortingColumn !== column || sortingColumn === column && isNull(sortingColumn.order)) {
  45004. if (sortingColumn) {
  45005. sortingColumn.order = null;
  45006. }
  45007. states.sortingColumn.value = column;
  45008. sortProp = column.property;
  45009. }
  45010. if (!order) {
  45011. sortOrder = column.order = null;
  45012. } else {
  45013. sortOrder = column.order = order;
  45014. }
  45015. states.sortProp.value = sortProp;
  45016. states.sortOrder.value = sortOrder;
  45017. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  45018. };
  45019. return {
  45020. handleHeaderClick,
  45021. handleHeaderContextMenu,
  45022. handleMouseDown,
  45023. handleMouseMove,
  45024. handleMouseOut,
  45025. handleSortClick,
  45026. handleFilterClick
  45027. };
  45028. }
  45029. function useStyle$2(props) {
  45030. const parent = vue.inject(TABLE_INJECTION_KEY);
  45031. const ns = useNamespace("table");
  45032. const getHeaderRowStyle = (rowIndex) => {
  45033. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  45034. if (isFunction$1(headerRowStyle)) {
  45035. return headerRowStyle.call(null, { rowIndex });
  45036. }
  45037. return headerRowStyle;
  45038. };
  45039. const getHeaderRowClass = (rowIndex) => {
  45040. const classes = [];
  45041. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  45042. if (isString$1(headerRowClassName)) {
  45043. classes.push(headerRowClassName);
  45044. } else if (isFunction$1(headerRowClassName)) {
  45045. classes.push(headerRowClassName.call(null, { rowIndex }));
  45046. }
  45047. return classes.join(" ");
  45048. };
  45049. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  45050. var _a;
  45051. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  45052. if (isFunction$1(headerCellStyles)) {
  45053. headerCellStyles = headerCellStyles.call(null, {
  45054. rowIndex,
  45055. columnIndex,
  45056. row,
  45057. column
  45058. });
  45059. }
  45060. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  45061. ensurePosition(fixedStyle, "left");
  45062. ensurePosition(fixedStyle, "right");
  45063. return Object.assign({}, headerCellStyles, fixedStyle);
  45064. };
  45065. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  45066. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  45067. const classes = [
  45068. column.id,
  45069. column.order,
  45070. column.headerAlign,
  45071. column.className,
  45072. column.labelClassName,
  45073. ...fixedClasses
  45074. ];
  45075. if (!column.children) {
  45076. classes.push("is-leaf");
  45077. }
  45078. if (column.sortable) {
  45079. classes.push("is-sortable");
  45080. }
  45081. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  45082. if (isString$1(headerCellClassName)) {
  45083. classes.push(headerCellClassName);
  45084. } else if (isFunction$1(headerCellClassName)) {
  45085. classes.push(headerCellClassName.call(null, {
  45086. rowIndex,
  45087. columnIndex,
  45088. row,
  45089. column
  45090. }));
  45091. }
  45092. classes.push(ns.e("cell"));
  45093. return classes.filter((className) => Boolean(className)).join(" ");
  45094. };
  45095. return {
  45096. getHeaderRowStyle,
  45097. getHeaderRowClass,
  45098. getHeaderCellStyle,
  45099. getHeaderCellClass
  45100. };
  45101. }
  45102. const getAllColumns = (columns) => {
  45103. const result = [];
  45104. columns.forEach((column) => {
  45105. if (column.children) {
  45106. result.push(column);
  45107. result.push.apply(result, getAllColumns(column.children));
  45108. } else {
  45109. result.push(column);
  45110. }
  45111. });
  45112. return result;
  45113. };
  45114. const convertToRows = (originColumns) => {
  45115. let maxLevel = 1;
  45116. const traverse = (column, parent) => {
  45117. if (parent) {
  45118. column.level = parent.level + 1;
  45119. if (maxLevel < column.level) {
  45120. maxLevel = column.level;
  45121. }
  45122. }
  45123. if (column.children) {
  45124. let colSpan = 0;
  45125. column.children.forEach((subColumn) => {
  45126. traverse(subColumn, column);
  45127. colSpan += subColumn.colSpan;
  45128. });
  45129. column.colSpan = colSpan;
  45130. } else {
  45131. column.colSpan = 1;
  45132. }
  45133. };
  45134. originColumns.forEach((column) => {
  45135. column.level = 1;
  45136. traverse(column, void 0);
  45137. });
  45138. const rows = [];
  45139. for (let i = 0; i < maxLevel; i++) {
  45140. rows.push([]);
  45141. }
  45142. const allColumns = getAllColumns(originColumns);
  45143. allColumns.forEach((column) => {
  45144. if (!column.children) {
  45145. column.rowSpan = maxLevel - column.level + 1;
  45146. } else {
  45147. column.rowSpan = 1;
  45148. column.children.forEach((col) => col.isSubColumn = true);
  45149. }
  45150. rows[column.level - 1].push(column);
  45151. });
  45152. return rows;
  45153. };
  45154. function useUtils$1(props) {
  45155. const parent = vue.inject(TABLE_INJECTION_KEY);
  45156. const columnRows = vue.computed(() => {
  45157. return convertToRows(props.store.states.originColumns.value);
  45158. });
  45159. const isGroup = vue.computed(() => {
  45160. const result = columnRows.value.length > 1;
  45161. if (result && parent) {
  45162. parent.state.isGroup.value = true;
  45163. }
  45164. return result;
  45165. });
  45166. const toggleAllSelection = (event) => {
  45167. event.stopPropagation();
  45168. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  45169. };
  45170. return {
  45171. isGroup,
  45172. toggleAllSelection,
  45173. columnRows
  45174. };
  45175. }
  45176. var TableHeader = vue.defineComponent({
  45177. name: "ElTableHeader",
  45178. components: {
  45179. ElCheckbox
  45180. },
  45181. props: {
  45182. fixed: {
  45183. type: String,
  45184. default: ""
  45185. },
  45186. store: {
  45187. required: true,
  45188. type: Object
  45189. },
  45190. border: Boolean,
  45191. defaultSort: {
  45192. type: Object,
  45193. default: () => {
  45194. return {
  45195. prop: "",
  45196. order: ""
  45197. };
  45198. }
  45199. },
  45200. appendFilterPanelTo: {
  45201. type: String
  45202. },
  45203. allowDragLastColumn: {
  45204. type: Boolean
  45205. }
  45206. },
  45207. setup(props, { emit }) {
  45208. const instance = vue.getCurrentInstance();
  45209. const parent = vue.inject(TABLE_INJECTION_KEY);
  45210. const ns = useNamespace("table");
  45211. const filterPanels = vue.ref({});
  45212. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  45213. const isTableLayoutAuto = (parent == null ? void 0 : parent.props.tableLayout) === "auto";
  45214. const saveIndexSelection = vue.reactive(/* @__PURE__ */ new Map());
  45215. const theadRef = vue.ref();
  45216. const updateFixedColumnStyle = () => {
  45217. setTimeout(() => {
  45218. if (saveIndexSelection.size > 0) {
  45219. saveIndexSelection.forEach((column, key) => {
  45220. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  45221. if (el) {
  45222. const width = el.getBoundingClientRect().width;
  45223. column.width = width;
  45224. }
  45225. });
  45226. saveIndexSelection.clear();
  45227. }
  45228. });
  45229. };
  45230. vue.watch(saveIndexSelection, updateFixedColumnStyle);
  45231. vue.onMounted(async () => {
  45232. await vue.nextTick();
  45233. await vue.nextTick();
  45234. const { prop, order } = props.defaultSort;
  45235. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  45236. updateFixedColumnStyle();
  45237. });
  45238. const {
  45239. handleHeaderClick,
  45240. handleHeaderContextMenu,
  45241. handleMouseDown,
  45242. handleMouseMove,
  45243. handleMouseOut,
  45244. handleSortClick,
  45245. handleFilterClick
  45246. } = useEvent(props, emit);
  45247. const {
  45248. getHeaderRowStyle,
  45249. getHeaderRowClass,
  45250. getHeaderCellStyle,
  45251. getHeaderCellClass
  45252. } = useStyle$2(props);
  45253. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  45254. instance.state = {
  45255. onColumnsChange,
  45256. onScrollableChange
  45257. };
  45258. instance.filterPanels = filterPanels;
  45259. return {
  45260. ns,
  45261. filterPanels,
  45262. onColumnsChange,
  45263. onScrollableChange,
  45264. columnRows,
  45265. getHeaderRowClass,
  45266. getHeaderRowStyle,
  45267. getHeaderCellClass,
  45268. getHeaderCellStyle,
  45269. handleHeaderClick,
  45270. handleHeaderContextMenu,
  45271. handleMouseDown,
  45272. handleMouseMove,
  45273. handleMouseOut,
  45274. handleSortClick,
  45275. handleFilterClick,
  45276. isGroup,
  45277. toggleAllSelection,
  45278. saveIndexSelection,
  45279. isTableLayoutAuto,
  45280. theadRef,
  45281. updateFixedColumnStyle
  45282. };
  45283. },
  45284. render() {
  45285. const {
  45286. ns,
  45287. isGroup,
  45288. columnRows,
  45289. getHeaderCellStyle,
  45290. getHeaderCellClass,
  45291. getHeaderRowClass,
  45292. getHeaderRowStyle,
  45293. handleHeaderClick,
  45294. handleHeaderContextMenu,
  45295. handleMouseDown,
  45296. handleMouseMove,
  45297. handleSortClick,
  45298. handleMouseOut,
  45299. store,
  45300. $parent,
  45301. saveIndexSelection,
  45302. isTableLayoutAuto
  45303. } = this;
  45304. let rowSpan = 1;
  45305. return vue.h("thead", {
  45306. ref: "theadRef",
  45307. class: { [ns.is("group")]: isGroup }
  45308. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  45309. class: getHeaderRowClass(rowIndex),
  45310. key: rowIndex,
  45311. style: getHeaderRowStyle(rowIndex)
  45312. }, subColumns.map((column, cellIndex) => {
  45313. if (column.rowSpan > rowSpan) {
  45314. rowSpan = column.rowSpan;
  45315. }
  45316. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  45317. if (isTableLayoutAuto && column.fixed) {
  45318. saveIndexSelection.set(_class, column);
  45319. }
  45320. return vue.h("th", {
  45321. class: _class,
  45322. colspan: column.colSpan,
  45323. key: `${column.id}-thead`,
  45324. rowspan: column.rowSpan,
  45325. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  45326. onClick: ($event) => {
  45327. if ($event.currentTarget.classList.contains("noclick")) {
  45328. return;
  45329. }
  45330. handleHeaderClick($event, column);
  45331. },
  45332. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  45333. onMousedown: ($event) => handleMouseDown($event, column),
  45334. onMousemove: ($event) => handleMouseMove($event, column),
  45335. onMouseout: handleMouseOut
  45336. }, [
  45337. vue.h("div", {
  45338. class: [
  45339. "cell",
  45340. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  45341. ]
  45342. }, [
  45343. column.renderHeader ? column.renderHeader({
  45344. column,
  45345. $index: cellIndex,
  45346. store,
  45347. _self: $parent
  45348. }) : column.label,
  45349. column.sortable && vue.h("span", {
  45350. onClick: ($event) => handleSortClick($event, column),
  45351. class: "caret-wrapper"
  45352. }, [
  45353. vue.h("i", {
  45354. onClick: ($event) => handleSortClick($event, column, "ascending"),
  45355. class: "sort-caret ascending"
  45356. }),
  45357. vue.h("i", {
  45358. onClick: ($event) => handleSortClick($event, column, "descending"),
  45359. class: "sort-caret descending"
  45360. })
  45361. ]),
  45362. column.filterable && vue.h(FilterPanel, {
  45363. store,
  45364. placement: column.filterPlacement || "bottom-start",
  45365. appendTo: $parent.appendFilterPanelTo,
  45366. column,
  45367. upDataColumn: (key, value) => {
  45368. column[key] = value;
  45369. }
  45370. }, {
  45371. "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({
  45372. filterOpened: column.filterOpened
  45373. }) : null
  45374. })
  45375. ])
  45376. ]);
  45377. }))));
  45378. }
  45379. });
  45380. function isGreaterThan(a, b, epsilon = 0.03) {
  45381. return a - b > epsilon;
  45382. }
  45383. function useEvents(props) {
  45384. const parent = vue.inject(TABLE_INJECTION_KEY);
  45385. const tooltipContent = vue.ref("");
  45386. const tooltipTrigger = vue.ref(vue.h("div"));
  45387. const handleEvent = (event, row, name) => {
  45388. var _a;
  45389. const table = parent;
  45390. const cell = getCell(event);
  45391. let column;
  45392. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45393. if (cell) {
  45394. column = getColumnByCell({
  45395. columns: props.store.states.columns.value
  45396. }, cell, namespace);
  45397. if (column) {
  45398. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  45399. }
  45400. }
  45401. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  45402. };
  45403. const handleDoubleClick = (event, row) => {
  45404. handleEvent(event, row, "dblclick");
  45405. };
  45406. const handleClick = (event, row) => {
  45407. props.store.commit("setCurrentRow", row);
  45408. handleEvent(event, row, "click");
  45409. };
  45410. const handleContextMenu = (event, row) => {
  45411. handleEvent(event, row, "contextmenu");
  45412. };
  45413. const handleMouseEnter = debounce((index) => {
  45414. props.store.commit("setHoverRow", index);
  45415. }, 30);
  45416. const handleMouseLeave = debounce(() => {
  45417. props.store.commit("setHoverRow", null);
  45418. }, 30);
  45419. const getPadding = (el) => {
  45420. const style = window.getComputedStyle(el, null);
  45421. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  45422. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  45423. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  45424. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  45425. return {
  45426. left: paddingLeft,
  45427. right: paddingRight,
  45428. top: paddingTop,
  45429. bottom: paddingBottom
  45430. };
  45431. };
  45432. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  45433. let node = event.target.parentNode;
  45434. while (rowSpan > 1) {
  45435. node = node == null ? void 0 : node.nextSibling;
  45436. if (!node || node.nodeName !== "TR")
  45437. break;
  45438. toggle(node, "hover-row hover-fixed-row");
  45439. rowSpan--;
  45440. }
  45441. };
  45442. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  45443. var _a, _b, _c;
  45444. const table = parent;
  45445. const cell = getCell(event);
  45446. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45447. let column;
  45448. if (cell) {
  45449. column = getColumnByCell({
  45450. columns: props.store.states.columns.value
  45451. }, cell, namespace);
  45452. if (cell.rowSpan > 1) {
  45453. toggleRowClassByCell(cell.rowSpan, event, addClass);
  45454. }
  45455. const hoverState = table.hoverState = { cell, column, row };
  45456. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  45457. }
  45458. if (!tooltipOptions) {
  45459. return;
  45460. }
  45461. const cellChild = event.target.querySelector(".cell");
  45462. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  45463. return;
  45464. }
  45465. const range = document.createRange();
  45466. range.setStart(cellChild, 0);
  45467. range.setEnd(cellChild, cellChild.childNodes.length);
  45468. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  45469. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  45470. const { top, left, right, bottom } = getPadding(cellChild);
  45471. const horizontalPadding = left + right;
  45472. const verticalPadding = top + bottom;
  45473. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  45474. createTablePopper(tooltipOptions, cell.innerText || cell.textContent, row, column, cell, table);
  45475. } else if (((_b = removePopper) == null ? void 0 : _b.trigger) === cell) {
  45476. (_c = removePopper) == null ? void 0 : _c();
  45477. }
  45478. };
  45479. const handleCellMouseLeave = (event) => {
  45480. const cell = getCell(event);
  45481. if (!cell)
  45482. return;
  45483. if (cell.rowSpan > 1) {
  45484. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  45485. }
  45486. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  45487. 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);
  45488. };
  45489. return {
  45490. handleDoubleClick,
  45491. handleClick,
  45492. handleContextMenu,
  45493. handleMouseEnter,
  45494. handleMouseLeave,
  45495. handleCellMouseEnter,
  45496. handleCellMouseLeave,
  45497. tooltipContent,
  45498. tooltipTrigger
  45499. };
  45500. }
  45501. function useStyles$1(props) {
  45502. const parent = vue.inject(TABLE_INJECTION_KEY);
  45503. const ns = useNamespace("table");
  45504. const getRowStyle = (row, rowIndex) => {
  45505. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  45506. if (isFunction$1(rowStyle)) {
  45507. return rowStyle.call(null, {
  45508. row,
  45509. rowIndex
  45510. });
  45511. }
  45512. return rowStyle || null;
  45513. };
  45514. const getRowClass = (row, rowIndex) => {
  45515. const classes = [ns.e("row")];
  45516. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  45517. classes.push("current-row");
  45518. }
  45519. if (props.stripe && rowIndex % 2 === 1) {
  45520. classes.push(ns.em("row", "striped"));
  45521. }
  45522. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  45523. if (isString$1(rowClassName)) {
  45524. classes.push(rowClassName);
  45525. } else if (isFunction$1(rowClassName)) {
  45526. classes.push(rowClassName.call(null, {
  45527. row,
  45528. rowIndex
  45529. }));
  45530. }
  45531. return classes;
  45532. };
  45533. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  45534. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  45535. let cellStyles = cellStyle != null ? cellStyle : {};
  45536. if (isFunction$1(cellStyle)) {
  45537. cellStyles = cellStyle.call(null, {
  45538. rowIndex,
  45539. columnIndex,
  45540. row,
  45541. column
  45542. });
  45543. }
  45544. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  45545. ensurePosition(fixedStyle, "left");
  45546. ensurePosition(fixedStyle, "right");
  45547. return Object.assign({}, cellStyles, fixedStyle);
  45548. };
  45549. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  45550. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  45551. const classes = [column.id, column.align, column.className, ...fixedClasses];
  45552. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  45553. if (isString$1(cellClassName)) {
  45554. classes.push(cellClassName);
  45555. } else if (isFunction$1(cellClassName)) {
  45556. classes.push(cellClassName.call(null, {
  45557. rowIndex,
  45558. columnIndex,
  45559. row,
  45560. column
  45561. }));
  45562. }
  45563. classes.push(ns.e("cell"));
  45564. return classes.filter((className) => Boolean(className)).join(" ");
  45565. };
  45566. const getSpan = (row, column, rowIndex, columnIndex) => {
  45567. let rowspan = 1;
  45568. let colspan = 1;
  45569. const fn = parent == null ? void 0 : parent.props.spanMethod;
  45570. if (isFunction$1(fn)) {
  45571. const result = fn({
  45572. row,
  45573. column,
  45574. rowIndex,
  45575. columnIndex
  45576. });
  45577. if (isArray$1(result)) {
  45578. rowspan = result[0];
  45579. colspan = result[1];
  45580. } else if (isObject$1(result)) {
  45581. rowspan = result.rowspan;
  45582. colspan = result.colspan;
  45583. }
  45584. }
  45585. return { rowspan, colspan };
  45586. };
  45587. const getColspanRealWidth = (columns, colspan, index) => {
  45588. if (colspan < 1) {
  45589. return columns[index].realWidth;
  45590. }
  45591. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  45592. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  45593. };
  45594. return {
  45595. getRowStyle,
  45596. getRowClass,
  45597. getCellStyle,
  45598. getCellClass,
  45599. getSpan,
  45600. getColspanRealWidth
  45601. };
  45602. }
  45603. const __default__$v = vue.defineComponent({
  45604. name: "TableTdWrapper"
  45605. });
  45606. const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
  45607. ...__default__$v,
  45608. props: {
  45609. colspan: {
  45610. type: Number,
  45611. default: 1
  45612. },
  45613. rowspan: {
  45614. type: Number,
  45615. default: 1
  45616. }
  45617. },
  45618. setup(__props) {
  45619. return (_ctx, _cache) => {
  45620. return vue.openBlock(), vue.createElementBlock("td", {
  45621. colspan: __props.colspan,
  45622. rowspan: __props.rowspan
  45623. }, [
  45624. vue.renderSlot(_ctx.$slots, "default")
  45625. ], 8, ["colspan", "rowspan"]);
  45626. };
  45627. }
  45628. });
  45629. var TdWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "td-wrapper.vue"]]);
  45630. function useRender$1(props) {
  45631. const parent = vue.inject(TABLE_INJECTION_KEY);
  45632. const ns = useNamespace("table");
  45633. const {
  45634. handleDoubleClick,
  45635. handleClick,
  45636. handleContextMenu,
  45637. handleMouseEnter,
  45638. handleMouseLeave,
  45639. handleCellMouseEnter,
  45640. handleCellMouseLeave,
  45641. tooltipContent,
  45642. tooltipTrigger
  45643. } = useEvents(props);
  45644. const {
  45645. getRowStyle,
  45646. getRowClass,
  45647. getCellStyle,
  45648. getCellClass,
  45649. getSpan,
  45650. getColspanRealWidth
  45651. } = useStyles$1(props);
  45652. const firstDefaultColumnIndex = vue.computed(() => {
  45653. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  45654. });
  45655. const getKeyOfRow = (row, index) => {
  45656. const rowKey = parent.props.rowKey;
  45657. if (rowKey) {
  45658. return getRowIdentity(row, rowKey);
  45659. }
  45660. return index;
  45661. };
  45662. const rowRender = (row, $index, treeRowData, expanded = false) => {
  45663. const { tooltipEffect, tooltipOptions, store } = props;
  45664. const { indent, columns } = store.states;
  45665. const rowClasses = getRowClass(row, $index);
  45666. let display = true;
  45667. if (treeRowData) {
  45668. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  45669. display = treeRowData.display;
  45670. }
  45671. const displayStyle = display ? null : { display: "none" };
  45672. return vue.h("tr", {
  45673. style: [displayStyle, getRowStyle(row, $index)],
  45674. class: rowClasses,
  45675. key: getKeyOfRow(row, $index),
  45676. onDblclick: ($event) => handleDoubleClick($event, row),
  45677. onClick: ($event) => handleClick($event, row),
  45678. onContextmenu: ($event) => handleContextMenu($event, row),
  45679. onMouseenter: () => handleMouseEnter($index),
  45680. onMouseleave: handleMouseLeave
  45681. }, columns.value.map((column, cellIndex) => {
  45682. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  45683. if (!rowspan || !colspan) {
  45684. return null;
  45685. }
  45686. const columnData = Object.assign({}, column);
  45687. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  45688. const data = {
  45689. store: props.store,
  45690. _self: props.context || parent,
  45691. column: columnData,
  45692. row,
  45693. $index,
  45694. cellIndex,
  45695. expanded
  45696. };
  45697. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  45698. data.treeNode = {
  45699. indent: treeRowData.level * indent.value,
  45700. level: treeRowData.level
  45701. };
  45702. if (isBoolean(treeRowData.expanded)) {
  45703. data.treeNode.expanded = treeRowData.expanded;
  45704. if ("loading" in treeRowData) {
  45705. data.treeNode.loading = treeRowData.loading;
  45706. }
  45707. if ("noLazyChildren" in treeRowData) {
  45708. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  45709. }
  45710. }
  45711. }
  45712. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  45713. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  45714. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  45715. effect: tooltipEffect
  45716. }, tooltipOptions, column.showOverflowTooltip);
  45717. return vue.h(TdWrapper, {
  45718. style: getCellStyle($index, cellIndex, row, column),
  45719. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  45720. key: `${patchKey}${baseKey}`,
  45721. rowspan,
  45722. colspan,
  45723. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  45724. onMouseleave: handleCellMouseLeave
  45725. }, {
  45726. default: () => cellChildren(cellIndex, column, data)
  45727. });
  45728. }));
  45729. };
  45730. const cellChildren = (cellIndex, column, data) => {
  45731. return column.renderCell(data);
  45732. };
  45733. const wrappedRowRender = (row, $index) => {
  45734. const store = props.store;
  45735. const { isRowExpanded, assertRowKey } = store;
  45736. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  45737. const columns = store.states.columns.value;
  45738. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  45739. if (hasExpandColumn) {
  45740. const expanded = isRowExpanded(row);
  45741. const tr = rowRender(row, $index, void 0, expanded);
  45742. const renderExpanded = parent.renderExpanded;
  45743. if (!renderExpanded) {
  45744. console.error("[Element Error]renderExpanded is required.");
  45745. return tr;
  45746. }
  45747. const rows = [[tr]];
  45748. if (parent.props.preserveExpandedContent || expanded) {
  45749. rows[0].push(vue.h("tr", {
  45750. key: `expanded-row__${tr.key}`,
  45751. style: { display: expanded ? "" : "none" }
  45752. }, [
  45753. vue.h("td", {
  45754. colspan: columns.length,
  45755. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  45756. }, [renderExpanded({ row, $index, store, expanded })])
  45757. ]));
  45758. }
  45759. return rows;
  45760. } else if (Object.keys(treeData.value).length) {
  45761. assertRowKey();
  45762. const key = getRowIdentity(row, rowKey.value);
  45763. let cur = treeData.value[key];
  45764. let treeRowData = null;
  45765. if (cur) {
  45766. treeRowData = {
  45767. expanded: cur.expanded,
  45768. level: cur.level,
  45769. display: true
  45770. };
  45771. if (isBoolean(cur.lazy)) {
  45772. if (isBoolean(cur.loaded) && cur.loaded) {
  45773. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45774. }
  45775. treeRowData.loading = cur.loading;
  45776. }
  45777. }
  45778. const tmp = [rowRender(row, $index, treeRowData)];
  45779. if (cur) {
  45780. let i = 0;
  45781. const traverse = (children, parent2) => {
  45782. if (!(children && children.length && parent2))
  45783. return;
  45784. children.forEach((node) => {
  45785. const innerTreeRowData = {
  45786. display: parent2.display && parent2.expanded,
  45787. level: parent2.level + 1,
  45788. expanded: false,
  45789. noLazyChildren: false,
  45790. loading: false
  45791. };
  45792. const childKey = getRowIdentity(node, rowKey.value);
  45793. if (isPropAbsent(childKey)) {
  45794. throw new Error("For nested data item, row-key is required.");
  45795. }
  45796. cur = { ...treeData.value[childKey] };
  45797. if (cur) {
  45798. innerTreeRowData.expanded = cur.expanded;
  45799. cur.level = cur.level || innerTreeRowData.level;
  45800. cur.display = !!(cur.expanded && innerTreeRowData.display);
  45801. if (isBoolean(cur.lazy)) {
  45802. if (isBoolean(cur.loaded) && cur.loaded) {
  45803. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45804. }
  45805. innerTreeRowData.loading = cur.loading;
  45806. }
  45807. }
  45808. i++;
  45809. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  45810. if (cur) {
  45811. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  45812. traverse(nodes2, cur);
  45813. }
  45814. });
  45815. };
  45816. cur.display = true;
  45817. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  45818. traverse(nodes, cur);
  45819. }
  45820. return tmp;
  45821. } else {
  45822. return rowRender(row, $index, void 0);
  45823. }
  45824. };
  45825. return {
  45826. wrappedRowRender,
  45827. tooltipContent,
  45828. tooltipTrigger
  45829. };
  45830. }
  45831. const defaultProps$3 = {
  45832. store: {
  45833. required: true,
  45834. type: Object
  45835. },
  45836. stripe: Boolean,
  45837. tooltipEffect: String,
  45838. tooltipOptions: {
  45839. type: Object
  45840. },
  45841. context: {
  45842. default: () => ({}),
  45843. type: Object
  45844. },
  45845. rowClassName: [String, Function],
  45846. rowStyle: [Object, Function],
  45847. fixed: {
  45848. type: String,
  45849. default: ""
  45850. },
  45851. highlight: Boolean
  45852. };
  45853. var defaultProps$4 = defaultProps$3;
  45854. var TableBody = vue.defineComponent({
  45855. name: "ElTableBody",
  45856. props: defaultProps$4,
  45857. setup(props) {
  45858. const instance = vue.getCurrentInstance();
  45859. const parent = vue.inject(TABLE_INJECTION_KEY);
  45860. const ns = useNamespace("table");
  45861. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  45862. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  45863. const hoveredCellList = [];
  45864. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  45865. var _a;
  45866. const el = instance == null ? void 0 : instance.vnode.el;
  45867. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  45868. let rowNum = newVal;
  45869. const childNodes = (_a = rows[rowNum]) == null ? void 0 : _a.childNodes;
  45870. if (childNodes == null ? void 0 : childNodes.length) {
  45871. let control = 0;
  45872. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  45873. var _a2, _b;
  45874. if (((_a2 = childNodes[index]) == null ? void 0 : _a2.colSpan) > 1) {
  45875. control = (_b = childNodes[index]) == null ? void 0 : _b.colSpan;
  45876. }
  45877. if (item.nodeName !== "TD" && control === 0) {
  45878. acc.push(index);
  45879. }
  45880. control > 0 && control--;
  45881. return acc;
  45882. }, []);
  45883. indexes.forEach((rowIndex) => {
  45884. var _a2;
  45885. rowNum = newVal;
  45886. while (rowNum > 0) {
  45887. const preChildNodes = (_a2 = rows[rowNum - 1]) == null ? void 0 : _a2.childNodes;
  45888. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  45889. addClass(preChildNodes[rowIndex], "hover-cell");
  45890. hoveredCellList.push(preChildNodes[rowIndex]);
  45891. break;
  45892. }
  45893. rowNum--;
  45894. }
  45895. });
  45896. } else {
  45897. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  45898. hoveredCellList.length = 0;
  45899. }
  45900. if (!props.store.states.isComplex.value || !isClient)
  45901. return;
  45902. rAF(() => {
  45903. const oldRow = rows[oldVal];
  45904. const newRow = rows[newVal];
  45905. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  45906. removeClass(oldRow, "hover-row");
  45907. }
  45908. if (newRow) {
  45909. addClass(newRow, "hover-row");
  45910. }
  45911. });
  45912. });
  45913. vue.onUnmounted(() => {
  45914. var _a;
  45915. (_a = removePopper) == null ? void 0 : _a();
  45916. });
  45917. return {
  45918. ns,
  45919. onColumnsChange,
  45920. onScrollableChange,
  45921. wrappedRowRender,
  45922. tooltipContent,
  45923. tooltipTrigger
  45924. };
  45925. },
  45926. render() {
  45927. const { wrappedRowRender, store } = this;
  45928. const data = store.states.data.value || [];
  45929. return vue.h("tbody", { tabIndex: -1 }, [
  45930. data.reduce((acc, row) => {
  45931. return acc.concat(wrappedRowRender(row, acc.length));
  45932. }, [])
  45933. ]);
  45934. }
  45935. });
  45936. function useMapState() {
  45937. const table = vue.inject(TABLE_INJECTION_KEY);
  45938. const store = table == null ? void 0 : table.store;
  45939. const leftFixedLeafCount = vue.computed(() => {
  45940. return store.states.fixedLeafColumnsLength.value;
  45941. });
  45942. const rightFixedLeafCount = vue.computed(() => {
  45943. return store.states.rightFixedColumns.value.length;
  45944. });
  45945. const columnsCount = vue.computed(() => {
  45946. return store.states.columns.value.length;
  45947. });
  45948. const leftFixedCount = vue.computed(() => {
  45949. return store.states.fixedColumns.value.length;
  45950. });
  45951. const rightFixedCount = vue.computed(() => {
  45952. return store.states.rightFixedColumns.value.length;
  45953. });
  45954. return {
  45955. leftFixedLeafCount,
  45956. rightFixedLeafCount,
  45957. columnsCount,
  45958. leftFixedCount,
  45959. rightFixedCount,
  45960. columns: store.states.columns
  45961. };
  45962. }
  45963. function useStyle$1(props) {
  45964. const { columns } = useMapState();
  45965. const ns = useNamespace("table");
  45966. const getCellClasses = (columns2, cellIndex) => {
  45967. const column = columns2[cellIndex];
  45968. const classes = [
  45969. ns.e("cell"),
  45970. column.id,
  45971. column.align,
  45972. column.labelClassName,
  45973. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  45974. ];
  45975. if (column.className) {
  45976. classes.push(column.className);
  45977. }
  45978. if (!column.children) {
  45979. classes.push(ns.is("leaf"));
  45980. }
  45981. return classes;
  45982. };
  45983. const getCellStyles = (column, cellIndex) => {
  45984. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  45985. ensurePosition(fixedStyle, "left");
  45986. ensurePosition(fixedStyle, "right");
  45987. return fixedStyle;
  45988. };
  45989. return {
  45990. getCellClasses,
  45991. getCellStyles,
  45992. columns
  45993. };
  45994. }
  45995. var TableFooter = vue.defineComponent({
  45996. name: "ElTableFooter",
  45997. props: {
  45998. fixed: {
  45999. type: String,
  46000. default: ""
  46001. },
  46002. store: {
  46003. required: true,
  46004. type: Object
  46005. },
  46006. summaryMethod: Function,
  46007. sumText: String,
  46008. border: Boolean,
  46009. defaultSort: {
  46010. type: Object,
  46011. default: () => {
  46012. return {
  46013. prop: "",
  46014. order: ""
  46015. };
  46016. }
  46017. }
  46018. },
  46019. setup(props) {
  46020. const parent = vue.inject(TABLE_INJECTION_KEY);
  46021. const ns = useNamespace("table");
  46022. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  46023. const { onScrollableChange, onColumnsChange } = useLayoutObserver(parent);
  46024. return {
  46025. ns,
  46026. onScrollableChange,
  46027. onColumnsChange,
  46028. getCellClasses,
  46029. getCellStyles,
  46030. columns
  46031. };
  46032. },
  46033. render() {
  46034. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  46035. const data = this.store.states.data.value;
  46036. let sums = [];
  46037. if (summaryMethod) {
  46038. sums = summaryMethod({
  46039. columns,
  46040. data
  46041. });
  46042. } else {
  46043. columns.forEach((column, index) => {
  46044. if (index === 0) {
  46045. sums[index] = sumText;
  46046. return;
  46047. }
  46048. const values = data.map((item) => Number(item[column.property]));
  46049. const precisions = [];
  46050. let notNumber = true;
  46051. values.forEach((value) => {
  46052. if (!Number.isNaN(+value)) {
  46053. notNumber = false;
  46054. const decimal = `${value}`.split(".")[1];
  46055. precisions.push(decimal ? decimal.length : 0);
  46056. }
  46057. });
  46058. const precision = Math.max.apply(null, precisions);
  46059. if (!notNumber) {
  46060. sums[index] = values.reduce((prev, curr) => {
  46061. const value = Number(curr);
  46062. if (!Number.isNaN(+value)) {
  46063. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  46064. } else {
  46065. return prev;
  46066. }
  46067. }, 0);
  46068. } else {
  46069. sums[index] = "";
  46070. }
  46071. });
  46072. }
  46073. return vue.h(vue.h("tfoot", [
  46074. vue.h("tr", {}, [
  46075. ...columns.map((column, cellIndex) => vue.h("td", {
  46076. key: cellIndex,
  46077. colspan: column.colSpan,
  46078. rowspan: column.rowSpan,
  46079. class: getCellClasses(columns, cellIndex),
  46080. style: getCellStyles(column, cellIndex)
  46081. }, [
  46082. vue.h("div", {
  46083. class: ["cell", column.labelClassName]
  46084. }, [sums[cellIndex]])
  46085. ]))
  46086. ])
  46087. ]));
  46088. }
  46089. });
  46090. function useUtils(store) {
  46091. const setCurrentRow = (row) => {
  46092. store.commit("setCurrentRow", row);
  46093. };
  46094. const getSelectionRows = () => {
  46095. return store.getSelectionRows();
  46096. };
  46097. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  46098. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  46099. store.updateAllSelected();
  46100. };
  46101. const clearSelection = () => {
  46102. store.clearSelection();
  46103. };
  46104. const clearFilter = (columnKeys) => {
  46105. store.clearFilter(columnKeys);
  46106. };
  46107. const toggleAllSelection = () => {
  46108. store.commit("toggleAllSelection");
  46109. };
  46110. const toggleRowExpansion = (row, expanded) => {
  46111. store.toggleRowExpansionAdapter(row, expanded);
  46112. };
  46113. const clearSort = () => {
  46114. store.clearSort();
  46115. };
  46116. const sort = (prop, order) => {
  46117. store.commit("sort", { prop, order });
  46118. };
  46119. const updateKeyChildren = (key, data) => {
  46120. store.updateKeyChildren(key, data);
  46121. };
  46122. return {
  46123. setCurrentRow,
  46124. getSelectionRows,
  46125. toggleRowSelection,
  46126. clearSelection,
  46127. clearFilter,
  46128. toggleAllSelection,
  46129. toggleRowExpansion,
  46130. clearSort,
  46131. sort,
  46132. updateKeyChildren
  46133. };
  46134. }
  46135. function useStyle(props, layout, store, table) {
  46136. const isHidden = vue.ref(false);
  46137. const renderExpanded = vue.ref(null);
  46138. const resizeProxyVisible = vue.ref(false);
  46139. const setDragVisible = (visible) => {
  46140. resizeProxyVisible.value = visible;
  46141. };
  46142. const resizeState = vue.ref({
  46143. width: null,
  46144. height: null,
  46145. headerHeight: null
  46146. });
  46147. const isGroup = vue.ref(false);
  46148. const scrollbarViewStyle = {
  46149. display: "inline-block",
  46150. verticalAlign: "middle"
  46151. };
  46152. const tableWidth = vue.ref();
  46153. const tableScrollHeight = vue.ref(0);
  46154. const bodyScrollHeight = vue.ref(0);
  46155. const headerScrollHeight = vue.ref(0);
  46156. const footerScrollHeight = vue.ref(0);
  46157. const appendScrollHeight = vue.ref(0);
  46158. vue.watchEffect(() => {
  46159. layout.setHeight(props.height);
  46160. });
  46161. vue.watchEffect(() => {
  46162. layout.setMaxHeight(props.maxHeight);
  46163. });
  46164. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  46165. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  46166. return;
  46167. store.setCurrentRowKey(`${currentRowKey}`);
  46168. }, {
  46169. immediate: true
  46170. });
  46171. vue.watch(() => props.data, (data) => {
  46172. table.store.commit("setData", data);
  46173. }, {
  46174. immediate: true,
  46175. deep: true
  46176. });
  46177. vue.watchEffect(() => {
  46178. if (props.expandRowKeys) {
  46179. store.setExpandRowKeysAdapter(props.expandRowKeys);
  46180. }
  46181. });
  46182. const handleMouseLeave = () => {
  46183. table.store.commit("setHoverRow", null);
  46184. if (table.hoverState)
  46185. table.hoverState = null;
  46186. };
  46187. const handleHeaderFooterMousewheel = (event, data) => {
  46188. const { pixelX, pixelY } = data;
  46189. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  46190. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  46191. }
  46192. };
  46193. const shouldUpdateHeight = vue.computed(() => {
  46194. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  46195. });
  46196. const tableBodyStyles = vue.computed(() => {
  46197. return {
  46198. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  46199. };
  46200. });
  46201. const doLayout = () => {
  46202. if (shouldUpdateHeight.value) {
  46203. layout.updateElsHeight();
  46204. }
  46205. layout.updateColumnsWidth();
  46206. if (typeof window === "undefined")
  46207. return;
  46208. requestAnimationFrame(syncPosition);
  46209. };
  46210. vue.onMounted(async () => {
  46211. await vue.nextTick();
  46212. store.updateColumns();
  46213. bindEvents();
  46214. requestAnimationFrame(doLayout);
  46215. const el = table.vnode.el;
  46216. const tableHeader = table.refs.headerWrapper;
  46217. if (props.flexible && el && el.parentElement) {
  46218. el.parentElement.style.minWidth = "0";
  46219. }
  46220. resizeState.value = {
  46221. width: tableWidth.value = el.offsetWidth,
  46222. height: el.offsetHeight,
  46223. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  46224. };
  46225. store.states.columns.value.forEach((column) => {
  46226. if (column.filteredValue && column.filteredValue.length) {
  46227. table.store.commit("filterChange", {
  46228. column,
  46229. values: column.filteredValue,
  46230. silent: true
  46231. });
  46232. }
  46233. });
  46234. table.$ready = true;
  46235. });
  46236. const setScrollClassByEl = (el, className) => {
  46237. if (!el)
  46238. return;
  46239. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  46240. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  46241. el.className = classList.join(" ");
  46242. };
  46243. const setScrollClass = (className) => {
  46244. const { tableWrapper } = table.refs;
  46245. setScrollClassByEl(tableWrapper, className);
  46246. };
  46247. const hasScrollClass = (className) => {
  46248. const { tableWrapper } = table.refs;
  46249. return !!(tableWrapper && tableWrapper.classList.contains(className));
  46250. };
  46251. const syncPosition = function() {
  46252. if (!table.refs.scrollBarRef)
  46253. return;
  46254. if (!layout.scrollX.value) {
  46255. const scrollingNoneClass = "is-scrolling-none";
  46256. if (!hasScrollClass(scrollingNoneClass)) {
  46257. setScrollClass(scrollingNoneClass);
  46258. }
  46259. return;
  46260. }
  46261. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  46262. if (!scrollContainer)
  46263. return;
  46264. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  46265. const { headerWrapper, footerWrapper } = table.refs;
  46266. if (headerWrapper)
  46267. headerWrapper.scrollLeft = scrollLeft;
  46268. if (footerWrapper)
  46269. footerWrapper.scrollLeft = scrollLeft;
  46270. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  46271. if (scrollLeft >= maxScrollLeftPosition) {
  46272. setScrollClass("is-scrolling-right");
  46273. } else if (scrollLeft === 0) {
  46274. setScrollClass("is-scrolling-left");
  46275. } else {
  46276. setScrollClass("is-scrolling-middle");
  46277. }
  46278. };
  46279. const bindEvents = () => {
  46280. if (!table.refs.scrollBarRef)
  46281. return;
  46282. if (table.refs.scrollBarRef.wrapRef) {
  46283. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  46284. passive: true
  46285. });
  46286. }
  46287. if (props.fit) {
  46288. useResizeObserver(table.vnode.el, resizeListener);
  46289. } else {
  46290. useEventListener(window, "resize", resizeListener);
  46291. }
  46292. useResizeObserver(table.refs.bodyWrapper, () => {
  46293. var _a, _b;
  46294. resizeListener();
  46295. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  46296. });
  46297. };
  46298. const resizeListener = () => {
  46299. var _a, _b, _c, _d;
  46300. const el = table.vnode.el;
  46301. if (!table.$ready || !el)
  46302. return;
  46303. let shouldUpdateLayout = false;
  46304. const {
  46305. width: oldWidth,
  46306. height: oldHeight,
  46307. headerHeight: oldHeaderHeight
  46308. } = resizeState.value;
  46309. const width = tableWidth.value = el.offsetWidth;
  46310. if (oldWidth !== width) {
  46311. shouldUpdateLayout = true;
  46312. }
  46313. const height = el.offsetHeight;
  46314. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  46315. shouldUpdateLayout = true;
  46316. }
  46317. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  46318. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  46319. shouldUpdateLayout = true;
  46320. }
  46321. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  46322. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  46323. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  46324. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  46325. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  46326. if (shouldUpdateLayout) {
  46327. resizeState.value = {
  46328. width,
  46329. height,
  46330. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  46331. };
  46332. doLayout();
  46333. }
  46334. };
  46335. const tableSize = useFormSize();
  46336. const bodyWidth = vue.computed(() => {
  46337. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  46338. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  46339. });
  46340. const tableLayout = vue.computed(() => {
  46341. if (props.maxHeight)
  46342. return "fixed";
  46343. return props.tableLayout;
  46344. });
  46345. const emptyBlockStyle = vue.computed(() => {
  46346. if (props.data && props.data.length)
  46347. return null;
  46348. let height = "100%";
  46349. if (props.height && bodyScrollHeight.value) {
  46350. height = `${bodyScrollHeight.value}px`;
  46351. }
  46352. const width = tableWidth.value;
  46353. return {
  46354. width: width ? `${width}px` : "",
  46355. height
  46356. };
  46357. });
  46358. const scrollbarStyle = vue.computed(() => {
  46359. if (props.height) {
  46360. return {
  46361. height: "100%"
  46362. };
  46363. }
  46364. if (props.maxHeight) {
  46365. if (!Number.isNaN(Number(props.maxHeight))) {
  46366. return {
  46367. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  46368. };
  46369. } else {
  46370. return {
  46371. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  46372. };
  46373. }
  46374. }
  46375. return {};
  46376. });
  46377. const handleFixedMousewheel = (event, data) => {
  46378. const bodyWrapper = table.refs.bodyWrapper;
  46379. if (Math.abs(data.spinY) > 0) {
  46380. const currentScrollTop = bodyWrapper.scrollTop;
  46381. if (data.pixelY < 0 && currentScrollTop !== 0) {
  46382. event.preventDefault();
  46383. }
  46384. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  46385. event.preventDefault();
  46386. }
  46387. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  46388. } else {
  46389. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  46390. }
  46391. };
  46392. return {
  46393. isHidden,
  46394. renderExpanded,
  46395. setDragVisible,
  46396. isGroup,
  46397. handleMouseLeave,
  46398. handleHeaderFooterMousewheel,
  46399. tableSize,
  46400. emptyBlockStyle,
  46401. handleFixedMousewheel,
  46402. resizeProxyVisible,
  46403. bodyWidth,
  46404. resizeState,
  46405. doLayout,
  46406. tableBodyStyles,
  46407. tableLayout,
  46408. scrollbarViewStyle,
  46409. scrollbarStyle
  46410. };
  46411. }
  46412. function useKeyRender(table) {
  46413. const observer = vue.ref();
  46414. const initWatchDom = () => {
  46415. const el = table.vnode.el;
  46416. const columnsWrapper = el.querySelector(".hidden-columns");
  46417. const config = { childList: true, subtree: true };
  46418. const updateOrderFns = table.store.states.updateOrderFns;
  46419. observer.value = new MutationObserver(() => {
  46420. updateOrderFns.forEach((fn) => fn());
  46421. });
  46422. observer.value.observe(columnsWrapper, config);
  46423. };
  46424. vue.onMounted(() => {
  46425. initWatchDom();
  46426. });
  46427. vue.onUnmounted(() => {
  46428. var _a;
  46429. (_a = observer.value) == null ? void 0 : _a.disconnect();
  46430. });
  46431. }
  46432. var defaultProps$2 = {
  46433. data: {
  46434. type: Array,
  46435. default: () => []
  46436. },
  46437. size: useSizeProp,
  46438. width: [String, Number],
  46439. height: [String, Number],
  46440. maxHeight: [String, Number],
  46441. fit: {
  46442. type: Boolean,
  46443. default: true
  46444. },
  46445. stripe: Boolean,
  46446. border: Boolean,
  46447. rowKey: [String, Function],
  46448. showHeader: {
  46449. type: Boolean,
  46450. default: true
  46451. },
  46452. showSummary: Boolean,
  46453. sumText: String,
  46454. summaryMethod: Function,
  46455. rowClassName: [String, Function],
  46456. rowStyle: [Object, Function],
  46457. cellClassName: [String, Function],
  46458. cellStyle: [Object, Function],
  46459. headerRowClassName: [String, Function],
  46460. headerRowStyle: [Object, Function],
  46461. headerCellClassName: [String, Function],
  46462. headerCellStyle: [Object, Function],
  46463. highlightCurrentRow: Boolean,
  46464. currentRowKey: [String, Number],
  46465. emptyText: String,
  46466. expandRowKeys: Array,
  46467. defaultExpandAll: Boolean,
  46468. defaultSort: Object,
  46469. tooltipEffect: String,
  46470. tooltipOptions: Object,
  46471. spanMethod: Function,
  46472. selectOnIndeterminate: {
  46473. type: Boolean,
  46474. default: true
  46475. },
  46476. indent: {
  46477. type: Number,
  46478. default: 16
  46479. },
  46480. treeProps: {
  46481. type: Object,
  46482. default: () => {
  46483. return {
  46484. hasChildren: "hasChildren",
  46485. children: "children",
  46486. checkStrictly: false
  46487. };
  46488. }
  46489. },
  46490. lazy: Boolean,
  46491. load: Function,
  46492. style: {
  46493. type: Object,
  46494. default: () => ({})
  46495. },
  46496. className: {
  46497. type: String,
  46498. default: ""
  46499. },
  46500. tableLayout: {
  46501. type: String,
  46502. default: "fixed"
  46503. },
  46504. scrollbarAlwaysOn: Boolean,
  46505. flexible: Boolean,
  46506. showOverflowTooltip: [Boolean, Object],
  46507. tooltipFormatter: Function,
  46508. appendFilterPanelTo: String,
  46509. scrollbarTabindex: {
  46510. type: [Number, String],
  46511. default: void 0
  46512. },
  46513. allowDragLastColumn: {
  46514. type: Boolean,
  46515. default: true
  46516. },
  46517. preserveExpandedContent: {
  46518. type: Boolean,
  46519. default: false
  46520. }
  46521. };
  46522. function hColgroup(props) {
  46523. const isAuto = props.tableLayout === "auto";
  46524. let columns = props.columns || [];
  46525. if (isAuto) {
  46526. if (columns.every(({ width }) => isUndefined(width))) {
  46527. columns = [];
  46528. }
  46529. }
  46530. const getPropsData = (column) => {
  46531. const propsData = {
  46532. key: `${props.tableLayout}_${column.id}`,
  46533. style: {},
  46534. name: void 0
  46535. };
  46536. if (isAuto) {
  46537. propsData.style = {
  46538. width: `${column.width}px`
  46539. };
  46540. } else {
  46541. propsData.name = column.id;
  46542. }
  46543. return propsData;
  46544. };
  46545. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  46546. }
  46547. hColgroup.props = ["columns", "tableLayout"];
  46548. const useScrollbar$1 = () => {
  46549. const scrollBarRef = vue.ref();
  46550. const scrollTo = (options, yCoord) => {
  46551. const scrollbar = scrollBarRef.value;
  46552. if (scrollbar) {
  46553. scrollbar.scrollTo(options, yCoord);
  46554. }
  46555. };
  46556. const setScrollPosition = (position, offset) => {
  46557. const scrollbar = scrollBarRef.value;
  46558. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  46559. scrollbar[`setScroll${position}`](offset);
  46560. }
  46561. };
  46562. const setScrollTop = (top) => setScrollPosition("Top", top);
  46563. const setScrollLeft = (left) => setScrollPosition("Left", left);
  46564. return {
  46565. scrollBarRef,
  46566. scrollTo,
  46567. setScrollTop,
  46568. setScrollLeft
  46569. };
  46570. };
  46571. let tableIdSeed = 1;
  46572. const _sfc_main$A = vue.defineComponent({
  46573. name: "ElTable",
  46574. directives: {
  46575. Mousewheel
  46576. },
  46577. components: {
  46578. TableHeader,
  46579. TableBody,
  46580. TableFooter,
  46581. ElScrollbar,
  46582. hColgroup
  46583. },
  46584. props: defaultProps$2,
  46585. emits: [
  46586. "select",
  46587. "select-all",
  46588. "selection-change",
  46589. "cell-mouse-enter",
  46590. "cell-mouse-leave",
  46591. "cell-contextmenu",
  46592. "cell-click",
  46593. "cell-dblclick",
  46594. "row-click",
  46595. "row-contextmenu",
  46596. "row-dblclick",
  46597. "header-click",
  46598. "header-contextmenu",
  46599. "sort-change",
  46600. "filter-change",
  46601. "current-change",
  46602. "header-dragend",
  46603. "expand-change",
  46604. "scroll"
  46605. ],
  46606. setup(props) {
  46607. const { t } = useLocale();
  46608. const ns = useNamespace("table");
  46609. const table = vue.getCurrentInstance();
  46610. vue.provide(TABLE_INJECTION_KEY, table);
  46611. const store = createStore(table, props);
  46612. table.store = store;
  46613. const layout = new TableLayout$1({
  46614. store: table.store,
  46615. table,
  46616. fit: props.fit,
  46617. showHeader: props.showHeader
  46618. });
  46619. table.layout = layout;
  46620. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  46621. const {
  46622. setCurrentRow,
  46623. getSelectionRows,
  46624. toggleRowSelection,
  46625. clearSelection,
  46626. clearFilter,
  46627. toggleAllSelection,
  46628. toggleRowExpansion,
  46629. clearSort,
  46630. sort,
  46631. updateKeyChildren
  46632. } = useUtils(store);
  46633. const {
  46634. isHidden,
  46635. renderExpanded,
  46636. setDragVisible,
  46637. isGroup,
  46638. handleMouseLeave,
  46639. handleHeaderFooterMousewheel,
  46640. tableSize,
  46641. emptyBlockStyle,
  46642. handleFixedMousewheel,
  46643. resizeProxyVisible,
  46644. bodyWidth,
  46645. resizeState,
  46646. doLayout,
  46647. tableBodyStyles,
  46648. tableLayout,
  46649. scrollbarViewStyle,
  46650. scrollbarStyle
  46651. } = useStyle(props, layout, store, table);
  46652. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  46653. const debouncedUpdateLayout = debounce(doLayout, 50);
  46654. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  46655. table.tableId = tableId;
  46656. table.state = {
  46657. isGroup,
  46658. resizeState,
  46659. doLayout,
  46660. debouncedUpdateLayout
  46661. };
  46662. const computedSumText = vue.computed(() => {
  46663. var _a;
  46664. return (_a = props.sumText) != null ? _a : t("el.table.sumText");
  46665. });
  46666. const computedEmptyText = vue.computed(() => {
  46667. var _a;
  46668. return (_a = props.emptyText) != null ? _a : t("el.table.emptyText");
  46669. });
  46670. const columns = vue.computed(() => {
  46671. return convertToRows(store.states.originColumns.value)[0];
  46672. });
  46673. useKeyRender(table);
  46674. vue.onBeforeUnmount(() => {
  46675. debouncedUpdateLayout.cancel();
  46676. });
  46677. return {
  46678. ns,
  46679. layout,
  46680. store,
  46681. columns,
  46682. handleHeaderFooterMousewheel,
  46683. handleMouseLeave,
  46684. tableId,
  46685. tableSize,
  46686. isHidden,
  46687. isEmpty,
  46688. renderExpanded,
  46689. resizeProxyVisible,
  46690. resizeState,
  46691. isGroup,
  46692. bodyWidth,
  46693. tableBodyStyles,
  46694. emptyBlockStyle,
  46695. debouncedUpdateLayout,
  46696. handleFixedMousewheel,
  46697. setCurrentRow,
  46698. getSelectionRows,
  46699. toggleRowSelection,
  46700. clearSelection,
  46701. clearFilter,
  46702. toggleAllSelection,
  46703. toggleRowExpansion,
  46704. clearSort,
  46705. doLayout,
  46706. sort,
  46707. updateKeyChildren,
  46708. t,
  46709. setDragVisible,
  46710. context: table,
  46711. computedSumText,
  46712. computedEmptyText,
  46713. tableLayout,
  46714. scrollbarViewStyle,
  46715. scrollbarStyle,
  46716. scrollBarRef,
  46717. scrollTo,
  46718. setScrollLeft,
  46719. setScrollTop,
  46720. allowDragLastColumn: props.allowDragLastColumn
  46721. };
  46722. }
  46723. });
  46724. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  46725. const _component_hColgroup = vue.resolveComponent("hColgroup");
  46726. const _component_table_header = vue.resolveComponent("table-header");
  46727. const _component_table_body = vue.resolveComponent("table-body");
  46728. const _component_table_footer = vue.resolveComponent("table-footer");
  46729. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  46730. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  46731. return vue.openBlock(), vue.createElementBlock("div", {
  46732. ref: "tableWrapper",
  46733. class: vue.normalizeClass([
  46734. {
  46735. [_ctx.ns.m("fit")]: _ctx.fit,
  46736. [_ctx.ns.m("striped")]: _ctx.stripe,
  46737. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  46738. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  46739. [_ctx.ns.m("group")]: _ctx.isGroup,
  46740. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  46741. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  46742. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  46743. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  46744. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  46745. "has-footer": _ctx.showSummary
  46746. },
  46747. _ctx.ns.m(_ctx.tableSize),
  46748. _ctx.className,
  46749. _ctx.ns.b(),
  46750. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  46751. ]),
  46752. style: vue.normalizeStyle(_ctx.style),
  46753. "data-prefix": _ctx.ns.namespace.value,
  46754. onMouseleave: _ctx.handleMouseLeave
  46755. }, [
  46756. vue.createElementVNode("div", {
  46757. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper"))
  46758. }, [
  46759. vue.createElementVNode("div", {
  46760. ref: "hiddenColumns",
  46761. class: "hidden-columns"
  46762. }, [
  46763. vue.renderSlot(_ctx.$slots, "default")
  46764. ], 512),
  46765. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  46766. key: 0,
  46767. ref: "headerWrapper",
  46768. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  46769. }, [
  46770. vue.createElementVNode("table", {
  46771. ref: "tableHeader",
  46772. class: vue.normalizeClass(_ctx.ns.e("header")),
  46773. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  46774. border: "0",
  46775. cellpadding: "0",
  46776. cellspacing: "0"
  46777. }, [
  46778. vue.createVNode(_component_hColgroup, {
  46779. columns: _ctx.store.states.columns.value,
  46780. "table-layout": _ctx.tableLayout
  46781. }, null, 8, ["columns", "table-layout"]),
  46782. vue.createVNode(_component_table_header, {
  46783. ref: "tableHeaderRef",
  46784. border: _ctx.border,
  46785. "default-sort": _ctx.defaultSort,
  46786. store: _ctx.store,
  46787. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46788. "allow-drag-last-column": _ctx.allowDragLastColumn,
  46789. onSetDragVisible: _ctx.setDragVisible
  46790. }, null, 8, ["border", "default-sort", "store", "append-filter-panel-to", "allow-drag-last-column", "onSetDragVisible"])
  46791. ], 6)
  46792. ], 2)), [
  46793. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46794. ]) : vue.createCommentVNode("v-if", true),
  46795. vue.createElementVNode("div", {
  46796. ref: "bodyWrapper",
  46797. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  46798. }, [
  46799. vue.createVNode(_component_el_scrollbar, {
  46800. ref: "scrollBarRef",
  46801. "view-style": _ctx.scrollbarViewStyle,
  46802. "wrap-style": _ctx.scrollbarStyle,
  46803. always: _ctx.scrollbarAlwaysOn,
  46804. tabindex: _ctx.scrollbarTabindex,
  46805. onScroll: ($event) => _ctx.$emit("scroll", $event)
  46806. }, {
  46807. default: vue.withCtx(() => [
  46808. vue.createElementVNode("table", {
  46809. ref: "tableBody",
  46810. class: vue.normalizeClass(_ctx.ns.e("body")),
  46811. cellspacing: "0",
  46812. cellpadding: "0",
  46813. border: "0",
  46814. style: vue.normalizeStyle({
  46815. width: _ctx.bodyWidth,
  46816. tableLayout: _ctx.tableLayout
  46817. })
  46818. }, [
  46819. vue.createVNode(_component_hColgroup, {
  46820. columns: _ctx.store.states.columns.value,
  46821. "table-layout": _ctx.tableLayout
  46822. }, null, 8, ["columns", "table-layout"]),
  46823. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  46824. key: 0,
  46825. ref: "tableHeaderRef",
  46826. class: vue.normalizeClass(_ctx.ns.e("body-header")),
  46827. border: _ctx.border,
  46828. "default-sort": _ctx.defaultSort,
  46829. store: _ctx.store,
  46830. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46831. onSetDragVisible: _ctx.setDragVisible
  46832. }, null, 8, ["class", "border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  46833. vue.createVNode(_component_table_body, {
  46834. context: _ctx.context,
  46835. highlight: _ctx.highlightCurrentRow,
  46836. "row-class-name": _ctx.rowClassName,
  46837. "tooltip-effect": _ctx.tooltipEffect,
  46838. "tooltip-options": _ctx.tooltipOptions,
  46839. "row-style": _ctx.rowStyle,
  46840. store: _ctx.store,
  46841. stripe: _ctx.stripe
  46842. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  46843. _ctx.showSummary && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_footer, {
  46844. key: 1,
  46845. class: vue.normalizeClass(_ctx.ns.e("body-footer")),
  46846. border: _ctx.border,
  46847. "default-sort": _ctx.defaultSort,
  46848. store: _ctx.store,
  46849. "sum-text": _ctx.computedSumText,
  46850. "summary-method": _ctx.summaryMethod
  46851. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : vue.createCommentVNode("v-if", true)
  46852. ], 6),
  46853. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  46854. key: 0,
  46855. ref: "emptyBlock",
  46856. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  46857. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  46858. }, [
  46859. vue.createElementVNode("span", {
  46860. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  46861. }, [
  46862. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  46863. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  46864. ])
  46865. ], 2)
  46866. ], 6)) : vue.createCommentVNode("v-if", true),
  46867. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  46868. key: 1,
  46869. ref: "appendWrapper",
  46870. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  46871. }, [
  46872. vue.renderSlot(_ctx.$slots, "append")
  46873. ], 2)) : vue.createCommentVNode("v-if", true)
  46874. ]),
  46875. _: 3
  46876. }, 8, ["view-style", "wrap-style", "always", "tabindex", "onScroll"])
  46877. ], 2),
  46878. _ctx.showSummary && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  46879. key: 1,
  46880. ref: "footerWrapper",
  46881. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  46882. }, [
  46883. vue.createElementVNode("table", {
  46884. class: vue.normalizeClass(_ctx.ns.e("footer")),
  46885. cellspacing: "0",
  46886. cellpadding: "0",
  46887. border: "0",
  46888. style: vue.normalizeStyle(_ctx.tableBodyStyles)
  46889. }, [
  46890. vue.createVNode(_component_hColgroup, {
  46891. columns: _ctx.store.states.columns.value,
  46892. "table-layout": _ctx.tableLayout
  46893. }, null, 8, ["columns", "table-layout"]),
  46894. vue.createVNode(_component_table_footer, {
  46895. border: _ctx.border,
  46896. "default-sort": _ctx.defaultSort,
  46897. store: _ctx.store,
  46898. "sum-text": _ctx.computedSumText,
  46899. "summary-method": _ctx.summaryMethod
  46900. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  46901. ], 6)
  46902. ], 2)), [
  46903. [vue.vShow, !_ctx.isEmpty],
  46904. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46905. ]) : vue.createCommentVNode("v-if", true),
  46906. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  46907. key: 2,
  46908. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  46909. }, null, 2)) : vue.createCommentVNode("v-if", true)
  46910. ], 2),
  46911. vue.withDirectives(vue.createElementVNode("div", {
  46912. ref: "resizeProxy",
  46913. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  46914. }, null, 2), [
  46915. [vue.vShow, _ctx.resizeProxyVisible]
  46916. ])
  46917. ], 46, ["data-prefix", "onMouseleave"]);
  46918. }
  46919. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  46920. const defaultClassNames = {
  46921. selection: "table-column--selection",
  46922. expand: "table__expand-column"
  46923. };
  46924. const cellStarts = {
  46925. default: {
  46926. order: ""
  46927. },
  46928. selection: {
  46929. width: 48,
  46930. minWidth: 48,
  46931. realWidth: 48,
  46932. order: ""
  46933. },
  46934. expand: {
  46935. width: 48,
  46936. minWidth: 48,
  46937. realWidth: 48,
  46938. order: ""
  46939. },
  46940. index: {
  46941. width: 48,
  46942. minWidth: 48,
  46943. realWidth: 48,
  46944. order: ""
  46945. }
  46946. };
  46947. const getDefaultClassName = (type) => {
  46948. return defaultClassNames[type] || "";
  46949. };
  46950. const cellForced = {
  46951. selection: {
  46952. renderHeader({ store, column }) {
  46953. function isDisabled() {
  46954. return store.states.data.value && store.states.data.value.length === 0;
  46955. }
  46956. return vue.h(ElCheckbox, {
  46957. disabled: isDisabled(),
  46958. size: store.states.tableSize.value,
  46959. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  46960. "onUpdate:modelValue": store.toggleAllSelection,
  46961. modelValue: store.states.isAllSelected.value,
  46962. ariaLabel: column.label
  46963. });
  46964. },
  46965. renderCell({
  46966. row,
  46967. column,
  46968. store,
  46969. $index
  46970. }) {
  46971. return vue.h(ElCheckbox, {
  46972. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  46973. size: store.states.tableSize.value,
  46974. onChange: () => {
  46975. store.commit("rowSelectedChanged", row);
  46976. },
  46977. onClick: (event) => event.stopPropagation(),
  46978. modelValue: store.isSelected(row),
  46979. ariaLabel: column.label
  46980. });
  46981. },
  46982. sortable: false,
  46983. resizable: false
  46984. },
  46985. index: {
  46986. renderHeader({ column }) {
  46987. return column.label || "#";
  46988. },
  46989. renderCell({
  46990. column,
  46991. $index
  46992. }) {
  46993. let i = $index + 1;
  46994. const index = column.index;
  46995. if (isNumber(index)) {
  46996. i = $index + index;
  46997. } else if (isFunction$1(index)) {
  46998. i = index($index);
  46999. }
  47000. return vue.h("div", {}, [i]);
  47001. },
  47002. sortable: false
  47003. },
  47004. expand: {
  47005. renderHeader({ column }) {
  47006. return column.label || "";
  47007. },
  47008. renderCell({
  47009. row,
  47010. store,
  47011. expanded
  47012. }) {
  47013. const { ns } = store;
  47014. const classes = [ns.e("expand-icon")];
  47015. if (expanded) {
  47016. classes.push(ns.em("expand-icon", "expanded"));
  47017. }
  47018. const callback = function(e) {
  47019. e.stopPropagation();
  47020. store.toggleRowExpansion(row);
  47021. };
  47022. return vue.h("div", {
  47023. class: classes,
  47024. onClick: callback
  47025. }, {
  47026. default: () => {
  47027. return [
  47028. vue.h(ElIcon, null, {
  47029. default: () => {
  47030. return [vue.h(arrow_right_default)];
  47031. }
  47032. })
  47033. ];
  47034. }
  47035. });
  47036. },
  47037. sortable: false,
  47038. resizable: false
  47039. }
  47040. };
  47041. function defaultRenderCell({
  47042. row,
  47043. column,
  47044. $index
  47045. }) {
  47046. var _a;
  47047. const property = column.property;
  47048. const value = property && getProp(row, property).value;
  47049. if (column && column.formatter) {
  47050. return column.formatter(row, column, value, $index);
  47051. }
  47052. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  47053. }
  47054. function treeCellPrefix({
  47055. row,
  47056. treeNode,
  47057. store
  47058. }, createPlaceholder = false) {
  47059. const { ns } = store;
  47060. if (!treeNode) {
  47061. if (createPlaceholder) {
  47062. return [
  47063. vue.h("span", {
  47064. class: ns.e("placeholder")
  47065. })
  47066. ];
  47067. }
  47068. return null;
  47069. }
  47070. const ele = [];
  47071. const callback = function(e) {
  47072. e.stopPropagation();
  47073. if (treeNode.loading) {
  47074. return;
  47075. }
  47076. store.loadOrToggle(row);
  47077. };
  47078. if (treeNode.indent) {
  47079. ele.push(vue.h("span", {
  47080. class: ns.e("indent"),
  47081. style: { "padding-left": `${treeNode.indent}px` }
  47082. }));
  47083. }
  47084. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  47085. const expandClasses = [
  47086. ns.e("expand-icon"),
  47087. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  47088. ];
  47089. let icon = arrow_right_default;
  47090. if (treeNode.loading) {
  47091. icon = loading_default;
  47092. }
  47093. ele.push(vue.h("div", {
  47094. class: expandClasses,
  47095. onClick: callback
  47096. }, {
  47097. default: () => {
  47098. return [
  47099. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  47100. default: () => [vue.h(icon)]
  47101. })
  47102. ];
  47103. }
  47104. }));
  47105. } else {
  47106. ele.push(vue.h("span", {
  47107. class: ns.e("placeholder")
  47108. }));
  47109. }
  47110. return ele;
  47111. }
  47112. function getAllAliases(props, aliases) {
  47113. return props.reduce((prev, cur) => {
  47114. prev[cur] = cur;
  47115. return prev;
  47116. }, aliases);
  47117. }
  47118. function useWatcher(owner, props_) {
  47119. const instance = vue.getCurrentInstance();
  47120. const registerComplexWatchers = () => {
  47121. const props = ["fixed"];
  47122. const aliases = {
  47123. realWidth: "width",
  47124. realMinWidth: "minWidth"
  47125. };
  47126. const allAliases = getAllAliases(props, aliases);
  47127. Object.keys(allAliases).forEach((key) => {
  47128. const columnKey = aliases[key];
  47129. if (hasOwn(props_, columnKey)) {
  47130. vue.watch(() => props_[columnKey], (newVal) => {
  47131. let value = newVal;
  47132. if (columnKey === "width" && key === "realWidth") {
  47133. value = parseWidth(newVal);
  47134. }
  47135. if (columnKey === "minWidth" && key === "realMinWidth") {
  47136. value = parseMinWidth(newVal);
  47137. }
  47138. instance.columnConfig.value[columnKey] = value;
  47139. instance.columnConfig.value[key] = value;
  47140. const updateColumns = columnKey === "fixed";
  47141. owner.value.store.scheduleLayout(updateColumns);
  47142. });
  47143. }
  47144. });
  47145. };
  47146. const registerNormalWatchers = () => {
  47147. const props = [
  47148. "label",
  47149. "filters",
  47150. "filterMultiple",
  47151. "filteredValue",
  47152. "sortable",
  47153. "index",
  47154. "formatter",
  47155. "className",
  47156. "labelClassName",
  47157. "filterClassName",
  47158. "showOverflowTooltip",
  47159. "tooltipFormatter"
  47160. ];
  47161. const aliases = {
  47162. property: "prop",
  47163. align: "realAlign",
  47164. headerAlign: "realHeaderAlign"
  47165. };
  47166. const allAliases = getAllAliases(props, aliases);
  47167. Object.keys(allAliases).forEach((key) => {
  47168. const columnKey = aliases[key];
  47169. if (hasOwn(props_, columnKey)) {
  47170. vue.watch(() => props_[columnKey], (newVal) => {
  47171. instance.columnConfig.value[key] = newVal;
  47172. });
  47173. }
  47174. });
  47175. };
  47176. return {
  47177. registerComplexWatchers,
  47178. registerNormalWatchers
  47179. };
  47180. }
  47181. function useRender(props, slots, owner) {
  47182. const instance = vue.getCurrentInstance();
  47183. const columnId = vue.ref("");
  47184. const isSubColumn = vue.ref(false);
  47185. const realAlign = vue.ref();
  47186. const realHeaderAlign = vue.ref();
  47187. const ns = useNamespace("table");
  47188. vue.watchEffect(() => {
  47189. realAlign.value = props.align ? `is-${props.align}` : null;
  47190. realAlign.value;
  47191. });
  47192. vue.watchEffect(() => {
  47193. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  47194. realHeaderAlign.value;
  47195. });
  47196. const columnOrTableParent = vue.computed(() => {
  47197. let parent = instance.vnode.vParent || instance.parent;
  47198. while (parent && !parent.tableId && !parent.columnId) {
  47199. parent = parent.vnode.vParent || parent.parent;
  47200. }
  47201. return parent;
  47202. });
  47203. const hasTreeColumn = vue.computed(() => {
  47204. const { store } = instance.parent;
  47205. if (!store)
  47206. return false;
  47207. const { treeData } = store.states;
  47208. const treeDataValue = treeData.value;
  47209. return treeDataValue && Object.keys(treeDataValue).length > 0;
  47210. });
  47211. const realWidth = vue.ref(parseWidth(props.width));
  47212. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  47213. const setColumnWidth = (column) => {
  47214. if (realWidth.value)
  47215. column.width = realWidth.value;
  47216. if (realMinWidth.value) {
  47217. column.minWidth = realMinWidth.value;
  47218. }
  47219. if (!realWidth.value && realMinWidth.value) {
  47220. column.width = void 0;
  47221. }
  47222. if (!column.minWidth) {
  47223. column.minWidth = 80;
  47224. }
  47225. column.realWidth = Number(isUndefined(column.width) ? column.minWidth : column.width);
  47226. return column;
  47227. };
  47228. const setColumnForcedProps = (column) => {
  47229. const type = column.type;
  47230. const source = cellForced[type] || {};
  47231. Object.keys(source).forEach((prop) => {
  47232. const value = source[prop];
  47233. if (prop !== "className" && !isUndefined(value)) {
  47234. column[prop] = value;
  47235. }
  47236. });
  47237. const className = getDefaultClassName(type);
  47238. if (className) {
  47239. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  47240. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  47241. }
  47242. return column;
  47243. };
  47244. const checkSubColumn = (children) => {
  47245. if (isArray$1(children)) {
  47246. children.forEach((child) => check(child));
  47247. } else {
  47248. check(children);
  47249. }
  47250. function check(item) {
  47251. var _a;
  47252. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  47253. item.vParent = instance;
  47254. }
  47255. }
  47256. };
  47257. const setColumnRenders = (column) => {
  47258. if (props.renderHeader) ; else if (column.type !== "selection") {
  47259. column.renderHeader = (scope) => {
  47260. instance.columnConfig.value["label"];
  47261. return vue.renderSlot(slots, "header", scope, () => [column.label]);
  47262. };
  47263. }
  47264. if (slots["filter-icon"]) {
  47265. column.renderFilterIcon = (scope) => {
  47266. return vue.renderSlot(slots, "filter-icon", scope);
  47267. };
  47268. }
  47269. let originRenderCell = column.renderCell;
  47270. if (column.type === "expand") {
  47271. column.renderCell = (data) => vue.h("div", {
  47272. class: "cell"
  47273. }, [originRenderCell(data)]);
  47274. owner.value.renderExpanded = (data) => {
  47275. return slots.default ? slots.default(data) : slots.default;
  47276. };
  47277. } else {
  47278. originRenderCell = originRenderCell || defaultRenderCell;
  47279. column.renderCell = (data) => {
  47280. let children = null;
  47281. if (slots.default) {
  47282. const vnodes = slots.default(data);
  47283. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  47284. } else {
  47285. children = originRenderCell(data);
  47286. }
  47287. const { columns } = owner.value.store.states;
  47288. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  47289. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  47290. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  47291. const props2 = {
  47292. class: "cell",
  47293. style: {}
  47294. };
  47295. if (column.showOverflowTooltip) {
  47296. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  47297. props2.style = {
  47298. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  47299. };
  47300. }
  47301. checkSubColumn(children);
  47302. return vue.h("div", props2, [prefix, children]);
  47303. };
  47304. }
  47305. return column;
  47306. };
  47307. const getPropsData = (...propsKey) => {
  47308. return propsKey.reduce((prev, cur) => {
  47309. if (isArray$1(cur)) {
  47310. cur.forEach((key) => {
  47311. prev[key] = props[key];
  47312. });
  47313. }
  47314. return prev;
  47315. }, {});
  47316. };
  47317. const getColumnElIndex = (children, child) => {
  47318. return Array.prototype.indexOf.call(children, child);
  47319. };
  47320. const updateColumnOrder = () => {
  47321. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  47322. };
  47323. return {
  47324. columnId,
  47325. realAlign,
  47326. isSubColumn,
  47327. realHeaderAlign,
  47328. columnOrTableParent,
  47329. setColumnWidth,
  47330. setColumnForcedProps,
  47331. setColumnRenders,
  47332. getPropsData,
  47333. getColumnElIndex,
  47334. updateColumnOrder
  47335. };
  47336. }
  47337. var defaultProps$1 = {
  47338. type: {
  47339. type: String,
  47340. default: "default"
  47341. },
  47342. label: String,
  47343. className: String,
  47344. labelClassName: String,
  47345. property: String,
  47346. prop: String,
  47347. width: {
  47348. type: [String, Number],
  47349. default: ""
  47350. },
  47351. minWidth: {
  47352. type: [String, Number],
  47353. default: ""
  47354. },
  47355. renderHeader: Function,
  47356. sortable: {
  47357. type: [Boolean, String],
  47358. default: false
  47359. },
  47360. sortMethod: Function,
  47361. sortBy: [String, Function, Array],
  47362. resizable: {
  47363. type: Boolean,
  47364. default: true
  47365. },
  47366. columnKey: String,
  47367. align: String,
  47368. headerAlign: String,
  47369. showOverflowTooltip: {
  47370. type: [Boolean, Object],
  47371. default: void 0
  47372. },
  47373. tooltipFormatter: Function,
  47374. fixed: [Boolean, String],
  47375. formatter: Function,
  47376. selectable: Function,
  47377. reserveSelection: Boolean,
  47378. filterMethod: Function,
  47379. filteredValue: Array,
  47380. filters: Array,
  47381. filterPlacement: String,
  47382. filterMultiple: {
  47383. type: Boolean,
  47384. default: true
  47385. },
  47386. filterClassName: String,
  47387. index: [Number, Function],
  47388. sortOrders: {
  47389. type: Array,
  47390. default: () => {
  47391. return ["ascending", "descending", null];
  47392. },
  47393. validator: (val) => {
  47394. return val.every((order) => ["ascending", "descending", null].includes(order));
  47395. }
  47396. }
  47397. };
  47398. let columnIdSeed = 1;
  47399. var ElTableColumn$1 = vue.defineComponent({
  47400. name: "ElTableColumn",
  47401. components: {
  47402. ElCheckbox
  47403. },
  47404. props: defaultProps$1,
  47405. setup(props, { slots }) {
  47406. const instance = vue.getCurrentInstance();
  47407. const columnConfig = vue.ref({});
  47408. const owner = vue.computed(() => {
  47409. let parent2 = instance.parent;
  47410. while (parent2 && !parent2.tableId) {
  47411. parent2 = parent2.parent;
  47412. }
  47413. return parent2;
  47414. });
  47415. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  47416. const {
  47417. columnId,
  47418. isSubColumn,
  47419. realHeaderAlign,
  47420. columnOrTableParent,
  47421. setColumnWidth,
  47422. setColumnForcedProps,
  47423. setColumnRenders,
  47424. getPropsData,
  47425. getColumnElIndex,
  47426. realAlign,
  47427. updateColumnOrder
  47428. } = useRender(props, slots, owner);
  47429. const parent = columnOrTableParent.value;
  47430. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  47431. vue.onBeforeMount(() => {
  47432. isSubColumn.value = owner.value !== parent;
  47433. const type = props.type || "default";
  47434. const sortable = props.sortable === "" ? true : props.sortable;
  47435. const showOverflowTooltip = type === "selection" ? false : isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  47436. const tooltipFormatter = isUndefined(props.tooltipFormatter) ? parent.props.tooltipFormatter : props.tooltipFormatter;
  47437. const defaults = {
  47438. ...cellStarts[type],
  47439. id: columnId.value,
  47440. type,
  47441. property: props.prop || props.property,
  47442. align: realAlign,
  47443. headerAlign: realHeaderAlign,
  47444. showOverflowTooltip,
  47445. tooltipFormatter,
  47446. filterable: props.filters || props.filterMethod,
  47447. filteredValue: [],
  47448. filterPlacement: "",
  47449. filterClassName: "",
  47450. isColumnGroup: false,
  47451. isSubColumn: false,
  47452. filterOpened: false,
  47453. sortable,
  47454. index: props.index,
  47455. rawColumnKey: instance.vnode.key
  47456. };
  47457. const basicProps = [
  47458. "columnKey",
  47459. "label",
  47460. "className",
  47461. "labelClassName",
  47462. "type",
  47463. "renderHeader",
  47464. "formatter",
  47465. "fixed",
  47466. "resizable"
  47467. ];
  47468. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  47469. const selectProps = ["selectable", "reserveSelection"];
  47470. const filterProps = [
  47471. "filterMethod",
  47472. "filters",
  47473. "filterMultiple",
  47474. "filterOpened",
  47475. "filteredValue",
  47476. "filterPlacement",
  47477. "filterClassName"
  47478. ];
  47479. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  47480. column = mergeOptions(defaults, column);
  47481. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  47482. column = chains(column);
  47483. columnConfig.value = column;
  47484. registerNormalWatchers();
  47485. registerComplexWatchers();
  47486. });
  47487. vue.onMounted(() => {
  47488. var _a;
  47489. const parent2 = columnOrTableParent.value;
  47490. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  47491. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  47492. columnConfig.value.getColumnIndex = getColumnIndex;
  47493. const columnIndex = getColumnIndex();
  47494. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  47495. });
  47496. vue.onBeforeUnmount(() => {
  47497. const getColumnIndex = columnConfig.value.getColumnIndex;
  47498. const columnIndex = getColumnIndex ? getColumnIndex() : -1;
  47499. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  47500. });
  47501. instance.columnId = columnId.value;
  47502. instance.columnConfig = columnConfig;
  47503. return;
  47504. },
  47505. render() {
  47506. var _a, _b, _c;
  47507. try {
  47508. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  47509. row: {},
  47510. column: {},
  47511. $index: -1
  47512. });
  47513. const children = [];
  47514. if (isArray$1(renderDefault)) {
  47515. for (const childNode of renderDefault) {
  47516. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  47517. children.push(childNode);
  47518. } else if (childNode.type === vue.Fragment && isArray$1(childNode.children)) {
  47519. childNode.children.forEach((vnode2) => {
  47520. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  47521. children.push(vnode2);
  47522. }
  47523. });
  47524. }
  47525. }
  47526. }
  47527. const vnode = vue.h("div", children);
  47528. return vnode;
  47529. } catch (e) {
  47530. return vue.h("div", []);
  47531. }
  47532. }
  47533. });
  47534. const ElTable = withInstall(Table, {
  47535. TableColumn: ElTableColumn$1
  47536. });
  47537. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  47538. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  47539. SortOrder2["ASC"] = "asc";
  47540. SortOrder2["DESC"] = "desc";
  47541. return SortOrder2;
  47542. })(SortOrder || {});
  47543. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  47544. Alignment2["CENTER"] = "center";
  47545. Alignment2["RIGHT"] = "right";
  47546. return Alignment2;
  47547. })(Alignment || {});
  47548. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  47549. FixedDir2["LEFT"] = "left";
  47550. FixedDir2["RIGHT"] = "right";
  47551. return FixedDir2;
  47552. })(FixedDir || {});
  47553. const oppositeOrderMap = {
  47554. ["asc" /* ASC */]: "desc" /* DESC */,
  47555. ["desc" /* DESC */]: "asc" /* ASC */
  47556. };
  47557. const placeholderSign = Symbol("placeholder");
  47558. const calcColumnStyle = (column, fixedColumn, fixed) => {
  47559. var _a;
  47560. const flex = {
  47561. flexGrow: 0,
  47562. flexShrink: 0,
  47563. ...fixed ? {} : {
  47564. flexGrow: column.flexGrow || 0,
  47565. flexShrink: column.flexShrink || 1
  47566. }
  47567. };
  47568. if (!fixed) {
  47569. flex.flexShrink = 1;
  47570. }
  47571. const style = {
  47572. ...(_a = column.style) != null ? _a : {},
  47573. ...flex,
  47574. flexBasis: "auto",
  47575. width: column.width
  47576. };
  47577. if (!fixedColumn) {
  47578. if (column.maxWidth)
  47579. style.maxWidth = column.maxWidth;
  47580. if (column.minWidth)
  47581. style.minWidth = column.minWidth;
  47582. }
  47583. return style;
  47584. };
  47585. function useColumns(props, columns, fixed) {
  47586. const _columns = vue.computed(() => vue.unref(columns).map((column, index) => {
  47587. var _a, _b;
  47588. return {
  47589. ...column,
  47590. key: (_b = (_a = column.key) != null ? _a : column.dataKey) != null ? _b : index
  47591. };
  47592. }));
  47593. const visibleColumns = vue.computed(() => {
  47594. return vue.unref(_columns).filter((column) => !column.hidden);
  47595. });
  47596. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  47597. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  47598. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  47599. const mainColumns = vue.computed(() => {
  47600. const ret = [];
  47601. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  47602. ret.push({
  47603. ...column,
  47604. placeholderSign
  47605. });
  47606. });
  47607. vue.unref(normalColumns).forEach((column) => {
  47608. ret.push(column);
  47609. });
  47610. vue.unref(fixedColumnsOnRight).forEach((column) => {
  47611. ret.push({
  47612. ...column,
  47613. placeholderSign
  47614. });
  47615. });
  47616. return ret;
  47617. });
  47618. const hasFixedColumns = vue.computed(() => {
  47619. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  47620. });
  47621. const columnsStyles = vue.computed(() => {
  47622. return vue.unref(_columns).reduce((style, column) => {
  47623. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  47624. return style;
  47625. }, {});
  47626. });
  47627. const columnsTotalWidth = vue.computed(() => {
  47628. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  47629. });
  47630. const getColumn = (key) => {
  47631. return vue.unref(_columns).find((column) => column.key === key);
  47632. };
  47633. const getColumnStyle = (key) => {
  47634. return vue.unref(columnsStyles)[key];
  47635. };
  47636. const updateColumnWidth = (column, width) => {
  47637. column.width = width;
  47638. };
  47639. function onColumnSorted(e) {
  47640. var _a;
  47641. const { key } = e.currentTarget.dataset;
  47642. if (!key)
  47643. return;
  47644. const { sortState, sortBy } = props;
  47645. let order = SortOrder.ASC;
  47646. if (isObject$1(sortState)) {
  47647. order = oppositeOrderMap[sortState[key]];
  47648. } else {
  47649. order = oppositeOrderMap[sortBy.order];
  47650. }
  47651. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  47652. }
  47653. return {
  47654. columns: _columns,
  47655. columnsStyles,
  47656. columnsTotalWidth,
  47657. fixedColumnsOnLeft,
  47658. fixedColumnsOnRight,
  47659. hasFixedColumns,
  47660. mainColumns,
  47661. normalColumns,
  47662. visibleColumns,
  47663. getColumn,
  47664. getColumnStyle,
  47665. updateColumnWidth,
  47666. onColumnSorted
  47667. };
  47668. }
  47669. const useScrollbar = (props, {
  47670. mainTableRef,
  47671. leftTableRef,
  47672. rightTableRef,
  47673. onMaybeEndReached
  47674. }) => {
  47675. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  47676. function doScroll(params) {
  47677. var _a, _b, _c;
  47678. const { scrollTop } = params;
  47679. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  47680. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  47681. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  47682. }
  47683. function scrollTo(params) {
  47684. scrollPos.value = params;
  47685. doScroll(params);
  47686. }
  47687. function scrollToTop(scrollTop) {
  47688. scrollPos.value.scrollTop = scrollTop;
  47689. doScroll(vue.unref(scrollPos));
  47690. }
  47691. function scrollToLeft(scrollLeft) {
  47692. var _a, _b;
  47693. scrollPos.value.scrollLeft = scrollLeft;
  47694. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  47695. }
  47696. function onScroll(params) {
  47697. var _a;
  47698. scrollTo(params);
  47699. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  47700. }
  47701. function onVerticalScroll({ scrollTop }) {
  47702. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  47703. if (scrollTop !== currentScrollTop)
  47704. scrollToTop(scrollTop);
  47705. }
  47706. function scrollToRow(row, strategy = "auto") {
  47707. var _a;
  47708. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  47709. }
  47710. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  47711. if (cur > prev)
  47712. onMaybeEndReached();
  47713. });
  47714. return {
  47715. scrollPos,
  47716. scrollTo,
  47717. scrollToLeft,
  47718. scrollToTop,
  47719. scrollToRow,
  47720. onScroll,
  47721. onVerticalScroll
  47722. };
  47723. };
  47724. const useRow = (props, {
  47725. mainTableRef,
  47726. leftTableRef,
  47727. rightTableRef,
  47728. tableInstance,
  47729. ns,
  47730. isScrolling
  47731. }) => {
  47732. const vm = vue.getCurrentInstance();
  47733. const { emit } = vm;
  47734. const isResetting = vue.shallowRef(false);
  47735. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  47736. const lastRenderedRowIndex = vue.ref(-1);
  47737. const resetIndex = vue.shallowRef(null);
  47738. const rowHeights = vue.ref({});
  47739. const pendingRowHeights = vue.ref({});
  47740. const leftTableHeights = vue.shallowRef({});
  47741. const mainTableHeights = vue.shallowRef({});
  47742. const rightTableHeights = vue.shallowRef({});
  47743. const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight));
  47744. function onRowsRendered(params) {
  47745. var _a;
  47746. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  47747. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  47748. lastRenderedRowIndex.value = params.rowCacheEnd;
  47749. }
  47750. }
  47751. function onRowHovered({ hovered, rowKey }) {
  47752. if (isScrolling.value) {
  47753. return;
  47754. }
  47755. const tableRoot = tableInstance.vnode.el;
  47756. const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
  47757. rows.forEach((row) => {
  47758. if (hovered) {
  47759. row.classList.add(ns.is("hovered"));
  47760. } else {
  47761. row.classList.remove(ns.is("hovered"));
  47762. }
  47763. });
  47764. }
  47765. function onRowExpanded({
  47766. expanded,
  47767. rowData,
  47768. rowIndex,
  47769. rowKey
  47770. }) {
  47771. var _a, _b;
  47772. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  47773. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  47774. if (expanded) {
  47775. if (currentKeyIndex === -1)
  47776. _expandedRowKeys.push(rowKey);
  47777. } else {
  47778. if (currentKeyIndex > -1)
  47779. _expandedRowKeys.splice(currentKeyIndex, 1);
  47780. }
  47781. expandedRowKeys.value = _expandedRowKeys;
  47782. emit("update:expandedRowKeys", _expandedRowKeys);
  47783. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  47784. expanded,
  47785. rowData,
  47786. rowIndex,
  47787. rowKey
  47788. });
  47789. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  47790. }
  47791. const flushingRowHeights = debounce(() => {
  47792. var _a, _b, _c, _d;
  47793. isResetting.value = true;
  47794. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  47795. resetAfterIndex(vue.unref(resetIndex), false);
  47796. pendingRowHeights.value = {};
  47797. resetIndex.value = null;
  47798. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  47799. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  47800. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  47801. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  47802. isResetting.value = false;
  47803. }, 0);
  47804. function resetAfterIndex(index, forceUpdate = false) {
  47805. if (!vue.unref(isDynamic))
  47806. return;
  47807. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  47808. const table = vue.unref(tableRef);
  47809. if (table)
  47810. table.resetAfterRowIndex(index, forceUpdate);
  47811. });
  47812. }
  47813. function resetHeights(rowKey, height, rowIdx) {
  47814. const resetIdx = vue.unref(resetIndex);
  47815. if (resetIdx === null) {
  47816. resetIndex.value = rowIdx;
  47817. } else {
  47818. if (resetIdx > rowIdx) {
  47819. resetIndex.value = rowIdx;
  47820. }
  47821. }
  47822. pendingRowHeights.value[rowKey] = height;
  47823. }
  47824. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  47825. if (!fixedDir) {
  47826. mainTableHeights.value[rowKey] = height;
  47827. } else {
  47828. if (fixedDir === FixedDir.RIGHT) {
  47829. rightTableHeights.value[rowKey] = height;
  47830. } else {
  47831. leftTableHeights.value[rowKey] = height;
  47832. }
  47833. }
  47834. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  47835. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  47836. resetHeights(rowKey, maximumHeight, rowIndex);
  47837. flushingRowHeights();
  47838. }
  47839. }
  47840. return {
  47841. expandedRowKeys,
  47842. lastRenderedRowIndex,
  47843. isDynamic,
  47844. isResetting,
  47845. rowHeights,
  47846. resetAfterIndex,
  47847. onRowExpanded,
  47848. onRowHovered,
  47849. onRowsRendered,
  47850. onRowHeightChange
  47851. };
  47852. };
  47853. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  47854. const depthMap = vue.ref({});
  47855. const flattenedData = vue.computed(() => {
  47856. const depths = {};
  47857. const { data: data2, rowKey } = props;
  47858. const _expandedRowKeys = vue.unref(expandedRowKeys);
  47859. if (!_expandedRowKeys || !_expandedRowKeys.length)
  47860. return data2;
  47861. const array = [];
  47862. const keysSet = /* @__PURE__ */ new Set();
  47863. _expandedRowKeys.forEach((x) => keysSet.add(x));
  47864. let copy = data2.slice();
  47865. copy.forEach((x) => depths[x[rowKey]] = 0);
  47866. while (copy.length > 0) {
  47867. const item = copy.shift();
  47868. array.push(item);
  47869. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  47870. copy = [...item.children, ...copy];
  47871. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  47872. }
  47873. }
  47874. depthMap.value = depths;
  47875. return array;
  47876. });
  47877. const data = vue.computed(() => {
  47878. const { data: data2, expandColumnKey } = props;
  47879. return expandColumnKey ? vue.unref(flattenedData) : data2;
  47880. });
  47881. vue.watch(data, (val, prev) => {
  47882. if (val !== prev) {
  47883. lastRenderedRowIndex.value = -1;
  47884. resetAfterIndex(0, true);
  47885. }
  47886. });
  47887. return {
  47888. data,
  47889. depthMap
  47890. };
  47891. };
  47892. const sumReducer = (sum2, num) => sum2 + num;
  47893. const sum = (listLike) => {
  47894. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  47895. };
  47896. const tryCall = (fLike, params, defaultRet = {}) => {
  47897. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  47898. };
  47899. const enforceUnit = (style) => {
  47900. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  47901. style[key] = addUnit(style[key]);
  47902. });
  47903. return style;
  47904. };
  47905. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  47906. const useStyles = (props, {
  47907. columnsTotalWidth,
  47908. rowsHeight,
  47909. fixedColumnsOnLeft,
  47910. fixedColumnsOnRight
  47911. }) => {
  47912. const bodyWidth = vue.computed(() => {
  47913. const { fixed, width, vScrollbarSize } = props;
  47914. const ret = width - vScrollbarSize;
  47915. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  47916. });
  47917. const headerWidth = vue.computed(() => vue.unref(bodyWidth) + props.vScrollbarSize);
  47918. const mainTableHeight = vue.computed(() => {
  47919. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  47920. if (maxHeight > 0) {
  47921. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  47922. const _rowsHeight = vue.unref(rowsHeight);
  47923. const _headerHeight = vue.unref(headerHeight);
  47924. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  47925. return Math.min(total, maxHeight - footerHeight2);
  47926. }
  47927. return height - footerHeight2;
  47928. });
  47929. const fixedTableHeight = vue.computed(() => {
  47930. const { maxHeight } = props;
  47931. const tableHeight = vue.unref(mainTableHeight);
  47932. if (isNumber(maxHeight) && maxHeight > 0)
  47933. return tableHeight;
  47934. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  47935. return Math.min(tableHeight, totalHeight);
  47936. });
  47937. const mapColumn = (column) => column.width;
  47938. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  47939. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  47940. const headerHeight = vue.computed(() => sum(props.headerHeight));
  47941. const fixedRowsHeight = vue.computed(() => {
  47942. var _a;
  47943. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  47944. });
  47945. const windowHeight = vue.computed(() => {
  47946. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  47947. });
  47948. const rootStyle = vue.computed(() => {
  47949. const { style = {}, height, width } = props;
  47950. return enforceUnit({
  47951. ...style,
  47952. height,
  47953. width
  47954. });
  47955. });
  47956. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  47957. const emptyStyle = vue.computed(() => ({
  47958. top: addUnit(vue.unref(headerHeight)),
  47959. bottom: addUnit(props.footerHeight),
  47960. width: addUnit(props.width)
  47961. }));
  47962. return {
  47963. bodyWidth,
  47964. fixedTableHeight,
  47965. mainTableHeight,
  47966. leftTableWidth,
  47967. rightTableWidth,
  47968. headerWidth,
  47969. windowHeight,
  47970. footerHeight,
  47971. emptyStyle,
  47972. rootStyle,
  47973. headerHeight
  47974. };
  47975. };
  47976. const useAutoResize = (props) => {
  47977. const sizer = vue.ref();
  47978. const width$ = vue.ref(0);
  47979. const height$ = vue.ref(0);
  47980. let resizerStopper;
  47981. vue.onMounted(() => {
  47982. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  47983. const { width, height } = entry.contentRect;
  47984. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  47985. const left = Number.parseInt(paddingLeft) || 0;
  47986. const right = Number.parseInt(paddingRight) || 0;
  47987. const top = Number.parseInt(paddingTop) || 0;
  47988. const bottom = Number.parseInt(paddingBottom) || 0;
  47989. width$.value = width - left - right;
  47990. height$.value = height - top - bottom;
  47991. }).stop;
  47992. });
  47993. vue.onBeforeUnmount(() => {
  47994. resizerStopper == null ? void 0 : resizerStopper();
  47995. });
  47996. vue.watch([width$, height$], ([width, height]) => {
  47997. var _a;
  47998. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  47999. width,
  48000. height
  48001. });
  48002. });
  48003. return {
  48004. sizer,
  48005. width: width$,
  48006. height: height$
  48007. };
  48008. };
  48009. function useTable(props) {
  48010. const mainTableRef = vue.ref();
  48011. const leftTableRef = vue.ref();
  48012. const rightTableRef = vue.ref();
  48013. const {
  48014. columns,
  48015. columnsStyles,
  48016. columnsTotalWidth,
  48017. fixedColumnsOnLeft,
  48018. fixedColumnsOnRight,
  48019. hasFixedColumns,
  48020. mainColumns,
  48021. onColumnSorted
  48022. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  48023. const {
  48024. scrollTo,
  48025. scrollToLeft,
  48026. scrollToTop,
  48027. scrollToRow,
  48028. onScroll,
  48029. onVerticalScroll,
  48030. scrollPos
  48031. } = useScrollbar(props, {
  48032. mainTableRef,
  48033. leftTableRef,
  48034. rightTableRef,
  48035. onMaybeEndReached
  48036. });
  48037. const ns = useNamespace("table-v2");
  48038. const instance = vue.getCurrentInstance();
  48039. const isScrolling = vue.shallowRef(false);
  48040. const {
  48041. expandedRowKeys,
  48042. lastRenderedRowIndex,
  48043. isDynamic,
  48044. isResetting,
  48045. rowHeights,
  48046. resetAfterIndex,
  48047. onRowExpanded,
  48048. onRowHeightChange,
  48049. onRowHovered,
  48050. onRowsRendered
  48051. } = useRow(props, {
  48052. mainTableRef,
  48053. leftTableRef,
  48054. rightTableRef,
  48055. tableInstance: instance,
  48056. ns,
  48057. isScrolling
  48058. });
  48059. const { data, depthMap } = useData(props, {
  48060. expandedRowKeys,
  48061. lastRenderedRowIndex,
  48062. resetAfterIndex
  48063. });
  48064. const rowsHeight = vue.computed(() => {
  48065. const { estimatedRowHeight, rowHeight } = props;
  48066. const _data = vue.unref(data);
  48067. if (isNumber(estimatedRowHeight)) {
  48068. return Object.values(vue.unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  48069. }
  48070. return _data.length * rowHeight;
  48071. });
  48072. const {
  48073. bodyWidth,
  48074. fixedTableHeight,
  48075. mainTableHeight,
  48076. leftTableWidth,
  48077. rightTableWidth,
  48078. headerWidth,
  48079. windowHeight,
  48080. footerHeight,
  48081. emptyStyle,
  48082. rootStyle,
  48083. headerHeight
  48084. } = useStyles(props, {
  48085. columnsTotalWidth,
  48086. fixedColumnsOnLeft,
  48087. fixedColumnsOnRight,
  48088. rowsHeight
  48089. });
  48090. const containerRef = vue.ref();
  48091. const showEmpty = vue.computed(() => {
  48092. const noData = vue.unref(data).length === 0;
  48093. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  48094. });
  48095. function getRowHeight(rowIndex) {
  48096. const { estimatedRowHeight, rowHeight, rowKey } = props;
  48097. if (!estimatedRowHeight)
  48098. return rowHeight;
  48099. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  48100. }
  48101. function onMaybeEndReached() {
  48102. const { onEndReached } = props;
  48103. if (!onEndReached)
  48104. return;
  48105. const { scrollTop } = vue.unref(scrollPos);
  48106. const _totalHeight = vue.unref(rowsHeight);
  48107. const clientHeight = vue.unref(windowHeight);
  48108. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  48109. if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  48110. onEndReached(heightUntilEnd);
  48111. }
  48112. }
  48113. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  48114. deep: true
  48115. });
  48116. return {
  48117. columns,
  48118. containerRef,
  48119. mainTableRef,
  48120. leftTableRef,
  48121. rightTableRef,
  48122. isDynamic,
  48123. isResetting,
  48124. isScrolling,
  48125. hasFixedColumns,
  48126. columnsStyles,
  48127. columnsTotalWidth,
  48128. data,
  48129. expandedRowKeys,
  48130. depthMap,
  48131. fixedColumnsOnLeft,
  48132. fixedColumnsOnRight,
  48133. mainColumns,
  48134. bodyWidth,
  48135. emptyStyle,
  48136. rootStyle,
  48137. headerWidth,
  48138. footerHeight,
  48139. mainTableHeight,
  48140. fixedTableHeight,
  48141. leftTableWidth,
  48142. rightTableWidth,
  48143. showEmpty,
  48144. getRowHeight,
  48145. onColumnSorted,
  48146. onRowHovered,
  48147. onRowExpanded,
  48148. onRowsRendered,
  48149. onRowHeightChange,
  48150. scrollTo,
  48151. scrollToLeft,
  48152. scrollToTop,
  48153. scrollToRow,
  48154. onScroll,
  48155. onVerticalScroll
  48156. };
  48157. }
  48158. const TableV2InjectionKey = Symbol("tableV2");
  48159. const classType = String;
  48160. const columns = {
  48161. type: definePropType(Array),
  48162. required: true
  48163. };
  48164. const fixedDataType = {
  48165. type: definePropType(Array)
  48166. };
  48167. const dataType = {
  48168. ...fixedDataType,
  48169. required: true
  48170. };
  48171. const expandColumnKey = String;
  48172. const expandKeys = {
  48173. type: definePropType(Array),
  48174. default: () => mutable([])
  48175. };
  48176. const requiredNumber = {
  48177. type: Number,
  48178. required: true
  48179. };
  48180. const rowKey = {
  48181. type: definePropType([String, Number, Symbol]),
  48182. default: "id"
  48183. };
  48184. const styleType = {
  48185. type: definePropType(Object)
  48186. };
  48187. const tableV2RowProps = buildProps({
  48188. class: String,
  48189. columns,
  48190. columnsStyles: {
  48191. type: definePropType(Object),
  48192. required: true
  48193. },
  48194. depth: Number,
  48195. expandColumnKey,
  48196. estimatedRowHeight: {
  48197. ...virtualizedGridProps.estimatedRowHeight,
  48198. default: void 0
  48199. },
  48200. isScrolling: Boolean,
  48201. onRowExpand: {
  48202. type: definePropType(Function)
  48203. },
  48204. onRowHover: {
  48205. type: definePropType(Function)
  48206. },
  48207. onRowHeightChange: {
  48208. type: definePropType(Function)
  48209. },
  48210. rowData: {
  48211. type: definePropType(Object),
  48212. required: true
  48213. },
  48214. rowEventHandlers: {
  48215. type: definePropType(Object)
  48216. },
  48217. rowIndex: {
  48218. type: Number,
  48219. required: true
  48220. },
  48221. rowKey,
  48222. style: {
  48223. type: definePropType(Object)
  48224. }
  48225. });
  48226. const requiredNumberType = {
  48227. type: Number,
  48228. required: true
  48229. };
  48230. const tableV2HeaderProps = buildProps({
  48231. class: String,
  48232. columns,
  48233. fixedHeaderData: {
  48234. type: definePropType(Array)
  48235. },
  48236. headerData: {
  48237. type: definePropType(Array),
  48238. required: true
  48239. },
  48240. headerHeight: {
  48241. type: definePropType([Number, Array]),
  48242. default: 50
  48243. },
  48244. rowWidth: requiredNumberType,
  48245. rowHeight: {
  48246. type: Number,
  48247. default: 50
  48248. },
  48249. height: requiredNumberType,
  48250. width: requiredNumberType
  48251. });
  48252. const tableV2GridProps = buildProps({
  48253. columns,
  48254. data: dataType,
  48255. fixedData: fixedDataType,
  48256. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  48257. width: requiredNumber,
  48258. height: requiredNumber,
  48259. headerWidth: requiredNumber,
  48260. headerHeight: tableV2HeaderProps.headerHeight,
  48261. bodyWidth: requiredNumber,
  48262. rowHeight: requiredNumber,
  48263. cache: virtualizedListProps.cache,
  48264. useIsScrolling: Boolean,
  48265. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  48266. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  48267. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  48268. class: classType,
  48269. style: styleType,
  48270. containerStyle: styleType,
  48271. getRowHeight: {
  48272. type: definePropType(Function),
  48273. required: true
  48274. },
  48275. rowKey: tableV2RowProps.rowKey,
  48276. onRowsRendered: {
  48277. type: definePropType(Function)
  48278. },
  48279. onScroll: {
  48280. type: definePropType(Function)
  48281. }
  48282. });
  48283. const tableV2Props = buildProps({
  48284. cache: tableV2GridProps.cache,
  48285. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  48286. rowKey,
  48287. headerClass: {
  48288. type: definePropType([
  48289. String,
  48290. Function
  48291. ])
  48292. },
  48293. headerProps: {
  48294. type: definePropType([
  48295. Object,
  48296. Function
  48297. ])
  48298. },
  48299. headerCellProps: {
  48300. type: definePropType([
  48301. Object,
  48302. Function
  48303. ])
  48304. },
  48305. headerHeight: tableV2HeaderProps.headerHeight,
  48306. footerHeight: {
  48307. type: Number,
  48308. default: 0
  48309. },
  48310. rowClass: {
  48311. type: definePropType([String, Function])
  48312. },
  48313. rowProps: {
  48314. type: definePropType([Object, Function])
  48315. },
  48316. rowHeight: {
  48317. type: Number,
  48318. default: 50
  48319. },
  48320. cellProps: {
  48321. type: definePropType([
  48322. Object,
  48323. Function
  48324. ])
  48325. },
  48326. columns,
  48327. data: dataType,
  48328. dataGetter: {
  48329. type: definePropType(Function)
  48330. },
  48331. fixedData: fixedDataType,
  48332. expandColumnKey: tableV2RowProps.expandColumnKey,
  48333. expandedRowKeys: expandKeys,
  48334. defaultExpandedRowKeys: expandKeys,
  48335. class: classType,
  48336. fixed: Boolean,
  48337. style: {
  48338. type: definePropType(Object)
  48339. },
  48340. width: requiredNumber,
  48341. height: requiredNumber,
  48342. maxHeight: Number,
  48343. useIsScrolling: Boolean,
  48344. indentSize: {
  48345. type: Number,
  48346. default: 12
  48347. },
  48348. iconSize: {
  48349. type: Number,
  48350. default: 12
  48351. },
  48352. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  48353. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  48354. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  48355. sortBy: {
  48356. type: definePropType(Object),
  48357. default: () => ({})
  48358. },
  48359. sortState: {
  48360. type: definePropType(Object),
  48361. default: void 0
  48362. },
  48363. onColumnSort: {
  48364. type: definePropType(Function)
  48365. },
  48366. onExpandedRowsChange: {
  48367. type: definePropType(Function)
  48368. },
  48369. onEndReached: {
  48370. type: definePropType(Function)
  48371. },
  48372. onRowExpand: tableV2RowProps.onRowExpand,
  48373. onScroll: tableV2GridProps.onScroll,
  48374. onRowsRendered: tableV2GridProps.onRowsRendered,
  48375. rowEventHandlers: tableV2RowProps.rowEventHandlers
  48376. });
  48377. const TableV2Cell = (props, {
  48378. slots
  48379. }) => {
  48380. var _a;
  48381. const {
  48382. cellData,
  48383. style
  48384. } = props;
  48385. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  48386. const defaultSlot = vue.renderSlot(slots, "default", props, () => [displayText]);
  48387. return vue.createVNode("div", {
  48388. "class": props.class,
  48389. "title": displayText,
  48390. "style": style
  48391. }, [defaultSlot]);
  48392. };
  48393. TableV2Cell.displayName = "ElTableV2Cell";
  48394. TableV2Cell.inheritAttrs = false;
  48395. var TableCell = TableV2Cell;
  48396. const HeaderCell = (props, {
  48397. slots
  48398. }) => vue.renderSlot(slots, "default", props, () => {
  48399. var _a, _b;
  48400. return [vue.createVNode("div", {
  48401. "class": props.class,
  48402. "title": (_a = props.column) == null ? void 0 : _a.title
  48403. }, [(_b = props.column) == null ? void 0 : _b.title])];
  48404. });
  48405. HeaderCell.displayName = "ElTableV2HeaderCell";
  48406. HeaderCell.inheritAttrs = false;
  48407. var HeaderCell$1 = HeaderCell;
  48408. const tableV2HeaderRowProps = buildProps({
  48409. class: String,
  48410. columns,
  48411. columnsStyles: {
  48412. type: definePropType(Object),
  48413. required: true
  48414. },
  48415. headerIndex: Number,
  48416. style: { type: definePropType(Object) }
  48417. });
  48418. const TableV2HeaderRow = vue.defineComponent({
  48419. name: "ElTableV2HeaderRow",
  48420. props: tableV2HeaderRowProps,
  48421. setup(props, {
  48422. slots
  48423. }) {
  48424. return () => {
  48425. const {
  48426. columns,
  48427. columnsStyles,
  48428. headerIndex,
  48429. style
  48430. } = props;
  48431. let Cells = columns.map((column, columnIndex) => {
  48432. return slots.cell({
  48433. columns,
  48434. column,
  48435. columnIndex,
  48436. headerIndex,
  48437. style: columnsStyles[column.key]
  48438. });
  48439. });
  48440. if (slots.header) {
  48441. Cells = slots.header({
  48442. cells: Cells.map((node) => {
  48443. if (isArray$1(node) && node.length === 1) {
  48444. return node[0];
  48445. }
  48446. return node;
  48447. }),
  48448. columns,
  48449. headerIndex
  48450. });
  48451. }
  48452. return vue.createVNode("div", {
  48453. "class": props.class,
  48454. "style": style,
  48455. "role": "row"
  48456. }, [Cells]);
  48457. };
  48458. }
  48459. });
  48460. var HeaderRow = TableV2HeaderRow;
  48461. const COMPONENT_NAME$7 = "ElTableV2Header";
  48462. const TableV2Header = vue.defineComponent({
  48463. name: COMPONENT_NAME$7,
  48464. props: tableV2HeaderProps,
  48465. setup(props, {
  48466. slots,
  48467. expose
  48468. }) {
  48469. const ns = useNamespace("table-v2");
  48470. const scrollLeftInfo = vue.inject("tableV2GridScrollLeft");
  48471. const headerRef = vue.ref();
  48472. const headerStyle = vue.computed(() => enforceUnit({
  48473. width: props.width,
  48474. height: props.height
  48475. }));
  48476. const rowStyle = vue.computed(() => enforceUnit({
  48477. width: props.rowWidth,
  48478. height: props.height
  48479. }));
  48480. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  48481. const scrollToLeft = (left) => {
  48482. const headerEl = vue.unref(headerRef);
  48483. vue.nextTick(() => {
  48484. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  48485. left
  48486. });
  48487. });
  48488. };
  48489. const renderFixedRows = () => {
  48490. const fixedRowClassName = ns.e("fixed-header-row");
  48491. const {
  48492. columns,
  48493. fixedHeaderData,
  48494. rowHeight
  48495. } = props;
  48496. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  48497. var _a;
  48498. const style = enforceUnit({
  48499. height: rowHeight,
  48500. width: "100%"
  48501. });
  48502. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  48503. class: fixedRowClassName,
  48504. columns,
  48505. rowData: fixedRowData,
  48506. rowIndex: -(fixedRowIndex + 1),
  48507. style
  48508. });
  48509. });
  48510. };
  48511. const renderDynamicRows = () => {
  48512. const dynamicRowClassName = ns.e("dynamic-header-row");
  48513. const {
  48514. columns
  48515. } = props;
  48516. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  48517. var _a;
  48518. const style = enforceUnit({
  48519. width: "100%",
  48520. height: rowHeight
  48521. });
  48522. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  48523. class: dynamicRowClassName,
  48524. columns,
  48525. headerIndex: rowIndex,
  48526. style
  48527. });
  48528. });
  48529. };
  48530. vue.onUpdated(() => {
  48531. if (scrollLeftInfo == null ? void 0 : scrollLeftInfo.value) {
  48532. scrollToLeft(scrollLeftInfo.value);
  48533. }
  48534. });
  48535. expose({
  48536. scrollToLeft
  48537. });
  48538. return () => {
  48539. if (props.height <= 0)
  48540. return;
  48541. return vue.createVNode("div", {
  48542. "ref": headerRef,
  48543. "class": props.class,
  48544. "style": vue.unref(headerStyle),
  48545. "role": "rowgroup"
  48546. }, [vue.createVNode("div", {
  48547. "style": vue.unref(rowStyle),
  48548. "class": ns.e("header")
  48549. }, [renderDynamicRows(), renderFixedRows()])]);
  48550. };
  48551. }
  48552. });
  48553. var Header = TableV2Header;
  48554. const useTableRow = (props) => {
  48555. const {
  48556. isScrolling
  48557. } = vue.inject(TableV2InjectionKey);
  48558. const measured = vue.ref(false);
  48559. const rowRef = vue.ref();
  48560. const measurable = vue.computed(() => {
  48561. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  48562. });
  48563. const doMeasure = (isInit = false) => {
  48564. const $rowRef = vue.unref(rowRef);
  48565. if (!$rowRef)
  48566. return;
  48567. const {
  48568. columns,
  48569. onRowHeightChange,
  48570. rowKey,
  48571. rowIndex,
  48572. style
  48573. } = props;
  48574. const {
  48575. height
  48576. } = $rowRef.getBoundingClientRect();
  48577. measured.value = true;
  48578. vue.nextTick(() => {
  48579. if (isInit || height !== Number.parseInt(style.height)) {
  48580. const firstColumn = columns[0];
  48581. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  48582. onRowHeightChange == null ? void 0 : onRowHeightChange({
  48583. rowKey,
  48584. height,
  48585. rowIndex
  48586. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  48587. }
  48588. });
  48589. };
  48590. const eventHandlers = vue.computed(() => {
  48591. const {
  48592. rowData,
  48593. rowIndex,
  48594. rowKey,
  48595. onRowHover
  48596. } = props;
  48597. const handlers = props.rowEventHandlers || {};
  48598. const eventHandlers2 = {};
  48599. Object.entries(handlers).forEach(([eventName, handler]) => {
  48600. if (isFunction$1(handler)) {
  48601. eventHandlers2[eventName] = (event) => {
  48602. handler({
  48603. event,
  48604. rowData,
  48605. rowIndex,
  48606. rowKey
  48607. });
  48608. };
  48609. }
  48610. });
  48611. if (onRowHover) {
  48612. [{
  48613. name: "onMouseleave",
  48614. hovered: false
  48615. }, {
  48616. name: "onMouseenter",
  48617. hovered: true
  48618. }].forEach(({
  48619. name,
  48620. hovered
  48621. }) => {
  48622. const existedHandler = eventHandlers2[name];
  48623. eventHandlers2[name] = (event) => {
  48624. onRowHover({
  48625. event,
  48626. hovered,
  48627. rowData,
  48628. rowIndex,
  48629. rowKey
  48630. });
  48631. existedHandler == null ? void 0 : existedHandler(event);
  48632. };
  48633. });
  48634. }
  48635. return eventHandlers2;
  48636. });
  48637. const onExpand = (expanded) => {
  48638. const {
  48639. onRowExpand,
  48640. rowData,
  48641. rowIndex,
  48642. rowKey
  48643. } = props;
  48644. onRowExpand == null ? void 0 : onRowExpand({
  48645. expanded,
  48646. rowData,
  48647. rowIndex,
  48648. rowKey
  48649. });
  48650. };
  48651. vue.onMounted(() => {
  48652. if (vue.unref(measurable)) {
  48653. doMeasure(true);
  48654. }
  48655. });
  48656. return {
  48657. isScrolling,
  48658. measurable,
  48659. measured,
  48660. rowRef,
  48661. eventHandlers,
  48662. onExpand
  48663. };
  48664. };
  48665. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  48666. const TableV2Row = vue.defineComponent({
  48667. name: COMPONENT_NAME$6,
  48668. props: tableV2RowProps,
  48669. setup(props, {
  48670. expose,
  48671. slots,
  48672. attrs
  48673. }) {
  48674. const {
  48675. eventHandlers,
  48676. isScrolling,
  48677. measurable,
  48678. measured,
  48679. rowRef,
  48680. onExpand
  48681. } = useTableRow(props);
  48682. expose({
  48683. onExpand
  48684. });
  48685. return () => {
  48686. const {
  48687. columns,
  48688. columnsStyles,
  48689. expandColumnKey,
  48690. depth,
  48691. rowData,
  48692. rowIndex,
  48693. style
  48694. } = props;
  48695. let ColumnCells = columns.map((column, columnIndex) => {
  48696. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  48697. return slots.cell({
  48698. column,
  48699. columns,
  48700. columnIndex,
  48701. depth,
  48702. style: columnsStyles[column.key],
  48703. rowData,
  48704. rowIndex,
  48705. isScrolling: vue.unref(isScrolling),
  48706. expandIconProps: expandable ? {
  48707. rowData,
  48708. rowIndex,
  48709. onExpand
  48710. } : void 0
  48711. });
  48712. });
  48713. if (slots.row) {
  48714. ColumnCells = slots.row({
  48715. cells: ColumnCells.map((node) => {
  48716. if (isArray$1(node) && node.length === 1) {
  48717. return node[0];
  48718. }
  48719. return node;
  48720. }),
  48721. style,
  48722. columns,
  48723. depth,
  48724. rowData,
  48725. rowIndex,
  48726. isScrolling: vue.unref(isScrolling)
  48727. });
  48728. }
  48729. if (vue.unref(measurable)) {
  48730. const {
  48731. height,
  48732. ...exceptHeightStyle
  48733. } = style || {};
  48734. const _measured = vue.unref(measured);
  48735. return vue.createVNode("div", vue.mergeProps({
  48736. "ref": rowRef,
  48737. "class": props.class,
  48738. "style": _measured ? style : exceptHeightStyle,
  48739. "role": "row"
  48740. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  48741. }
  48742. return vue.createVNode("div", vue.mergeProps(attrs, {
  48743. "ref": rowRef,
  48744. "class": props.class,
  48745. "style": style,
  48746. "role": "row"
  48747. }, vue.unref(eventHandlers)), [ColumnCells]);
  48748. };
  48749. }
  48750. });
  48751. var Row = TableV2Row;
  48752. const SortIcon = (props) => {
  48753. const {
  48754. sortOrder
  48755. } = props;
  48756. return vue.createVNode(ElIcon, {
  48757. "size": 14,
  48758. "class": props.class
  48759. }, {
  48760. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  48761. });
  48762. };
  48763. var SortIcon$1 = SortIcon;
  48764. const ExpandIcon = (props) => {
  48765. const {
  48766. expanded,
  48767. expandable,
  48768. onExpand,
  48769. style,
  48770. size
  48771. } = props;
  48772. const expandIconProps = {
  48773. onClick: expandable ? () => onExpand(!expanded) : void 0,
  48774. class: props.class
  48775. };
  48776. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  48777. "size": size,
  48778. "style": style
  48779. }), {
  48780. default: () => [vue.createVNode(arrow_right_default, null, null)]
  48781. });
  48782. };
  48783. var ExpandIcon$1 = ExpandIcon;
  48784. const COMPONENT_NAME$5 = "ElTableV2Grid";
  48785. const useTableGrid = (props) => {
  48786. const headerRef = vue.ref();
  48787. const bodyRef = vue.ref();
  48788. const scrollLeft = vue.ref(0);
  48789. const totalHeight = vue.computed(() => {
  48790. const {
  48791. data,
  48792. rowHeight,
  48793. estimatedRowHeight
  48794. } = props;
  48795. if (estimatedRowHeight) {
  48796. return;
  48797. }
  48798. return data.length * rowHeight;
  48799. });
  48800. const fixedRowHeight = vue.computed(() => {
  48801. const {
  48802. fixedData,
  48803. rowHeight
  48804. } = props;
  48805. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  48806. });
  48807. const headerHeight = vue.computed(() => sum(props.headerHeight));
  48808. const gridHeight = vue.computed(() => {
  48809. const {
  48810. height
  48811. } = props;
  48812. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  48813. });
  48814. const hasHeader = vue.computed(() => {
  48815. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  48816. });
  48817. const itemKey = ({
  48818. data,
  48819. rowIndex
  48820. }) => data[rowIndex][props.rowKey];
  48821. function onItemRendered({
  48822. rowCacheStart,
  48823. rowCacheEnd,
  48824. rowVisibleStart,
  48825. rowVisibleEnd
  48826. }) {
  48827. var _a;
  48828. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  48829. rowCacheStart,
  48830. rowCacheEnd,
  48831. rowVisibleStart,
  48832. rowVisibleEnd
  48833. });
  48834. }
  48835. function resetAfterRowIndex(index, forceUpdate2) {
  48836. var _a;
  48837. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  48838. }
  48839. function scrollTo(leftOrOptions, top) {
  48840. const header$ = vue.unref(headerRef);
  48841. const body$ = vue.unref(bodyRef);
  48842. if (isObject$1(leftOrOptions)) {
  48843. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  48844. scrollLeft.value = leftOrOptions.scrollLeft;
  48845. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  48846. } else {
  48847. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  48848. scrollLeft.value = leftOrOptions;
  48849. body$ == null ? void 0 : body$.scrollTo({
  48850. scrollLeft: leftOrOptions,
  48851. scrollTop: top
  48852. });
  48853. }
  48854. }
  48855. function scrollToTop(scrollTop) {
  48856. var _a;
  48857. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  48858. scrollTop
  48859. });
  48860. }
  48861. function scrollToRow(row, strategy) {
  48862. var _a;
  48863. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  48864. }
  48865. function forceUpdate() {
  48866. var _a, _b;
  48867. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  48868. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  48869. }
  48870. vue.watch(() => props.bodyWidth, () => {
  48871. var _a;
  48872. if (isNumber(props.estimatedRowHeight))
  48873. (_a = bodyRef.value) == null ? void 0 : _a.resetAfter({
  48874. columnIndex: 0
  48875. }, false);
  48876. });
  48877. return {
  48878. bodyRef,
  48879. forceUpdate,
  48880. fixedRowHeight,
  48881. gridHeight,
  48882. hasHeader,
  48883. headerHeight,
  48884. headerRef,
  48885. totalHeight,
  48886. itemKey,
  48887. onItemRendered,
  48888. resetAfterRowIndex,
  48889. scrollTo,
  48890. scrollToTop,
  48891. scrollToRow,
  48892. scrollLeft
  48893. };
  48894. };
  48895. const TableGrid = vue.defineComponent({
  48896. name: COMPONENT_NAME$5,
  48897. props: tableV2GridProps,
  48898. setup(props, {
  48899. slots,
  48900. expose
  48901. }) {
  48902. const {
  48903. ns
  48904. } = vue.inject(TableV2InjectionKey);
  48905. const {
  48906. bodyRef,
  48907. fixedRowHeight,
  48908. gridHeight,
  48909. hasHeader,
  48910. headerRef,
  48911. headerHeight,
  48912. totalHeight,
  48913. forceUpdate,
  48914. itemKey,
  48915. onItemRendered,
  48916. resetAfterRowIndex,
  48917. scrollTo,
  48918. scrollToTop,
  48919. scrollToRow,
  48920. scrollLeft
  48921. } = useTableGrid(props);
  48922. vue.provide("tableV2GridScrollLeft", scrollLeft);
  48923. expose({
  48924. forceUpdate,
  48925. totalHeight,
  48926. scrollTo,
  48927. scrollToTop,
  48928. scrollToRow,
  48929. resetAfterRowIndex
  48930. });
  48931. const getColumnWidth = () => props.bodyWidth;
  48932. return () => {
  48933. const {
  48934. cache,
  48935. columns,
  48936. data,
  48937. fixedData,
  48938. useIsScrolling,
  48939. scrollbarAlwaysOn,
  48940. scrollbarEndGap,
  48941. scrollbarStartGap,
  48942. style,
  48943. rowHeight,
  48944. bodyWidth,
  48945. estimatedRowHeight,
  48946. headerWidth,
  48947. height,
  48948. width,
  48949. getRowHeight,
  48950. onScroll
  48951. } = props;
  48952. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  48953. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  48954. const _headerHeight = vue.unref(headerHeight);
  48955. return vue.createVNode("div", {
  48956. "role": "table",
  48957. "class": [ns.e("table"), props.class],
  48958. "style": style
  48959. }, [vue.createVNode(Grid, {
  48960. "ref": bodyRef,
  48961. "data": data,
  48962. "useIsScrolling": useIsScrolling,
  48963. "itemKey": itemKey,
  48964. "columnCache": 0,
  48965. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  48966. "totalColumn": 1,
  48967. "totalRow": data.length,
  48968. "rowCache": cache,
  48969. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  48970. "width": width,
  48971. "height": vue.unref(gridHeight),
  48972. "class": ns.e("body"),
  48973. "role": "rowgroup",
  48974. "scrollbarStartGap": scrollbarStartGap,
  48975. "scrollbarEndGap": scrollbarEndGap,
  48976. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  48977. "onScroll": onScroll,
  48978. "onItemRendered": onItemRendered,
  48979. "perfMode": false
  48980. }, {
  48981. default: (params) => {
  48982. var _a;
  48983. const rowData = data[params.rowIndex];
  48984. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  48985. ...params,
  48986. columns,
  48987. rowData
  48988. });
  48989. }
  48990. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  48991. "ref": headerRef,
  48992. "class": ns.e("header-wrapper"),
  48993. "columns": columns,
  48994. "headerData": data,
  48995. "headerHeight": props.headerHeight,
  48996. "fixedHeaderData": fixedData,
  48997. "rowWidth": headerWidth,
  48998. "rowHeight": rowHeight,
  48999. "width": width,
  49000. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  49001. }, {
  49002. dynamic: slots.header,
  49003. fixed: slots.row
  49004. })]);
  49005. };
  49006. }
  49007. });
  49008. function _isSlot$5(s) {
  49009. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  49010. }
  49011. const MainTable = (props, {
  49012. slots
  49013. }) => {
  49014. const {
  49015. mainTableRef,
  49016. ...rest
  49017. } = props;
  49018. return vue.createVNode(TableGrid, vue.mergeProps({
  49019. "ref": mainTableRef
  49020. }, rest), _isSlot$5(slots) ? slots : {
  49021. default: () => [slots]
  49022. });
  49023. };
  49024. function _isSlot$4(s) {
  49025. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  49026. }
  49027. const LeftTable$1 = (props, {
  49028. slots
  49029. }) => {
  49030. if (!props.columns.length)
  49031. return;
  49032. const {
  49033. leftTableRef,
  49034. ...rest
  49035. } = props;
  49036. return vue.createVNode(TableGrid, vue.mergeProps({
  49037. "ref": leftTableRef
  49038. }, rest), _isSlot$4(slots) ? slots : {
  49039. default: () => [slots]
  49040. });
  49041. };
  49042. function _isSlot$3(s) {
  49043. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  49044. }
  49045. const LeftTable = (props, {
  49046. slots
  49047. }) => {
  49048. if (!props.columns.length)
  49049. return;
  49050. const {
  49051. rightTableRef,
  49052. ...rest
  49053. } = props;
  49054. return vue.createVNode(TableGrid, vue.mergeProps({
  49055. "ref": rightTableRef
  49056. }, rest), _isSlot$3(slots) ? slots : {
  49057. default: () => [slots]
  49058. });
  49059. };
  49060. function _isSlot$2(s) {
  49061. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  49062. }
  49063. const RowRenderer = (props, {
  49064. slots
  49065. }) => {
  49066. const {
  49067. columns,
  49068. columnsStyles,
  49069. depthMap,
  49070. expandColumnKey,
  49071. expandedRowKeys,
  49072. estimatedRowHeight,
  49073. hasFixedColumns,
  49074. rowData,
  49075. rowIndex,
  49076. style,
  49077. isScrolling,
  49078. rowProps,
  49079. rowClass,
  49080. rowKey,
  49081. rowEventHandlers,
  49082. ns,
  49083. onRowHovered,
  49084. onRowExpanded
  49085. } = props;
  49086. const rowKls = tryCall(rowClass, {
  49087. columns,
  49088. rowData,
  49089. rowIndex
  49090. }, "");
  49091. const additionalProps = tryCall(rowProps, {
  49092. columns,
  49093. rowData,
  49094. rowIndex
  49095. });
  49096. const _rowKey = rowData[rowKey];
  49097. const depth = depthMap[_rowKey] || 0;
  49098. const canExpand = Boolean(expandColumnKey);
  49099. const isFixedRow = rowIndex < 0;
  49100. const kls = [ns.e("row"), rowKls, {
  49101. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  49102. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  49103. [ns.is("fixed")]: !depth && isFixedRow,
  49104. [ns.is("customized")]: Boolean(slots.row)
  49105. }];
  49106. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  49107. const _rowProps = {
  49108. ...additionalProps,
  49109. columns,
  49110. columnsStyles,
  49111. class: kls,
  49112. depth,
  49113. expandColumnKey,
  49114. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  49115. isScrolling,
  49116. rowIndex,
  49117. rowData,
  49118. rowKey: _rowKey,
  49119. rowEventHandlers,
  49120. style
  49121. };
  49122. const handlerMosueEnter = (e) => {
  49123. onRowHover == null ? void 0 : onRowHover({
  49124. hovered: true,
  49125. rowKey: _rowKey,
  49126. event: e,
  49127. rowData,
  49128. rowIndex
  49129. });
  49130. };
  49131. const handlerMouseLeave = (e) => {
  49132. onRowHover == null ? void 0 : onRowHover({
  49133. hovered: false,
  49134. rowKey: _rowKey,
  49135. event: e,
  49136. rowData,
  49137. rowIndex
  49138. });
  49139. };
  49140. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  49141. "onRowExpand": onRowExpanded,
  49142. "onMouseenter": handlerMosueEnter,
  49143. "onMouseleave": handlerMouseLeave,
  49144. "rowkey": _rowKey
  49145. }), _isSlot$2(slots) ? slots : {
  49146. default: () => [slots]
  49147. });
  49148. };
  49149. const CellRenderer = ({
  49150. columns,
  49151. column,
  49152. columnIndex,
  49153. depth,
  49154. expandIconProps,
  49155. isScrolling,
  49156. rowData,
  49157. rowIndex,
  49158. style,
  49159. expandedRowKeys,
  49160. ns,
  49161. cellProps: _cellProps,
  49162. expandColumnKey,
  49163. indentSize,
  49164. iconSize,
  49165. rowKey
  49166. }, {
  49167. slots
  49168. }) => {
  49169. const cellStyle = enforceUnit(style);
  49170. if (column.placeholderSign === placeholderSign) {
  49171. return vue.createVNode("div", {
  49172. "class": ns.em("row-cell", "placeholder"),
  49173. "style": cellStyle
  49174. }, null);
  49175. }
  49176. const {
  49177. cellRenderer,
  49178. dataKey,
  49179. dataGetter
  49180. } = column;
  49181. const cellData = isFunction$1(dataGetter) ? dataGetter({
  49182. columns,
  49183. column,
  49184. columnIndex,
  49185. rowData,
  49186. rowIndex
  49187. }) : get(rowData, dataKey != null ? dataKey : "");
  49188. const extraCellProps = tryCall(_cellProps, {
  49189. cellData,
  49190. columns,
  49191. column,
  49192. columnIndex,
  49193. rowIndex,
  49194. rowData
  49195. });
  49196. const cellProps = {
  49197. class: ns.e("cell-text"),
  49198. columns,
  49199. column,
  49200. columnIndex,
  49201. cellData,
  49202. isScrolling,
  49203. rowData,
  49204. rowIndex
  49205. };
  49206. const columnCellRenderer = componentToSlot(cellRenderer);
  49207. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(TableCell, cellProps, null)]);
  49208. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  49209. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  49210. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  49211. let IconOrPlaceholder;
  49212. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  49213. if (expandable) {
  49214. if (isObject$1(expandIconProps)) {
  49215. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  49216. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  49217. "size": iconSize,
  49218. "expanded": expanded,
  49219. "style": iconStyle,
  49220. "expandable": true
  49221. }), null);
  49222. } else {
  49223. IconOrPlaceholder = vue.createVNode("div", {
  49224. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  49225. }, null);
  49226. }
  49227. }
  49228. return vue.createVNode("div", vue.mergeProps({
  49229. "class": kls,
  49230. "style": cellStyle
  49231. }, extraCellProps, {
  49232. "role": "cell"
  49233. }), [IconOrPlaceholder, Cell]);
  49234. };
  49235. CellRenderer.inheritAttrs = false;
  49236. function _isSlot$1(s) {
  49237. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  49238. }
  49239. const HeaderRenderer = ({
  49240. columns,
  49241. columnsStyles,
  49242. headerIndex,
  49243. style,
  49244. headerClass,
  49245. headerProps,
  49246. ns
  49247. }, {
  49248. slots
  49249. }) => {
  49250. const param = {
  49251. columns,
  49252. headerIndex
  49253. };
  49254. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  49255. [ns.is("customized")]: Boolean(slots.header)
  49256. }];
  49257. const extraProps = {
  49258. ...tryCall(headerProps, param),
  49259. columnsStyles,
  49260. class: kls,
  49261. columns,
  49262. headerIndex,
  49263. style
  49264. };
  49265. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  49266. default: () => [slots]
  49267. });
  49268. };
  49269. const HeaderCellRenderer = (props, {
  49270. slots
  49271. }) => {
  49272. const {
  49273. column,
  49274. ns,
  49275. style,
  49276. onColumnSorted
  49277. } = props;
  49278. const cellStyle = enforceUnit(style);
  49279. if (column.placeholderSign === placeholderSign) {
  49280. return vue.createVNode("div", {
  49281. "class": ns.em("header-row-cell", "placeholder"),
  49282. "style": cellStyle
  49283. }, null);
  49284. }
  49285. const {
  49286. headerCellRenderer,
  49287. headerClass,
  49288. sortable
  49289. } = column;
  49290. const cellProps = {
  49291. ...props,
  49292. class: ns.e("header-cell-text")
  49293. };
  49294. const columnCellRenderer = componentToSlot(headerCellRenderer);
  49295. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(HeaderCell$1, cellProps, null)]);
  49296. const {
  49297. sortBy,
  49298. sortState,
  49299. headerCellProps
  49300. } = props;
  49301. let sorting, sortOrder;
  49302. if (sortState) {
  49303. const order = sortState[column.key];
  49304. sorting = Boolean(oppositeOrderMap[order]);
  49305. sortOrder = sorting ? order : SortOrder.ASC;
  49306. } else {
  49307. sorting = column.key === sortBy.key;
  49308. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  49309. }
  49310. 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")];
  49311. const cellWrapperProps = {
  49312. ...tryCall(headerCellProps, props),
  49313. onClick: column.sortable ? onColumnSorted : void 0,
  49314. class: cellKls,
  49315. style: cellStyle,
  49316. ["data-key"]: column.key
  49317. };
  49318. return vue.createVNode("div", vue.mergeProps(cellWrapperProps, {
  49319. "role": "columnheader"
  49320. }), [Cell, sortable && vue.createVNode(SortIcon$1, {
  49321. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  49322. "sortOrder": sortOrder
  49323. }, null)]);
  49324. };
  49325. const Footer$1 = (props, {
  49326. slots
  49327. }) => {
  49328. var _a;
  49329. return vue.createVNode("div", {
  49330. "class": props.class,
  49331. "style": props.style
  49332. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49333. };
  49334. Footer$1.displayName = "ElTableV2Footer";
  49335. const Footer = (props, {
  49336. slots
  49337. }) => {
  49338. const defaultSlot = vue.renderSlot(slots, "default", {}, () => [vue.createVNode(ElEmpty, null, null)]);
  49339. return vue.createVNode("div", {
  49340. "class": props.class,
  49341. "style": props.style
  49342. }, [defaultSlot]);
  49343. };
  49344. Footer.displayName = "ElTableV2Empty";
  49345. const Overlay = (props, {
  49346. slots
  49347. }) => {
  49348. var _a;
  49349. return vue.createVNode("div", {
  49350. "class": props.class,
  49351. "style": props.style
  49352. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49353. };
  49354. Overlay.displayName = "ElTableV2Overlay";
  49355. function _isSlot(s) {
  49356. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  49357. }
  49358. const COMPONENT_NAME$4 = "ElTableV2";
  49359. const TableV2 = vue.defineComponent({
  49360. name: COMPONENT_NAME$4,
  49361. props: tableV2Props,
  49362. setup(props, {
  49363. slots,
  49364. expose
  49365. }) {
  49366. const ns = useNamespace("table-v2");
  49367. const {
  49368. columnsStyles,
  49369. fixedColumnsOnLeft,
  49370. fixedColumnsOnRight,
  49371. mainColumns,
  49372. mainTableHeight,
  49373. fixedTableHeight,
  49374. leftTableWidth,
  49375. rightTableWidth,
  49376. data,
  49377. depthMap,
  49378. expandedRowKeys,
  49379. hasFixedColumns,
  49380. mainTableRef,
  49381. leftTableRef,
  49382. rightTableRef,
  49383. isDynamic,
  49384. isResetting,
  49385. isScrolling,
  49386. bodyWidth,
  49387. emptyStyle,
  49388. rootStyle,
  49389. headerWidth,
  49390. footerHeight,
  49391. showEmpty,
  49392. scrollTo,
  49393. scrollToLeft,
  49394. scrollToTop,
  49395. scrollToRow,
  49396. getRowHeight,
  49397. onColumnSorted,
  49398. onRowHeightChange,
  49399. onRowHovered,
  49400. onRowExpanded,
  49401. onRowsRendered,
  49402. onScroll,
  49403. onVerticalScroll
  49404. } = useTable(props);
  49405. expose({
  49406. scrollTo,
  49407. scrollToLeft,
  49408. scrollToTop,
  49409. scrollToRow
  49410. });
  49411. vue.provide(TableV2InjectionKey, {
  49412. ns,
  49413. isResetting,
  49414. isScrolling
  49415. });
  49416. return () => {
  49417. const {
  49418. cache,
  49419. cellProps,
  49420. estimatedRowHeight,
  49421. expandColumnKey,
  49422. fixedData,
  49423. headerHeight,
  49424. headerClass,
  49425. headerProps,
  49426. headerCellProps,
  49427. sortBy,
  49428. sortState,
  49429. rowHeight,
  49430. rowClass,
  49431. rowEventHandlers,
  49432. rowKey,
  49433. rowProps,
  49434. scrollbarAlwaysOn,
  49435. indentSize,
  49436. iconSize,
  49437. useIsScrolling,
  49438. vScrollbarSize,
  49439. width
  49440. } = props;
  49441. const _data = vue.unref(data);
  49442. const mainTableProps = {
  49443. cache,
  49444. class: ns.e("main"),
  49445. columns: vue.unref(mainColumns),
  49446. data: _data,
  49447. fixedData,
  49448. estimatedRowHeight,
  49449. bodyWidth: vue.unref(bodyWidth) + vScrollbarSize,
  49450. headerHeight,
  49451. headerWidth: vue.unref(headerWidth),
  49452. height: vue.unref(mainTableHeight),
  49453. mainTableRef,
  49454. rowKey,
  49455. rowHeight,
  49456. scrollbarAlwaysOn,
  49457. scrollbarStartGap: 2,
  49458. scrollbarEndGap: vScrollbarSize,
  49459. useIsScrolling,
  49460. width,
  49461. getRowHeight,
  49462. onRowsRendered,
  49463. onScroll
  49464. };
  49465. const leftColumnsWidth = vue.unref(leftTableWidth);
  49466. const _fixedTableHeight = vue.unref(fixedTableHeight);
  49467. const leftTableProps = {
  49468. cache,
  49469. class: ns.e("left"),
  49470. columns: vue.unref(fixedColumnsOnLeft),
  49471. data: _data,
  49472. fixedData,
  49473. estimatedRowHeight,
  49474. leftTableRef,
  49475. rowHeight,
  49476. bodyWidth: leftColumnsWidth,
  49477. headerWidth: leftColumnsWidth,
  49478. headerHeight,
  49479. height: _fixedTableHeight,
  49480. rowKey,
  49481. scrollbarAlwaysOn,
  49482. scrollbarStartGap: 2,
  49483. scrollbarEndGap: vScrollbarSize,
  49484. useIsScrolling,
  49485. width: leftColumnsWidth,
  49486. getRowHeight,
  49487. onScroll: onVerticalScroll
  49488. };
  49489. const rightColumnsWidth = vue.unref(rightTableWidth);
  49490. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  49491. const rightTableProps = {
  49492. cache,
  49493. class: ns.e("right"),
  49494. columns: vue.unref(fixedColumnsOnRight),
  49495. data: _data,
  49496. fixedData,
  49497. estimatedRowHeight,
  49498. rightTableRef,
  49499. rowHeight,
  49500. bodyWidth: rightColumnsWidthWithScrollbar,
  49501. headerWidth: rightColumnsWidthWithScrollbar,
  49502. headerHeight,
  49503. height: _fixedTableHeight,
  49504. rowKey,
  49505. scrollbarAlwaysOn,
  49506. scrollbarStartGap: 2,
  49507. scrollbarEndGap: vScrollbarSize,
  49508. width: rightColumnsWidthWithScrollbar,
  49509. style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  49510. useIsScrolling,
  49511. getRowHeight,
  49512. onScroll: onVerticalScroll
  49513. };
  49514. const _columnsStyles = vue.unref(columnsStyles);
  49515. const tableRowProps = {
  49516. ns,
  49517. depthMap: vue.unref(depthMap),
  49518. columnsStyles: _columnsStyles,
  49519. expandColumnKey,
  49520. expandedRowKeys: vue.unref(expandedRowKeys),
  49521. estimatedRowHeight,
  49522. hasFixedColumns: vue.unref(hasFixedColumns),
  49523. rowProps,
  49524. rowClass,
  49525. rowKey,
  49526. rowEventHandlers,
  49527. onRowHovered,
  49528. onRowExpanded,
  49529. onRowHeightChange
  49530. };
  49531. const tableCellProps = {
  49532. cellProps,
  49533. expandColumnKey,
  49534. indentSize,
  49535. iconSize,
  49536. rowKey,
  49537. expandedRowKeys: vue.unref(expandedRowKeys),
  49538. ns
  49539. };
  49540. const tableHeaderProps = {
  49541. ns,
  49542. headerClass,
  49543. headerProps,
  49544. columnsStyles: _columnsStyles
  49545. };
  49546. const tableHeaderCellProps = {
  49547. ns,
  49548. sortBy,
  49549. sortState,
  49550. headerCellProps,
  49551. onColumnSorted
  49552. };
  49553. const tableSlots = {
  49554. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  49555. row: slots.row,
  49556. cell: (props3) => {
  49557. let _slot;
  49558. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  49559. "style": _columnsStyles[props3.column.key]
  49560. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  49561. default: () => [_slot]
  49562. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  49563. "style": _columnsStyles[props3.column.key]
  49564. }), null);
  49565. }
  49566. }),
  49567. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  49568. header: slots.header,
  49569. cell: (props3) => {
  49570. let _slot2;
  49571. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  49572. "style": _columnsStyles[props3.column.key]
  49573. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  49574. default: () => [_slot2]
  49575. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  49576. "style": _columnsStyles[props3.column.key]
  49577. }), null);
  49578. }
  49579. })
  49580. };
  49581. const rootKls = [props.class, ns.b(), ns.e("root"), {
  49582. [ns.is("dynamic")]: vue.unref(isDynamic)
  49583. }];
  49584. const footerProps = {
  49585. class: ns.e("footer"),
  49586. style: vue.unref(footerHeight)
  49587. };
  49588. return vue.createVNode("div", {
  49589. "class": rootKls,
  49590. "style": vue.unref(rootStyle)
  49591. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  49592. default: () => [tableSlots]
  49593. }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  49594. default: () => [tableSlots]
  49595. }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  49596. default: () => [tableSlots]
  49597. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  49598. default: slots.footer
  49599. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  49600. "class": ns.e("empty"),
  49601. "style": vue.unref(emptyStyle)
  49602. }, {
  49603. default: slots.empty
  49604. }), slots.overlay && vue.createVNode(Overlay, {
  49605. "class": ns.e("overlay")
  49606. }, {
  49607. default: slots.overlay
  49608. })]);
  49609. };
  49610. }
  49611. });
  49612. var TableV2$1 = TableV2;
  49613. const autoResizerProps = buildProps({
  49614. disableWidth: Boolean,
  49615. disableHeight: Boolean,
  49616. onResize: {
  49617. type: definePropType(Function)
  49618. }
  49619. });
  49620. const AutoResizer = vue.defineComponent({
  49621. name: "ElAutoResizer",
  49622. props: autoResizerProps,
  49623. setup(props, {
  49624. slots
  49625. }) {
  49626. const ns = useNamespace("auto-resizer");
  49627. const {
  49628. height,
  49629. width,
  49630. sizer
  49631. } = useAutoResize(props);
  49632. const style = {
  49633. width: "100%",
  49634. height: "100%"
  49635. };
  49636. return () => {
  49637. var _a;
  49638. return vue.createVNode("div", {
  49639. "ref": sizer,
  49640. "class": ns.b(),
  49641. "style": style
  49642. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  49643. height: height.value,
  49644. width: width.value
  49645. })]);
  49646. };
  49647. }
  49648. });
  49649. const ElTableV2 = withInstall(TableV2$1);
  49650. const ElAutoResizer = withInstall(AutoResizer);
  49651. const tabsRootContextKey = Symbol("tabsRootContextKey");
  49652. const tabBarProps = buildProps({
  49653. tabs: {
  49654. type: definePropType(Array),
  49655. default: () => mutable([])
  49656. }
  49657. });
  49658. const COMPONENT_NAME$3 = "ElTabBar";
  49659. const __default__$u = vue.defineComponent({
  49660. name: COMPONENT_NAME$3
  49661. });
  49662. const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
  49663. ...__default__$u,
  49664. props: tabBarProps,
  49665. setup(__props, { expose }) {
  49666. const props = __props;
  49667. const instance = vue.getCurrentInstance();
  49668. const rootTabs = vue.inject(tabsRootContextKey);
  49669. if (!rootTabs)
  49670. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  49671. const ns = useNamespace("tabs");
  49672. const barRef = vue.ref();
  49673. const barStyle = vue.ref();
  49674. const getBarStyle = () => {
  49675. let offset = 0;
  49676. let tabSize = 0;
  49677. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  49678. const sizeDir = sizeName === "width" ? "x" : "y";
  49679. const position = sizeDir === "x" ? "left" : "top";
  49680. props.tabs.every((tab) => {
  49681. var _a, _b;
  49682. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  49683. if (!$el)
  49684. return false;
  49685. if (!tab.active) {
  49686. return true;
  49687. }
  49688. offset = $el[`offset${capitalize(position)}`];
  49689. tabSize = $el[`client${capitalize(sizeName)}`];
  49690. const tabStyles = window.getComputedStyle($el);
  49691. if (sizeName === "width") {
  49692. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  49693. offset += Number.parseFloat(tabStyles.paddingLeft);
  49694. }
  49695. return false;
  49696. });
  49697. return {
  49698. [sizeName]: `${tabSize}px`,
  49699. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  49700. };
  49701. };
  49702. const update = () => barStyle.value = getBarStyle();
  49703. const saveObserver = [];
  49704. const observerTabs = () => {
  49705. var _a;
  49706. saveObserver.forEach((observer) => observer.stop());
  49707. saveObserver.length = 0;
  49708. const list = (_a = instance.parent) == null ? void 0 : _a.refs;
  49709. if (!list)
  49710. return;
  49711. for (const key in list) {
  49712. if (key.startsWith("tab-")) {
  49713. const _el = list[key];
  49714. if (_el) {
  49715. saveObserver.push(useResizeObserver(_el, update));
  49716. }
  49717. }
  49718. }
  49719. };
  49720. vue.watch(() => props.tabs, async () => {
  49721. await vue.nextTick();
  49722. update();
  49723. observerTabs();
  49724. }, { immediate: true });
  49725. const barObserever = useResizeObserver(barRef, () => update());
  49726. vue.onBeforeUnmount(() => {
  49727. saveObserver.forEach((observer) => observer.stop());
  49728. saveObserver.length = 0;
  49729. barObserever.stop();
  49730. });
  49731. expose({
  49732. ref: barRef,
  49733. update
  49734. });
  49735. return (_ctx, _cache) => {
  49736. return vue.openBlock(), vue.createElementBlock("div", {
  49737. ref_key: "barRef",
  49738. ref: barRef,
  49739. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  49740. style: vue.normalizeStyle(barStyle.value)
  49741. }, null, 6);
  49742. };
  49743. }
  49744. });
  49745. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__file", "tab-bar.vue"]]);
  49746. const tabNavProps = buildProps({
  49747. panes: {
  49748. type: definePropType(Array),
  49749. default: () => mutable([])
  49750. },
  49751. currentName: {
  49752. type: [String, Number],
  49753. default: ""
  49754. },
  49755. editable: Boolean,
  49756. type: {
  49757. type: String,
  49758. values: ["card", "border-card", ""],
  49759. default: ""
  49760. },
  49761. stretch: Boolean
  49762. });
  49763. const tabNavEmits = {
  49764. tabClick: (tab, tabName, ev) => ev instanceof Event,
  49765. tabRemove: (tab, ev) => ev instanceof Event
  49766. };
  49767. const COMPONENT_NAME$2 = "ElTabNav";
  49768. const TabNav = vue.defineComponent({
  49769. name: COMPONENT_NAME$2,
  49770. props: tabNavProps,
  49771. emits: tabNavEmits,
  49772. setup(props, {
  49773. expose,
  49774. emit
  49775. }) {
  49776. const rootTabs = vue.inject(tabsRootContextKey);
  49777. if (!rootTabs)
  49778. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  49779. const ns = useNamespace("tabs");
  49780. const visibility = useDocumentVisibility();
  49781. const focused = useWindowFocus();
  49782. const navScroll$ = vue.ref();
  49783. const nav$ = vue.ref();
  49784. const el$ = vue.ref();
  49785. const tabBarRef = vue.ref();
  49786. const scrollable = vue.ref(false);
  49787. const navOffset = vue.ref(0);
  49788. const isFocus = vue.ref(false);
  49789. const focusable = vue.ref(true);
  49790. const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  49791. const navStyle = vue.computed(() => {
  49792. const dir = sizeName.value === "width" ? "X" : "Y";
  49793. return {
  49794. transform: `translate${dir}(-${navOffset.value}px)`
  49795. };
  49796. });
  49797. const scrollPrev = () => {
  49798. if (!navScroll$.value)
  49799. return;
  49800. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49801. const currentOffset = navOffset.value;
  49802. if (!currentOffset)
  49803. return;
  49804. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  49805. navOffset.value = newOffset;
  49806. };
  49807. const scrollNext = () => {
  49808. if (!navScroll$.value || !nav$.value)
  49809. return;
  49810. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49811. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49812. const currentOffset = navOffset.value;
  49813. if (navSize - currentOffset <= containerSize)
  49814. return;
  49815. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  49816. navOffset.value = newOffset;
  49817. };
  49818. const scrollToActiveTab = async () => {
  49819. const nav = nav$.value;
  49820. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  49821. return;
  49822. await vue.nextTick();
  49823. const activeTab = el$.value.querySelector(".is-active");
  49824. if (!activeTab)
  49825. return;
  49826. const navScroll = navScroll$.value;
  49827. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  49828. const activeTabBounding = activeTab.getBoundingClientRect();
  49829. const navScrollBounding = navScroll.getBoundingClientRect();
  49830. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  49831. const currentOffset = navOffset.value;
  49832. let newOffset = currentOffset;
  49833. if (isHorizontal) {
  49834. if (activeTabBounding.left < navScrollBounding.left) {
  49835. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  49836. }
  49837. if (activeTabBounding.right > navScrollBounding.right) {
  49838. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  49839. }
  49840. } else {
  49841. if (activeTabBounding.top < navScrollBounding.top) {
  49842. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  49843. }
  49844. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  49845. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  49846. }
  49847. }
  49848. newOffset = Math.max(newOffset, 0);
  49849. navOffset.value = Math.min(newOffset, maxOffset);
  49850. };
  49851. const update = () => {
  49852. var _a;
  49853. if (!nav$.value || !navScroll$.value)
  49854. return;
  49855. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  49856. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49857. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49858. const currentOffset = navOffset.value;
  49859. if (containerSize < navSize) {
  49860. scrollable.value = scrollable.value || {};
  49861. scrollable.value.prev = currentOffset;
  49862. scrollable.value.next = currentOffset + containerSize < navSize;
  49863. if (navSize - currentOffset < containerSize) {
  49864. navOffset.value = navSize - containerSize;
  49865. }
  49866. } else {
  49867. scrollable.value = false;
  49868. if (currentOffset > 0) {
  49869. navOffset.value = 0;
  49870. }
  49871. }
  49872. };
  49873. const changeTab = (event) => {
  49874. let step = 0;
  49875. switch (event.code) {
  49876. case EVENT_CODE.left:
  49877. case EVENT_CODE.up:
  49878. step = -1;
  49879. break;
  49880. case EVENT_CODE.right:
  49881. case EVENT_CODE.down:
  49882. step = 1;
  49883. break;
  49884. default:
  49885. return;
  49886. }
  49887. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  49888. const currentIndex = tabList.indexOf(event.target);
  49889. let nextIndex = currentIndex + step;
  49890. if (nextIndex < 0) {
  49891. nextIndex = tabList.length - 1;
  49892. } else if (nextIndex >= tabList.length) {
  49893. nextIndex = 0;
  49894. }
  49895. tabList[nextIndex].focus({
  49896. preventScroll: true
  49897. });
  49898. tabList[nextIndex].click();
  49899. setFocus();
  49900. };
  49901. const setFocus = () => {
  49902. if (focusable.value)
  49903. isFocus.value = true;
  49904. };
  49905. const removeFocus = () => isFocus.value = false;
  49906. vue.watch(visibility, (visibility2) => {
  49907. if (visibility2 === "hidden") {
  49908. focusable.value = false;
  49909. } else if (visibility2 === "visible") {
  49910. setTimeout(() => focusable.value = true, 50);
  49911. }
  49912. });
  49913. vue.watch(focused, (focused2) => {
  49914. if (focused2) {
  49915. setTimeout(() => focusable.value = true, 50);
  49916. } else {
  49917. focusable.value = false;
  49918. }
  49919. });
  49920. useResizeObserver(el$, update);
  49921. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  49922. vue.onUpdated(() => update());
  49923. expose({
  49924. scrollToActiveTab,
  49925. removeFocus
  49926. });
  49927. return () => {
  49928. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  49929. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  49930. "onClick": scrollPrev
  49931. }, [vue.createVNode(ElIcon, null, {
  49932. default: () => [vue.createVNode(arrow_left_default, null, null)]
  49933. })]), vue.createVNode("span", {
  49934. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  49935. "onClick": scrollNext
  49936. }, [vue.createVNode(ElIcon, null, {
  49937. default: () => [vue.createVNode(arrow_right_default, null, null)]
  49938. })])] : null;
  49939. const tabs = props.panes.map((pane, index) => {
  49940. var _a, _b, _c, _d;
  49941. const uid = pane.uid;
  49942. const disabled = pane.props.disabled;
  49943. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  49944. const closable = !disabled && (pane.isClosable || props.editable);
  49945. pane.index = `${index}`;
  49946. const btnClose = closable ? vue.createVNode(ElIcon, {
  49947. "class": "is-icon-close",
  49948. "onClick": (ev) => emit("tabRemove", pane, ev)
  49949. }, {
  49950. default: () => [vue.createVNode(close_default, null, null)]
  49951. }) : null;
  49952. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  49953. const tabindex = !disabled && pane.active ? 0 : -1;
  49954. return vue.createVNode("div", {
  49955. "ref": `tab-${uid}`,
  49956. "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)],
  49957. "id": `tab-${tabName}`,
  49958. "key": `tab-${uid}`,
  49959. "aria-controls": `pane-${tabName}`,
  49960. "role": "tab",
  49961. "aria-selected": pane.active,
  49962. "tabindex": tabindex,
  49963. "onFocus": () => setFocus(),
  49964. "onBlur": () => removeFocus(),
  49965. "onClick": (ev) => {
  49966. removeFocus();
  49967. emit("tabClick", pane, tabName, ev);
  49968. },
  49969. "onKeydown": (ev) => {
  49970. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  49971. emit("tabRemove", pane, ev);
  49972. }
  49973. }
  49974. }, [...[tabLabelContent, btnClose]]);
  49975. });
  49976. return vue.createVNode("div", {
  49977. "ref": el$,
  49978. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  49979. }, [scrollBtn, vue.createVNode("div", {
  49980. "class": ns.e("nav-scroll"),
  49981. "ref": navScroll$
  49982. }, [vue.createVNode("div", {
  49983. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  49984. "ref": nav$,
  49985. "style": navStyle.value,
  49986. "role": "tablist",
  49987. "onKeydown": changeTab
  49988. }, [...[!props.type ? vue.createVNode(TabBar, {
  49989. "ref": tabBarRef,
  49990. "tabs": [...props.panes]
  49991. }, null) : null, tabs]])])]);
  49992. };
  49993. }
  49994. });
  49995. const tabsProps = buildProps({
  49996. type: {
  49997. type: String,
  49998. values: ["card", "border-card", ""],
  49999. default: ""
  50000. },
  50001. closable: Boolean,
  50002. addable: Boolean,
  50003. modelValue: {
  50004. type: [String, Number]
  50005. },
  50006. editable: Boolean,
  50007. tabPosition: {
  50008. type: String,
  50009. values: ["top", "right", "bottom", "left"],
  50010. default: "top"
  50011. },
  50012. beforeLeave: {
  50013. type: definePropType(Function),
  50014. default: () => true
  50015. },
  50016. stretch: Boolean
  50017. });
  50018. const isPaneName = (value) => isString$1(value) || isNumber(value);
  50019. const tabsEmits = {
  50020. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  50021. tabClick: (pane, ev) => ev instanceof Event,
  50022. tabChange: (name) => isPaneName(name),
  50023. edit: (paneName, action) => ["remove", "add"].includes(action),
  50024. tabRemove: (name) => isPaneName(name),
  50025. tabAdd: () => true
  50026. };
  50027. const Tabs = vue.defineComponent({
  50028. name: "ElTabs",
  50029. props: tabsProps,
  50030. emits: tabsEmits,
  50031. setup(props, {
  50032. emit,
  50033. slots,
  50034. expose
  50035. }) {
  50036. var _a;
  50037. const ns = useNamespace("tabs");
  50038. const isVertical = vue.computed(() => ["left", "right"].includes(props.tabPosition));
  50039. const {
  50040. children: panes,
  50041. addChild: sortPane,
  50042. removeChild: unregisterPane
  50043. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  50044. const nav$ = vue.ref();
  50045. const currentName = vue.ref((_a = props.modelValue) != null ? _a : "0");
  50046. const setCurrentName = async (value, trigger = false) => {
  50047. var _a2, _b;
  50048. if (currentName.value === value || isUndefined(value))
  50049. return;
  50050. try {
  50051. let canLeave;
  50052. if (props.beforeLeave) {
  50053. const result = props.beforeLeave(value, currentName.value);
  50054. canLeave = result instanceof Promise ? await result : result;
  50055. } else {
  50056. canLeave = true;
  50057. }
  50058. if (canLeave !== false) {
  50059. currentName.value = value;
  50060. if (trigger) {
  50061. emit(UPDATE_MODEL_EVENT, value);
  50062. emit("tabChange", value);
  50063. }
  50064. (_b = (_a2 = nav$.value) == null ? void 0 : _a2.removeFocus) == null ? void 0 : _b.call(_a2);
  50065. }
  50066. } catch (e) {
  50067. }
  50068. };
  50069. const handleTabClick = (tab, tabName, event) => {
  50070. if (tab.props.disabled)
  50071. return;
  50072. emit("tabClick", tab, event);
  50073. setCurrentName(tabName, true);
  50074. };
  50075. const handleTabRemove = (pane, ev) => {
  50076. if (pane.props.disabled || isUndefined(pane.props.name))
  50077. return;
  50078. ev.stopPropagation();
  50079. emit("edit", pane.props.name, "remove");
  50080. emit("tabRemove", pane.props.name);
  50081. };
  50082. const handleTabAdd = () => {
  50083. emit("edit", void 0, "add");
  50084. emit("tabAdd");
  50085. };
  50086. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  50087. vue.watch(currentName, async () => {
  50088. var _a2;
  50089. await vue.nextTick();
  50090. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  50091. });
  50092. vue.provide(tabsRootContextKey, {
  50093. props,
  50094. currentName,
  50095. registerPane: (pane) => {
  50096. panes.value.push(pane);
  50097. },
  50098. sortPane,
  50099. unregisterPane
  50100. });
  50101. expose({
  50102. currentName
  50103. });
  50104. const TabNavRenderer = ({
  50105. render
  50106. }) => {
  50107. return render();
  50108. };
  50109. return () => {
  50110. const addSlot = slots["add-icon"];
  50111. const newButton = props.editable || props.addable ? vue.createVNode("div", {
  50112. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  50113. "tabindex": "0",
  50114. "onClick": handleTabAdd,
  50115. "onKeydown": (ev) => {
  50116. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(ev.code))
  50117. handleTabAdd();
  50118. }
  50119. }, [addSlot ? vue.renderSlot(slots, "add-icon") : vue.createVNode(ElIcon, {
  50120. "class": ns.is("icon-plus")
  50121. }, {
  50122. default: () => [vue.createVNode(plus_default, null, null)]
  50123. })]) : null;
  50124. const header = vue.createVNode("div", {
  50125. "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
  50126. }, [vue.createVNode(TabNavRenderer, {
  50127. "render": () => {
  50128. const hasLabelSlot = panes.value.some((pane) => pane.slots.label);
  50129. return vue.createVNode(TabNav, {
  50130. ref: nav$,
  50131. currentName: currentName.value,
  50132. editable: props.editable,
  50133. type: props.type,
  50134. panes: panes.value,
  50135. stretch: props.stretch,
  50136. onTabClick: handleTabClick,
  50137. onTabRemove: handleTabRemove
  50138. }, {
  50139. $stable: !hasLabelSlot
  50140. });
  50141. }
  50142. }, null), newButton]);
  50143. const panels = vue.createVNode("div", {
  50144. "class": ns.e("content")
  50145. }, [vue.renderSlot(slots, "default")]);
  50146. return vue.createVNode("div", {
  50147. "class": [ns.b(), ns.m(props.tabPosition), {
  50148. [ns.m("card")]: props.type === "card",
  50149. [ns.m("border-card")]: props.type === "border-card"
  50150. }]
  50151. }, [panels, header]);
  50152. };
  50153. }
  50154. });
  50155. const tabPaneProps = buildProps({
  50156. label: {
  50157. type: String,
  50158. default: ""
  50159. },
  50160. name: {
  50161. type: [String, Number]
  50162. },
  50163. closable: Boolean,
  50164. disabled: Boolean,
  50165. lazy: Boolean
  50166. });
  50167. const COMPONENT_NAME$1 = "ElTabPane";
  50168. const __default__$t = vue.defineComponent({
  50169. name: COMPONENT_NAME$1
  50170. });
  50171. const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
  50172. ...__default__$t,
  50173. props: tabPaneProps,
  50174. setup(__props) {
  50175. const props = __props;
  50176. const instance = vue.getCurrentInstance();
  50177. const slots = vue.useSlots();
  50178. const tabsRoot = vue.inject(tabsRootContextKey);
  50179. if (!tabsRoot)
  50180. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  50181. const ns = useNamespace("tab-pane");
  50182. const index = vue.ref();
  50183. const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
  50184. const active = computedEager(() => {
  50185. var _a;
  50186. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  50187. });
  50188. const loaded = vue.ref(active.value);
  50189. const paneName = vue.computed(() => {
  50190. var _a;
  50191. return (_a = props.name) != null ? _a : index.value;
  50192. });
  50193. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  50194. vue.watch(active, (val) => {
  50195. if (val)
  50196. loaded.value = true;
  50197. });
  50198. const pane = vue.reactive({
  50199. uid: instance.uid,
  50200. slots,
  50201. props,
  50202. paneName,
  50203. active,
  50204. index,
  50205. isClosable
  50206. });
  50207. tabsRoot.registerPane(pane);
  50208. vue.onMounted(() => {
  50209. tabsRoot.sortPane(pane);
  50210. });
  50211. vue.onUnmounted(() => {
  50212. tabsRoot.unregisterPane(pane.uid);
  50213. });
  50214. return (_ctx, _cache) => {
  50215. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  50216. key: 0,
  50217. id: `pane-${vue.unref(paneName)}`,
  50218. class: vue.normalizeClass(vue.unref(ns).b()),
  50219. role: "tabpanel",
  50220. "aria-hidden": !vue.unref(active),
  50221. "aria-labelledby": `tab-${vue.unref(paneName)}`
  50222. }, [
  50223. vue.renderSlot(_ctx.$slots, "default")
  50224. ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
  50225. [vue.vShow, vue.unref(active)]
  50226. ]) : vue.createCommentVNode("v-if", true);
  50227. };
  50228. }
  50229. });
  50230. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "tab-pane.vue"]]);
  50231. const ElTabs = withInstall(Tabs, {
  50232. TabPane
  50233. });
  50234. const ElTabPane = withNoopInstall(TabPane);
  50235. const textProps = buildProps({
  50236. type: {
  50237. type: String,
  50238. values: ["primary", "success", "info", "warning", "danger", ""],
  50239. default: ""
  50240. },
  50241. size: {
  50242. type: String,
  50243. values: componentSizes,
  50244. default: ""
  50245. },
  50246. truncated: Boolean,
  50247. lineClamp: {
  50248. type: [String, Number]
  50249. },
  50250. tag: {
  50251. type: String,
  50252. default: "span"
  50253. }
  50254. });
  50255. const __default__$s = vue.defineComponent({
  50256. name: "ElText"
  50257. });
  50258. const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
  50259. ...__default__$s,
  50260. props: textProps,
  50261. setup(__props) {
  50262. const props = __props;
  50263. const textRef = vue.ref();
  50264. const textSize = useFormSize();
  50265. const ns = useNamespace("text");
  50266. const textKls = vue.computed(() => [
  50267. ns.b(),
  50268. ns.m(props.type),
  50269. ns.m(textSize.value),
  50270. ns.is("truncated", props.truncated),
  50271. ns.is("line-clamp", !isUndefined(props.lineClamp))
  50272. ]);
  50273. const inheritTitle = vue.useAttrs().title;
  50274. const bindTitle = () => {
  50275. var _a, _b, _c, _d, _e;
  50276. if (inheritTitle)
  50277. return;
  50278. let shouldAddTitle = false;
  50279. const text = ((_a = textRef.value) == null ? void 0 : _a.textContent) || "";
  50280. if (props.truncated) {
  50281. const width = (_b = textRef.value) == null ? void 0 : _b.offsetWidth;
  50282. const scrollWidth = (_c = textRef.value) == null ? void 0 : _c.scrollWidth;
  50283. if (width && scrollWidth && scrollWidth > width) {
  50284. shouldAddTitle = true;
  50285. }
  50286. } else if (!isUndefined(props.lineClamp)) {
  50287. const height = (_d = textRef.value) == null ? void 0 : _d.offsetHeight;
  50288. const scrollHeight = (_e = textRef.value) == null ? void 0 : _e.scrollHeight;
  50289. if (height && scrollHeight && scrollHeight > height) {
  50290. shouldAddTitle = true;
  50291. }
  50292. }
  50293. if (shouldAddTitle) {
  50294. textRef.value.setAttribute("title", text);
  50295. } else {
  50296. textRef.value.removeAttribute("title");
  50297. }
  50298. };
  50299. vue.onMounted(bindTitle);
  50300. vue.onUpdated(bindTitle);
  50301. return (_ctx, _cache) => {
  50302. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  50303. ref_key: "textRef",
  50304. ref: textRef,
  50305. class: vue.normalizeClass(vue.unref(textKls)),
  50306. style: vue.normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  50307. }, {
  50308. default: vue.withCtx(() => [
  50309. vue.renderSlot(_ctx.$slots, "default")
  50310. ]),
  50311. _: 3
  50312. }, 8, ["class", "style"]);
  50313. };
  50314. }
  50315. });
  50316. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "text.vue"]]);
  50317. const ElText = withInstall(Text);
  50318. const timeSelectProps = buildProps({
  50319. format: {
  50320. type: String,
  50321. default: "HH:mm"
  50322. },
  50323. modelValue: String,
  50324. disabled: Boolean,
  50325. editable: {
  50326. type: Boolean,
  50327. default: true
  50328. },
  50329. effect: {
  50330. type: definePropType(String),
  50331. default: "light"
  50332. },
  50333. clearable: {
  50334. type: Boolean,
  50335. default: true
  50336. },
  50337. size: useSizeProp,
  50338. placeholder: String,
  50339. start: {
  50340. type: String,
  50341. default: "09:00"
  50342. },
  50343. end: {
  50344. type: String,
  50345. default: "18:00"
  50346. },
  50347. step: {
  50348. type: String,
  50349. default: "00:30"
  50350. },
  50351. minTime: String,
  50352. maxTime: String,
  50353. includeEndTime: {
  50354. type: Boolean,
  50355. default: false
  50356. },
  50357. name: String,
  50358. prefixIcon: {
  50359. type: definePropType([String, Object]),
  50360. default: () => clock_default
  50361. },
  50362. clearIcon: {
  50363. type: definePropType([String, Object]),
  50364. default: () => circle_close_default
  50365. },
  50366. ...useEmptyValuesProps
  50367. });
  50368. const parseTime = (time) => {
  50369. const values = (time || "").split(":");
  50370. if (values.length >= 2) {
  50371. let hours = Number.parseInt(values[0], 10);
  50372. const minutes = Number.parseInt(values[1], 10);
  50373. const timeUpper = time.toUpperCase();
  50374. if (timeUpper.includes("AM") && hours === 12) {
  50375. hours = 0;
  50376. } else if (timeUpper.includes("PM") && hours !== 12) {
  50377. hours += 12;
  50378. }
  50379. return {
  50380. hours,
  50381. minutes
  50382. };
  50383. }
  50384. return null;
  50385. };
  50386. const compareTime = (time1, time2) => {
  50387. const value1 = parseTime(time1);
  50388. if (!value1)
  50389. return -1;
  50390. const value2 = parseTime(time2);
  50391. if (!value2)
  50392. return -1;
  50393. const minutes1 = value1.minutes + value1.hours * 60;
  50394. const minutes2 = value2.minutes + value2.hours * 60;
  50395. if (minutes1 === minutes2) {
  50396. return 0;
  50397. }
  50398. return minutes1 > minutes2 ? 1 : -1;
  50399. };
  50400. const padTime = (time) => {
  50401. return `${time}`.padStart(2, "0");
  50402. };
  50403. const formatTime = (time) => {
  50404. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  50405. };
  50406. const nextTime = (time, step) => {
  50407. const timeValue = parseTime(time);
  50408. if (!timeValue)
  50409. return "";
  50410. const stepValue = parseTime(step);
  50411. if (!stepValue)
  50412. return "";
  50413. const next = {
  50414. hours: timeValue.hours,
  50415. minutes: timeValue.minutes
  50416. };
  50417. next.minutes += stepValue.minutes;
  50418. next.hours += stepValue.hours;
  50419. next.hours += Math.floor(next.minutes / 60);
  50420. next.minutes = next.minutes % 60;
  50421. return formatTime(next);
  50422. };
  50423. const __default__$r = vue.defineComponent({
  50424. name: "ElTimeSelect"
  50425. });
  50426. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  50427. ...__default__$r,
  50428. props: timeSelectProps,
  50429. emits: [CHANGE_EVENT, "blur", "focus", "clear", UPDATE_MODEL_EVENT],
  50430. setup(__props, { expose }) {
  50431. const props = __props;
  50432. dayjs.extend(customParseFormat);
  50433. const { Option: ElOption } = ElSelect;
  50434. const nsInput = useNamespace("input");
  50435. const select = vue.ref();
  50436. const _disabled = useFormDisabled();
  50437. const { lang } = useLocale();
  50438. const value = vue.computed(() => props.modelValue);
  50439. const start = vue.computed(() => {
  50440. const time = parseTime(props.start);
  50441. return time ? formatTime(time) : null;
  50442. });
  50443. const end = vue.computed(() => {
  50444. const time = parseTime(props.end);
  50445. return time ? formatTime(time) : null;
  50446. });
  50447. const step = vue.computed(() => {
  50448. const time = parseTime(props.step);
  50449. return time ? formatTime(time) : null;
  50450. });
  50451. const minTime = vue.computed(() => {
  50452. const time = parseTime(props.minTime || "");
  50453. return time ? formatTime(time) : null;
  50454. });
  50455. const maxTime = vue.computed(() => {
  50456. const time = parseTime(props.maxTime || "");
  50457. return time ? formatTime(time) : null;
  50458. });
  50459. const items = vue.computed(() => {
  50460. var _a;
  50461. const result = [];
  50462. const push = (formattedValue, rawValue) => {
  50463. result.push({
  50464. value: formattedValue,
  50465. disabled: compareTime(rawValue, minTime.value || "-1:-1") <= 0 || compareTime(rawValue, maxTime.value || "100:100") >= 0
  50466. });
  50467. };
  50468. if (props.start && props.end && props.step) {
  50469. let current = start.value;
  50470. let currentTime;
  50471. while (current && end.value && compareTime(current, end.value) <= 0) {
  50472. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  50473. push(currentTime, current);
  50474. current = nextTime(current, step.value);
  50475. }
  50476. if (props.includeEndTime && end.value && ((_a = result[result.length - 1]) == null ? void 0 : _a.value) !== end.value) {
  50477. const formattedValue = dayjs(end.value, "HH:mm").locale(lang.value).format(props.format);
  50478. push(formattedValue, end.value);
  50479. }
  50480. }
  50481. return result;
  50482. });
  50483. const blur = () => {
  50484. var _a, _b;
  50485. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  50486. };
  50487. const focus = () => {
  50488. var _a, _b;
  50489. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  50490. };
  50491. expose({
  50492. blur,
  50493. focus
  50494. });
  50495. return (_ctx, _cache) => {
  50496. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  50497. ref_key: "select",
  50498. ref: select,
  50499. "model-value": vue.unref(value),
  50500. disabled: vue.unref(_disabled),
  50501. clearable: _ctx.clearable,
  50502. "clear-icon": _ctx.clearIcon,
  50503. size: _ctx.size,
  50504. effect: _ctx.effect,
  50505. placeholder: _ctx.placeholder,
  50506. "default-first-option": "",
  50507. filterable: _ctx.editable,
  50508. "empty-values": _ctx.emptyValues,
  50509. "value-on-clear": _ctx.valueOnClear,
  50510. "onUpdate:modelValue": (event) => _ctx.$emit(vue.unref(UPDATE_MODEL_EVENT), event),
  50511. onChange: (event) => _ctx.$emit(vue.unref(CHANGE_EVENT), event),
  50512. onBlur: (event) => _ctx.$emit("blur", event),
  50513. onFocus: (event) => _ctx.$emit("focus", event),
  50514. onClear: () => _ctx.$emit("clear")
  50515. }, {
  50516. prefix: vue.withCtx(() => [
  50517. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  50518. key: 0,
  50519. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  50520. }, {
  50521. default: vue.withCtx(() => [
  50522. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  50523. ]),
  50524. _: 1
  50525. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  50526. ]),
  50527. default: vue.withCtx(() => [
  50528. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  50529. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  50530. key: item.value,
  50531. label: item.value,
  50532. value: item.value,
  50533. disabled: item.disabled
  50534. }, null, 8, ["label", "value", "disabled"]);
  50535. }), 128))
  50536. ]),
  50537. _: 1
  50538. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
  50539. };
  50540. }
  50541. });
  50542. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "time-select.vue"]]);
  50543. const ElTimeSelect = withInstall(TimeSelect);
  50544. const Timeline = vue.defineComponent({
  50545. name: "ElTimeline",
  50546. setup(_, { slots }) {
  50547. const ns = useNamespace("timeline");
  50548. vue.provide("timeline", slots);
  50549. return () => {
  50550. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  50551. };
  50552. }
  50553. });
  50554. var Timeline$1 = Timeline;
  50555. const timelineItemProps = buildProps({
  50556. timestamp: {
  50557. type: String,
  50558. default: ""
  50559. },
  50560. hideTimestamp: Boolean,
  50561. center: Boolean,
  50562. placement: {
  50563. type: String,
  50564. values: ["top", "bottom"],
  50565. default: "bottom"
  50566. },
  50567. type: {
  50568. type: String,
  50569. values: ["primary", "success", "warning", "danger", "info"],
  50570. default: ""
  50571. },
  50572. color: {
  50573. type: String,
  50574. default: ""
  50575. },
  50576. size: {
  50577. type: String,
  50578. values: ["normal", "large"],
  50579. default: "normal"
  50580. },
  50581. icon: {
  50582. type: iconPropType
  50583. },
  50584. hollow: Boolean
  50585. });
  50586. const __default__$q = vue.defineComponent({
  50587. name: "ElTimelineItem"
  50588. });
  50589. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  50590. ...__default__$q,
  50591. props: timelineItemProps,
  50592. setup(__props) {
  50593. const props = __props;
  50594. const ns = useNamespace("timeline-item");
  50595. const defaultNodeKls = vue.computed(() => [
  50596. ns.e("node"),
  50597. ns.em("node", props.size || ""),
  50598. ns.em("node", props.type || ""),
  50599. ns.is("hollow", props.hollow)
  50600. ]);
  50601. return (_ctx, _cache) => {
  50602. return vue.openBlock(), vue.createElementBlock("li", {
  50603. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  50604. }, [
  50605. vue.createElementVNode("div", {
  50606. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  50607. }, null, 2),
  50608. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  50609. key: 0,
  50610. class: vue.normalizeClass(vue.unref(defaultNodeKls)),
  50611. style: vue.normalizeStyle({
  50612. backgroundColor: _ctx.color
  50613. })
  50614. }, [
  50615. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  50616. key: 0,
  50617. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  50618. }, {
  50619. default: vue.withCtx(() => [
  50620. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  50621. ]),
  50622. _: 1
  50623. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  50624. ], 6)) : vue.createCommentVNode("v-if", true),
  50625. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  50626. key: 1,
  50627. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  50628. }, [
  50629. vue.renderSlot(_ctx.$slots, "dot")
  50630. ], 2)) : vue.createCommentVNode("v-if", true),
  50631. vue.createElementVNode("div", {
  50632. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  50633. }, [
  50634. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  50635. key: 0,
  50636. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  50637. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  50638. vue.createElementVNode("div", {
  50639. class: vue.normalizeClass(vue.unref(ns).e("content"))
  50640. }, [
  50641. vue.renderSlot(_ctx.$slots, "default")
  50642. ], 2),
  50643. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  50644. key: 1,
  50645. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  50646. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  50647. ], 2)
  50648. ], 2);
  50649. };
  50650. }
  50651. });
  50652. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "timeline-item.vue"]]);
  50653. const ElTimeline = withInstall(Timeline$1, {
  50654. TimelineItem
  50655. });
  50656. const ElTimelineItem = withNoopInstall(TimelineItem);
  50657. const tooltipV2CommonProps = buildProps({
  50658. nowrap: Boolean
  50659. });
  50660. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  50661. TooltipV2Sides2["top"] = "top";
  50662. TooltipV2Sides2["bottom"] = "bottom";
  50663. TooltipV2Sides2["left"] = "left";
  50664. TooltipV2Sides2["right"] = "right";
  50665. return TooltipV2Sides2;
  50666. })(TooltipV2Sides || {});
  50667. const tooltipV2Sides = Object.values(TooltipV2Sides);
  50668. const tooltipV2ArrowProps = buildProps({
  50669. width: {
  50670. type: Number,
  50671. default: 10
  50672. },
  50673. height: {
  50674. type: Number,
  50675. default: 10
  50676. },
  50677. style: {
  50678. type: definePropType(Object),
  50679. default: null
  50680. }
  50681. });
  50682. const tooltipV2ArrowSpecialProps = buildProps({
  50683. side: {
  50684. type: definePropType(String),
  50685. values: tooltipV2Sides,
  50686. required: true
  50687. }
  50688. });
  50689. const tooltipV2Strategies = ["absolute", "fixed"];
  50690. const tooltipV2Placements = [
  50691. "top-start",
  50692. "top-end",
  50693. "top",
  50694. "bottom-start",
  50695. "bottom-end",
  50696. "bottom",
  50697. "left-start",
  50698. "left-end",
  50699. "left",
  50700. "right-start",
  50701. "right-end",
  50702. "right"
  50703. ];
  50704. const tooltipV2ContentProps = buildProps({
  50705. arrowPadding: {
  50706. type: definePropType(Number),
  50707. default: 5
  50708. },
  50709. effect: {
  50710. type: definePropType(String),
  50711. default: "light"
  50712. },
  50713. contentClass: String,
  50714. placement: {
  50715. type: definePropType(String),
  50716. values: tooltipV2Placements,
  50717. default: "bottom"
  50718. },
  50719. reference: {
  50720. type: definePropType(Object),
  50721. default: null
  50722. },
  50723. offset: {
  50724. type: Number,
  50725. default: 8
  50726. },
  50727. strategy: {
  50728. type: definePropType(String),
  50729. values: tooltipV2Strategies,
  50730. default: "absolute"
  50731. },
  50732. showArrow: Boolean,
  50733. ...useAriaProps(["ariaLabel"])
  50734. });
  50735. const tooltipV2RootProps = buildProps({
  50736. delayDuration: {
  50737. type: Number,
  50738. default: 300
  50739. },
  50740. defaultOpen: Boolean,
  50741. open: {
  50742. type: Boolean,
  50743. default: void 0
  50744. },
  50745. onOpenChange: {
  50746. type: definePropType(Function)
  50747. },
  50748. "onUpdate:open": {
  50749. type: definePropType(Function)
  50750. }
  50751. });
  50752. const EventHandler = {
  50753. type: definePropType(Function)
  50754. };
  50755. const tooltipV2TriggerProps = buildProps({
  50756. onBlur: EventHandler,
  50757. onClick: EventHandler,
  50758. onFocus: EventHandler,
  50759. onMouseDown: EventHandler,
  50760. onMouseEnter: EventHandler,
  50761. onMouseLeave: EventHandler
  50762. });
  50763. const tooltipV2Props = buildProps({
  50764. ...tooltipV2RootProps,
  50765. ...tooltipV2ArrowProps,
  50766. ...tooltipV2TriggerProps,
  50767. ...tooltipV2ContentProps,
  50768. alwaysOn: Boolean,
  50769. fullTransition: Boolean,
  50770. transitionProps: {
  50771. type: definePropType(Object),
  50772. default: null
  50773. },
  50774. teleported: Boolean,
  50775. to: {
  50776. type: definePropType(String),
  50777. default: "body"
  50778. }
  50779. });
  50780. const tooltipV2RootKey = Symbol("tooltipV2");
  50781. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  50782. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  50783. const __default__$p = vue.defineComponent({
  50784. name: "ElTooltipV2Root"
  50785. });
  50786. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  50787. ...__default__$p,
  50788. props: tooltipV2RootProps,
  50789. setup(__props, { expose }) {
  50790. const props = __props;
  50791. const _open = vue.ref(props.defaultOpen);
  50792. const triggerRef = vue.ref(null);
  50793. const open = vue.computed({
  50794. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  50795. set: (open2) => {
  50796. var _a;
  50797. _open.value = open2;
  50798. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  50799. }
  50800. });
  50801. const isOpenDelayed = vue.computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  50802. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  50803. open.value = true;
  50804. }, vue.computed(() => props.delayDuration), {
  50805. immediate: false
  50806. });
  50807. const ns = useNamespace("tooltip-v2");
  50808. const contentId = useId();
  50809. const onNormalOpen = () => {
  50810. clearTimer();
  50811. open.value = true;
  50812. };
  50813. const onDelayOpen = () => {
  50814. vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  50815. };
  50816. const onOpen = onNormalOpen;
  50817. const onClose = () => {
  50818. clearTimer();
  50819. open.value = false;
  50820. };
  50821. const onChange = (open2) => {
  50822. var _a;
  50823. if (open2) {
  50824. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  50825. onOpen();
  50826. }
  50827. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  50828. };
  50829. vue.watch(open, onChange);
  50830. vue.onMounted(() => {
  50831. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  50832. });
  50833. vue.onBeforeUnmount(() => {
  50834. clearTimer();
  50835. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  50836. });
  50837. vue.provide(tooltipV2RootKey, {
  50838. contentId,
  50839. triggerRef,
  50840. ns,
  50841. onClose,
  50842. onDelayOpen,
  50843. onOpen
  50844. });
  50845. expose({
  50846. onOpen,
  50847. onClose
  50848. });
  50849. return (_ctx, _cache) => {
  50850. return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) });
  50851. };
  50852. }
  50853. });
  50854. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "root.vue"]]);
  50855. const __default__$o = vue.defineComponent({
  50856. name: "ElTooltipV2Arrow"
  50857. });
  50858. const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
  50859. ...__default__$o,
  50860. props: {
  50861. ...tooltipV2ArrowProps,
  50862. ...tooltipV2ArrowSpecialProps
  50863. },
  50864. setup(__props) {
  50865. const props = __props;
  50866. const { ns } = vue.inject(tooltipV2RootKey);
  50867. const { arrowRef } = vue.inject(tooltipV2ContentKey);
  50868. const arrowStyle = vue.computed(() => {
  50869. const { style, width, height } = props;
  50870. const namespace = ns.namespace.value;
  50871. return {
  50872. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  50873. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  50874. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  50875. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  50876. ...style || {}
  50877. };
  50878. });
  50879. return (_ctx, _cache) => {
  50880. return vue.openBlock(), vue.createElementBlock("span", {
  50881. ref_key: "arrowRef",
  50882. ref: arrowRef,
  50883. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  50884. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  50885. }, null, 6);
  50886. };
  50887. }
  50888. });
  50889. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "arrow.vue"]]);
  50890. const visualHiddenProps = buildProps({
  50891. style: {
  50892. type: definePropType([String, Object, Array]),
  50893. default: () => ({})
  50894. }
  50895. });
  50896. const __default__$n = vue.defineComponent({
  50897. name: "ElVisuallyHidden"
  50898. });
  50899. const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
  50900. ...__default__$n,
  50901. props: visualHiddenProps,
  50902. setup(__props) {
  50903. const props = __props;
  50904. const computedStyle = vue.computed(() => {
  50905. return [
  50906. props.style,
  50907. {
  50908. position: "absolute",
  50909. border: 0,
  50910. width: 1,
  50911. height: 1,
  50912. padding: 0,
  50913. margin: -1,
  50914. overflow: "hidden",
  50915. clip: "rect(0, 0, 0, 0)",
  50916. whiteSpace: "nowrap",
  50917. wordWrap: "normal"
  50918. }
  50919. ];
  50920. });
  50921. return (_ctx, _cache) => {
  50922. return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
  50923. vue.renderSlot(_ctx.$slots, "default")
  50924. ], 16);
  50925. };
  50926. }
  50927. });
  50928. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "visual-hidden.vue"]]);
  50929. const __default__$m = vue.defineComponent({
  50930. name: "ElTooltipV2Content"
  50931. });
  50932. const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
  50933. ...__default__$m,
  50934. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  50935. setup(__props) {
  50936. const props = __props;
  50937. const { triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  50938. const placement = vue.ref(props.placement);
  50939. const strategy = vue.ref(props.strategy);
  50940. const arrowRef = vue.ref(null);
  50941. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating$1({
  50942. placement,
  50943. strategy,
  50944. middleware: vue.computed(() => {
  50945. const middleware = [offset(props.offset)];
  50946. if (props.showArrow) {
  50947. middleware.push(arrowMiddleware({
  50948. arrowRef
  50949. }));
  50950. }
  50951. return middleware;
  50952. })
  50953. });
  50954. const zIndex = useZIndex().nextZIndex();
  50955. const ns = useNamespace("tooltip-v2");
  50956. const side = vue.computed(() => {
  50957. return placement.value.split("-")[0];
  50958. });
  50959. const contentStyle = vue.computed(() => {
  50960. return {
  50961. position: vue.unref(strategy),
  50962. top: `${vue.unref(y) || 0}px`,
  50963. left: `${vue.unref(x) || 0}px`,
  50964. zIndex
  50965. };
  50966. });
  50967. const arrowStyle = vue.computed(() => {
  50968. if (!props.showArrow)
  50969. return {};
  50970. const { arrow } = vue.unref(middlewareData);
  50971. return {
  50972. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  50973. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  50974. };
  50975. });
  50976. const contentClass = vue.computed(() => [
  50977. ns.e("content"),
  50978. ns.is("dark", props.effect === "dark"),
  50979. ns.is(vue.unref(strategy)),
  50980. props.contentClass
  50981. ]);
  50982. vue.watch(arrowRef, () => update());
  50983. vue.watch(() => props.placement, (val) => placement.value = val);
  50984. vue.onMounted(() => {
  50985. vue.watch(() => props.reference || triggerRef.value, (el) => {
  50986. referenceRef.value = el || void 0;
  50987. }, {
  50988. immediate: true
  50989. });
  50990. });
  50991. vue.provide(tooltipV2ContentKey, { arrowRef });
  50992. return (_ctx, _cache) => {
  50993. return vue.openBlock(), vue.createElementBlock("div", {
  50994. ref_key: "contentRef",
  50995. ref: contentRef,
  50996. style: vue.normalizeStyle(vue.unref(contentStyle)),
  50997. "data-tooltip-v2-root": ""
  50998. }, [
  50999. !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", {
  51000. key: 0,
  51001. "data-side": vue.unref(side),
  51002. class: vue.normalizeClass(vue.unref(contentClass))
  51003. }, [
  51004. vue.renderSlot(_ctx.$slots, "default", {
  51005. contentStyle: vue.unref(contentStyle),
  51006. contentClass: vue.unref(contentClass)
  51007. }),
  51008. vue.createVNode(vue.unref(ElVisuallyHidden), {
  51009. id: vue.unref(contentId),
  51010. role: "tooltip"
  51011. }, {
  51012. default: vue.withCtx(() => [
  51013. _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  51014. vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1)
  51015. ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
  51016. ]),
  51017. _: 3
  51018. }, 8, ["id"]),
  51019. vue.renderSlot(_ctx.$slots, "arrow", {
  51020. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  51021. side: vue.unref(side)
  51022. })
  51023. ], 10, ["data-side"])) : vue.createCommentVNode("v-if", true)
  51024. ], 4);
  51025. };
  51026. }
  51027. });
  51028. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "content.vue"]]);
  51029. const forwardRefProps = buildProps({
  51030. setRef: {
  51031. type: definePropType(Function),
  51032. required: true
  51033. },
  51034. onlyChild: Boolean
  51035. });
  51036. var ForwardRef = vue.defineComponent({
  51037. props: forwardRefProps,
  51038. setup(props, {
  51039. slots
  51040. }) {
  51041. const fragmentRef = vue.ref();
  51042. const setRef = composeRefs(fragmentRef, (el) => {
  51043. if (el) {
  51044. props.setRef(el.nextElementSibling);
  51045. } else {
  51046. props.setRef(null);
  51047. }
  51048. });
  51049. return () => {
  51050. var _a;
  51051. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  51052. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  51053. return vue.createVNode(vue.Fragment, {
  51054. "ref": setRef
  51055. }, [child]);
  51056. };
  51057. }
  51058. });
  51059. const __default__$l = vue.defineComponent({
  51060. name: "ElTooltipV2Trigger"
  51061. });
  51062. const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
  51063. ...__default__$l,
  51064. props: {
  51065. ...tooltipV2CommonProps,
  51066. ...tooltipV2TriggerProps
  51067. },
  51068. setup(__props) {
  51069. const props = __props;
  51070. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  51071. let isMousedown = false;
  51072. const setTriggerRef = (el) => {
  51073. triggerRef.value = el;
  51074. };
  51075. const onMouseup = () => {
  51076. isMousedown = false;
  51077. };
  51078. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  51079. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  51080. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  51081. onClose();
  51082. isMousedown = true;
  51083. document.addEventListener("mouseup", onMouseup, { once: true });
  51084. });
  51085. const onFocus = composeEventHandlers(props.onFocus, () => {
  51086. if (!isMousedown)
  51087. onOpen();
  51088. });
  51089. const onBlur = composeEventHandlers(props.onBlur, onClose);
  51090. const onClick = composeEventHandlers(props.onClick, (e) => {
  51091. if (e.detail === 0)
  51092. onClose();
  51093. });
  51094. const events = {
  51095. blur: onBlur,
  51096. click: onClick,
  51097. focus: onFocus,
  51098. mousedown: onMousedown,
  51099. mouseenter: onMouseenter,
  51100. mouseleave: onMouseleave
  51101. };
  51102. const setEvents = (el, events2, type) => {
  51103. if (el) {
  51104. Object.entries(events2).forEach(([name, handler]) => {
  51105. el[type](name, handler);
  51106. });
  51107. }
  51108. };
  51109. vue.watch(triggerRef, (triggerEl, previousTriggerEl) => {
  51110. setEvents(triggerEl, events, "addEventListener");
  51111. setEvents(previousTriggerEl, events, "removeEventListener");
  51112. if (triggerEl) {
  51113. triggerEl.setAttribute("aria-describedby", contentId.value);
  51114. }
  51115. });
  51116. vue.onBeforeUnmount(() => {
  51117. setEvents(triggerRef.value, events, "removeEventListener");
  51118. document.removeEventListener("mouseup", onMouseup);
  51119. });
  51120. return (_ctx, _cache) => {
  51121. return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), {
  51122. key: 0,
  51123. "set-ref": setTriggerRef,
  51124. "only-child": ""
  51125. }, {
  51126. default: vue.withCtx(() => [
  51127. vue.renderSlot(_ctx.$slots, "default")
  51128. ]),
  51129. _: 3
  51130. })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
  51131. key: 1,
  51132. ref_key: "triggerRef",
  51133. ref: triggerRef
  51134. }, _ctx.$attrs), [
  51135. vue.renderSlot(_ctx.$slots, "default")
  51136. ], 16));
  51137. };
  51138. }
  51139. });
  51140. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "trigger.vue"]]);
  51141. const __default__$k = vue.defineComponent({
  51142. name: "ElTooltipV2"
  51143. });
  51144. const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
  51145. ...__default__$k,
  51146. props: tooltipV2Props,
  51147. setup(__props) {
  51148. const props = __props;
  51149. const refedProps = vue.toRefs(props);
  51150. const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  51151. const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  51152. const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  51153. const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  51154. return (_ctx, _cache) => {
  51155. return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), {
  51156. default: vue.withCtx(({ open }) => [
  51157. vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), {
  51158. default: vue.withCtx(() => [
  51159. vue.renderSlot(_ctx.$slots, "trigger")
  51160. ]),
  51161. _: 3
  51162. }, 16),
  51163. vue.createVNode(vue.unref(ElTeleport$1), {
  51164. to: _ctx.to,
  51165. disabled: !_ctx.teleported
  51166. }, {
  51167. default: vue.withCtx(() => [
  51168. _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), {
  51169. default: vue.withCtx(() => [
  51170. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  51171. arrow: vue.withCtx(({ style, side }) => [
  51172. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  51173. style,
  51174. side
  51175. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  51176. ]),
  51177. default: vue.withCtx(() => [
  51178. vue.renderSlot(_ctx.$slots, "default")
  51179. ]),
  51180. _: 3
  51181. }, 16)) : vue.createCommentVNode("v-if", true)
  51182. ]),
  51183. _: 2
  51184. }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  51185. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  51186. arrow: vue.withCtx(({ style, side }) => [
  51187. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  51188. style,
  51189. side
  51190. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  51191. ]),
  51192. default: vue.withCtx(() => [
  51193. vue.renderSlot(_ctx.$slots, "default")
  51194. ]),
  51195. _: 3
  51196. }, 16)) : vue.createCommentVNode("v-if", true)
  51197. ], 64))
  51198. ]),
  51199. _: 2
  51200. }, 1032, ["to", "disabled"])
  51201. ]),
  51202. _: 3
  51203. }, 16);
  51204. };
  51205. }
  51206. });
  51207. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tooltip.vue"]]);
  51208. const ElTooltipV2 = withInstall(TooltipV2);
  51209. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  51210. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  51211. const transferProps = buildProps({
  51212. data: {
  51213. type: definePropType(Array),
  51214. default: () => []
  51215. },
  51216. titles: {
  51217. type: definePropType(Array),
  51218. default: () => []
  51219. },
  51220. buttonTexts: {
  51221. type: definePropType(Array),
  51222. default: () => []
  51223. },
  51224. filterPlaceholder: String,
  51225. filterMethod: {
  51226. type: definePropType(Function)
  51227. },
  51228. leftDefaultChecked: {
  51229. type: definePropType(Array),
  51230. default: () => []
  51231. },
  51232. rightDefaultChecked: {
  51233. type: definePropType(Array),
  51234. default: () => []
  51235. },
  51236. renderContent: {
  51237. type: definePropType(Function)
  51238. },
  51239. modelValue: {
  51240. type: definePropType(Array),
  51241. default: () => []
  51242. },
  51243. format: {
  51244. type: definePropType(Object),
  51245. default: () => ({})
  51246. },
  51247. filterable: Boolean,
  51248. props: {
  51249. type: definePropType(Object),
  51250. default: () => mutable({
  51251. label: "label",
  51252. key: "key",
  51253. disabled: "disabled"
  51254. })
  51255. },
  51256. targetOrder: {
  51257. type: String,
  51258. values: ["original", "push", "unshift"],
  51259. default: "original"
  51260. },
  51261. validateEvent: {
  51262. type: Boolean,
  51263. default: true
  51264. }
  51265. });
  51266. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  51267. const transferEmits = {
  51268. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  51269. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  51270. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  51271. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  51272. };
  51273. const CHECKED_CHANGE_EVENT = "checked-change";
  51274. const transferPanelProps = buildProps({
  51275. data: transferProps.data,
  51276. optionRender: {
  51277. type: definePropType(Function)
  51278. },
  51279. placeholder: String,
  51280. title: String,
  51281. filterable: Boolean,
  51282. format: transferProps.format,
  51283. filterMethod: transferProps.filterMethod,
  51284. defaultChecked: transferProps.leftDefaultChecked,
  51285. props: transferProps.props
  51286. });
  51287. const transferPanelEmits = {
  51288. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  51289. };
  51290. const usePropsAlias = (props) => {
  51291. const initProps = {
  51292. label: "label",
  51293. key: "key",
  51294. disabled: "disabled"
  51295. };
  51296. return vue.computed(() => ({
  51297. ...initProps,
  51298. ...props.props
  51299. }));
  51300. };
  51301. const useCheck$1 = (props, panelState, emit) => {
  51302. const propsAlias = usePropsAlias(props);
  51303. const filteredData = vue.computed(() => {
  51304. return props.data.filter((item) => {
  51305. if (isFunction$1(props.filterMethod)) {
  51306. return props.filterMethod(panelState.query, item);
  51307. } else {
  51308. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  51309. return label.toLowerCase().includes(panelState.query.toLowerCase());
  51310. }
  51311. });
  51312. });
  51313. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  51314. const checkedSummary = vue.computed(() => {
  51315. const checkedLength = panelState.checked.length;
  51316. const dataLength = props.data.length;
  51317. const { noChecked, hasChecked } = props.format;
  51318. if (noChecked && hasChecked) {
  51319. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  51320. } else {
  51321. return `${checkedLength}/${dataLength}`;
  51322. }
  51323. });
  51324. const isIndeterminate = vue.computed(() => {
  51325. const checkedLength = panelState.checked.length;
  51326. return checkedLength > 0 && checkedLength < checkableData.value.length;
  51327. });
  51328. const updateAllChecked = () => {
  51329. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  51330. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  51331. };
  51332. const handleAllCheckedChange = (value) => {
  51333. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  51334. };
  51335. vue.watch(() => panelState.checked, (val, oldVal) => {
  51336. updateAllChecked();
  51337. if (panelState.checkChangeByUser) {
  51338. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  51339. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  51340. } else {
  51341. emit(CHECKED_CHANGE_EVENT, val);
  51342. panelState.checkChangeByUser = true;
  51343. }
  51344. });
  51345. vue.watch(checkableData, () => {
  51346. updateAllChecked();
  51347. });
  51348. vue.watch(() => props.data, () => {
  51349. const checked = [];
  51350. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  51351. panelState.checked.forEach((item) => {
  51352. if (filteredDataKeys.includes(item)) {
  51353. checked.push(item);
  51354. }
  51355. });
  51356. panelState.checkChangeByUser = false;
  51357. panelState.checked = checked;
  51358. });
  51359. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  51360. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  51361. return;
  51362. const checked = [];
  51363. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  51364. val.forEach((item) => {
  51365. if (checkableDataKeys.includes(item)) {
  51366. checked.push(item);
  51367. }
  51368. });
  51369. panelState.checkChangeByUser = false;
  51370. panelState.checked = checked;
  51371. }, {
  51372. immediate: true
  51373. });
  51374. return {
  51375. filteredData,
  51376. checkableData,
  51377. checkedSummary,
  51378. isIndeterminate,
  51379. updateAllChecked,
  51380. handleAllCheckedChange
  51381. };
  51382. };
  51383. const useCheckedChange = (checkedState, emit) => {
  51384. const onSourceCheckedChange = (val, movedKeys) => {
  51385. checkedState.leftChecked = val;
  51386. if (!movedKeys)
  51387. return;
  51388. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  51389. };
  51390. const onTargetCheckedChange = (val, movedKeys) => {
  51391. checkedState.rightChecked = val;
  51392. if (!movedKeys)
  51393. return;
  51394. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  51395. };
  51396. return {
  51397. onSourceCheckedChange,
  51398. onTargetCheckedChange
  51399. };
  51400. };
  51401. const useComputedData = (props) => {
  51402. const propsAlias = usePropsAlias(props);
  51403. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  51404. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  51405. const targetData = vue.computed(() => {
  51406. if (props.targetOrder === "original") {
  51407. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  51408. } else {
  51409. return props.modelValue.reduce((arr, cur) => {
  51410. const val = dataObj.value[cur];
  51411. if (val) {
  51412. arr.push(val);
  51413. }
  51414. return arr;
  51415. }, []);
  51416. }
  51417. });
  51418. return {
  51419. sourceData,
  51420. targetData
  51421. };
  51422. };
  51423. const useMove = (props, checkedState, emit) => {
  51424. const propsAlias = usePropsAlias(props);
  51425. const _emit = (value, direction, movedKeys) => {
  51426. emit(UPDATE_MODEL_EVENT, value);
  51427. emit(CHANGE_EVENT, value, direction, movedKeys);
  51428. };
  51429. const addToLeft = () => {
  51430. const currentValue = props.modelValue.slice();
  51431. checkedState.rightChecked.forEach((item) => {
  51432. const index = currentValue.indexOf(item);
  51433. if (index > -1) {
  51434. currentValue.splice(index, 1);
  51435. }
  51436. });
  51437. _emit(currentValue, "left", checkedState.rightChecked);
  51438. };
  51439. const addToRight = () => {
  51440. let currentValue = props.modelValue.slice();
  51441. const itemsToBeMoved = props.data.filter((item) => {
  51442. const itemKey = item[propsAlias.value.key];
  51443. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  51444. }).map((item) => item[propsAlias.value.key]);
  51445. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  51446. if (props.targetOrder === "original") {
  51447. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  51448. }
  51449. _emit(currentValue, "right", checkedState.leftChecked);
  51450. };
  51451. return {
  51452. addToLeft,
  51453. addToRight
  51454. };
  51455. };
  51456. const __default__$j = vue.defineComponent({
  51457. name: "ElTransferPanel"
  51458. });
  51459. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  51460. ...__default__$j,
  51461. props: transferPanelProps,
  51462. emits: transferPanelEmits,
  51463. setup(__props, { expose, emit }) {
  51464. const props = __props;
  51465. const slots = vue.useSlots();
  51466. const OptionContent = ({ option }) => option;
  51467. const { t } = useLocale();
  51468. const ns = useNamespace("transfer");
  51469. const panelState = vue.reactive({
  51470. checked: [],
  51471. allChecked: false,
  51472. query: "",
  51473. checkChangeByUser: true
  51474. });
  51475. const propsAlias = usePropsAlias(props);
  51476. const {
  51477. filteredData,
  51478. checkedSummary,
  51479. isIndeterminate,
  51480. handleAllCheckedChange
  51481. } = useCheck$1(props, panelState, emit);
  51482. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  51483. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  51484. const { checked, allChecked, query } = vue.toRefs(panelState);
  51485. expose({
  51486. query
  51487. });
  51488. return (_ctx, _cache) => {
  51489. return vue.openBlock(), vue.createElementBlock("div", {
  51490. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  51491. }, [
  51492. vue.createElementVNode("p", {
  51493. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  51494. }, [
  51495. vue.createVNode(vue.unref(ElCheckbox), {
  51496. modelValue: vue.unref(allChecked),
  51497. "onUpdate:modelValue": ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null,
  51498. indeterminate: vue.unref(isIndeterminate),
  51499. "validate-event": false,
  51500. onChange: vue.unref(handleAllCheckedChange)
  51501. }, {
  51502. default: vue.withCtx(() => [
  51503. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  51504. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  51505. ]),
  51506. _: 1
  51507. }, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "onChange"])
  51508. ], 2),
  51509. vue.createElementVNode("div", {
  51510. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  51511. }, [
  51512. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  51513. key: 0,
  51514. modelValue: vue.unref(query),
  51515. "onUpdate:modelValue": ($event) => vue.isRef(query) ? query.value = $event : null,
  51516. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  51517. size: "default",
  51518. placeholder: _ctx.placeholder,
  51519. "prefix-icon": vue.unref(search_default),
  51520. clearable: "",
  51521. "validate-event": false
  51522. }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  51523. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  51524. modelValue: vue.unref(checked),
  51525. "onUpdate:modelValue": ($event) => vue.isRef(checked) ? checked.value = $event : null,
  51526. "validate-event": false,
  51527. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  51528. }, {
  51529. default: vue.withCtx(() => [
  51530. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  51531. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  51532. key: item[vue.unref(propsAlias).key],
  51533. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  51534. value: item[vue.unref(propsAlias).key],
  51535. disabled: item[vue.unref(propsAlias).disabled],
  51536. "validate-event": false
  51537. }, {
  51538. default: vue.withCtx(() => {
  51539. var _a;
  51540. return [
  51541. vue.createVNode(OptionContent, {
  51542. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  51543. }, null, 8, ["option"])
  51544. ];
  51545. }),
  51546. _: 2
  51547. }, 1032, ["class", "value", "disabled"]);
  51548. }), 128))
  51549. ]),
  51550. _: 1
  51551. }, 8, ["modelValue", "onUpdate:modelValue", "class"]), [
  51552. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  51553. ]),
  51554. vue.withDirectives(vue.createElementVNode("div", {
  51555. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  51556. }, [
  51557. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  51558. vue.createTextVNode(vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 1)
  51559. ])
  51560. ], 2), [
  51561. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  51562. ])
  51563. ], 2),
  51564. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  51565. key: 0,
  51566. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  51567. }, [
  51568. vue.renderSlot(_ctx.$slots, "default")
  51569. ], 2)) : vue.createCommentVNode("v-if", true)
  51570. ], 2);
  51571. };
  51572. }
  51573. });
  51574. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "transfer-panel.vue"]]);
  51575. const __default__$i = vue.defineComponent({
  51576. name: "ElTransfer"
  51577. });
  51578. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  51579. ...__default__$i,
  51580. props: transferProps,
  51581. emits: transferEmits,
  51582. setup(__props, { expose, emit }) {
  51583. const props = __props;
  51584. const slots = vue.useSlots();
  51585. const { t } = useLocale();
  51586. const ns = useNamespace("transfer");
  51587. const { formItem } = useFormItem();
  51588. const checkedState = vue.reactive({
  51589. leftChecked: [],
  51590. rightChecked: []
  51591. });
  51592. const propsAlias = usePropsAlias(props);
  51593. const { sourceData, targetData } = useComputedData(props);
  51594. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  51595. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  51596. const leftPanel = vue.ref();
  51597. const rightPanel = vue.ref();
  51598. const clearQuery = (which) => {
  51599. switch (which) {
  51600. case "left":
  51601. leftPanel.value.query = "";
  51602. break;
  51603. case "right":
  51604. rightPanel.value.query = "";
  51605. break;
  51606. }
  51607. };
  51608. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  51609. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  51610. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  51611. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  51612. vue.watch(() => props.modelValue, () => {
  51613. var _a;
  51614. if (props.validateEvent) {
  51615. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  51616. }
  51617. });
  51618. const optionRender = vue.computed(() => (option) => {
  51619. var _a;
  51620. if (props.renderContent)
  51621. return props.renderContent(vue.h, option);
  51622. const defaultSlotVNodes = (((_a = slots.default) == null ? void 0 : _a.call(slots, { option })) || []).filter((node) => node.type !== vue.Comment);
  51623. if (defaultSlotVNodes.length) {
  51624. return defaultSlotVNodes;
  51625. }
  51626. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  51627. });
  51628. expose({
  51629. clearQuery,
  51630. leftPanel,
  51631. rightPanel
  51632. });
  51633. return (_ctx, _cache) => {
  51634. return vue.openBlock(), vue.createElementBlock("div", {
  51635. class: vue.normalizeClass(vue.unref(ns).b())
  51636. }, [
  51637. vue.createVNode(TransferPanel, {
  51638. ref_key: "leftPanel",
  51639. ref: leftPanel,
  51640. data: vue.unref(sourceData),
  51641. "option-render": vue.unref(optionRender),
  51642. placeholder: vue.unref(panelFilterPlaceholder),
  51643. title: vue.unref(leftPanelTitle),
  51644. filterable: _ctx.filterable,
  51645. format: _ctx.format,
  51646. "filter-method": _ctx.filterMethod,
  51647. "default-checked": _ctx.leftDefaultChecked,
  51648. props: props.props,
  51649. onCheckedChange: vue.unref(onSourceCheckedChange)
  51650. }, {
  51651. empty: vue.withCtx(() => [
  51652. vue.renderSlot(_ctx.$slots, "left-empty")
  51653. ]),
  51654. default: vue.withCtx(() => [
  51655. vue.renderSlot(_ctx.$slots, "left-footer")
  51656. ]),
  51657. _: 3
  51658. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  51659. vue.createElementVNode("div", {
  51660. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  51661. }, [
  51662. vue.createVNode(vue.unref(ElButton), {
  51663. type: "primary",
  51664. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  51665. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  51666. onClick: vue.unref(addToLeft)
  51667. }, {
  51668. default: vue.withCtx(() => [
  51669. vue.createVNode(vue.unref(ElIcon), null, {
  51670. default: vue.withCtx(() => [
  51671. vue.createVNode(vue.unref(arrow_left_default))
  51672. ]),
  51673. _: 1
  51674. }),
  51675. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  51676. ]),
  51677. _: 1
  51678. }, 8, ["class", "disabled", "onClick"]),
  51679. vue.createVNode(vue.unref(ElButton), {
  51680. type: "primary",
  51681. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  51682. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  51683. onClick: vue.unref(addToRight)
  51684. }, {
  51685. default: vue.withCtx(() => [
  51686. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  51687. vue.createVNode(vue.unref(ElIcon), null, {
  51688. default: vue.withCtx(() => [
  51689. vue.createVNode(vue.unref(arrow_right_default))
  51690. ]),
  51691. _: 1
  51692. })
  51693. ]),
  51694. _: 1
  51695. }, 8, ["class", "disabled", "onClick"])
  51696. ], 2),
  51697. vue.createVNode(TransferPanel, {
  51698. ref_key: "rightPanel",
  51699. ref: rightPanel,
  51700. data: vue.unref(targetData),
  51701. "option-render": vue.unref(optionRender),
  51702. placeholder: vue.unref(panelFilterPlaceholder),
  51703. filterable: _ctx.filterable,
  51704. format: _ctx.format,
  51705. "filter-method": _ctx.filterMethod,
  51706. title: vue.unref(rightPanelTitle),
  51707. "default-checked": _ctx.rightDefaultChecked,
  51708. props: props.props,
  51709. onCheckedChange: vue.unref(onTargetCheckedChange)
  51710. }, {
  51711. empty: vue.withCtx(() => [
  51712. vue.renderSlot(_ctx.$slots, "right-empty")
  51713. ]),
  51714. default: vue.withCtx(() => [
  51715. vue.renderSlot(_ctx.$slots, "right-footer")
  51716. ]),
  51717. _: 3
  51718. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  51719. ], 2);
  51720. };
  51721. }
  51722. });
  51723. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "transfer.vue"]]);
  51724. const ElTransfer = withInstall(Transfer);
  51725. const NODE_KEY = "$treeNodeId";
  51726. const markNodeData = function(node, data) {
  51727. if (!data || data[NODE_KEY])
  51728. return;
  51729. Object.defineProperty(data, NODE_KEY, {
  51730. value: node.id,
  51731. enumerable: false,
  51732. configurable: false,
  51733. writable: false
  51734. });
  51735. };
  51736. const getNodeKey = (key, data) => data == null ? void 0 : data[key || NODE_KEY];
  51737. const handleCurrentChange = (store, emit, setCurrent) => {
  51738. const preCurrentNode = store.value.currentNode;
  51739. setCurrent();
  51740. const currentNode = store.value.currentNode;
  51741. if (preCurrentNode === currentNode)
  51742. return;
  51743. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  51744. };
  51745. const getChildState = (node) => {
  51746. let all = true;
  51747. let none = true;
  51748. let allWithoutDisable = true;
  51749. for (let i = 0, j = node.length; i < j; i++) {
  51750. const n = node[i];
  51751. if (n.checked !== true || n.indeterminate) {
  51752. all = false;
  51753. if (!n.disabled) {
  51754. allWithoutDisable = false;
  51755. }
  51756. }
  51757. if (n.checked !== false || n.indeterminate) {
  51758. none = false;
  51759. }
  51760. }
  51761. return { all, none, allWithoutDisable, half: !all && !none };
  51762. };
  51763. const reInitChecked = function(node) {
  51764. if (node.childNodes.length === 0 || node.loading)
  51765. return;
  51766. const { all, none, half } = getChildState(node.childNodes);
  51767. if (all) {
  51768. node.checked = true;
  51769. node.indeterminate = false;
  51770. } else if (half) {
  51771. node.checked = false;
  51772. node.indeterminate = true;
  51773. } else if (none) {
  51774. node.checked = false;
  51775. node.indeterminate = false;
  51776. }
  51777. const parent = node.parent;
  51778. if (!parent || parent.level === 0)
  51779. return;
  51780. if (!node.store.checkStrictly) {
  51781. reInitChecked(parent);
  51782. }
  51783. };
  51784. const getPropertyFromData = function(node, prop) {
  51785. const props = node.store.props;
  51786. const data = node.data || {};
  51787. const config = props[prop];
  51788. if (isFunction$1(config)) {
  51789. return config(data, node);
  51790. } else if (isString$1(config)) {
  51791. return data[config];
  51792. } else if (isUndefined(config)) {
  51793. const dataProp = data[prop];
  51794. return dataProp === void 0 ? "" : dataProp;
  51795. }
  51796. };
  51797. let nodeIdSeed = 0;
  51798. class Node {
  51799. constructor(options) {
  51800. this.id = nodeIdSeed++;
  51801. this.text = null;
  51802. this.checked = false;
  51803. this.indeterminate = false;
  51804. this.data = null;
  51805. this.expanded = false;
  51806. this.parent = null;
  51807. this.visible = true;
  51808. this.isCurrent = false;
  51809. this.canFocus = false;
  51810. for (const name in options) {
  51811. if (hasOwn(options, name)) {
  51812. this[name] = options[name];
  51813. }
  51814. }
  51815. this.level = 0;
  51816. this.loaded = false;
  51817. this.childNodes = [];
  51818. this.loading = false;
  51819. if (this.parent) {
  51820. this.level = this.parent.level + 1;
  51821. }
  51822. }
  51823. initialize() {
  51824. const store = this.store;
  51825. if (!store) {
  51826. throw new Error("[Node]store is required!");
  51827. }
  51828. store.registerNode(this);
  51829. const props = store.props;
  51830. if (props && typeof props.isLeaf !== "undefined") {
  51831. const isLeaf = getPropertyFromData(this, "isLeaf");
  51832. if (isBoolean(isLeaf)) {
  51833. this.isLeafByUser = isLeaf;
  51834. }
  51835. }
  51836. if (store.lazy !== true && this.data) {
  51837. this.setData(this.data);
  51838. if (store.defaultExpandAll) {
  51839. this.expanded = true;
  51840. this.canFocus = true;
  51841. }
  51842. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
  51843. this.expand();
  51844. }
  51845. if (!isArray$1(this.data)) {
  51846. markNodeData(this, this.data);
  51847. }
  51848. if (!this.data)
  51849. return;
  51850. const defaultExpandedKeys = store.defaultExpandedKeys;
  51851. const key = store.key;
  51852. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  51853. this.expand(null, store.autoExpandParent);
  51854. }
  51855. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  51856. store.currentNode = this;
  51857. store.currentNode.isCurrent = true;
  51858. }
  51859. if (store.lazy) {
  51860. store._initDefaultCheckedNode(this);
  51861. }
  51862. this.updateLeafState();
  51863. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  51864. this.canFocus = true;
  51865. }
  51866. setData(data) {
  51867. if (!isArray$1(data)) {
  51868. markNodeData(this, data);
  51869. }
  51870. this.data = data;
  51871. this.childNodes = [];
  51872. let children;
  51873. if (this.level === 0 && isArray$1(this.data)) {
  51874. children = this.data;
  51875. } else {
  51876. children = getPropertyFromData(this, "children") || [];
  51877. }
  51878. for (let i = 0, j = children.length; i < j; i++) {
  51879. this.insertChild({ data: children[i] });
  51880. }
  51881. }
  51882. get label() {
  51883. return getPropertyFromData(this, "label");
  51884. }
  51885. get key() {
  51886. const nodeKey = this.store.key;
  51887. if (this.data)
  51888. return this.data[nodeKey];
  51889. return null;
  51890. }
  51891. get disabled() {
  51892. return getPropertyFromData(this, "disabled");
  51893. }
  51894. get nextSibling() {
  51895. const parent = this.parent;
  51896. if (parent) {
  51897. const index = parent.childNodes.indexOf(this);
  51898. if (index > -1) {
  51899. return parent.childNodes[index + 1];
  51900. }
  51901. }
  51902. return null;
  51903. }
  51904. get previousSibling() {
  51905. const parent = this.parent;
  51906. if (parent) {
  51907. const index = parent.childNodes.indexOf(this);
  51908. if (index > -1) {
  51909. return index > 0 ? parent.childNodes[index - 1] : null;
  51910. }
  51911. }
  51912. return null;
  51913. }
  51914. contains(target, deep = true) {
  51915. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  51916. }
  51917. remove() {
  51918. const parent = this.parent;
  51919. if (parent) {
  51920. parent.removeChild(this);
  51921. }
  51922. }
  51923. insertChild(child, index, batch) {
  51924. if (!child)
  51925. throw new Error("InsertChild error: child is required.");
  51926. if (!(child instanceof Node)) {
  51927. if (!batch) {
  51928. const children = this.getChildren(true);
  51929. if (!children.includes(child.data)) {
  51930. if (isUndefined(index) || index < 0) {
  51931. children.push(child.data);
  51932. } else {
  51933. children.splice(index, 0, child.data);
  51934. }
  51935. }
  51936. }
  51937. Object.assign(child, {
  51938. parent: this,
  51939. store: this.store
  51940. });
  51941. child = vue.reactive(new Node(child));
  51942. if (child instanceof Node) {
  51943. child.initialize();
  51944. }
  51945. }
  51946. child.level = this.level + 1;
  51947. if (isUndefined(index) || index < 0) {
  51948. this.childNodes.push(child);
  51949. } else {
  51950. this.childNodes.splice(index, 0, child);
  51951. }
  51952. this.updateLeafState();
  51953. }
  51954. insertBefore(child, ref) {
  51955. let index;
  51956. if (ref) {
  51957. index = this.childNodes.indexOf(ref);
  51958. }
  51959. this.insertChild(child, index);
  51960. }
  51961. insertAfter(child, ref) {
  51962. let index;
  51963. if (ref) {
  51964. index = this.childNodes.indexOf(ref);
  51965. if (index !== -1)
  51966. index += 1;
  51967. }
  51968. this.insertChild(child, index);
  51969. }
  51970. removeChild(child) {
  51971. const children = this.getChildren() || [];
  51972. const dataIndex = children.indexOf(child.data);
  51973. if (dataIndex > -1) {
  51974. children.splice(dataIndex, 1);
  51975. }
  51976. const index = this.childNodes.indexOf(child);
  51977. if (index > -1) {
  51978. this.store && this.store.deregisterNode(child);
  51979. child.parent = null;
  51980. this.childNodes.splice(index, 1);
  51981. }
  51982. this.updateLeafState();
  51983. }
  51984. removeChildByData(data) {
  51985. let targetNode = null;
  51986. for (let i = 0; i < this.childNodes.length; i++) {
  51987. if (this.childNodes[i].data === data) {
  51988. targetNode = this.childNodes[i];
  51989. break;
  51990. }
  51991. }
  51992. if (targetNode) {
  51993. this.removeChild(targetNode);
  51994. }
  51995. }
  51996. expand(callback, expandParent) {
  51997. const done = () => {
  51998. if (expandParent) {
  51999. let parent = this.parent;
  52000. while (parent.level > 0) {
  52001. parent.expanded = true;
  52002. parent = parent.parent;
  52003. }
  52004. }
  52005. this.expanded = true;
  52006. if (callback)
  52007. callback();
  52008. this.childNodes.forEach((item) => {
  52009. item.canFocus = true;
  52010. });
  52011. };
  52012. if (this.shouldLoadData()) {
  52013. this.loadData((data) => {
  52014. if (isArray$1(data)) {
  52015. if (this.checked) {
  52016. this.setChecked(true, true);
  52017. } else if (!this.store.checkStrictly) {
  52018. reInitChecked(this);
  52019. }
  52020. done();
  52021. }
  52022. });
  52023. } else {
  52024. done();
  52025. }
  52026. }
  52027. doCreateChildren(array, defaultProps = {}) {
  52028. array.forEach((item) => {
  52029. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  52030. });
  52031. }
  52032. collapse() {
  52033. this.expanded = false;
  52034. this.childNodes.forEach((item) => {
  52035. item.canFocus = false;
  52036. });
  52037. }
  52038. shouldLoadData() {
  52039. return this.store.lazy === true && this.store.load && !this.loaded;
  52040. }
  52041. updateLeafState() {
  52042. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  52043. this.isLeaf = this.isLeafByUser;
  52044. return;
  52045. }
  52046. const childNodes = this.childNodes;
  52047. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  52048. this.isLeaf = !childNodes || childNodes.length === 0;
  52049. return;
  52050. }
  52051. this.isLeaf = false;
  52052. }
  52053. setChecked(value, deep, recursion, passValue) {
  52054. this.indeterminate = value === "half";
  52055. this.checked = value === true;
  52056. if (this.store.checkStrictly)
  52057. return;
  52058. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  52059. const { all, allWithoutDisable } = getChildState(this.childNodes);
  52060. if (!this.isLeaf && !all && allWithoutDisable) {
  52061. this.checked = false;
  52062. value = false;
  52063. }
  52064. const handleDescendants = () => {
  52065. if (deep) {
  52066. const childNodes = this.childNodes;
  52067. for (let i = 0, j = childNodes.length; i < j; i++) {
  52068. const child = childNodes[i];
  52069. passValue = passValue || value !== false;
  52070. const isCheck = child.disabled ? child.checked : passValue;
  52071. child.setChecked(isCheck, deep, true, passValue);
  52072. }
  52073. const { half, all: all2 } = getChildState(childNodes);
  52074. if (!all2) {
  52075. this.checked = all2;
  52076. this.indeterminate = half;
  52077. }
  52078. }
  52079. };
  52080. if (this.shouldLoadData()) {
  52081. this.loadData(() => {
  52082. handleDescendants();
  52083. reInitChecked(this);
  52084. }, {
  52085. checked: value !== false
  52086. });
  52087. return;
  52088. } else {
  52089. handleDescendants();
  52090. }
  52091. }
  52092. const parent = this.parent;
  52093. if (!parent || parent.level === 0)
  52094. return;
  52095. if (!recursion) {
  52096. reInitChecked(parent);
  52097. }
  52098. }
  52099. getChildren(forceInit = false) {
  52100. if (this.level === 0)
  52101. return this.data;
  52102. const data = this.data;
  52103. if (!data)
  52104. return null;
  52105. const props = this.store.props;
  52106. let children = "children";
  52107. if (props) {
  52108. children = props.children || "children";
  52109. }
  52110. if (data[children] === void 0) {
  52111. data[children] = null;
  52112. }
  52113. if (forceInit && !data[children]) {
  52114. data[children] = [];
  52115. }
  52116. return data[children];
  52117. }
  52118. updateChildren() {
  52119. const newData = this.getChildren() || [];
  52120. const oldData = this.childNodes.map((node) => node.data);
  52121. const newDataMap = {};
  52122. const newNodes = [];
  52123. newData.forEach((item, index) => {
  52124. const key = item[NODE_KEY];
  52125. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  52126. if (isNodeExists) {
  52127. newDataMap[key] = { index, data: item };
  52128. } else {
  52129. newNodes.push({ index, data: item });
  52130. }
  52131. });
  52132. if (!this.store.lazy) {
  52133. oldData.forEach((item) => {
  52134. if (!newDataMap[item[NODE_KEY]])
  52135. this.removeChildByData(item);
  52136. });
  52137. }
  52138. newNodes.forEach(({ index, data }) => {
  52139. this.insertChild({ data }, index);
  52140. });
  52141. this.updateLeafState();
  52142. }
  52143. loadData(callback, defaultProps = {}) {
  52144. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  52145. this.loading = true;
  52146. const resolve = (children) => {
  52147. this.childNodes = [];
  52148. this.doCreateChildren(children, defaultProps);
  52149. this.loaded = true;
  52150. this.loading = false;
  52151. this.updateLeafState();
  52152. if (callback) {
  52153. callback.call(this, children);
  52154. }
  52155. };
  52156. const reject = () => {
  52157. this.loading = false;
  52158. };
  52159. this.store.load(this, resolve, reject);
  52160. } else {
  52161. if (callback) {
  52162. callback.call(this);
  52163. }
  52164. }
  52165. }
  52166. eachNode(callback) {
  52167. const arr = [this];
  52168. while (arr.length) {
  52169. const node = arr.shift();
  52170. arr.unshift(...node.childNodes);
  52171. callback(node);
  52172. }
  52173. }
  52174. reInitChecked() {
  52175. if (this.store.checkStrictly)
  52176. return;
  52177. reInitChecked(this);
  52178. }
  52179. }
  52180. var Node$1 = Node;
  52181. class TreeStore {
  52182. constructor(options) {
  52183. this.currentNode = null;
  52184. this.currentNodeKey = null;
  52185. for (const option in options) {
  52186. if (hasOwn(options, option)) {
  52187. this[option] = options[option];
  52188. }
  52189. }
  52190. this.nodesMap = {};
  52191. }
  52192. initialize() {
  52193. this.root = new Node$1({
  52194. data: this.data,
  52195. store: this
  52196. });
  52197. this.root.initialize();
  52198. if (this.lazy && this.load) {
  52199. const loadFn = this.load;
  52200. loadFn(this.root, (data) => {
  52201. this.root.doCreateChildren(data);
  52202. this._initDefaultCheckedNodes();
  52203. });
  52204. } else {
  52205. this._initDefaultCheckedNodes();
  52206. }
  52207. }
  52208. filter(value) {
  52209. const filterNodeMethod = this.filterNodeMethod;
  52210. const lazy = this.lazy;
  52211. const traverse = async function(node) {
  52212. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52213. for (const [index, child] of childNodes.entries()) {
  52214. child.visible = filterNodeMethod.call(child, value, child.data, child);
  52215. if (index % 80 === 0 && index > 0) {
  52216. await vue.nextTick();
  52217. }
  52218. traverse(child);
  52219. }
  52220. if (!node.visible && childNodes.length) {
  52221. let allHidden = true;
  52222. allHidden = !childNodes.some((child) => child.visible);
  52223. if (node.root) {
  52224. node.root.visible = allHidden === false;
  52225. } else {
  52226. node.visible = allHidden === false;
  52227. }
  52228. }
  52229. if (!value)
  52230. return;
  52231. if (node.visible && !node.isLeaf) {
  52232. if (!lazy || node.loaded) {
  52233. node.expand();
  52234. }
  52235. }
  52236. };
  52237. traverse(this);
  52238. }
  52239. setData(newVal) {
  52240. const instanceChanged = newVal !== this.root.data;
  52241. if (instanceChanged) {
  52242. this.nodesMap = {};
  52243. this.root.setData(newVal);
  52244. this._initDefaultCheckedNodes();
  52245. this.setCurrentNodeKey(this.currentNodeKey);
  52246. } else {
  52247. this.root.updateChildren();
  52248. }
  52249. }
  52250. getNode(data) {
  52251. if (data instanceof Node$1)
  52252. return data;
  52253. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  52254. return this.nodesMap[key] || null;
  52255. }
  52256. insertBefore(data, refData) {
  52257. const refNode = this.getNode(refData);
  52258. refNode.parent.insertBefore({ data }, refNode);
  52259. }
  52260. insertAfter(data, refData) {
  52261. const refNode = this.getNode(refData);
  52262. refNode.parent.insertAfter({ data }, refNode);
  52263. }
  52264. remove(data) {
  52265. const node = this.getNode(data);
  52266. if (node && node.parent) {
  52267. if (node === this.currentNode) {
  52268. this.currentNode = null;
  52269. }
  52270. node.parent.removeChild(node);
  52271. }
  52272. }
  52273. append(data, parentData) {
  52274. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  52275. if (parentNode) {
  52276. parentNode.insertChild({ data });
  52277. }
  52278. }
  52279. _initDefaultCheckedNodes() {
  52280. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  52281. const nodesMap = this.nodesMap;
  52282. defaultCheckedKeys.forEach((checkedKey) => {
  52283. const node = nodesMap[checkedKey];
  52284. if (node) {
  52285. node.setChecked(true, !this.checkStrictly);
  52286. }
  52287. });
  52288. }
  52289. _initDefaultCheckedNode(node) {
  52290. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  52291. if (defaultCheckedKeys.includes(node.key)) {
  52292. node.setChecked(true, !this.checkStrictly);
  52293. }
  52294. }
  52295. setDefaultCheckedKey(newVal) {
  52296. if (newVal !== this.defaultCheckedKeys) {
  52297. this.defaultCheckedKeys = newVal;
  52298. this._initDefaultCheckedNodes();
  52299. }
  52300. }
  52301. registerNode(node) {
  52302. const key = this.key;
  52303. if (!node || !node.data)
  52304. return;
  52305. if (!key) {
  52306. this.nodesMap[node.id] = node;
  52307. } else {
  52308. const nodeKey = node.key;
  52309. if (nodeKey !== void 0)
  52310. this.nodesMap[node.key] = node;
  52311. }
  52312. }
  52313. deregisterNode(node) {
  52314. const key = this.key;
  52315. if (!key || !node || !node.data)
  52316. return;
  52317. node.childNodes.forEach((child) => {
  52318. this.deregisterNode(child);
  52319. });
  52320. delete this.nodesMap[node.key];
  52321. }
  52322. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  52323. const checkedNodes = [];
  52324. const traverse = function(node) {
  52325. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52326. childNodes.forEach((child) => {
  52327. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  52328. checkedNodes.push(child.data);
  52329. }
  52330. traverse(child);
  52331. });
  52332. };
  52333. traverse(this);
  52334. return checkedNodes;
  52335. }
  52336. getCheckedKeys(leafOnly = false) {
  52337. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  52338. }
  52339. getHalfCheckedNodes() {
  52340. const nodes = [];
  52341. const traverse = function(node) {
  52342. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52343. childNodes.forEach((child) => {
  52344. if (child.indeterminate) {
  52345. nodes.push(child.data);
  52346. }
  52347. traverse(child);
  52348. });
  52349. };
  52350. traverse(this);
  52351. return nodes;
  52352. }
  52353. getHalfCheckedKeys() {
  52354. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  52355. }
  52356. _getAllNodes() {
  52357. const allNodes = [];
  52358. const nodesMap = this.nodesMap;
  52359. for (const nodeKey in nodesMap) {
  52360. if (hasOwn(nodesMap, nodeKey)) {
  52361. allNodes.push(nodesMap[nodeKey]);
  52362. }
  52363. }
  52364. return allNodes;
  52365. }
  52366. updateChildren(key, data) {
  52367. const node = this.nodesMap[key];
  52368. if (!node)
  52369. return;
  52370. const childNodes = node.childNodes;
  52371. for (let i = childNodes.length - 1; i >= 0; i--) {
  52372. const child = childNodes[i];
  52373. this.remove(child.data);
  52374. }
  52375. for (let i = 0, j = data.length; i < j; i++) {
  52376. const child = data[i];
  52377. this.append(child, node.data);
  52378. }
  52379. }
  52380. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  52381. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  52382. const cache = /* @__PURE__ */ Object.create(null);
  52383. const keys = Object.keys(checkedKeys);
  52384. allNodes.forEach((node) => node.setChecked(false, false));
  52385. const cacheCheckedChild = (node) => {
  52386. node.childNodes.forEach((child) => {
  52387. var _a;
  52388. cache[child.data[key]] = true;
  52389. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  52390. cacheCheckedChild(child);
  52391. }
  52392. });
  52393. };
  52394. for (let i = 0, j = allNodes.length; i < j; i++) {
  52395. const node = allNodes[i];
  52396. const nodeKey = node.data[key].toString();
  52397. const checked = keys.includes(nodeKey);
  52398. if (!checked) {
  52399. if (node.checked && !cache[nodeKey]) {
  52400. node.setChecked(false, false);
  52401. }
  52402. continue;
  52403. }
  52404. if (node.childNodes.length) {
  52405. cacheCheckedChild(node);
  52406. }
  52407. if (node.isLeaf || this.checkStrictly) {
  52408. node.setChecked(true, false);
  52409. continue;
  52410. }
  52411. node.setChecked(true, true);
  52412. if (leafOnly) {
  52413. node.setChecked(false, false);
  52414. const traverse = function(node2) {
  52415. const childNodes = node2.childNodes;
  52416. childNodes.forEach((child) => {
  52417. if (!child.isLeaf) {
  52418. child.setChecked(false, false);
  52419. }
  52420. traverse(child);
  52421. });
  52422. };
  52423. traverse(node);
  52424. }
  52425. }
  52426. }
  52427. setCheckedNodes(array, leafOnly = false) {
  52428. const key = this.key;
  52429. const checkedKeys = {};
  52430. array.forEach((item) => {
  52431. checkedKeys[(item || {})[key]] = true;
  52432. });
  52433. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52434. }
  52435. setCheckedKeys(keys, leafOnly = false) {
  52436. this.defaultCheckedKeys = keys;
  52437. const key = this.key;
  52438. const checkedKeys = {};
  52439. keys.forEach((key2) => {
  52440. checkedKeys[key2] = true;
  52441. });
  52442. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52443. }
  52444. setDefaultExpandedKeys(keys) {
  52445. keys = keys || [];
  52446. this.defaultExpandedKeys = keys;
  52447. keys.forEach((key) => {
  52448. const node = this.getNode(key);
  52449. if (node)
  52450. node.expand(null, this.autoExpandParent);
  52451. });
  52452. }
  52453. setChecked(data, checked, deep) {
  52454. const node = this.getNode(data);
  52455. if (node) {
  52456. node.setChecked(!!checked, deep);
  52457. }
  52458. }
  52459. getCurrentNode() {
  52460. return this.currentNode;
  52461. }
  52462. setCurrentNode(currentNode) {
  52463. const prevCurrentNode = this.currentNode;
  52464. if (prevCurrentNode) {
  52465. prevCurrentNode.isCurrent = false;
  52466. }
  52467. this.currentNode = currentNode;
  52468. this.currentNode.isCurrent = true;
  52469. }
  52470. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  52471. const key = node[this.key];
  52472. const currNode = this.nodesMap[key];
  52473. this.setCurrentNode(currNode);
  52474. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52475. this.currentNode.parent.expand(null, true);
  52476. }
  52477. }
  52478. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  52479. this.currentNodeKey = key;
  52480. if (key === null || key === void 0) {
  52481. this.currentNode && (this.currentNode.isCurrent = false);
  52482. this.currentNode = null;
  52483. return;
  52484. }
  52485. const node = this.getNode(key);
  52486. if (node) {
  52487. this.setCurrentNode(node);
  52488. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52489. this.currentNode.parent.expand(null, true);
  52490. }
  52491. }
  52492. }
  52493. }
  52494. const _sfc_main$m = vue.defineComponent({
  52495. name: "ElTreeNodeContent",
  52496. props: {
  52497. node: {
  52498. type: Object,
  52499. required: true
  52500. },
  52501. renderContent: Function
  52502. },
  52503. setup(props) {
  52504. const ns = useNamespace("tree");
  52505. const nodeInstance = vue.inject("NodeInstance");
  52506. const tree = vue.inject("RootTree");
  52507. return () => {
  52508. const node = props.node;
  52509. const { data, store } = node;
  52510. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : vue.renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  52511. vue.h("span", { class: ns.be("node", "label") }, [node.label])
  52512. ]);
  52513. };
  52514. }
  52515. });
  52516. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "tree-node-content.vue"]]);
  52517. function useNodeExpandEventBroadcast(props) {
  52518. const parentNodeMap = vue.inject("TreeNodeMap", null);
  52519. const currentNodeMap = {
  52520. treeNodeExpand: (node) => {
  52521. if (props.node !== node) {
  52522. props.node.collapse();
  52523. }
  52524. },
  52525. children: []
  52526. };
  52527. if (parentNodeMap) {
  52528. parentNodeMap.children.push(currentNodeMap);
  52529. }
  52530. vue.provide("TreeNodeMap", currentNodeMap);
  52531. return {
  52532. broadcastExpanded: (node) => {
  52533. if (!props.accordion)
  52534. return;
  52535. for (const childNode of currentNodeMap.children) {
  52536. childNode.treeNodeExpand(node);
  52537. }
  52538. }
  52539. };
  52540. }
  52541. const dragEventsKey = Symbol("dragEvents");
  52542. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  52543. const ns = useNamespace("tree");
  52544. const dragState = vue.ref({
  52545. showDropIndicator: false,
  52546. draggingNode: null,
  52547. dropNode: null,
  52548. allowDrop: true,
  52549. dropType: null
  52550. });
  52551. const treeNodeDragStart = ({ event, treeNode }) => {
  52552. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  52553. event.preventDefault();
  52554. return false;
  52555. }
  52556. event.dataTransfer.effectAllowed = "move";
  52557. try {
  52558. event.dataTransfer.setData("text/plain", "");
  52559. } catch (e) {
  52560. }
  52561. dragState.value.draggingNode = treeNode;
  52562. ctx.emit("node-drag-start", treeNode.node, event);
  52563. };
  52564. const treeNodeDragOver = ({ event, treeNode }) => {
  52565. const dropNode = treeNode;
  52566. const oldDropNode = dragState.value.dropNode;
  52567. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  52568. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  52569. }
  52570. const draggingNode = dragState.value.draggingNode;
  52571. if (!draggingNode || !dropNode)
  52572. return;
  52573. let dropPrev = true;
  52574. let dropInner = true;
  52575. let dropNext = true;
  52576. let userAllowDropInner = true;
  52577. if (isFunction$1(props.allowDrop)) {
  52578. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  52579. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  52580. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  52581. }
  52582. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  52583. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  52584. if (oldDropNode) {
  52585. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  52586. }
  52587. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  52588. }
  52589. if (dropPrev || dropInner || dropNext) {
  52590. dragState.value.dropNode = dropNode;
  52591. } else {
  52592. dragState.value.dropNode = null;
  52593. }
  52594. if (dropNode.node.nextSibling === draggingNode.node) {
  52595. dropNext = false;
  52596. }
  52597. if (dropNode.node.previousSibling === draggingNode.node) {
  52598. dropPrev = false;
  52599. }
  52600. if (dropNode.node.contains(draggingNode.node, false)) {
  52601. dropInner = false;
  52602. }
  52603. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  52604. dropPrev = false;
  52605. dropInner = false;
  52606. dropNext = false;
  52607. }
  52608. const targetPosition = dropNode.$el.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  52609. const treePosition = el$.value.getBoundingClientRect();
  52610. let dropType;
  52611. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  52612. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  52613. let indicatorTop = -9999;
  52614. const distance = event.clientY - targetPosition.top;
  52615. if (distance < targetPosition.height * prevPercent) {
  52616. dropType = "before";
  52617. } else if (distance > targetPosition.height * nextPercent) {
  52618. dropType = "after";
  52619. } else if (dropInner) {
  52620. dropType = "inner";
  52621. } else {
  52622. dropType = "none";
  52623. }
  52624. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  52625. const dropIndicator = dropIndicator$.value;
  52626. if (dropType === "before") {
  52627. indicatorTop = iconPosition.top - treePosition.top;
  52628. } else if (dropType === "after") {
  52629. indicatorTop = iconPosition.bottom - treePosition.top;
  52630. }
  52631. dropIndicator.style.top = `${indicatorTop}px`;
  52632. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  52633. if (dropType === "inner") {
  52634. addClass(dropNode.$el, ns.is("drop-inner"));
  52635. } else {
  52636. removeClass(dropNode.$el, ns.is("drop-inner"));
  52637. }
  52638. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  52639. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  52640. dragState.value.dropType = dropType;
  52641. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  52642. };
  52643. const treeNodeDragEnd = (event) => {
  52644. const { draggingNode, dropType, dropNode } = dragState.value;
  52645. event.preventDefault();
  52646. if (event.dataTransfer) {
  52647. event.dataTransfer.dropEffect = "move";
  52648. }
  52649. if (draggingNode && dropNode) {
  52650. const draggingNodeCopy = { data: draggingNode.node.data };
  52651. if (dropType !== "none") {
  52652. draggingNode.node.remove();
  52653. }
  52654. if (dropType === "before") {
  52655. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  52656. } else if (dropType === "after") {
  52657. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  52658. } else if (dropType === "inner") {
  52659. dropNode.node.insertChild(draggingNodeCopy);
  52660. }
  52661. if (dropType !== "none") {
  52662. store.value.registerNode(draggingNodeCopy);
  52663. if (store.value.key) {
  52664. draggingNode.node.eachNode((node) => {
  52665. var _a;
  52666. (_a = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a.setChecked(node.checked, !store.value.checkStrictly);
  52667. });
  52668. }
  52669. }
  52670. removeClass(dropNode.$el, ns.is("drop-inner"));
  52671. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  52672. if (dropType !== "none") {
  52673. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  52674. }
  52675. }
  52676. if (draggingNode && !dropNode) {
  52677. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  52678. }
  52679. dragState.value.showDropIndicator = false;
  52680. dragState.value.draggingNode = null;
  52681. dragState.value.dropNode = null;
  52682. dragState.value.allowDrop = true;
  52683. };
  52684. vue.provide(dragEventsKey, {
  52685. treeNodeDragStart,
  52686. treeNodeDragOver,
  52687. treeNodeDragEnd
  52688. });
  52689. return {
  52690. dragState
  52691. };
  52692. }
  52693. const _sfc_main$l = vue.defineComponent({
  52694. name: "ElTreeNode",
  52695. components: {
  52696. ElCollapseTransition,
  52697. ElCheckbox,
  52698. NodeContent,
  52699. ElIcon,
  52700. Loading: loading_default
  52701. },
  52702. props: {
  52703. node: {
  52704. type: Node$1,
  52705. default: () => ({})
  52706. },
  52707. props: {
  52708. type: Object,
  52709. default: () => ({})
  52710. },
  52711. accordion: Boolean,
  52712. renderContent: Function,
  52713. renderAfterExpand: Boolean,
  52714. showCheckbox: {
  52715. type: Boolean,
  52716. default: false
  52717. }
  52718. },
  52719. emits: ["node-expand"],
  52720. setup(props, ctx) {
  52721. const ns = useNamespace("tree");
  52722. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  52723. const tree = vue.inject("RootTree");
  52724. const expanded = vue.ref(false);
  52725. const childNodeRendered = vue.ref(false);
  52726. const oldChecked = vue.ref();
  52727. const oldIndeterminate = vue.ref();
  52728. const node$ = vue.ref();
  52729. const dragEvents = vue.inject(dragEventsKey);
  52730. const instance = vue.getCurrentInstance();
  52731. vue.provide("NodeInstance", instance);
  52732. if (props.node.expanded) {
  52733. expanded.value = true;
  52734. childNodeRendered.value = true;
  52735. }
  52736. const childrenKey = tree.props.props["children"] || "children";
  52737. vue.watch(() => {
  52738. var _a;
  52739. const children = (_a = props.node.data) == null ? void 0 : _a[childrenKey];
  52740. return children && [...children];
  52741. }, () => {
  52742. props.node.updateChildren();
  52743. });
  52744. vue.watch(() => props.node.indeterminate, (val) => {
  52745. handleSelectChange(props.node.checked, val);
  52746. });
  52747. vue.watch(() => props.node.checked, (val) => {
  52748. handleSelectChange(val, props.node.indeterminate);
  52749. });
  52750. vue.watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  52751. vue.watch(() => props.node.expanded, (val) => {
  52752. vue.nextTick(() => expanded.value = val);
  52753. if (val) {
  52754. childNodeRendered.value = true;
  52755. }
  52756. });
  52757. const getNodeKey$1 = (node) => {
  52758. return getNodeKey(tree.props.nodeKey, node.data);
  52759. };
  52760. const getNodeClass = (node) => {
  52761. const nodeClassFunc = props.props.class;
  52762. if (!nodeClassFunc) {
  52763. return {};
  52764. }
  52765. let className;
  52766. if (isFunction$1(nodeClassFunc)) {
  52767. const { data } = node;
  52768. className = nodeClassFunc(data, node);
  52769. } else {
  52770. className = nodeClassFunc;
  52771. }
  52772. if (isString$1(className)) {
  52773. return { [className]: true };
  52774. } else {
  52775. return className;
  52776. }
  52777. };
  52778. const handleSelectChange = (checked, indeterminate) => {
  52779. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  52780. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  52781. }
  52782. oldChecked.value = checked;
  52783. oldIndeterminate.value = indeterminate;
  52784. };
  52785. const handleClick = (e) => {
  52786. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  52787. var _a;
  52788. const nodeKeyProp = (_a = tree == null ? void 0 : tree.props) == null ? void 0 : _a.nodeKey;
  52789. if (nodeKeyProp) {
  52790. const curNodeKey = getNodeKey$1(props.node);
  52791. tree.store.value.setCurrentNodeKey(curNodeKey);
  52792. } else {
  52793. tree.store.value.setCurrentNode(props.node);
  52794. }
  52795. });
  52796. tree.currentNode.value = props.node;
  52797. if (tree.props.expandOnClickNode) {
  52798. handleExpandIconClick();
  52799. }
  52800. if ((tree.props.checkOnClickNode || props.node.isLeaf && tree.props.checkOnClickLeaf && props.showCheckbox) && !props.node.disabled) {
  52801. handleCheckChange(!props.node.checked);
  52802. }
  52803. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  52804. };
  52805. const handleContextMenu = (event) => {
  52806. var _a;
  52807. if ((_a = tree.instance.vnode.props) == null ? void 0 : _a["onNodeContextmenu"]) {
  52808. event.stopPropagation();
  52809. event.preventDefault();
  52810. }
  52811. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  52812. };
  52813. const handleExpandIconClick = () => {
  52814. if (props.node.isLeaf)
  52815. return;
  52816. if (expanded.value) {
  52817. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  52818. props.node.collapse();
  52819. } else {
  52820. props.node.expand(() => {
  52821. ctx.emit("node-expand", props.node.data, props.node, instance);
  52822. });
  52823. }
  52824. };
  52825. const handleCheckChange = (value) => {
  52826. props.node.setChecked(value, !(tree == null ? void 0 : tree.props.checkStrictly));
  52827. vue.nextTick(() => {
  52828. const store = tree.store.value;
  52829. tree.ctx.emit("check", props.node.data, {
  52830. checkedNodes: store.getCheckedNodes(),
  52831. checkedKeys: store.getCheckedKeys(),
  52832. halfCheckedNodes: store.getHalfCheckedNodes(),
  52833. halfCheckedKeys: store.getHalfCheckedKeys()
  52834. });
  52835. });
  52836. };
  52837. const handleChildNodeExpand = (nodeData, node, instance2) => {
  52838. broadcastExpanded(node);
  52839. tree.ctx.emit("node-expand", nodeData, node, instance2);
  52840. };
  52841. const handleDragStart = (event) => {
  52842. if (!tree.props.draggable)
  52843. return;
  52844. dragEvents.treeNodeDragStart({ event, treeNode: props });
  52845. };
  52846. const handleDragOver = (event) => {
  52847. event.preventDefault();
  52848. if (!tree.props.draggable)
  52849. return;
  52850. dragEvents.treeNodeDragOver({
  52851. event,
  52852. treeNode: { $el: node$.value, node: props.node }
  52853. });
  52854. };
  52855. const handleDrop = (event) => {
  52856. event.preventDefault();
  52857. };
  52858. const handleDragEnd = (event) => {
  52859. if (!tree.props.draggable)
  52860. return;
  52861. dragEvents.treeNodeDragEnd(event);
  52862. };
  52863. return {
  52864. ns,
  52865. node$,
  52866. tree,
  52867. expanded,
  52868. childNodeRendered,
  52869. oldChecked,
  52870. oldIndeterminate,
  52871. getNodeKey: getNodeKey$1,
  52872. getNodeClass,
  52873. handleSelectChange,
  52874. handleClick,
  52875. handleContextMenu,
  52876. handleExpandIconClick,
  52877. handleCheckChange,
  52878. handleChildNodeExpand,
  52879. handleDragStart,
  52880. handleDragOver,
  52881. handleDrop,
  52882. handleDragEnd,
  52883. CaretRight: caret_right_default
  52884. };
  52885. }
  52886. });
  52887. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  52888. const _component_el_icon = vue.resolveComponent("el-icon");
  52889. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  52890. const _component_loading = vue.resolveComponent("loading");
  52891. const _component_node_content = vue.resolveComponent("node-content");
  52892. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  52893. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  52894. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  52895. ref: "node$",
  52896. class: vue.normalizeClass([
  52897. _ctx.ns.b("node"),
  52898. _ctx.ns.is("expanded", _ctx.expanded),
  52899. _ctx.ns.is("current", _ctx.node.isCurrent),
  52900. _ctx.ns.is("hidden", !_ctx.node.visible),
  52901. _ctx.ns.is("focusable", !_ctx.node.disabled),
  52902. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  52903. _ctx.getNodeClass(_ctx.node)
  52904. ]),
  52905. role: "treeitem",
  52906. tabindex: "-1",
  52907. "aria-expanded": _ctx.expanded,
  52908. "aria-disabled": _ctx.node.disabled,
  52909. "aria-checked": _ctx.node.checked,
  52910. draggable: _ctx.tree.props.draggable,
  52911. "data-key": _ctx.getNodeKey(_ctx.node),
  52912. onClick: vue.withModifiers(_ctx.handleClick, ["stop"]),
  52913. onContextmenu: _ctx.handleContextMenu,
  52914. onDragstart: vue.withModifiers(_ctx.handleDragStart, ["stop"]),
  52915. onDragover: vue.withModifiers(_ctx.handleDragOver, ["stop"]),
  52916. onDragend: vue.withModifiers(_ctx.handleDragEnd, ["stop"]),
  52917. onDrop: vue.withModifiers(_ctx.handleDrop, ["stop"])
  52918. }, [
  52919. vue.createElementVNode("div", {
  52920. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  52921. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  52922. }, [
  52923. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  52924. key: 0,
  52925. class: vue.normalizeClass([
  52926. _ctx.ns.be("node", "expand-icon"),
  52927. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  52928. {
  52929. expanded: !_ctx.node.isLeaf && _ctx.expanded
  52930. }
  52931. ]),
  52932. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  52933. }, {
  52934. default: vue.withCtx(() => [
  52935. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  52936. ]),
  52937. _: 1
  52938. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  52939. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  52940. key: 1,
  52941. "model-value": _ctx.node.checked,
  52942. indeterminate: _ctx.node.indeterminate,
  52943. disabled: !!_ctx.node.disabled,
  52944. onClick: vue.withModifiers(() => {
  52945. }, ["stop"]),
  52946. onChange: _ctx.handleCheckChange
  52947. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : vue.createCommentVNode("v-if", true),
  52948. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  52949. key: 2,
  52950. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  52951. }, {
  52952. default: vue.withCtx(() => [
  52953. vue.createVNode(_component_loading)
  52954. ]),
  52955. _: 1
  52956. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  52957. vue.createVNode(_component_node_content, {
  52958. node: _ctx.node,
  52959. "render-content": _ctx.renderContent
  52960. }, null, 8, ["node", "render-content"])
  52961. ], 6),
  52962. vue.createVNode(_component_el_collapse_transition, null, {
  52963. default: vue.withCtx(() => [
  52964. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  52965. key: 0,
  52966. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  52967. role: "group",
  52968. "aria-expanded": _ctx.expanded
  52969. }, [
  52970. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  52971. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  52972. key: _ctx.getNodeKey(child),
  52973. "render-content": _ctx.renderContent,
  52974. "render-after-expand": _ctx.renderAfterExpand,
  52975. "show-checkbox": _ctx.showCheckbox,
  52976. node: child,
  52977. accordion: _ctx.accordion,
  52978. props: _ctx.props,
  52979. onNodeExpand: _ctx.handleChildNodeExpand
  52980. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  52981. }), 128))
  52982. ], 10, ["aria-expanded"])), [
  52983. [vue.vShow, _ctx.expanded]
  52984. ]) : vue.createCommentVNode("v-if", true)
  52985. ]),
  52986. _: 1
  52987. })
  52988. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
  52989. [vue.vShow, _ctx.node.visible]
  52990. ]);
  52991. }
  52992. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  52993. function useKeydown({ el$ }, store) {
  52994. const ns = useNamespace("tree");
  52995. const treeItems = vue.shallowRef([]);
  52996. const checkboxItems = vue.shallowRef([]);
  52997. vue.onMounted(() => {
  52998. initTabIndex();
  52999. });
  53000. vue.onUpdated(() => {
  53001. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  53002. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  53003. });
  53004. vue.watch(checkboxItems, (val) => {
  53005. val.forEach((checkbox) => {
  53006. checkbox.setAttribute("tabindex", "-1");
  53007. });
  53008. });
  53009. const handleKeydown = (ev) => {
  53010. const currentItem = ev.target;
  53011. if (!currentItem.className.includes(ns.b("node")))
  53012. return;
  53013. const code = ev.code;
  53014. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  53015. const currentIndex = treeItems.value.indexOf(currentItem);
  53016. let nextIndex;
  53017. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  53018. ev.preventDefault();
  53019. if (code === EVENT_CODE.up) {
  53020. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  53021. const startIndex = nextIndex;
  53022. while (true) {
  53023. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  53024. break;
  53025. nextIndex--;
  53026. if (nextIndex === startIndex) {
  53027. nextIndex = -1;
  53028. break;
  53029. }
  53030. if (nextIndex < 0) {
  53031. nextIndex = treeItems.value.length - 1;
  53032. }
  53033. }
  53034. } else {
  53035. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  53036. const startIndex = nextIndex;
  53037. while (true) {
  53038. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  53039. break;
  53040. nextIndex++;
  53041. if (nextIndex === startIndex) {
  53042. nextIndex = -1;
  53043. break;
  53044. }
  53045. if (nextIndex >= treeItems.value.length) {
  53046. nextIndex = 0;
  53047. }
  53048. }
  53049. }
  53050. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  53051. }
  53052. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  53053. ev.preventDefault();
  53054. currentItem.click();
  53055. }
  53056. const hasInput = currentItem.querySelector('[type="checkbox"]');
  53057. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code) && hasInput) {
  53058. ev.preventDefault();
  53059. hasInput.click();
  53060. }
  53061. };
  53062. useEventListener(el$, "keydown", handleKeydown);
  53063. const initTabIndex = () => {
  53064. var _a;
  53065. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  53066. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  53067. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  53068. if (checkedItem.length) {
  53069. checkedItem[0].setAttribute("tabindex", "0");
  53070. return;
  53071. }
  53072. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  53073. };
  53074. }
  53075. const _sfc_main$k = vue.defineComponent({
  53076. name: "ElTree",
  53077. components: { ElTreeNode: ElTreeNode$1 },
  53078. props: {
  53079. data: {
  53080. type: Array,
  53081. default: () => []
  53082. },
  53083. emptyText: {
  53084. type: String
  53085. },
  53086. renderAfterExpand: {
  53087. type: Boolean,
  53088. default: true
  53089. },
  53090. nodeKey: String,
  53091. checkStrictly: Boolean,
  53092. defaultExpandAll: Boolean,
  53093. expandOnClickNode: {
  53094. type: Boolean,
  53095. default: true
  53096. },
  53097. checkOnClickNode: Boolean,
  53098. checkOnClickLeaf: {
  53099. type: Boolean,
  53100. default: true
  53101. },
  53102. checkDescendants: {
  53103. type: Boolean,
  53104. default: false
  53105. },
  53106. autoExpandParent: {
  53107. type: Boolean,
  53108. default: true
  53109. },
  53110. defaultCheckedKeys: Array,
  53111. defaultExpandedKeys: Array,
  53112. currentNodeKey: [String, Number],
  53113. renderContent: Function,
  53114. showCheckbox: {
  53115. type: Boolean,
  53116. default: false
  53117. },
  53118. draggable: {
  53119. type: Boolean,
  53120. default: false
  53121. },
  53122. allowDrag: Function,
  53123. allowDrop: Function,
  53124. props: {
  53125. type: Object,
  53126. default: () => ({
  53127. children: "children",
  53128. label: "label",
  53129. disabled: "disabled"
  53130. })
  53131. },
  53132. lazy: {
  53133. type: Boolean,
  53134. default: false
  53135. },
  53136. highlightCurrent: Boolean,
  53137. load: Function,
  53138. filterNodeMethod: Function,
  53139. accordion: Boolean,
  53140. indent: {
  53141. type: Number,
  53142. default: 18
  53143. },
  53144. icon: {
  53145. type: iconPropType
  53146. }
  53147. },
  53148. emits: [
  53149. "check-change",
  53150. "current-change",
  53151. "node-click",
  53152. "node-contextmenu",
  53153. "node-collapse",
  53154. "node-expand",
  53155. "check",
  53156. "node-drag-start",
  53157. "node-drag-end",
  53158. "node-drop",
  53159. "node-drag-leave",
  53160. "node-drag-enter",
  53161. "node-drag-over"
  53162. ],
  53163. setup(props, ctx) {
  53164. const { t } = useLocale();
  53165. const ns = useNamespace("tree");
  53166. const selectInfo = vue.inject(selectKey, null);
  53167. const store = vue.ref(new TreeStore({
  53168. key: props.nodeKey,
  53169. data: props.data,
  53170. lazy: props.lazy,
  53171. props: props.props,
  53172. load: props.load,
  53173. currentNodeKey: props.currentNodeKey,
  53174. checkStrictly: props.checkStrictly,
  53175. checkDescendants: props.checkDescendants,
  53176. defaultCheckedKeys: props.defaultCheckedKeys,
  53177. defaultExpandedKeys: props.defaultExpandedKeys,
  53178. autoExpandParent: props.autoExpandParent,
  53179. defaultExpandAll: props.defaultExpandAll,
  53180. filterNodeMethod: props.filterNodeMethod
  53181. }));
  53182. store.value.initialize();
  53183. const root = vue.ref(store.value.root);
  53184. const currentNode = vue.ref(null);
  53185. const el$ = vue.ref(null);
  53186. const dropIndicator$ = vue.ref(null);
  53187. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  53188. const { dragState } = useDragNodeHandler({
  53189. props,
  53190. ctx,
  53191. el$,
  53192. dropIndicator$,
  53193. store
  53194. });
  53195. useKeydown({ el$ }, store);
  53196. const isEmpty = vue.computed(() => {
  53197. const { childNodes } = root.value;
  53198. const hasFilteredOptions = selectInfo ? selectInfo.hasFilteredOptions !== 0 : false;
  53199. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !hasFilteredOptions;
  53200. });
  53201. vue.watch(() => props.currentNodeKey, (newVal) => {
  53202. store.value.setCurrentNodeKey(newVal);
  53203. });
  53204. vue.watch(() => props.defaultCheckedKeys, (newVal) => {
  53205. store.value.setDefaultCheckedKey(newVal);
  53206. });
  53207. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  53208. store.value.setDefaultExpandedKeys(newVal);
  53209. });
  53210. vue.watch(() => props.data, (newVal) => {
  53211. store.value.setData(newVal);
  53212. }, { deep: true });
  53213. vue.watch(() => props.checkStrictly, (newVal) => {
  53214. store.value.checkStrictly = newVal;
  53215. });
  53216. const filter = (value) => {
  53217. if (!props.filterNodeMethod)
  53218. throw new Error("[Tree] filterNodeMethod is required when filter");
  53219. store.value.filter(value);
  53220. };
  53221. const getNodeKey$1 = (node) => {
  53222. return getNodeKey(props.nodeKey, node.data);
  53223. };
  53224. const getNodePath = (data) => {
  53225. if (!props.nodeKey)
  53226. throw new Error("[Tree] nodeKey is required in getNodePath");
  53227. const node = store.value.getNode(data);
  53228. if (!node)
  53229. return [];
  53230. const path = [node.data];
  53231. let parent = node.parent;
  53232. while (parent && parent !== root.value) {
  53233. path.push(parent.data);
  53234. parent = parent.parent;
  53235. }
  53236. return path.reverse();
  53237. };
  53238. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  53239. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  53240. };
  53241. const getCheckedKeys = (leafOnly) => {
  53242. return store.value.getCheckedKeys(leafOnly);
  53243. };
  53244. const getCurrentNode = () => {
  53245. const currentNode2 = store.value.getCurrentNode();
  53246. return currentNode2 ? currentNode2.data : null;
  53247. };
  53248. const getCurrentKey = () => {
  53249. if (!props.nodeKey)
  53250. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  53251. const currentNode2 = getCurrentNode();
  53252. return currentNode2 ? currentNode2[props.nodeKey] : null;
  53253. };
  53254. const setCheckedNodes = (nodes, leafOnly) => {
  53255. if (!props.nodeKey)
  53256. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  53257. store.value.setCheckedNodes(nodes, leafOnly);
  53258. };
  53259. const setCheckedKeys = (keys, leafOnly) => {
  53260. if (!props.nodeKey)
  53261. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  53262. store.value.setCheckedKeys(keys, leafOnly);
  53263. };
  53264. const setChecked = (data, checked, deep) => {
  53265. store.value.setChecked(data, checked, deep);
  53266. };
  53267. const getHalfCheckedNodes = () => {
  53268. return store.value.getHalfCheckedNodes();
  53269. };
  53270. const getHalfCheckedKeys = () => {
  53271. return store.value.getHalfCheckedKeys();
  53272. };
  53273. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  53274. if (!props.nodeKey)
  53275. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  53276. handleCurrentChange(store, ctx.emit, () => {
  53277. broadcastExpanded(node);
  53278. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  53279. });
  53280. };
  53281. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  53282. if (!props.nodeKey)
  53283. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  53284. handleCurrentChange(store, ctx.emit, () => {
  53285. broadcastExpanded();
  53286. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  53287. });
  53288. };
  53289. const getNode = (data) => {
  53290. return store.value.getNode(data);
  53291. };
  53292. const remove = (data) => {
  53293. store.value.remove(data);
  53294. };
  53295. const append = (data, parentNode) => {
  53296. store.value.append(data, parentNode);
  53297. };
  53298. const insertBefore = (data, refNode) => {
  53299. store.value.insertBefore(data, refNode);
  53300. };
  53301. const insertAfter = (data, refNode) => {
  53302. store.value.insertAfter(data, refNode);
  53303. };
  53304. const handleNodeExpand = (nodeData, node, instance) => {
  53305. broadcastExpanded(node);
  53306. ctx.emit("node-expand", nodeData, node, instance);
  53307. };
  53308. const updateKeyChildren = (key, data) => {
  53309. if (!props.nodeKey)
  53310. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  53311. store.value.updateChildren(key, data);
  53312. };
  53313. vue.provide("RootTree", {
  53314. ctx,
  53315. props,
  53316. store,
  53317. root,
  53318. currentNode,
  53319. instance: vue.getCurrentInstance()
  53320. });
  53321. vue.provide(formItemContextKey, void 0);
  53322. return {
  53323. ns,
  53324. store,
  53325. root,
  53326. currentNode,
  53327. dragState,
  53328. el$,
  53329. dropIndicator$,
  53330. isEmpty,
  53331. filter,
  53332. getNodeKey: getNodeKey$1,
  53333. getNodePath,
  53334. getCheckedNodes,
  53335. getCheckedKeys,
  53336. getCurrentNode,
  53337. getCurrentKey,
  53338. setCheckedNodes,
  53339. setCheckedKeys,
  53340. setChecked,
  53341. getHalfCheckedNodes,
  53342. getHalfCheckedKeys,
  53343. setCurrentNode,
  53344. setCurrentKey,
  53345. t,
  53346. getNode,
  53347. remove,
  53348. append,
  53349. insertBefore,
  53350. insertAfter,
  53351. handleNodeExpand,
  53352. updateKeyChildren
  53353. };
  53354. }
  53355. });
  53356. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  53357. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  53358. return vue.openBlock(), vue.createElementBlock("div", {
  53359. ref: "el$",
  53360. class: vue.normalizeClass([
  53361. _ctx.ns.b(),
  53362. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  53363. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  53364. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  53365. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  53366. ]),
  53367. role: "tree"
  53368. }, [
  53369. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  53370. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  53371. key: _ctx.getNodeKey(child),
  53372. node: child,
  53373. props: _ctx.props,
  53374. accordion: _ctx.accordion,
  53375. "render-after-expand": _ctx.renderAfterExpand,
  53376. "show-checkbox": _ctx.showCheckbox,
  53377. "render-content": _ctx.renderContent,
  53378. onNodeExpand: _ctx.handleNodeExpand
  53379. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  53380. }), 128)),
  53381. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  53382. key: 0,
  53383. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  53384. }, [
  53385. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  53386. var _a;
  53387. return [
  53388. vue.createElementVNode("span", {
  53389. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  53390. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  53391. ];
  53392. })
  53393. ], 2)) : vue.createCommentVNode("v-if", true),
  53394. vue.withDirectives(vue.createElementVNode("div", {
  53395. ref: "dropIndicator$",
  53396. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  53397. }, null, 2), [
  53398. [vue.vShow, _ctx.dragState.showDropIndicator]
  53399. ])
  53400. ], 2);
  53401. }
  53402. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  53403. const ElTree = withInstall(Tree);
  53404. const useSelect = (props, { attrs, emit }, {
  53405. select,
  53406. tree,
  53407. key
  53408. }) => {
  53409. const ns = useNamespace("tree-select");
  53410. vue.watch(() => props.data, () => {
  53411. if (props.filterable) {
  53412. vue.nextTick(() => {
  53413. var _a, _b;
  53414. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  53415. });
  53416. }
  53417. }, { flush: "post" });
  53418. const result = {
  53419. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  53420. ...attrs,
  53421. class: vue.computed(() => attrs.class),
  53422. style: vue.computed(() => attrs.style),
  53423. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  53424. valueKey: key,
  53425. popperClass: vue.computed(() => {
  53426. const classes = [ns.e("popper")];
  53427. if (props.popperClass)
  53428. classes.push(props.popperClass);
  53429. return classes.join(" ");
  53430. }),
  53431. filterMethod: (keyword = "") => {
  53432. var _a;
  53433. if (props.filterMethod) {
  53434. props.filterMethod(keyword);
  53435. } else if (props.remoteMethod) {
  53436. props.remoteMethod(keyword);
  53437. } else {
  53438. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  53439. }
  53440. }
  53441. };
  53442. return result;
  53443. };
  53444. const component = vue.defineComponent({
  53445. extends: ElOption,
  53446. setup(props, ctx) {
  53447. const result = ElOption.setup(props, ctx);
  53448. delete result.selectOptionClick;
  53449. const vm = vue.getCurrentInstance().proxy;
  53450. vue.nextTick(() => {
  53451. if (!result.select.states.cachedOptions.get(vm.value)) {
  53452. result.select.onOptionCreate(vm);
  53453. }
  53454. });
  53455. vue.watch(() => ctx.attrs.visible, (val) => {
  53456. vue.nextTick(() => {
  53457. result.states.visible = val;
  53458. });
  53459. }, {
  53460. immediate: true
  53461. });
  53462. return result;
  53463. },
  53464. methods: {
  53465. selectOptionClick() {
  53466. this.$el.parentElement.click();
  53467. }
  53468. }
  53469. });
  53470. var TreeSelectOption = component;
  53471. function isValidValue(val) {
  53472. return val || val === 0;
  53473. }
  53474. function isValidArray(val) {
  53475. return isArray$1(val) && val.length;
  53476. }
  53477. function toValidArray(val) {
  53478. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  53479. }
  53480. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  53481. for (let i = 0; i < treeData.length; i++) {
  53482. const data = treeData[i];
  53483. if (findCallback(data, i, treeData, parent)) {
  53484. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  53485. } else {
  53486. const children = getChildren(data);
  53487. if (isValidArray(children)) {
  53488. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  53489. if (find)
  53490. return find;
  53491. }
  53492. }
  53493. }
  53494. }
  53495. function treeEach(treeData, callback, getChildren, parent) {
  53496. for (let i = 0; i < treeData.length; i++) {
  53497. const data = treeData[i];
  53498. callback(data, i, treeData, parent);
  53499. const children = getChildren(data);
  53500. if (isValidArray(children)) {
  53501. treeEach(children, callback, getChildren, data);
  53502. }
  53503. }
  53504. }
  53505. const useTree$1 = (props, { attrs, slots, emit }, {
  53506. select,
  53507. tree,
  53508. key
  53509. }) => {
  53510. vue.watch(() => props.modelValue, () => {
  53511. if (props.showCheckbox) {
  53512. vue.nextTick(() => {
  53513. const treeInstance = tree.value;
  53514. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  53515. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  53516. }
  53517. });
  53518. }
  53519. }, {
  53520. immediate: true,
  53521. deep: true
  53522. });
  53523. const propsMap = vue.computed(() => ({
  53524. value: key.value,
  53525. label: "label",
  53526. children: "children",
  53527. disabled: "disabled",
  53528. isLeaf: "isLeaf",
  53529. ...props.props
  53530. }));
  53531. const getNodeValByProp = (prop, data) => {
  53532. var _a;
  53533. const propVal = propsMap.value[prop];
  53534. if (isFunction$1(propVal)) {
  53535. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  53536. } else {
  53537. return data[propVal];
  53538. }
  53539. };
  53540. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  53541. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  53542. }).filter((item) => isValidValue(item));
  53543. const cacheOptions = vue.computed(() => {
  53544. if (!props.renderAfterExpand && !props.lazy)
  53545. return [];
  53546. const options = [];
  53547. treeEach(props.data.concat(props.cacheData), (node) => {
  53548. const value = getNodeValByProp("value", node);
  53549. options.push({
  53550. value,
  53551. currentLabel: getNodeValByProp("label", node),
  53552. isDisabled: getNodeValByProp("disabled", node)
  53553. });
  53554. }, (data) => getNodeValByProp("children", data));
  53555. return options;
  53556. });
  53557. const getChildCheckedKeys = () => {
  53558. var _a;
  53559. return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
  53560. var _a2;
  53561. const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
  53562. return !isNil(node) && isEmpty(node.childNodes);
  53563. });
  53564. };
  53565. return {
  53566. ...pick(vue.toRefs(props), Object.keys(ElTree.props)),
  53567. ...attrs,
  53568. nodeKey: key,
  53569. expandOnClickNode: vue.computed(() => {
  53570. return !props.checkStrictly && props.expandOnClickNode;
  53571. }),
  53572. defaultExpandedKeys: vue.computed(() => {
  53573. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  53574. }),
  53575. renderContent: (h, { node, data, store }) => {
  53576. return h(TreeSelectOption, {
  53577. value: getNodeValByProp("value", data),
  53578. label: getNodeValByProp("label", data),
  53579. disabled: getNodeValByProp("disabled", data),
  53580. visible: node.visible
  53581. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  53582. },
  53583. filterNodeMethod: (value, data, node) => {
  53584. if (props.filterNodeMethod)
  53585. return props.filterNodeMethod(value, data, node);
  53586. if (!value)
  53587. return true;
  53588. const regexp = new RegExp(escapeStringRegexp(value), "i");
  53589. return regexp.test(getNodeValByProp("label", data) || "");
  53590. },
  53591. onNodeClick: (data, node, e) => {
  53592. var _a, _b, _c, _d;
  53593. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  53594. if (props.showCheckbox && props.checkOnClickNode)
  53595. return;
  53596. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  53597. if (!getNodeValByProp("disabled", data)) {
  53598. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  53599. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  53600. }
  53601. } else if (props.expandOnClickNode) {
  53602. e.proxy.handleExpandIconClick();
  53603. }
  53604. (_d = select.value) == null ? void 0 : _d.focus();
  53605. },
  53606. onCheck: (data, params) => {
  53607. var _a;
  53608. if (!props.showCheckbox)
  53609. return;
  53610. const dataValue = getNodeValByProp("value", data);
  53611. const dataMap = {};
  53612. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  53613. const uncachedCheckedKeys = params.checkedKeys;
  53614. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  53615. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  53616. if (props.checkStrictly) {
  53617. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  53618. } else {
  53619. if (props.multiple) {
  53620. const childKeys = getChildCheckedKeys();
  53621. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53622. } else {
  53623. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  53624. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  53625. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  53626. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  53627. }
  53628. }
  53629. vue.nextTick(() => {
  53630. var _a2;
  53631. const checkedKeys2 = toValidArray(props.modelValue);
  53632. tree.value.setCheckedKeys(checkedKeys2);
  53633. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  53634. checkedKeys: tree.value.getCheckedKeys(),
  53635. checkedNodes: tree.value.getCheckedNodes(),
  53636. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  53637. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  53638. });
  53639. });
  53640. (_a = select.value) == null ? void 0 : _a.focus();
  53641. },
  53642. onNodeExpand: (data, node, e) => {
  53643. var _a;
  53644. (_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
  53645. vue.nextTick(() => {
  53646. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  53647. const dataMap = {};
  53648. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  53649. treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
  53650. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  53651. const childKeys = getChildCheckedKeys();
  53652. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53653. }
  53654. });
  53655. },
  53656. cacheOptions
  53657. };
  53658. };
  53659. var CacheOptions = vue.defineComponent({
  53660. props: {
  53661. data: {
  53662. type: Array,
  53663. default: () => []
  53664. }
  53665. },
  53666. setup(props) {
  53667. const select = vue.inject(selectKey);
  53668. vue.watch(() => props.data, () => {
  53669. var _a;
  53670. props.data.forEach((item) => {
  53671. if (!select.states.cachedOptions.has(item.value)) {
  53672. select.states.cachedOptions.set(item.value, item);
  53673. }
  53674. });
  53675. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  53676. if (isClient && !Array.from(inputs).includes(document.activeElement)) {
  53677. select.setSelected();
  53678. }
  53679. }, { flush: "post", immediate: true });
  53680. return () => void 0;
  53681. }
  53682. });
  53683. const _sfc_main$j = vue.defineComponent({
  53684. name: "ElTreeSelect",
  53685. inheritAttrs: false,
  53686. props: {
  53687. ...ElSelect.props,
  53688. ...ElTree.props,
  53689. cacheData: {
  53690. type: Array,
  53691. default: () => []
  53692. }
  53693. },
  53694. setup(props, context) {
  53695. const { slots, expose } = context;
  53696. const select = vue.ref();
  53697. const tree = vue.ref();
  53698. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  53699. const selectProps = useSelect(props, context, { select, tree, key });
  53700. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  53701. select,
  53702. tree,
  53703. key
  53704. });
  53705. const methods = vue.reactive({});
  53706. expose(methods);
  53707. vue.onMounted(() => {
  53708. Object.assign(methods, {
  53709. ...pick(tree.value, [
  53710. "filter",
  53711. "updateKeyChildren",
  53712. "getCheckedNodes",
  53713. "setCheckedNodes",
  53714. "getCheckedKeys",
  53715. "setCheckedKeys",
  53716. "setChecked",
  53717. "getHalfCheckedNodes",
  53718. "getHalfCheckedKeys",
  53719. "getCurrentKey",
  53720. "getCurrentNode",
  53721. "setCurrentKey",
  53722. "setCurrentNode",
  53723. "getNode",
  53724. "remove",
  53725. "append",
  53726. "insertBefore",
  53727. "insertAfter"
  53728. ]),
  53729. ...pick(select.value, ["focus", "blur", "selectedLabel"])
  53730. });
  53731. });
  53732. return () => vue.h(ElSelect, vue.reactive({
  53733. ...selectProps,
  53734. ref: (ref2) => select.value = ref2
  53735. }), {
  53736. ...slots,
  53737. default: () => [
  53738. vue.h(CacheOptions, { data: cacheOptions.value }),
  53739. vue.h(ElTree, vue.reactive({
  53740. ...treeProps,
  53741. ref: (ref2) => tree.value = ref2
  53742. }))
  53743. ]
  53744. });
  53745. }
  53746. });
  53747. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "tree-select.vue"]]);
  53748. const ElTreeSelect = withInstall(TreeSelect);
  53749. const ROOT_TREE_INJECTION_KEY = Symbol();
  53750. const EMPTY_NODE = {
  53751. key: -1,
  53752. level: -1,
  53753. data: {}
  53754. };
  53755. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  53756. TreeOptionsEnum2["KEY"] = "id";
  53757. TreeOptionsEnum2["LABEL"] = "label";
  53758. TreeOptionsEnum2["CHILDREN"] = "children";
  53759. TreeOptionsEnum2["DISABLED"] = "disabled";
  53760. TreeOptionsEnum2["CLASS"] = "";
  53761. return TreeOptionsEnum2;
  53762. })(TreeOptionsEnum || {});
  53763. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  53764. SetOperationEnum2["ADD"] = "add";
  53765. SetOperationEnum2["DELETE"] = "delete";
  53766. return SetOperationEnum2;
  53767. })(SetOperationEnum || {});
  53768. const itemSize = {
  53769. type: Number,
  53770. default: 26
  53771. };
  53772. const treeProps = buildProps({
  53773. data: {
  53774. type: definePropType(Array),
  53775. default: () => mutable([])
  53776. },
  53777. emptyText: {
  53778. type: String
  53779. },
  53780. height: {
  53781. type: Number,
  53782. default: 200
  53783. },
  53784. props: {
  53785. type: definePropType(Object),
  53786. default: () => mutable({
  53787. children: "children" /* CHILDREN */,
  53788. label: "label" /* LABEL */,
  53789. disabled: "disabled" /* DISABLED */,
  53790. value: "id" /* KEY */,
  53791. class: "" /* CLASS */
  53792. })
  53793. },
  53794. highlightCurrent: {
  53795. type: Boolean,
  53796. default: false
  53797. },
  53798. showCheckbox: {
  53799. type: Boolean,
  53800. default: false
  53801. },
  53802. defaultCheckedKeys: {
  53803. type: definePropType(Array),
  53804. default: () => mutable([])
  53805. },
  53806. checkStrictly: {
  53807. type: Boolean,
  53808. default: false
  53809. },
  53810. defaultExpandedKeys: {
  53811. type: definePropType(Array),
  53812. default: () => mutable([])
  53813. },
  53814. indent: {
  53815. type: Number,
  53816. default: 16
  53817. },
  53818. itemSize,
  53819. icon: {
  53820. type: iconPropType
  53821. },
  53822. expandOnClickNode: {
  53823. type: Boolean,
  53824. default: true
  53825. },
  53826. checkOnClickNode: {
  53827. type: Boolean,
  53828. default: false
  53829. },
  53830. checkOnClickLeaf: {
  53831. type: Boolean,
  53832. default: true
  53833. },
  53834. currentNodeKey: {
  53835. type: definePropType([String, Number])
  53836. },
  53837. accordion: {
  53838. type: Boolean,
  53839. default: false
  53840. },
  53841. filterMethod: {
  53842. type: definePropType(Function)
  53843. },
  53844. perfMode: {
  53845. type: Boolean,
  53846. default: true
  53847. }
  53848. });
  53849. const treeNodeProps = buildProps({
  53850. node: {
  53851. type: definePropType(Object),
  53852. default: () => mutable(EMPTY_NODE)
  53853. },
  53854. expanded: {
  53855. type: Boolean,
  53856. default: false
  53857. },
  53858. checked: {
  53859. type: Boolean,
  53860. default: false
  53861. },
  53862. indeterminate: {
  53863. type: Boolean,
  53864. default: false
  53865. },
  53866. showCheckbox: {
  53867. type: Boolean,
  53868. default: false
  53869. },
  53870. disabled: {
  53871. type: Boolean,
  53872. default: false
  53873. },
  53874. current: {
  53875. type: Boolean,
  53876. default: false
  53877. },
  53878. hiddenExpandIcon: {
  53879. type: Boolean,
  53880. default: false
  53881. },
  53882. itemSize
  53883. });
  53884. const treeNodeContentProps = buildProps({
  53885. node: {
  53886. type: definePropType(Object),
  53887. required: true
  53888. }
  53889. });
  53890. const NODE_CLICK = "node-click";
  53891. const NODE_DROP = "node-drop";
  53892. const NODE_EXPAND = "node-expand";
  53893. const NODE_COLLAPSE = "node-collapse";
  53894. const CURRENT_CHANGE = "current-change";
  53895. const NODE_CHECK = "check";
  53896. const NODE_CHECK_CHANGE = "check-change";
  53897. const NODE_CONTEXTMENU = "node-contextmenu";
  53898. const treeEmits = {
  53899. [NODE_CLICK]: (data, node, e) => data && node && e,
  53900. [NODE_DROP]: (data, node, e) => data && node && e,
  53901. [NODE_EXPAND]: (data, node) => data && node,
  53902. [NODE_COLLAPSE]: (data, node) => data && node,
  53903. [CURRENT_CHANGE]: (data, node) => data && node,
  53904. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  53905. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  53906. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  53907. };
  53908. const treeNodeEmits = {
  53909. click: (node, e) => !!(node && e),
  53910. drop: (node, e) => !!(node && e),
  53911. toggle: (node) => !!node,
  53912. check: (node, checked) => node && isBoolean(checked)
  53913. };
  53914. function useCheck(props, tree) {
  53915. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  53916. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  53917. const { emit } = vue.getCurrentInstance();
  53918. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  53919. return vue.nextTick(() => {
  53920. _setCheckedKeys(props.defaultCheckedKeys);
  53921. });
  53922. }, {
  53923. immediate: true
  53924. });
  53925. const updateCheckedKeys = () => {
  53926. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  53927. return;
  53928. }
  53929. const { levelTreeNodeMap, maxLevel } = tree.value;
  53930. const checkedKeySet = checkedKeys.value;
  53931. const indeterminateKeySet = /* @__PURE__ */ new Set();
  53932. for (let level = maxLevel - 1; level >= 1; --level) {
  53933. const nodes = levelTreeNodeMap.get(level);
  53934. if (!nodes)
  53935. continue;
  53936. nodes.forEach((node) => {
  53937. const children = node.children;
  53938. if (children) {
  53939. let allChecked = true;
  53940. let hasChecked = false;
  53941. for (const childNode of children) {
  53942. const key = childNode.key;
  53943. if (checkedKeySet.has(key)) {
  53944. hasChecked = true;
  53945. } else if (indeterminateKeySet.has(key)) {
  53946. allChecked = false;
  53947. hasChecked = true;
  53948. break;
  53949. } else {
  53950. allChecked = false;
  53951. }
  53952. }
  53953. if (allChecked) {
  53954. checkedKeySet.add(node.key);
  53955. } else if (hasChecked) {
  53956. indeterminateKeySet.add(node.key);
  53957. checkedKeySet.delete(node.key);
  53958. } else {
  53959. checkedKeySet.delete(node.key);
  53960. indeterminateKeySet.delete(node.key);
  53961. }
  53962. }
  53963. });
  53964. }
  53965. indeterminateKeys.value = indeterminateKeySet;
  53966. };
  53967. const isChecked = (node) => checkedKeys.value.has(node.key);
  53968. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  53969. const toggleCheckbox = (node, isChecked2, nodeClick = true, immediateUpdate = true) => {
  53970. const checkedKeySet = checkedKeys.value;
  53971. const toggle = (node2, checked) => {
  53972. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  53973. const children = node2.children;
  53974. if (!props.checkStrictly && children) {
  53975. children.forEach((childNode) => {
  53976. if (!childNode.disabled) {
  53977. toggle(childNode, checked);
  53978. }
  53979. });
  53980. }
  53981. };
  53982. toggle(node, isChecked2);
  53983. if (immediateUpdate) {
  53984. updateCheckedKeys();
  53985. }
  53986. if (nodeClick) {
  53987. afterNodeCheck(node, isChecked2);
  53988. }
  53989. };
  53990. const afterNodeCheck = (node, checked) => {
  53991. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  53992. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  53993. emit(NODE_CHECK, node.data, {
  53994. checkedKeys: checkedKeys2,
  53995. checkedNodes,
  53996. halfCheckedKeys,
  53997. halfCheckedNodes
  53998. });
  53999. emit(NODE_CHECK_CHANGE, node.data, checked);
  54000. };
  54001. function getCheckedKeys(leafOnly = false) {
  54002. return getChecked(leafOnly).checkedKeys;
  54003. }
  54004. function getCheckedNodes(leafOnly = false) {
  54005. return getChecked(leafOnly).checkedNodes;
  54006. }
  54007. function getHalfCheckedKeys() {
  54008. return getHalfChecked().halfCheckedKeys;
  54009. }
  54010. function getHalfCheckedNodes() {
  54011. return getHalfChecked().halfCheckedNodes;
  54012. }
  54013. function getChecked(leafOnly = false) {
  54014. const checkedNodes = [];
  54015. const keys = [];
  54016. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  54017. const { treeNodeMap } = tree.value;
  54018. checkedKeys.value.forEach((key) => {
  54019. const node = treeNodeMap.get(key);
  54020. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  54021. keys.push(key);
  54022. checkedNodes.push(node.data);
  54023. }
  54024. });
  54025. }
  54026. return {
  54027. checkedKeys: keys,
  54028. checkedNodes
  54029. };
  54030. }
  54031. function getHalfChecked() {
  54032. const halfCheckedNodes = [];
  54033. const halfCheckedKeys = [];
  54034. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  54035. const { treeNodeMap } = tree.value;
  54036. indeterminateKeys.value.forEach((key) => {
  54037. const node = treeNodeMap.get(key);
  54038. if (node) {
  54039. halfCheckedKeys.push(key);
  54040. halfCheckedNodes.push(node.data);
  54041. }
  54042. });
  54043. }
  54044. return {
  54045. halfCheckedNodes,
  54046. halfCheckedKeys
  54047. };
  54048. }
  54049. function setCheckedKeys(keys) {
  54050. checkedKeys.value.clear();
  54051. indeterminateKeys.value.clear();
  54052. vue.nextTick(() => {
  54053. _setCheckedKeys(keys);
  54054. });
  54055. }
  54056. function setChecked(key, isChecked2) {
  54057. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  54058. const node = tree.value.treeNodeMap.get(key);
  54059. if (node) {
  54060. toggleCheckbox(node, isChecked2, false);
  54061. }
  54062. }
  54063. }
  54064. function _setCheckedKeys(keys) {
  54065. if (tree == null ? void 0 : tree.value) {
  54066. const { treeNodeMap } = tree.value;
  54067. if (props.showCheckbox && treeNodeMap && (keys == null ? void 0 : keys.length) > 0) {
  54068. for (const key of keys) {
  54069. const node = treeNodeMap.get(key);
  54070. if (node && !isChecked(node)) {
  54071. toggleCheckbox(node, true, false, false);
  54072. }
  54073. }
  54074. updateCheckedKeys();
  54075. }
  54076. }
  54077. }
  54078. return {
  54079. updateCheckedKeys,
  54080. toggleCheckbox,
  54081. isChecked,
  54082. isIndeterminate,
  54083. getCheckedKeys,
  54084. getCheckedNodes,
  54085. getHalfCheckedKeys,
  54086. getHalfCheckedNodes,
  54087. setChecked,
  54088. setCheckedKeys
  54089. };
  54090. }
  54091. function useFilter(props, tree) {
  54092. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  54093. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  54094. const filterable = vue.computed(() => {
  54095. return isFunction$1(props.filterMethod);
  54096. });
  54097. function doFilter(query) {
  54098. var _a;
  54099. if (!filterable.value) {
  54100. return;
  54101. }
  54102. const expandKeySet = /* @__PURE__ */ new Set();
  54103. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  54104. const hiddenKeys = hiddenNodeKeySet.value;
  54105. const family = [];
  54106. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  54107. const filter = props.filterMethod;
  54108. hiddenKeys.clear();
  54109. function traverse(nodes2) {
  54110. nodes2.forEach((node) => {
  54111. family.push(node);
  54112. if (filter == null ? void 0 : filter(query, node.data, node)) {
  54113. family.forEach((member) => {
  54114. expandKeySet.add(member.key);
  54115. });
  54116. } else if (node.isLeaf) {
  54117. hiddenKeys.add(node.key);
  54118. }
  54119. const children = node.children;
  54120. if (children) {
  54121. traverse(children);
  54122. }
  54123. if (!node.isLeaf) {
  54124. if (!expandKeySet.has(node.key)) {
  54125. hiddenKeys.add(node.key);
  54126. } else if (children) {
  54127. let allHidden = true;
  54128. for (const childNode of children) {
  54129. if (!hiddenKeys.has(childNode.key)) {
  54130. allHidden = false;
  54131. break;
  54132. }
  54133. }
  54134. if (allHidden) {
  54135. hiddenExpandIconKeys.add(node.key);
  54136. } else {
  54137. hiddenExpandIconKeys.delete(node.key);
  54138. }
  54139. }
  54140. }
  54141. family.pop();
  54142. });
  54143. }
  54144. traverse(nodes);
  54145. return expandKeySet;
  54146. }
  54147. function isForceHiddenExpandIcon(node) {
  54148. return hiddenExpandIconKeySet.value.has(node.key);
  54149. }
  54150. return {
  54151. hiddenExpandIconKeySet,
  54152. hiddenNodeKeySet,
  54153. doFilter,
  54154. isForceHiddenExpandIcon
  54155. };
  54156. }
  54157. function useTree(props, emit) {
  54158. const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys));
  54159. const currentKey = vue.ref();
  54160. const tree = vue.shallowRef();
  54161. const listRef = vue.ref();
  54162. vue.watch(() => props.currentNodeKey, (key) => {
  54163. currentKey.value = key;
  54164. }, {
  54165. immediate: true
  54166. });
  54167. vue.watch(() => props.data, (data) => {
  54168. setData(data);
  54169. }, {
  54170. immediate: true
  54171. });
  54172. const {
  54173. isIndeterminate,
  54174. isChecked,
  54175. toggleCheckbox,
  54176. getCheckedKeys,
  54177. getCheckedNodes,
  54178. getHalfCheckedKeys,
  54179. getHalfCheckedNodes,
  54180. setChecked,
  54181. setCheckedKeys
  54182. } = useCheck(props, tree);
  54183. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  54184. const valueKey = vue.computed(() => {
  54185. var _a;
  54186. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  54187. });
  54188. const childrenKey = vue.computed(() => {
  54189. var _a;
  54190. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  54191. });
  54192. const disabledKey = vue.computed(() => {
  54193. var _a;
  54194. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  54195. });
  54196. const labelKey = vue.computed(() => {
  54197. var _a;
  54198. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  54199. });
  54200. const flattenTree = vue.computed(() => {
  54201. var _a;
  54202. const expandedKeys = expandedKeySet.value;
  54203. const hiddenKeys = hiddenNodeKeySet.value;
  54204. const flattenNodes = [];
  54205. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  54206. const stack = [];
  54207. for (let i = nodes.length - 1; i >= 0; --i) {
  54208. stack.push(nodes[i]);
  54209. }
  54210. while (stack.length) {
  54211. const node = stack.pop();
  54212. if (hiddenKeys.has(node.key))
  54213. continue;
  54214. flattenNodes.push(node);
  54215. if (node.children && expandedKeys.has(node.key)) {
  54216. for (let i = node.children.length - 1; i >= 0; --i) {
  54217. stack.push(node.children[i]);
  54218. }
  54219. }
  54220. }
  54221. return flattenNodes;
  54222. });
  54223. const isNotEmpty = vue.computed(() => {
  54224. return flattenTree.value.length > 0;
  54225. });
  54226. function createTree(data) {
  54227. const treeNodeMap = /* @__PURE__ */ new Map();
  54228. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  54229. let maxLevel = 1;
  54230. function traverse(nodes, level = 1, parent = void 0) {
  54231. var _a;
  54232. const siblings = [];
  54233. for (const rawNode of nodes) {
  54234. const value = getKey(rawNode);
  54235. const node = {
  54236. level,
  54237. key: value,
  54238. data: rawNode
  54239. };
  54240. node.label = getLabel(rawNode);
  54241. node.parent = parent;
  54242. const children = getChildren(rawNode);
  54243. node.disabled = getDisabled(rawNode);
  54244. node.isLeaf = !children || children.length === 0;
  54245. if (children && children.length) {
  54246. node.children = traverse(children, level + 1, node);
  54247. }
  54248. siblings.push(node);
  54249. treeNodeMap.set(value, node);
  54250. if (!levelTreeNodeMap.has(level)) {
  54251. levelTreeNodeMap.set(level, []);
  54252. }
  54253. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  54254. }
  54255. if (level > maxLevel) {
  54256. maxLevel = level;
  54257. }
  54258. return siblings;
  54259. }
  54260. const treeNodes = traverse(data);
  54261. return {
  54262. treeNodeMap,
  54263. levelTreeNodeMap,
  54264. maxLevel,
  54265. treeNodes
  54266. };
  54267. }
  54268. function filter(query) {
  54269. const keys = doFilter(query);
  54270. if (keys) {
  54271. expandedKeySet.value = keys;
  54272. }
  54273. }
  54274. function getChildren(node) {
  54275. return node[childrenKey.value];
  54276. }
  54277. function getKey(node) {
  54278. if (!node) {
  54279. return "";
  54280. }
  54281. return node[valueKey.value];
  54282. }
  54283. function getDisabled(node) {
  54284. return node[disabledKey.value];
  54285. }
  54286. function getLabel(node) {
  54287. return node[labelKey.value];
  54288. }
  54289. function toggleExpand(node) {
  54290. const expandedKeys = expandedKeySet.value;
  54291. if (expandedKeys.has(node.key)) {
  54292. collapseNode(node);
  54293. } else {
  54294. expandNode(node);
  54295. }
  54296. }
  54297. function setExpandedKeys(keys) {
  54298. const expandedKeys = /* @__PURE__ */ new Set();
  54299. const nodeMap = tree.value.treeNodeMap;
  54300. keys.forEach((k) => {
  54301. let node = nodeMap.get(k);
  54302. while (node && !expandedKeys.has(node.key)) {
  54303. expandedKeys.add(node.key);
  54304. node = node.parent;
  54305. }
  54306. });
  54307. expandedKeySet.value = expandedKeys;
  54308. }
  54309. function handleNodeClick(node, e) {
  54310. emit(NODE_CLICK, node.data, node, e);
  54311. handleCurrentChange(node);
  54312. if (props.expandOnClickNode) {
  54313. toggleExpand(node);
  54314. }
  54315. if (props.showCheckbox && (props.checkOnClickNode || node.isLeaf && props.checkOnClickLeaf) && !node.disabled) {
  54316. toggleCheckbox(node, !isChecked(node), true);
  54317. }
  54318. }
  54319. function handleNodeDrop(node, e) {
  54320. emit(NODE_DROP, node.data, node, e);
  54321. }
  54322. function handleCurrentChange(node) {
  54323. if (!isCurrent(node)) {
  54324. currentKey.value = node.key;
  54325. emit(CURRENT_CHANGE, node.data, node);
  54326. }
  54327. }
  54328. function handleNodeCheck(node, checked) {
  54329. toggleCheckbox(node, checked);
  54330. }
  54331. function expandNode(node) {
  54332. const keySet = expandedKeySet.value;
  54333. if (tree.value && props.accordion) {
  54334. const { treeNodeMap } = tree.value;
  54335. keySet.forEach((key) => {
  54336. const treeNode = treeNodeMap.get(key);
  54337. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  54338. keySet.delete(key);
  54339. }
  54340. });
  54341. }
  54342. keySet.add(node.key);
  54343. emit(NODE_EXPAND, node.data, node);
  54344. }
  54345. function collapseNode(node) {
  54346. expandedKeySet.value.delete(node.key);
  54347. emit(NODE_COLLAPSE, node.data, node);
  54348. }
  54349. function isExpanded(node) {
  54350. return expandedKeySet.value.has(node.key);
  54351. }
  54352. function isDisabled(node) {
  54353. return !!node.disabled;
  54354. }
  54355. function isCurrent(node) {
  54356. const current = currentKey.value;
  54357. return current !== void 0 && current === node.key;
  54358. }
  54359. function getCurrentNode() {
  54360. var _a, _b;
  54361. if (!currentKey.value)
  54362. return void 0;
  54363. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  54364. }
  54365. function getCurrentKey() {
  54366. return currentKey.value;
  54367. }
  54368. function setCurrentKey(key) {
  54369. currentKey.value = key;
  54370. }
  54371. function setData(data) {
  54372. vue.nextTick(() => tree.value = createTree(data));
  54373. }
  54374. function getNode(data) {
  54375. var _a;
  54376. const key = isObject$1(data) ? getKey(data) : data;
  54377. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  54378. }
  54379. function scrollToNode(key, strategy = "auto") {
  54380. const node = getNode(key);
  54381. if (node && listRef.value) {
  54382. listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  54383. }
  54384. }
  54385. function scrollTo(offset) {
  54386. var _a;
  54387. (_a = listRef.value) == null ? void 0 : _a.scrollTo(offset);
  54388. }
  54389. return {
  54390. tree,
  54391. flattenTree,
  54392. isNotEmpty,
  54393. listRef,
  54394. getKey,
  54395. getChildren,
  54396. toggleExpand,
  54397. toggleCheckbox,
  54398. isExpanded,
  54399. isChecked,
  54400. isIndeterminate,
  54401. isDisabled,
  54402. isCurrent,
  54403. isForceHiddenExpandIcon,
  54404. handleNodeClick,
  54405. handleNodeDrop,
  54406. handleNodeCheck,
  54407. getCurrentNode,
  54408. getCurrentKey,
  54409. setCurrentKey,
  54410. getCheckedKeys,
  54411. getCheckedNodes,
  54412. getHalfCheckedKeys,
  54413. getHalfCheckedNodes,
  54414. setChecked,
  54415. setCheckedKeys,
  54416. filter,
  54417. setData,
  54418. getNode,
  54419. expandNode,
  54420. collapseNode,
  54421. setExpandedKeys,
  54422. scrollToNode,
  54423. scrollTo
  54424. };
  54425. }
  54426. var ElNodeContent = vue.defineComponent({
  54427. name: "ElTreeNodeContent",
  54428. props: treeNodeContentProps,
  54429. setup(props) {
  54430. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  54431. const ns = useNamespace("tree");
  54432. return () => {
  54433. const node = props.node;
  54434. const { data } = node;
  54435. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : vue.h("span", { class: ns.be("node", "label") }, [node == null ? void 0 : node.label]);
  54436. };
  54437. }
  54438. });
  54439. const __default__$h = vue.defineComponent({
  54440. name: "ElTreeNode"
  54441. });
  54442. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  54443. ...__default__$h,
  54444. props: treeNodeProps,
  54445. emits: treeNodeEmits,
  54446. setup(__props, { emit }) {
  54447. const props = __props;
  54448. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  54449. const ns = useNamespace("tree");
  54450. const indent = vue.computed(() => {
  54451. var _a;
  54452. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  54453. });
  54454. const icon = vue.computed(() => {
  54455. var _a;
  54456. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  54457. });
  54458. const getNodeClass = (node) => {
  54459. const nodeClassFunc = tree == null ? void 0 : tree.props.props.class;
  54460. if (!nodeClassFunc)
  54461. return {};
  54462. let className;
  54463. if (isFunction$1(nodeClassFunc)) {
  54464. const { data } = node;
  54465. className = nodeClassFunc(data, node);
  54466. } else {
  54467. className = nodeClassFunc;
  54468. }
  54469. return isString$1(className) ? { [className]: true } : className;
  54470. };
  54471. const handleClick = (e) => {
  54472. emit("click", props.node, e);
  54473. };
  54474. const handleDrop = (e) => {
  54475. emit("drop", props.node, e);
  54476. };
  54477. const handleExpandIconClick = () => {
  54478. emit("toggle", props.node);
  54479. };
  54480. const handleCheckChange = (value) => {
  54481. emit("check", props.node, value);
  54482. };
  54483. const handleContextMenu = (event) => {
  54484. var _a, _b, _c, _d;
  54485. if ((_c = (_b = (_a = tree == null ? void 0 : tree.instance) == null ? void 0 : _a.vnode) == null ? void 0 : _b.props) == null ? void 0 : _c["onNodeContextmenu"]) {
  54486. event.stopPropagation();
  54487. event.preventDefault();
  54488. }
  54489. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  54490. };
  54491. return (_ctx, _cache) => {
  54492. var _a, _b, _c;
  54493. return vue.openBlock(), vue.createElementBlock("div", {
  54494. ref: "node$",
  54495. class: vue.normalizeClass([
  54496. vue.unref(ns).b("node"),
  54497. vue.unref(ns).is("expanded", _ctx.expanded),
  54498. vue.unref(ns).is("current", _ctx.current),
  54499. vue.unref(ns).is("focusable", !_ctx.disabled),
  54500. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked),
  54501. getNodeClass(_ctx.node)
  54502. ]),
  54503. role: "treeitem",
  54504. tabindex: "-1",
  54505. "aria-expanded": _ctx.expanded,
  54506. "aria-disabled": _ctx.disabled,
  54507. "aria-checked": _ctx.checked,
  54508. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  54509. onClick: vue.withModifiers(handleClick, ["stop"]),
  54510. onContextmenu: handleContextMenu,
  54511. onDragover: vue.withModifiers(() => {
  54512. }, ["prevent"]),
  54513. onDragenter: vue.withModifiers(() => {
  54514. }, ["prevent"]),
  54515. onDrop: vue.withModifiers(handleDrop, ["stop"])
  54516. }, [
  54517. vue.createElementVNode("div", {
  54518. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  54519. style: vue.normalizeStyle({
  54520. paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px`,
  54521. height: _ctx.itemSize + "px"
  54522. })
  54523. }, [
  54524. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54525. key: 0,
  54526. class: vue.normalizeClass([
  54527. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  54528. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  54529. {
  54530. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  54531. },
  54532. vue.unref(ns).be("node", "expand-icon")
  54533. ]),
  54534. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  54535. }, {
  54536. default: vue.withCtx(() => [
  54537. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  54538. ]),
  54539. _: 1
  54540. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  54541. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  54542. key: 1,
  54543. "model-value": _ctx.checked,
  54544. indeterminate: _ctx.indeterminate,
  54545. disabled: _ctx.disabled,
  54546. onChange: handleCheckChange,
  54547. onClick: vue.withModifiers(() => {
  54548. }, ["stop"])
  54549. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  54550. vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  54551. ], 6)
  54552. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick", "onDragover", "onDragenter", "onDrop"]);
  54553. };
  54554. }
  54555. });
  54556. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "tree-node.vue"]]);
  54557. const __default__$g = vue.defineComponent({
  54558. name: "ElTreeV2"
  54559. });
  54560. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  54561. ...__default__$g,
  54562. props: treeProps,
  54563. emits: treeEmits,
  54564. setup(__props, { expose, emit }) {
  54565. const props = __props;
  54566. const slots = vue.useSlots();
  54567. const treeNodeSize = vue.computed(() => props.itemSize);
  54568. vue.provide(ROOT_TREE_INJECTION_KEY, {
  54569. ctx: {
  54570. emit,
  54571. slots
  54572. },
  54573. props,
  54574. instance: vue.getCurrentInstance()
  54575. });
  54576. vue.provide(formItemContextKey, void 0);
  54577. const { t } = useLocale();
  54578. const ns = useNamespace("tree");
  54579. const {
  54580. flattenTree,
  54581. isNotEmpty,
  54582. listRef,
  54583. toggleExpand,
  54584. isExpanded,
  54585. isIndeterminate,
  54586. isChecked,
  54587. isDisabled,
  54588. isCurrent,
  54589. isForceHiddenExpandIcon,
  54590. handleNodeClick,
  54591. handleNodeDrop,
  54592. handleNodeCheck,
  54593. toggleCheckbox,
  54594. getCurrentNode,
  54595. getCurrentKey,
  54596. setCurrentKey,
  54597. getCheckedKeys,
  54598. getCheckedNodes,
  54599. getHalfCheckedKeys,
  54600. getHalfCheckedNodes,
  54601. setChecked,
  54602. setCheckedKeys,
  54603. filter,
  54604. setData,
  54605. getNode,
  54606. expandNode,
  54607. collapseNode,
  54608. setExpandedKeys,
  54609. scrollToNode,
  54610. scrollTo
  54611. } = useTree(props, emit);
  54612. expose({
  54613. toggleCheckbox,
  54614. getCurrentNode,
  54615. getCurrentKey,
  54616. setCurrentKey,
  54617. getCheckedKeys,
  54618. getCheckedNodes,
  54619. getHalfCheckedKeys,
  54620. getHalfCheckedNodes,
  54621. setChecked,
  54622. setCheckedKeys,
  54623. filter,
  54624. setData,
  54625. getNode,
  54626. expandNode,
  54627. collapseNode,
  54628. setExpandedKeys,
  54629. scrollToNode,
  54630. scrollTo
  54631. });
  54632. return (_ctx, _cache) => {
  54633. return vue.openBlock(), vue.createElementBlock("div", {
  54634. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  54635. role: "tree"
  54636. }, [
  54637. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  54638. key: 0,
  54639. ref_key: "listRef",
  54640. ref: listRef,
  54641. "class-name": vue.unref(ns).b("virtual-list"),
  54642. data: vue.unref(flattenTree),
  54643. total: vue.unref(flattenTree).length,
  54644. height: _ctx.height,
  54645. "item-size": vue.unref(treeNodeSize),
  54646. "perf-mode": _ctx.perfMode
  54647. }, {
  54648. default: vue.withCtx(({ data, index, style }) => [
  54649. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  54650. key: data[index].key,
  54651. style: vue.normalizeStyle(style),
  54652. node: data[index],
  54653. expanded: vue.unref(isExpanded)(data[index]),
  54654. "show-checkbox": _ctx.showCheckbox,
  54655. checked: vue.unref(isChecked)(data[index]),
  54656. indeterminate: vue.unref(isIndeterminate)(data[index]),
  54657. "item-size": vue.unref(treeNodeSize),
  54658. disabled: vue.unref(isDisabled)(data[index]),
  54659. current: vue.unref(isCurrent)(data[index]),
  54660. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  54661. onClick: vue.unref(handleNodeClick),
  54662. onToggle: vue.unref(toggleExpand),
  54663. onCheck: vue.unref(handleNodeCheck),
  54664. onDrop: vue.unref(handleNodeDrop)
  54665. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck", "onDrop"]))
  54666. ]),
  54667. _: 1
  54668. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", {
  54669. key: 1,
  54670. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  54671. }, [
  54672. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  54673. var _a;
  54674. return [
  54675. vue.createElementVNode("span", {
  54676. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  54677. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  54678. ];
  54679. })
  54680. ], 2))
  54681. ], 2);
  54682. };
  54683. }
  54684. });
  54685. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "tree.vue"]]);
  54686. const ElTreeV2 = withInstall(TreeV2);
  54687. const uploadContextKey = Symbol("uploadContextKey");
  54688. const SCOPE$2 = "ElUpload";
  54689. class UploadAjaxError extends Error {
  54690. constructor(message, status, method, url) {
  54691. super(message);
  54692. this.name = "UploadAjaxError";
  54693. this.status = status;
  54694. this.method = method;
  54695. this.url = url;
  54696. }
  54697. }
  54698. function getError(action, option, xhr) {
  54699. let msg;
  54700. if (xhr.response) {
  54701. msg = `${xhr.response.error || xhr.response}`;
  54702. } else if (xhr.responseText) {
  54703. msg = `${xhr.responseText}`;
  54704. } else {
  54705. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  54706. }
  54707. return new UploadAjaxError(msg, xhr.status, option.method, action);
  54708. }
  54709. function getBody(xhr) {
  54710. const text = xhr.responseText || xhr.response;
  54711. if (!text) {
  54712. return text;
  54713. }
  54714. try {
  54715. return JSON.parse(text);
  54716. } catch (e) {
  54717. return text;
  54718. }
  54719. }
  54720. const ajaxUpload = (option) => {
  54721. if (typeof XMLHttpRequest === "undefined")
  54722. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  54723. const xhr = new XMLHttpRequest();
  54724. const action = option.action;
  54725. if (xhr.upload) {
  54726. xhr.upload.addEventListener("progress", (evt) => {
  54727. const progressEvt = evt;
  54728. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  54729. option.onProgress(progressEvt);
  54730. });
  54731. }
  54732. const formData = new FormData();
  54733. if (option.data) {
  54734. for (const [key, value] of Object.entries(option.data)) {
  54735. if (isArray$1(value) && value.length)
  54736. formData.append(key, ...value);
  54737. else
  54738. formData.append(key, value);
  54739. }
  54740. }
  54741. formData.append(option.filename, option.file, option.file.name);
  54742. xhr.addEventListener("error", () => {
  54743. option.onError(getError(action, option, xhr));
  54744. });
  54745. xhr.addEventListener("load", () => {
  54746. if (xhr.status < 200 || xhr.status >= 300) {
  54747. return option.onError(getError(action, option, xhr));
  54748. }
  54749. option.onSuccess(getBody(xhr));
  54750. });
  54751. xhr.open(option.method, action, true);
  54752. if (option.withCredentials && "withCredentials" in xhr) {
  54753. xhr.withCredentials = true;
  54754. }
  54755. const headers = option.headers || {};
  54756. if (headers instanceof Headers) {
  54757. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  54758. } else {
  54759. for (const [key, value] of Object.entries(headers)) {
  54760. if (isNil(value))
  54761. continue;
  54762. xhr.setRequestHeader(key, String(value));
  54763. }
  54764. }
  54765. xhr.send(formData);
  54766. return xhr;
  54767. };
  54768. const uploadListTypes = ["text", "picture", "picture-card"];
  54769. let fileId = 1;
  54770. const genFileId = () => Date.now() + fileId++;
  54771. const uploadBaseProps = buildProps({
  54772. action: {
  54773. type: String,
  54774. default: "#"
  54775. },
  54776. headers: {
  54777. type: definePropType(Object)
  54778. },
  54779. method: {
  54780. type: String,
  54781. default: "post"
  54782. },
  54783. data: {
  54784. type: definePropType([Object, Function, Promise]),
  54785. default: () => mutable({})
  54786. },
  54787. multiple: Boolean,
  54788. name: {
  54789. type: String,
  54790. default: "file"
  54791. },
  54792. drag: Boolean,
  54793. withCredentials: Boolean,
  54794. showFileList: {
  54795. type: Boolean,
  54796. default: true
  54797. },
  54798. accept: {
  54799. type: String,
  54800. default: ""
  54801. },
  54802. fileList: {
  54803. type: definePropType(Array),
  54804. default: () => mutable([])
  54805. },
  54806. autoUpload: {
  54807. type: Boolean,
  54808. default: true
  54809. },
  54810. listType: {
  54811. type: String,
  54812. values: uploadListTypes,
  54813. default: "text"
  54814. },
  54815. httpRequest: {
  54816. type: definePropType(Function),
  54817. default: ajaxUpload
  54818. },
  54819. disabled: Boolean,
  54820. limit: Number
  54821. });
  54822. const uploadProps = buildProps({
  54823. ...uploadBaseProps,
  54824. beforeUpload: {
  54825. type: definePropType(Function),
  54826. default: NOOP
  54827. },
  54828. beforeRemove: {
  54829. type: definePropType(Function)
  54830. },
  54831. onRemove: {
  54832. type: definePropType(Function),
  54833. default: NOOP
  54834. },
  54835. onChange: {
  54836. type: definePropType(Function),
  54837. default: NOOP
  54838. },
  54839. onPreview: {
  54840. type: definePropType(Function),
  54841. default: NOOP
  54842. },
  54843. onSuccess: {
  54844. type: definePropType(Function),
  54845. default: NOOP
  54846. },
  54847. onProgress: {
  54848. type: definePropType(Function),
  54849. default: NOOP
  54850. },
  54851. onError: {
  54852. type: definePropType(Function),
  54853. default: NOOP
  54854. },
  54855. onExceed: {
  54856. type: definePropType(Function),
  54857. default: NOOP
  54858. },
  54859. crossorigin: {
  54860. type: definePropType(String)
  54861. }
  54862. });
  54863. const uploadListProps = buildProps({
  54864. files: {
  54865. type: definePropType(Array),
  54866. default: () => mutable([])
  54867. },
  54868. disabled: {
  54869. type: Boolean,
  54870. default: false
  54871. },
  54872. handlePreview: {
  54873. type: definePropType(Function),
  54874. default: NOOP
  54875. },
  54876. listType: {
  54877. type: String,
  54878. values: uploadListTypes,
  54879. default: "text"
  54880. },
  54881. crossorigin: {
  54882. type: definePropType(String)
  54883. }
  54884. });
  54885. const uploadListEmits = {
  54886. remove: (file) => !!file
  54887. };
  54888. const __default__$f = vue.defineComponent({
  54889. name: "ElUploadList"
  54890. });
  54891. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  54892. ...__default__$f,
  54893. props: uploadListProps,
  54894. emits: uploadListEmits,
  54895. setup(__props, { emit }) {
  54896. const props = __props;
  54897. const { t } = useLocale();
  54898. const nsUpload = useNamespace("upload");
  54899. const nsIcon = useNamespace("icon");
  54900. const nsList = useNamespace("list");
  54901. const disabled = useFormDisabled();
  54902. const focusing = vue.ref(false);
  54903. const containerKls = vue.computed(() => [
  54904. nsUpload.b("list"),
  54905. nsUpload.bm("list", props.listType),
  54906. nsUpload.is("disabled", props.disabled)
  54907. ]);
  54908. const handleRemove = (file) => {
  54909. emit("remove", file);
  54910. };
  54911. return (_ctx, _cache) => {
  54912. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  54913. tag: "ul",
  54914. class: vue.normalizeClass(vue.unref(containerKls)),
  54915. name: vue.unref(nsList).b()
  54916. }, {
  54917. default: vue.withCtx(() => [
  54918. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file, index) => {
  54919. return vue.openBlock(), vue.createElementBlock("li", {
  54920. key: file.uid || file.name,
  54921. class: vue.normalizeClass([
  54922. vue.unref(nsUpload).be("list", "item"),
  54923. vue.unref(nsUpload).is(file.status),
  54924. { focusing: focusing.value }
  54925. ]),
  54926. tabindex: "0",
  54927. onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]),
  54928. onFocus: ($event) => focusing.value = true,
  54929. onBlur: ($event) => focusing.value = false,
  54930. onClick: ($event) => focusing.value = false
  54931. }, [
  54932. vue.renderSlot(_ctx.$slots, "default", {
  54933. file,
  54934. index
  54935. }, () => [
  54936. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  54937. key: 0,
  54938. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  54939. src: file.url,
  54940. crossorigin: _ctx.crossorigin,
  54941. alt: ""
  54942. }, null, 10, ["src", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  54943. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  54944. key: 1,
  54945. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  54946. }, [
  54947. vue.createElementVNode("a", {
  54948. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  54949. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  54950. }, [
  54951. vue.createVNode(vue.unref(ElIcon), {
  54952. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  54953. }, {
  54954. default: vue.withCtx(() => [
  54955. vue.createVNode(vue.unref(document_default))
  54956. ]),
  54957. _: 1
  54958. }, 8, ["class"]),
  54959. vue.createElementVNode("span", {
  54960. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name")),
  54961. title: file.name
  54962. }, vue.toDisplayString(file.name), 11, ["title"])
  54963. ], 10, ["onClick"]),
  54964. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  54965. key: 0,
  54966. type: _ctx.listType === "picture-card" ? "circle" : "line",
  54967. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  54968. percentage: Number(file.percentage),
  54969. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  54970. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  54971. ], 2)) : vue.createCommentVNode("v-if", true),
  54972. vue.createElementVNode("label", {
  54973. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  54974. }, [
  54975. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54976. key: 0,
  54977. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  54978. }, {
  54979. default: vue.withCtx(() => [
  54980. vue.createVNode(vue.unref(circle_check_default))
  54981. ]),
  54982. _: 1
  54983. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54984. key: 1,
  54985. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  54986. }, {
  54987. default: vue.withCtx(() => [
  54988. vue.createVNode(vue.unref(check_default))
  54989. ]),
  54990. _: 1
  54991. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  54992. ], 2),
  54993. !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54994. key: 2,
  54995. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  54996. onClick: ($event) => handleRemove(file)
  54997. }, {
  54998. default: vue.withCtx(() => [
  54999. vue.createVNode(vue.unref(close_default))
  55000. ]),
  55001. _: 2
  55002. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  55003. vue.createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  55004. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  55005. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  55006. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", {
  55007. key: 3,
  55008. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  55009. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  55010. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  55011. key: 4,
  55012. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  55013. }, [
  55014. vue.createElementVNode("span", {
  55015. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  55016. onClick: ($event) => _ctx.handlePreview(file)
  55017. }, [
  55018. vue.createVNode(vue.unref(ElIcon), {
  55019. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  55020. }, {
  55021. default: vue.withCtx(() => [
  55022. vue.createVNode(vue.unref(zoom_in_default))
  55023. ]),
  55024. _: 1
  55025. }, 8, ["class"])
  55026. ], 10, ["onClick"]),
  55027. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", {
  55028. key: 0,
  55029. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  55030. onClick: ($event) => handleRemove(file)
  55031. }, [
  55032. vue.createVNode(vue.unref(ElIcon), {
  55033. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  55034. }, {
  55035. default: vue.withCtx(() => [
  55036. vue.createVNode(vue.unref(delete_default))
  55037. ]),
  55038. _: 1
  55039. }, 8, ["class"])
  55040. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  55041. ], 2)) : vue.createCommentVNode("v-if", true)
  55042. ])
  55043. ], 42, ["onKeydown", "onFocus", "onBlur", "onClick"]);
  55044. }), 128)),
  55045. vue.renderSlot(_ctx.$slots, "append")
  55046. ]),
  55047. _: 3
  55048. }, 8, ["class", "name"]);
  55049. };
  55050. }
  55051. });
  55052. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "upload-list.vue"]]);
  55053. const uploadDraggerProps = buildProps({
  55054. disabled: {
  55055. type: Boolean,
  55056. default: false
  55057. }
  55058. });
  55059. const uploadDraggerEmits = {
  55060. file: (file) => isArray$1(file)
  55061. };
  55062. const COMPONENT_NAME = "ElUploadDrag";
  55063. const __default__$e = vue.defineComponent({
  55064. name: COMPONENT_NAME
  55065. });
  55066. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  55067. ...__default__$e,
  55068. props: uploadDraggerProps,
  55069. emits: uploadDraggerEmits,
  55070. setup(__props, { emit }) {
  55071. const uploaderContext = vue.inject(uploadContextKey);
  55072. if (!uploaderContext) {
  55073. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  55074. }
  55075. const ns = useNamespace("upload");
  55076. const dragover = vue.ref(false);
  55077. const disabled = useFormDisabled();
  55078. const onDrop = (e) => {
  55079. if (disabled.value)
  55080. return;
  55081. dragover.value = false;
  55082. e.stopPropagation();
  55083. const files = Array.from(e.dataTransfer.files);
  55084. const items = e.dataTransfer.items || [];
  55085. files.forEach((file, index) => {
  55086. var _a;
  55087. const item = items[index];
  55088. const entry = (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item);
  55089. if (entry) {
  55090. file.isDirectory = entry.isDirectory;
  55091. }
  55092. });
  55093. emit("file", files);
  55094. };
  55095. const onDragover = () => {
  55096. if (!disabled.value)
  55097. dragover.value = true;
  55098. };
  55099. return (_ctx, _cache) => {
  55100. return vue.openBlock(), vue.createElementBlock("div", {
  55101. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  55102. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  55103. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  55104. onDragleave: vue.withModifiers(($event) => dragover.value = false, ["prevent"])
  55105. }, [
  55106. vue.renderSlot(_ctx.$slots, "default")
  55107. ], 42, ["onDrop", "onDragover", "onDragleave"]);
  55108. };
  55109. }
  55110. });
  55111. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "upload-dragger.vue"]]);
  55112. const uploadContentProps = buildProps({
  55113. ...uploadBaseProps,
  55114. beforeUpload: {
  55115. type: definePropType(Function),
  55116. default: NOOP
  55117. },
  55118. onRemove: {
  55119. type: definePropType(Function),
  55120. default: NOOP
  55121. },
  55122. onStart: {
  55123. type: definePropType(Function),
  55124. default: NOOP
  55125. },
  55126. onSuccess: {
  55127. type: definePropType(Function),
  55128. default: NOOP
  55129. },
  55130. onProgress: {
  55131. type: definePropType(Function),
  55132. default: NOOP
  55133. },
  55134. onError: {
  55135. type: definePropType(Function),
  55136. default: NOOP
  55137. },
  55138. onExceed: {
  55139. type: definePropType(Function),
  55140. default: NOOP
  55141. }
  55142. });
  55143. const __default__$d = vue.defineComponent({
  55144. name: "ElUploadContent",
  55145. inheritAttrs: false
  55146. });
  55147. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  55148. ...__default__$d,
  55149. props: uploadContentProps,
  55150. setup(__props, { expose }) {
  55151. const props = __props;
  55152. const ns = useNamespace("upload");
  55153. const disabled = useFormDisabled();
  55154. const requests = vue.shallowRef({});
  55155. const inputRef = vue.shallowRef();
  55156. const uploadFiles = (files) => {
  55157. if (files.length === 0)
  55158. return;
  55159. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  55160. if (limit && fileList.length + files.length > limit) {
  55161. onExceed(files, fileList);
  55162. return;
  55163. }
  55164. if (!multiple) {
  55165. files = files.slice(0, 1);
  55166. }
  55167. for (const file of files) {
  55168. const rawFile = file;
  55169. rawFile.uid = genFileId();
  55170. onStart(rawFile);
  55171. if (autoUpload)
  55172. upload(rawFile);
  55173. }
  55174. };
  55175. const upload = async (rawFile) => {
  55176. inputRef.value.value = "";
  55177. if (!props.beforeUpload) {
  55178. return doUpload(rawFile);
  55179. }
  55180. let hookResult;
  55181. let beforeData = {};
  55182. try {
  55183. const originData = props.data;
  55184. const beforeUploadPromise = props.beforeUpload(rawFile);
  55185. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  55186. hookResult = await beforeUploadPromise;
  55187. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  55188. beforeData = cloneDeep(props.data);
  55189. }
  55190. } catch (e) {
  55191. hookResult = false;
  55192. }
  55193. if (hookResult === false) {
  55194. props.onRemove(rawFile);
  55195. return;
  55196. }
  55197. let file = rawFile;
  55198. if (hookResult instanceof Blob) {
  55199. if (hookResult instanceof File) {
  55200. file = hookResult;
  55201. } else {
  55202. file = new File([hookResult], rawFile.name, {
  55203. type: rawFile.type
  55204. });
  55205. }
  55206. }
  55207. doUpload(Object.assign(file, {
  55208. uid: rawFile.uid
  55209. }), beforeData);
  55210. };
  55211. const resolveData = async (data, rawFile) => {
  55212. if (isFunction$1(data)) {
  55213. return data(rawFile);
  55214. }
  55215. return data;
  55216. };
  55217. const doUpload = async (rawFile, beforeData) => {
  55218. const {
  55219. headers,
  55220. data,
  55221. method,
  55222. withCredentials,
  55223. name: filename,
  55224. action,
  55225. onProgress,
  55226. onSuccess,
  55227. onError,
  55228. httpRequest
  55229. } = props;
  55230. try {
  55231. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  55232. } catch (e) {
  55233. props.onRemove(rawFile);
  55234. return;
  55235. }
  55236. const { uid } = rawFile;
  55237. const options = {
  55238. headers: headers || {},
  55239. withCredentials,
  55240. file: rawFile,
  55241. data: beforeData,
  55242. method,
  55243. filename,
  55244. action,
  55245. onProgress: (evt) => {
  55246. onProgress(evt, rawFile);
  55247. },
  55248. onSuccess: (res) => {
  55249. onSuccess(res, rawFile);
  55250. delete requests.value[uid];
  55251. },
  55252. onError: (err) => {
  55253. onError(err, rawFile);
  55254. delete requests.value[uid];
  55255. }
  55256. };
  55257. const request = httpRequest(options);
  55258. requests.value[uid] = request;
  55259. if (request instanceof Promise) {
  55260. request.then(options.onSuccess, options.onError);
  55261. }
  55262. };
  55263. const handleChange = (e) => {
  55264. const files = e.target.files;
  55265. if (!files)
  55266. return;
  55267. uploadFiles(Array.from(files));
  55268. };
  55269. const handleClick = () => {
  55270. if (!disabled.value) {
  55271. inputRef.value.value = "";
  55272. inputRef.value.click();
  55273. }
  55274. };
  55275. const handleKeydown = () => {
  55276. handleClick();
  55277. };
  55278. const abort = (file) => {
  55279. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  55280. _reqs.forEach(([uid, req]) => {
  55281. if (req instanceof XMLHttpRequest)
  55282. req.abort();
  55283. delete requests.value[uid];
  55284. });
  55285. };
  55286. expose({
  55287. abort,
  55288. upload
  55289. });
  55290. return (_ctx, _cache) => {
  55291. return vue.openBlock(), vue.createElementBlock("div", {
  55292. class: vue.normalizeClass([
  55293. vue.unref(ns).b(),
  55294. vue.unref(ns).m(_ctx.listType),
  55295. vue.unref(ns).is("drag", _ctx.drag),
  55296. vue.unref(ns).is("disabled", vue.unref(disabled))
  55297. ]),
  55298. tabindex: vue.unref(disabled) ? "-1" : "0",
  55299. onClick: handleClick,
  55300. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  55301. }, [
  55302. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  55303. key: 0,
  55304. disabled: vue.unref(disabled),
  55305. onFile: uploadFiles
  55306. }, {
  55307. default: vue.withCtx(() => [
  55308. vue.renderSlot(_ctx.$slots, "default")
  55309. ]),
  55310. _: 3
  55311. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  55312. vue.createElementVNode("input", {
  55313. ref_key: "inputRef",
  55314. ref: inputRef,
  55315. class: vue.normalizeClass(vue.unref(ns).e("input")),
  55316. name: _ctx.name,
  55317. disabled: vue.unref(disabled),
  55318. multiple: _ctx.multiple,
  55319. accept: _ctx.accept,
  55320. type: "file",
  55321. onChange: handleChange,
  55322. onClick: vue.withModifiers(() => {
  55323. }, ["stop"])
  55324. }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
  55325. ], 42, ["tabindex", "onKeydown"]);
  55326. };
  55327. }
  55328. });
  55329. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "upload-content.vue"]]);
  55330. const SCOPE$1 = "ElUpload";
  55331. const revokeFileObjectURL = (file) => {
  55332. var _a;
  55333. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  55334. URL.revokeObjectURL(file.url);
  55335. }
  55336. };
  55337. const useHandlers = (props, uploadRef) => {
  55338. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  55339. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  55340. function abort(file) {
  55341. var _a;
  55342. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  55343. }
  55344. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  55345. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  55346. }
  55347. function removeFile(file) {
  55348. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid);
  55349. }
  55350. const handleError = (err, rawFile) => {
  55351. const file = getFile(rawFile);
  55352. if (!file)
  55353. return;
  55354. console.error(err);
  55355. file.status = "fail";
  55356. removeFile(file);
  55357. props.onError(err, file, uploadFiles.value);
  55358. props.onChange(file, uploadFiles.value);
  55359. };
  55360. const handleProgress = (evt, rawFile) => {
  55361. const file = getFile(rawFile);
  55362. if (!file)
  55363. return;
  55364. props.onProgress(evt, file, uploadFiles.value);
  55365. file.status = "uploading";
  55366. file.percentage = Math.round(evt.percent);
  55367. };
  55368. const handleSuccess = (response, rawFile) => {
  55369. const file = getFile(rawFile);
  55370. if (!file)
  55371. return;
  55372. file.status = "success";
  55373. file.response = response;
  55374. props.onSuccess(response, file, uploadFiles.value);
  55375. props.onChange(file, uploadFiles.value);
  55376. };
  55377. const handleStart = (file) => {
  55378. if (isNil(file.uid))
  55379. file.uid = genFileId();
  55380. const uploadFile = {
  55381. name: file.name,
  55382. percentage: 0,
  55383. status: "ready",
  55384. size: file.size,
  55385. raw: file,
  55386. uid: file.uid
  55387. };
  55388. if (props.listType === "picture-card" || props.listType === "picture") {
  55389. try {
  55390. uploadFile.url = URL.createObjectURL(file);
  55391. } catch (err) {
  55392. debugWarn(SCOPE$1, err.message);
  55393. props.onError(err, uploadFile, uploadFiles.value);
  55394. }
  55395. }
  55396. uploadFiles.value = [...uploadFiles.value, uploadFile];
  55397. props.onChange(uploadFile, uploadFiles.value);
  55398. };
  55399. const handleRemove = async (file) => {
  55400. const uploadFile = file instanceof File ? getFile(file) : file;
  55401. if (!uploadFile)
  55402. throwError(SCOPE$1, "file to be removed not found");
  55403. const doRemove = (file2) => {
  55404. abort(file2);
  55405. removeFile(file2);
  55406. props.onRemove(file2, uploadFiles.value);
  55407. revokeFileObjectURL(file2);
  55408. };
  55409. if (props.beforeRemove) {
  55410. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  55411. if (before !== false)
  55412. doRemove(uploadFile);
  55413. } else {
  55414. doRemove(uploadFile);
  55415. }
  55416. };
  55417. function submit() {
  55418. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  55419. var _a;
  55420. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  55421. });
  55422. }
  55423. vue.watch(() => props.listType, (val) => {
  55424. if (val !== "picture-card" && val !== "picture") {
  55425. return;
  55426. }
  55427. uploadFiles.value = uploadFiles.value.map((file) => {
  55428. const { raw, url } = file;
  55429. if (!url && raw) {
  55430. try {
  55431. file.url = URL.createObjectURL(raw);
  55432. } catch (err) {
  55433. props.onError(err, file, uploadFiles.value);
  55434. }
  55435. }
  55436. return file;
  55437. });
  55438. });
  55439. vue.watch(uploadFiles, (files) => {
  55440. for (const file of files) {
  55441. file.uid || (file.uid = genFileId());
  55442. file.status || (file.status = "success");
  55443. }
  55444. }, { immediate: true, deep: true });
  55445. return {
  55446. uploadFiles,
  55447. abort,
  55448. clearFiles,
  55449. handleError,
  55450. handleProgress,
  55451. handleStart,
  55452. handleSuccess,
  55453. handleRemove,
  55454. submit,
  55455. revokeFileObjectURL
  55456. };
  55457. };
  55458. const __default__$c = vue.defineComponent({
  55459. name: "ElUpload"
  55460. });
  55461. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  55462. ...__default__$c,
  55463. props: uploadProps,
  55464. setup(__props, { expose }) {
  55465. const props = __props;
  55466. const disabled = useFormDisabled();
  55467. const uploadRef = vue.shallowRef();
  55468. const {
  55469. abort,
  55470. submit,
  55471. clearFiles,
  55472. uploadFiles,
  55473. handleStart,
  55474. handleError,
  55475. handleRemove,
  55476. handleSuccess,
  55477. handleProgress,
  55478. revokeFileObjectURL
  55479. } = useHandlers(props, uploadRef);
  55480. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  55481. const uploadContentProps = vue.computed(() => ({
  55482. ...props,
  55483. fileList: uploadFiles.value,
  55484. onStart: handleStart,
  55485. onProgress: handleProgress,
  55486. onSuccess: handleSuccess,
  55487. onError: handleError,
  55488. onRemove: handleRemove
  55489. }));
  55490. vue.onBeforeUnmount(() => {
  55491. uploadFiles.value.forEach(revokeFileObjectURL);
  55492. });
  55493. vue.provide(uploadContextKey, {
  55494. accept: vue.toRef(props, "accept")
  55495. });
  55496. expose({
  55497. abort,
  55498. submit,
  55499. clearFiles,
  55500. handleStart,
  55501. handleRemove
  55502. });
  55503. return (_ctx, _cache) => {
  55504. return vue.openBlock(), vue.createElementBlock("div", null, [
  55505. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  55506. key: 0,
  55507. disabled: vue.unref(disabled),
  55508. "list-type": _ctx.listType,
  55509. files: vue.unref(uploadFiles),
  55510. crossorigin: _ctx.crossorigin,
  55511. "handle-preview": _ctx.onPreview,
  55512. onRemove: vue.unref(handleRemove)
  55513. }, vue.createSlots({
  55514. append: vue.withCtx(() => [
  55515. vue.createVNode(UploadContent, vue.mergeProps({
  55516. ref_key: "uploadRef",
  55517. ref: uploadRef
  55518. }, vue.unref(uploadContentProps)), {
  55519. default: vue.withCtx(() => [
  55520. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  55521. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  55522. ]),
  55523. _: 3
  55524. }, 16)
  55525. ]),
  55526. _: 2
  55527. }, [
  55528. _ctx.$slots.file ? {
  55529. name: "default",
  55530. fn: vue.withCtx(({ file, index }) => [
  55531. vue.renderSlot(_ctx.$slots, "file", {
  55532. file,
  55533. index
  55534. })
  55535. ])
  55536. } : void 0
  55537. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  55538. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  55539. key: 1,
  55540. ref_key: "uploadRef",
  55541. ref: uploadRef
  55542. }, vue.unref(uploadContentProps)), {
  55543. default: vue.withCtx(() => [
  55544. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  55545. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  55546. ]),
  55547. _: 3
  55548. }, 16)) : vue.createCommentVNode("v-if", true),
  55549. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  55550. vue.renderSlot(_ctx.$slots, "tip"),
  55551. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  55552. key: 3,
  55553. disabled: vue.unref(disabled),
  55554. "list-type": _ctx.listType,
  55555. files: vue.unref(uploadFiles),
  55556. crossorigin: _ctx.crossorigin,
  55557. "handle-preview": _ctx.onPreview,
  55558. onRemove: vue.unref(handleRemove)
  55559. }, vue.createSlots({
  55560. _: 2
  55561. }, [
  55562. _ctx.$slots.file ? {
  55563. name: "default",
  55564. fn: vue.withCtx(({ file, index }) => [
  55565. vue.renderSlot(_ctx.$slots, "file", {
  55566. file,
  55567. index
  55568. })
  55569. ])
  55570. } : void 0
  55571. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  55572. ]);
  55573. };
  55574. }
  55575. });
  55576. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "upload.vue"]]);
  55577. const ElUpload = withInstall(Upload);
  55578. const watermarkProps = buildProps({
  55579. zIndex: {
  55580. type: Number,
  55581. default: 9
  55582. },
  55583. rotate: {
  55584. type: Number,
  55585. default: -22
  55586. },
  55587. width: Number,
  55588. height: Number,
  55589. image: String,
  55590. content: {
  55591. type: definePropType([String, Array]),
  55592. default: "Element Plus"
  55593. },
  55594. font: {
  55595. type: definePropType(Object)
  55596. },
  55597. gap: {
  55598. type: definePropType(Array),
  55599. default: () => [100, 100]
  55600. },
  55601. offset: {
  55602. type: definePropType(Array)
  55603. }
  55604. });
  55605. function toLowercaseSeparator(key) {
  55606. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  55607. }
  55608. function getStyleStr(style) {
  55609. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  55610. }
  55611. function getPixelRatio() {
  55612. return window.devicePixelRatio || 1;
  55613. }
  55614. const reRendering = (mutation, watermarkElement) => {
  55615. let flag = false;
  55616. if (mutation.removedNodes.length && watermarkElement) {
  55617. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  55618. }
  55619. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  55620. flag = true;
  55621. }
  55622. return flag;
  55623. };
  55624. const FontGap = 3;
  55625. function prepareCanvas(width, height, ratio = 1) {
  55626. const canvas = document.createElement("canvas");
  55627. const ctx = canvas.getContext("2d");
  55628. const realWidth = width * ratio;
  55629. const realHeight = height * ratio;
  55630. canvas.setAttribute("width", `${realWidth}px`);
  55631. canvas.setAttribute("height", `${realHeight}px`);
  55632. ctx.save();
  55633. return [ctx, canvas, realWidth, realHeight];
  55634. }
  55635. function useClips() {
  55636. function getClips(content, rotate, ratio, width, height, font, gapX, gapY) {
  55637. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  55638. if (content instanceof HTMLImageElement) {
  55639. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  55640. } else {
  55641. const {
  55642. color,
  55643. fontSize,
  55644. fontStyle,
  55645. fontWeight,
  55646. fontFamily,
  55647. textAlign,
  55648. textBaseline
  55649. } = font;
  55650. const mergedFontSize = Number(fontSize) * ratio;
  55651. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  55652. ctx.fillStyle = color;
  55653. ctx.textAlign = textAlign;
  55654. ctx.textBaseline = textBaseline;
  55655. const contents = isArray$1(content) ? content : [content];
  55656. contents == null ? void 0 : contents.forEach((item, index) => {
  55657. ctx.fillText(item != null ? item : "", contentWidth / 2, index * (mergedFontSize + FontGap * ratio));
  55658. });
  55659. }
  55660. const angle = Math.PI / 180 * Number(rotate);
  55661. const maxSize = Math.max(width, height);
  55662. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  55663. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  55664. rCtx.rotate(angle);
  55665. if (contentWidth > 0 && contentHeight > 0) {
  55666. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  55667. }
  55668. function getRotatePos(x, y) {
  55669. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  55670. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  55671. return [targetX, targetY];
  55672. }
  55673. let left = 0;
  55674. let right = 0;
  55675. let top = 0;
  55676. let bottom = 0;
  55677. const halfWidth = contentWidth / 2;
  55678. const halfHeight = contentHeight / 2;
  55679. const points = [
  55680. [0 - halfWidth, 0 - halfHeight],
  55681. [0 + halfWidth, 0 - halfHeight],
  55682. [0 + halfWidth, 0 + halfHeight],
  55683. [0 - halfWidth, 0 + halfHeight]
  55684. ];
  55685. points.forEach(([x, y]) => {
  55686. const [targetX, targetY] = getRotatePos(x, y);
  55687. left = Math.min(left, targetX);
  55688. right = Math.max(right, targetX);
  55689. top = Math.min(top, targetY);
  55690. bottom = Math.max(bottom, targetY);
  55691. });
  55692. const cutLeft = left + realMaxSize / 2;
  55693. const cutTop = top + realMaxSize / 2;
  55694. const cutWidth = right - left;
  55695. const cutHeight = bottom - top;
  55696. const realGapX = gapX * ratio;
  55697. const realGapY = gapY * ratio;
  55698. const filledWidth = (cutWidth + realGapX) * 2;
  55699. const filledHeight = cutHeight + realGapY;
  55700. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  55701. function drawImg(targetX = 0, targetY = 0) {
  55702. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  55703. }
  55704. drawImg();
  55705. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  55706. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  55707. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  55708. }
  55709. return getClips;
  55710. }
  55711. const __default__$b = vue.defineComponent({
  55712. name: "ElWatermark"
  55713. });
  55714. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  55715. ...__default__$b,
  55716. props: watermarkProps,
  55717. setup(__props) {
  55718. const props = __props;
  55719. const style = {
  55720. position: "relative"
  55721. };
  55722. const color = vue.computed(() => {
  55723. var _a, _b;
  55724. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  55725. });
  55726. const fontSize = vue.computed(() => {
  55727. var _a, _b;
  55728. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  55729. });
  55730. const fontWeight = vue.computed(() => {
  55731. var _a, _b;
  55732. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  55733. });
  55734. const fontStyle = vue.computed(() => {
  55735. var _a, _b;
  55736. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  55737. });
  55738. const fontFamily = vue.computed(() => {
  55739. var _a, _b;
  55740. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  55741. });
  55742. const textAlign = vue.computed(() => {
  55743. var _a, _b;
  55744. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  55745. });
  55746. const textBaseline = vue.computed(() => {
  55747. var _a, _b;
  55748. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  55749. });
  55750. const gapX = vue.computed(() => props.gap[0]);
  55751. const gapY = vue.computed(() => props.gap[1]);
  55752. const gapXCenter = vue.computed(() => gapX.value / 2);
  55753. const gapYCenter = vue.computed(() => gapY.value / 2);
  55754. const offsetLeft = vue.computed(() => {
  55755. var _a, _b;
  55756. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  55757. });
  55758. const offsetTop = vue.computed(() => {
  55759. var _a, _b;
  55760. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  55761. });
  55762. const getMarkStyle = () => {
  55763. const markStyle = {
  55764. zIndex: props.zIndex,
  55765. position: "absolute",
  55766. left: 0,
  55767. top: 0,
  55768. width: "100%",
  55769. height: "100%",
  55770. pointerEvents: "none",
  55771. backgroundRepeat: "repeat"
  55772. };
  55773. let positionLeft = offsetLeft.value - gapXCenter.value;
  55774. let positionTop = offsetTop.value - gapYCenter.value;
  55775. if (positionLeft > 0) {
  55776. markStyle.left = `${positionLeft}px`;
  55777. markStyle.width = `calc(100% - ${positionLeft}px)`;
  55778. positionLeft = 0;
  55779. }
  55780. if (positionTop > 0) {
  55781. markStyle.top = `${positionTop}px`;
  55782. markStyle.height = `calc(100% - ${positionTop}px)`;
  55783. positionTop = 0;
  55784. }
  55785. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  55786. return markStyle;
  55787. };
  55788. const containerRef = vue.shallowRef(null);
  55789. const watermarkRef = vue.shallowRef();
  55790. const stopObservation = vue.ref(false);
  55791. const destroyWatermark = () => {
  55792. if (watermarkRef.value) {
  55793. watermarkRef.value.remove();
  55794. watermarkRef.value = void 0;
  55795. }
  55796. };
  55797. const appendWatermark = (base64Url, markWidth) => {
  55798. var _a;
  55799. if (containerRef.value && watermarkRef.value) {
  55800. stopObservation.value = true;
  55801. watermarkRef.value.setAttribute("style", getStyleStr({
  55802. ...getMarkStyle(),
  55803. backgroundImage: `url('${base64Url}')`,
  55804. backgroundSize: `${Math.floor(markWidth)}px`
  55805. }));
  55806. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  55807. setTimeout(() => {
  55808. stopObservation.value = false;
  55809. });
  55810. }
  55811. };
  55812. const getMarkSize = (ctx) => {
  55813. let defaultWidth = 120;
  55814. let defaultHeight = 64;
  55815. const { image, content, width, height, rotate } = props;
  55816. if (!image && ctx.measureText) {
  55817. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  55818. const contents = isArray$1(content) ? content : [content];
  55819. let maxWidth = 0;
  55820. let maxHeight = 0;
  55821. contents.forEach((item) => {
  55822. const {
  55823. width: width2,
  55824. fontBoundingBoxAscent,
  55825. fontBoundingBoxDescent,
  55826. actualBoundingBoxAscent,
  55827. actualBoundingBoxDescent
  55828. } = ctx.measureText(item);
  55829. const height2 = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
  55830. if (width2 > maxWidth)
  55831. maxWidth = Math.ceil(width2);
  55832. if (height2 > maxHeight)
  55833. maxHeight = Math.ceil(height2);
  55834. });
  55835. defaultWidth = maxWidth;
  55836. defaultHeight = maxHeight * contents.length + (contents.length - 1) * FontGap;
  55837. const angle = Math.PI / 180 * Number(rotate);
  55838. const space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
  55839. defaultWidth += space;
  55840. }
  55841. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
  55842. };
  55843. const getClips = useClips();
  55844. const renderWatermark = () => {
  55845. const canvas = document.createElement("canvas");
  55846. const ctx = canvas.getContext("2d");
  55847. const image = props.image;
  55848. const content = props.content;
  55849. const rotate = props.rotate;
  55850. if (ctx) {
  55851. if (!watermarkRef.value) {
  55852. watermarkRef.value = document.createElement("div");
  55853. }
  55854. const ratio = getPixelRatio();
  55855. const [markWidth, markHeight] = getMarkSize(ctx);
  55856. const drawCanvas = (drawContent) => {
  55857. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  55858. color: color.value,
  55859. fontSize: fontSize.value,
  55860. fontStyle: fontStyle.value,
  55861. fontWeight: fontWeight.value,
  55862. fontFamily: fontFamily.value,
  55863. textAlign: textAlign.value,
  55864. textBaseline: textBaseline.value
  55865. }, gapX.value, gapY.value);
  55866. appendWatermark(textClips, clipWidth);
  55867. };
  55868. if (image) {
  55869. const img = new Image();
  55870. img.onload = () => {
  55871. drawCanvas(img);
  55872. };
  55873. img.onerror = () => {
  55874. drawCanvas(content);
  55875. };
  55876. img.crossOrigin = "anonymous";
  55877. img.referrerPolicy = "no-referrer";
  55878. img.src = image;
  55879. } else {
  55880. drawCanvas(content);
  55881. }
  55882. }
  55883. };
  55884. vue.onMounted(() => {
  55885. renderWatermark();
  55886. });
  55887. vue.watch(() => props, () => {
  55888. renderWatermark();
  55889. }, {
  55890. deep: true,
  55891. flush: "post"
  55892. });
  55893. vue.onBeforeUnmount(() => {
  55894. destroyWatermark();
  55895. });
  55896. const onMutate = (mutations) => {
  55897. if (stopObservation.value) {
  55898. return;
  55899. }
  55900. mutations.forEach((mutation) => {
  55901. if (reRendering(mutation, watermarkRef.value)) {
  55902. destroyWatermark();
  55903. renderWatermark();
  55904. }
  55905. });
  55906. };
  55907. useMutationObserver(containerRef, onMutate, {
  55908. attributes: true,
  55909. subtree: true,
  55910. childList: true
  55911. });
  55912. return (_ctx, _cache) => {
  55913. return vue.openBlock(), vue.createElementBlock("div", {
  55914. ref_key: "containerRef",
  55915. ref: containerRef,
  55916. style: vue.normalizeStyle([style])
  55917. }, [
  55918. vue.renderSlot(_ctx.$slots, "default")
  55919. ], 4);
  55920. };
  55921. }
  55922. });
  55923. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "watermark.vue"]]);
  55924. const ElWatermark = withInstall(Watermark);
  55925. const maskProps = buildProps({
  55926. zIndex: {
  55927. type: Number,
  55928. default: 1001
  55929. },
  55930. visible: Boolean,
  55931. fill: {
  55932. type: String,
  55933. default: "rgba(0,0,0,0.5)"
  55934. },
  55935. pos: {
  55936. type: definePropType(Object)
  55937. },
  55938. targetAreaClickable: {
  55939. type: Boolean,
  55940. default: true
  55941. }
  55942. });
  55943. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  55944. const posInfo = vue.ref(null);
  55945. const getTargetEl = () => {
  55946. let targetEl;
  55947. if (isString$1(target.value)) {
  55948. targetEl = document.querySelector(target.value);
  55949. } else if (isFunction$1(target.value)) {
  55950. targetEl = target.value();
  55951. } else {
  55952. targetEl = target.value;
  55953. }
  55954. return targetEl;
  55955. };
  55956. const updatePosInfo = () => {
  55957. const targetEl = getTargetEl();
  55958. if (!targetEl || !open.value) {
  55959. posInfo.value = null;
  55960. return;
  55961. }
  55962. if (!isInViewPort(targetEl)) {
  55963. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  55964. }
  55965. const { left, top, width, height } = targetEl.getBoundingClientRect();
  55966. posInfo.value = {
  55967. left,
  55968. top,
  55969. width,
  55970. height,
  55971. radius: 0
  55972. };
  55973. };
  55974. vue.onMounted(() => {
  55975. vue.watch([open, target], () => {
  55976. updatePosInfo();
  55977. }, {
  55978. immediate: true
  55979. });
  55980. window.addEventListener("resize", updatePosInfo);
  55981. });
  55982. vue.onBeforeUnmount(() => {
  55983. window.removeEventListener("resize", updatePosInfo);
  55984. });
  55985. const getGapOffset = (index) => {
  55986. var _a;
  55987. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  55988. };
  55989. const mergedPosInfo = vue.computed(() => {
  55990. var _a;
  55991. if (!posInfo.value)
  55992. return posInfo.value;
  55993. const gapOffsetX = getGapOffset(0);
  55994. const gapOffsetY = getGapOffset(1);
  55995. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  55996. return {
  55997. left: posInfo.value.left - gapOffsetX,
  55998. top: posInfo.value.top - gapOffsetY,
  55999. width: posInfo.value.width + gapOffsetX * 2,
  56000. height: posInfo.value.height + gapOffsetY * 2,
  56001. radius: gapRadius
  56002. };
  56003. });
  56004. const triggerTarget = vue.computed(() => {
  56005. const targetEl = getTargetEl();
  56006. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  56007. return targetEl || void 0;
  56008. }
  56009. return {
  56010. getBoundingClientRect() {
  56011. var _a, _b, _c, _d;
  56012. return window.DOMRect.fromRect({
  56013. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  56014. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  56015. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  56016. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  56017. });
  56018. }
  56019. };
  56020. });
  56021. return {
  56022. mergedPosInfo,
  56023. triggerTarget
  56024. };
  56025. };
  56026. const tourKey = Symbol("ElTour");
  56027. function isInViewPort(element) {
  56028. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  56029. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  56030. const { top, right, bottom, left } = element.getBoundingClientRect();
  56031. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  56032. }
  56033. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  56034. const x = vue.ref();
  56035. const y = vue.ref();
  56036. const middlewareData = vue.ref({});
  56037. const states = {
  56038. x,
  56039. y,
  56040. placement,
  56041. strategy,
  56042. middlewareData
  56043. };
  56044. const middleware = vue.computed(() => {
  56045. const _middleware = [
  56046. offset(vue.unref(offset$1)),
  56047. flip(),
  56048. shift(),
  56049. overflowMiddleware()
  56050. ];
  56051. if (vue.unref(showArrow) && vue.unref(arrowRef)) {
  56052. _middleware.push(arrow({
  56053. element: vue.unref(arrowRef)
  56054. }));
  56055. }
  56056. return _middleware;
  56057. });
  56058. const update = async () => {
  56059. if (!isClient)
  56060. return;
  56061. const referenceEl = vue.unref(referenceRef);
  56062. const contentEl = vue.unref(contentRef);
  56063. if (!referenceEl || !contentEl)
  56064. return;
  56065. const data = await computePosition(referenceEl, contentEl, {
  56066. placement: vue.unref(placement),
  56067. strategy: vue.unref(strategy),
  56068. middleware: vue.unref(middleware)
  56069. });
  56070. keysOf(states).forEach((key) => {
  56071. states[key].value = data[key];
  56072. });
  56073. };
  56074. const contentStyle = vue.computed(() => {
  56075. if (!vue.unref(referenceRef)) {
  56076. return {
  56077. position: "fixed",
  56078. top: "50%",
  56079. left: "50%",
  56080. transform: "translate3d(-50%, -50%, 0)",
  56081. maxWidth: "100vw",
  56082. zIndex: vue.unref(zIndex)
  56083. };
  56084. }
  56085. const { overflow } = vue.unref(middlewareData);
  56086. return {
  56087. position: vue.unref(strategy),
  56088. zIndex: vue.unref(zIndex),
  56089. top: vue.unref(y) != null ? `${vue.unref(y)}px` : "",
  56090. left: vue.unref(x) != null ? `${vue.unref(x)}px` : "",
  56091. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  56092. };
  56093. });
  56094. const arrowStyle = vue.computed(() => {
  56095. if (!vue.unref(showArrow))
  56096. return {};
  56097. const { arrow: arrow2 } = vue.unref(middlewareData);
  56098. return {
  56099. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  56100. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  56101. };
  56102. });
  56103. let cleanup;
  56104. vue.onMounted(() => {
  56105. const referenceEl = vue.unref(referenceRef);
  56106. const contentEl = vue.unref(contentRef);
  56107. if (referenceEl && contentEl) {
  56108. cleanup = autoUpdate(referenceEl, contentEl, update);
  56109. }
  56110. vue.watchEffect(() => {
  56111. update();
  56112. });
  56113. });
  56114. vue.onBeforeUnmount(() => {
  56115. cleanup && cleanup();
  56116. });
  56117. return {
  56118. update,
  56119. contentStyle,
  56120. arrowStyle
  56121. };
  56122. };
  56123. const overflowMiddleware = () => {
  56124. return {
  56125. name: "overflow",
  56126. async fn(state) {
  56127. const overflow = await detectOverflow(state);
  56128. let overWidth = 0;
  56129. if (overflow.left > 0)
  56130. overWidth = overflow.left;
  56131. if (overflow.right > 0)
  56132. overWidth = overflow.right;
  56133. const floatingWidth = state.rects.floating.width;
  56134. return {
  56135. data: {
  56136. maxWidth: floatingWidth - overWidth
  56137. }
  56138. };
  56139. }
  56140. };
  56141. };
  56142. const __default__$a = vue.defineComponent({
  56143. name: "ElTourMask",
  56144. inheritAttrs: false
  56145. });
  56146. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  56147. ...__default__$a,
  56148. props: maskProps,
  56149. setup(__props) {
  56150. const props = __props;
  56151. const { ns } = vue.inject(tourKey);
  56152. const radius = vue.computed(() => {
  56153. var _a, _b;
  56154. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  56155. });
  56156. const roundInfo = vue.computed(() => {
  56157. const v = radius.value;
  56158. const baseInfo = `a${v},${v} 0 0 1`;
  56159. return {
  56160. topRight: `${baseInfo} ${v},${v}`,
  56161. bottomRight: `${baseInfo} ${-v},${v}`,
  56162. bottomLeft: `${baseInfo} ${-v},${-v}`,
  56163. topLeft: `${baseInfo} ${v},${-v}`
  56164. };
  56165. });
  56166. const path = vue.computed(() => {
  56167. const width = window.innerWidth;
  56168. const height = window.innerHeight;
  56169. const info = roundInfo.value;
  56170. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  56171. const _radius = radius.value;
  56172. return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
  56173. });
  56174. const pathStyle = vue.computed(() => {
  56175. return {
  56176. fill: props.fill,
  56177. pointerEvents: "auto",
  56178. cursor: "auto"
  56179. };
  56180. });
  56181. useLockscreen(vue.toRef(props, "visible"), {
  56182. ns
  56183. });
  56184. return (_ctx, _cache) => {
  56185. return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  56186. key: 0,
  56187. class: vue.unref(ns).e("mask"),
  56188. style: {
  56189. position: "fixed",
  56190. left: 0,
  56191. right: 0,
  56192. top: 0,
  56193. bottom: 0,
  56194. zIndex: _ctx.zIndex,
  56195. pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
  56196. }
  56197. }, _ctx.$attrs), [
  56198. (vue.openBlock(), vue.createElementBlock("svg", { style: {
  56199. width: "100%",
  56200. height: "100%"
  56201. } }, [
  56202. vue.createElementVNode("path", {
  56203. class: vue.normalizeClass(vue.unref(ns).e("hollow")),
  56204. style: vue.normalizeStyle(vue.unref(pathStyle)),
  56205. d: vue.unref(path)
  56206. }, null, 14, ["d"])
  56207. ]))
  56208. ], 16)) : vue.createCommentVNode("v-if", true);
  56209. };
  56210. }
  56211. });
  56212. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "mask.vue"]]);
  56213. const tourStrategies = ["absolute", "fixed"];
  56214. const tourPlacements = [
  56215. "top-start",
  56216. "top-end",
  56217. "top",
  56218. "bottom-start",
  56219. "bottom-end",
  56220. "bottom",
  56221. "left-start",
  56222. "left-end",
  56223. "left",
  56224. "right-start",
  56225. "right-end",
  56226. "right"
  56227. ];
  56228. const tourContentProps = buildProps({
  56229. placement: {
  56230. type: definePropType(String),
  56231. values: tourPlacements,
  56232. default: "bottom"
  56233. },
  56234. reference: {
  56235. type: definePropType(Object),
  56236. default: null
  56237. },
  56238. strategy: {
  56239. type: definePropType(String),
  56240. values: tourStrategies,
  56241. default: "absolute"
  56242. },
  56243. offset: {
  56244. type: Number,
  56245. default: 10
  56246. },
  56247. showArrow: Boolean,
  56248. zIndex: {
  56249. type: Number,
  56250. default: 2001
  56251. }
  56252. });
  56253. const tourContentEmits = {
  56254. close: () => true
  56255. };
  56256. const __default__$9 = vue.defineComponent({
  56257. name: "ElTourContent"
  56258. });
  56259. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  56260. ...__default__$9,
  56261. props: tourContentProps,
  56262. emits: tourContentEmits,
  56263. setup(__props, { emit }) {
  56264. const props = __props;
  56265. const placement = vue.ref(props.placement);
  56266. const strategy = vue.ref(props.strategy);
  56267. const contentRef = vue.ref(null);
  56268. const arrowRef = vue.ref(null);
  56269. vue.watch(() => props.placement, () => {
  56270. placement.value = props.placement;
  56271. });
  56272. const { contentStyle, arrowStyle } = useFloating(vue.toRef(props, "reference"), contentRef, arrowRef, placement, strategy, vue.toRef(props, "offset"), vue.toRef(props, "zIndex"), vue.toRef(props, "showArrow"));
  56273. const side = vue.computed(() => {
  56274. return placement.value.split("-")[0];
  56275. });
  56276. const { ns } = vue.inject(tourKey);
  56277. const onCloseRequested = () => {
  56278. emit("close");
  56279. };
  56280. const onFocusoutPrevented = (event) => {
  56281. if (event.detail.focusReason === "pointer") {
  56282. event.preventDefault();
  56283. }
  56284. };
  56285. return (_ctx, _cache) => {
  56286. return vue.openBlock(), vue.createElementBlock("div", {
  56287. ref_key: "contentRef",
  56288. ref: contentRef,
  56289. style: vue.normalizeStyle(vue.unref(contentStyle)),
  56290. class: vue.normalizeClass(vue.unref(ns).e("content")),
  56291. "data-side": vue.unref(side),
  56292. tabindex: "-1"
  56293. }, [
  56294. vue.createVNode(vue.unref(ElFocusTrap), {
  56295. loop: "",
  56296. trapped: "",
  56297. "focus-start-el": "container",
  56298. "focus-trap-el": contentRef.value || void 0,
  56299. onReleaseRequested: onCloseRequested,
  56300. onFocusoutPrevented
  56301. }, {
  56302. default: vue.withCtx(() => [
  56303. vue.renderSlot(_ctx.$slots, "default")
  56304. ]),
  56305. _: 3
  56306. }, 8, ["focus-trap-el"]),
  56307. _ctx.showArrow ? (vue.openBlock(), vue.createElementBlock("span", {
  56308. key: 0,
  56309. ref_key: "arrowRef",
  56310. ref: arrowRef,
  56311. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  56312. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  56313. }, null, 6)) : vue.createCommentVNode("v-if", true)
  56314. ], 14, ["data-side"]);
  56315. };
  56316. }
  56317. });
  56318. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "content.vue"]]);
  56319. var ElTourSteps = vue.defineComponent({
  56320. name: "ElTourSteps",
  56321. props: {
  56322. current: {
  56323. type: Number,
  56324. default: 0
  56325. }
  56326. },
  56327. emits: ["update-total"],
  56328. setup(props, { slots, emit }) {
  56329. let cacheTotal = 0;
  56330. return () => {
  56331. var _a, _b;
  56332. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  56333. const result = [];
  56334. let total = 0;
  56335. function filterSteps(children2) {
  56336. if (!isArray$1(children2))
  56337. return;
  56338. children2.forEach((item) => {
  56339. var _a2;
  56340. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  56341. if (name === "ElTourStep") {
  56342. result.push(item);
  56343. total += 1;
  56344. }
  56345. });
  56346. }
  56347. if (children.length) {
  56348. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  56349. }
  56350. if (cacheTotal !== total) {
  56351. cacheTotal = total;
  56352. emit("update-total", total);
  56353. }
  56354. if (result.length) {
  56355. return result[props.current];
  56356. }
  56357. return null;
  56358. };
  56359. }
  56360. });
  56361. const tourProps = buildProps({
  56362. modelValue: Boolean,
  56363. current: {
  56364. type: Number,
  56365. default: 0
  56366. },
  56367. showArrow: {
  56368. type: Boolean,
  56369. default: true
  56370. },
  56371. showClose: {
  56372. type: Boolean,
  56373. default: true
  56374. },
  56375. closeIcon: {
  56376. type: iconPropType
  56377. },
  56378. placement: tourContentProps.placement,
  56379. contentStyle: {
  56380. type: definePropType([Object])
  56381. },
  56382. mask: {
  56383. type: definePropType([Boolean, Object]),
  56384. default: true
  56385. },
  56386. gap: {
  56387. type: definePropType(Object),
  56388. default: () => ({
  56389. offset: 6,
  56390. radius: 2
  56391. })
  56392. },
  56393. zIndex: {
  56394. type: Number
  56395. },
  56396. scrollIntoViewOptions: {
  56397. type: definePropType([Boolean, Object]),
  56398. default: () => ({
  56399. block: "center"
  56400. })
  56401. },
  56402. type: {
  56403. type: definePropType(String)
  56404. },
  56405. appendTo: {
  56406. type: definePropType([String, Object]),
  56407. default: "body"
  56408. },
  56409. closeOnPressEscape: {
  56410. type: Boolean,
  56411. default: true
  56412. },
  56413. targetAreaClickable: {
  56414. type: Boolean,
  56415. default: true
  56416. }
  56417. });
  56418. const tourEmits = {
  56419. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  56420. ["update:current"]: (current) => isNumber(current),
  56421. close: (current) => isNumber(current),
  56422. finish: () => true,
  56423. change: (current) => isNumber(current)
  56424. };
  56425. const __default__$8 = vue.defineComponent({
  56426. name: "ElTour"
  56427. });
  56428. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  56429. ...__default__$8,
  56430. props: tourProps,
  56431. emits: tourEmits,
  56432. setup(__props, { emit }) {
  56433. const props = __props;
  56434. const ns = useNamespace("tour");
  56435. const total = vue.ref(0);
  56436. const currentStep = vue.ref();
  56437. const current = useVModel(props, "current", emit, {
  56438. passive: true
  56439. });
  56440. const currentTarget = vue.computed(() => {
  56441. var _a;
  56442. return (_a = currentStep.value) == null ? void 0 : _a.target;
  56443. });
  56444. const kls = vue.computed(() => [
  56445. ns.b(),
  56446. mergedType.value === "primary" ? ns.m("primary") : ""
  56447. ]);
  56448. const mergedPlacement = vue.computed(() => {
  56449. var _a;
  56450. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  56451. });
  56452. const mergedContentStyle = vue.computed(() => {
  56453. var _a, _b;
  56454. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  56455. });
  56456. const mergedMask = vue.computed(() => {
  56457. var _a, _b;
  56458. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  56459. });
  56460. const mergedShowMask = vue.computed(() => !!mergedMask.value && props.modelValue);
  56461. const mergedMaskStyle = vue.computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  56462. const mergedShowArrow = vue.computed(() => {
  56463. var _a, _b;
  56464. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  56465. });
  56466. const mergedScrollIntoViewOptions = vue.computed(() => {
  56467. var _a, _b;
  56468. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  56469. });
  56470. const mergedType = vue.computed(() => {
  56471. var _a, _b;
  56472. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  56473. });
  56474. const { nextZIndex } = useZIndex();
  56475. const nowZIndex = nextZIndex();
  56476. const mergedZIndex = vue.computed(() => {
  56477. var _a;
  56478. return (_a = props.zIndex) != null ? _a : nowZIndex;
  56479. });
  56480. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, vue.toRef(props, "modelValue"), vue.toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  56481. vue.watch(() => props.modelValue, (val) => {
  56482. if (!val) {
  56483. current.value = 0;
  56484. }
  56485. });
  56486. const onEscClose = () => {
  56487. if (props.closeOnPressEscape) {
  56488. emit(UPDATE_MODEL_EVENT, false);
  56489. emit("close", current.value);
  56490. }
  56491. };
  56492. const onUpdateTotal = (val) => {
  56493. total.value = val;
  56494. };
  56495. const slots = vue.useSlots();
  56496. vue.provide(tourKey, {
  56497. currentStep,
  56498. current,
  56499. total,
  56500. showClose: vue.toRef(props, "showClose"),
  56501. closeIcon: vue.toRef(props, "closeIcon"),
  56502. mergedType,
  56503. ns,
  56504. slots,
  56505. updateModelValue(modelValue) {
  56506. emit(UPDATE_MODEL_EVENT, modelValue);
  56507. },
  56508. onClose() {
  56509. emit("close", current.value);
  56510. },
  56511. onFinish() {
  56512. emit("finish");
  56513. },
  56514. onChange() {
  56515. emit(CHANGE_EVENT, current.value);
  56516. }
  56517. });
  56518. return (_ctx, _cache) => {
  56519. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  56520. vue.createVNode(vue.unref(ElTeleport$1), { to: _ctx.appendTo }, {
  56521. default: vue.withCtx(() => {
  56522. var _a, _b;
  56523. return [
  56524. vue.createElementVNode("div", vue.mergeProps({ class: vue.unref(kls) }, _ctx.$attrs), [
  56525. vue.createVNode(ElTourMask, {
  56526. visible: vue.unref(mergedShowMask),
  56527. fill: (_a = vue.unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  56528. style: vue.normalizeStyle((_b = vue.unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  56529. pos: vue.unref(pos),
  56530. "z-index": vue.unref(mergedZIndex),
  56531. "target-area-clickable": _ctx.targetAreaClickable
  56532. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  56533. _ctx.modelValue ? (vue.openBlock(), vue.createBlock(ElTourContent, {
  56534. key: vue.unref(current),
  56535. reference: vue.unref(triggerTarget),
  56536. placement: vue.unref(mergedPlacement),
  56537. "show-arrow": vue.unref(mergedShowArrow),
  56538. "z-index": vue.unref(mergedZIndex),
  56539. style: vue.normalizeStyle(vue.unref(mergedContentStyle)),
  56540. onClose: onEscClose
  56541. }, {
  56542. default: vue.withCtx(() => [
  56543. vue.createVNode(vue.unref(ElTourSteps), {
  56544. current: vue.unref(current),
  56545. onUpdateTotal
  56546. }, {
  56547. default: vue.withCtx(() => [
  56548. vue.renderSlot(_ctx.$slots, "default")
  56549. ]),
  56550. _: 3
  56551. }, 8, ["current"])
  56552. ]),
  56553. _: 3
  56554. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : vue.createCommentVNode("v-if", true)
  56555. ], 16)
  56556. ];
  56557. }),
  56558. _: 3
  56559. }, 8, ["to"]),
  56560. vue.createCommentVNode(" just for IDE "),
  56561. vue.createCommentVNode("v-if", true)
  56562. ], 64);
  56563. };
  56564. }
  56565. });
  56566. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tour.vue"]]);
  56567. const tourStepProps = buildProps({
  56568. target: {
  56569. type: definePropType([String, Object, Function])
  56570. },
  56571. title: String,
  56572. description: String,
  56573. showClose: {
  56574. type: Boolean,
  56575. default: void 0
  56576. },
  56577. closeIcon: {
  56578. type: iconPropType
  56579. },
  56580. showArrow: {
  56581. type: Boolean,
  56582. default: void 0
  56583. },
  56584. placement: tourContentProps.placement,
  56585. mask: {
  56586. type: definePropType([Boolean, Object]),
  56587. default: void 0
  56588. },
  56589. contentStyle: {
  56590. type: definePropType([Object])
  56591. },
  56592. prevButtonProps: {
  56593. type: definePropType(Object)
  56594. },
  56595. nextButtonProps: {
  56596. type: definePropType(Object)
  56597. },
  56598. scrollIntoViewOptions: {
  56599. type: definePropType([Boolean, Object]),
  56600. default: void 0
  56601. },
  56602. type: {
  56603. type: definePropType(String)
  56604. }
  56605. });
  56606. const tourStepEmits = {
  56607. close: () => true
  56608. };
  56609. const __default__$7 = vue.defineComponent({
  56610. name: "ElTourStep"
  56611. });
  56612. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  56613. ...__default__$7,
  56614. props: tourStepProps,
  56615. emits: tourStepEmits,
  56616. setup(__props, { emit }) {
  56617. const props = __props;
  56618. const { Close } = CloseComponents;
  56619. const { t } = useLocale();
  56620. const {
  56621. currentStep,
  56622. current,
  56623. total,
  56624. showClose,
  56625. closeIcon,
  56626. mergedType,
  56627. ns,
  56628. slots: tourSlots,
  56629. updateModelValue,
  56630. onClose: tourOnClose,
  56631. onFinish: tourOnFinish,
  56632. onChange
  56633. } = vue.inject(tourKey);
  56634. vue.watch(props, (val) => {
  56635. currentStep.value = val;
  56636. }, {
  56637. immediate: true
  56638. });
  56639. const mergedShowClose = vue.computed(() => {
  56640. var _a;
  56641. return (_a = props.showClose) != null ? _a : showClose.value;
  56642. });
  56643. const mergedCloseIcon = vue.computed(() => {
  56644. var _a, _b;
  56645. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  56646. });
  56647. const filterButtonProps = (btnProps) => {
  56648. if (!btnProps)
  56649. return;
  56650. return omit(btnProps, ["children", "onClick"]);
  56651. };
  56652. const onPrev = () => {
  56653. var _a, _b;
  56654. current.value -= 1;
  56655. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  56656. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  56657. }
  56658. onChange();
  56659. };
  56660. const onNext = () => {
  56661. var _a;
  56662. if (current.value >= total.value - 1) {
  56663. onFinish();
  56664. } else {
  56665. current.value += 1;
  56666. }
  56667. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  56668. props.nextButtonProps.onClick();
  56669. }
  56670. onChange();
  56671. };
  56672. const onFinish = () => {
  56673. onClose();
  56674. tourOnFinish();
  56675. };
  56676. const onClose = () => {
  56677. updateModelValue(false);
  56678. tourOnClose();
  56679. emit("close");
  56680. };
  56681. return (_ctx, _cache) => {
  56682. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  56683. vue.unref(mergedShowClose) ? (vue.openBlock(), vue.createElementBlock("button", {
  56684. key: 0,
  56685. "aria-label": "Close",
  56686. class: vue.normalizeClass(vue.unref(ns).e("closebtn")),
  56687. type: "button",
  56688. onClick: onClose
  56689. }, [
  56690. vue.createVNode(vue.unref(ElIcon), {
  56691. class: vue.normalizeClass(vue.unref(ns).e("close"))
  56692. }, {
  56693. default: vue.withCtx(() => [
  56694. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mergedCloseIcon))))
  56695. ]),
  56696. _: 1
  56697. }, 8, ["class"])
  56698. ], 2)) : vue.createCommentVNode("v-if", true),
  56699. vue.createElementVNode("header", {
  56700. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": vue.unref(showClose) }])
  56701. }, [
  56702. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  56703. vue.createElementVNode("span", {
  56704. role: "heading",
  56705. class: vue.normalizeClass(vue.unref(ns).e("title"))
  56706. }, vue.toDisplayString(_ctx.title), 3)
  56707. ])
  56708. ], 2),
  56709. vue.createElementVNode("div", {
  56710. class: vue.normalizeClass(vue.unref(ns).e("body"))
  56711. }, [
  56712. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  56713. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.description), 1)
  56714. ])
  56715. ], 2),
  56716. vue.createElementVNode("footer", {
  56717. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  56718. }, [
  56719. vue.createElementVNode("div", {
  56720. class: vue.normalizeClass(vue.unref(ns).b("indicators"))
  56721. }, [
  56722. vue.unref(tourSlots).indicators ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tourSlots).indicators), {
  56723. key: 0,
  56724. current: vue.unref(current),
  56725. total: vue.unref(total)
  56726. }, null, 8, ["current", "total"])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(total), (item, index) => {
  56727. return vue.openBlock(), vue.createElementBlock("span", {
  56728. key: item,
  56729. class: vue.normalizeClass([vue.unref(ns).b("indicator"), index === vue.unref(current) ? "is-active" : ""])
  56730. }, null, 2);
  56731. }), 128))
  56732. ], 2),
  56733. vue.createElementVNode("div", {
  56734. class: vue.normalizeClass(vue.unref(ns).b("buttons"))
  56735. }, [
  56736. vue.unref(current) > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  56737. key: 0,
  56738. size: "small",
  56739. type: vue.unref(mergedType)
  56740. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  56741. default: vue.withCtx(() => {
  56742. var _a, _b;
  56743. return [
  56744. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(t)("el.tour.previous")), 1)
  56745. ];
  56746. }),
  56747. _: 1
  56748. }, 16, ["type"])) : vue.createCommentVNode("v-if", true),
  56749. vue.unref(current) <= vue.unref(total) - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  56750. key: 1,
  56751. size: "small",
  56752. type: vue.unref(mergedType) === "primary" ? "default" : "primary"
  56753. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  56754. default: vue.withCtx(() => {
  56755. var _a, _b;
  56756. return [
  56757. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.nextButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(current) === vue.unref(total) - 1 ? vue.unref(t)("el.tour.finish") : vue.unref(t)("el.tour.next")), 1)
  56758. ];
  56759. }),
  56760. _: 1
  56761. }, 16, ["type"])) : vue.createCommentVNode("v-if", true)
  56762. ], 2)
  56763. ], 2)
  56764. ], 64);
  56765. };
  56766. }
  56767. });
  56768. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "step.vue"]]);
  56769. const ElTour = withInstall(Tour, {
  56770. TourStep
  56771. });
  56772. const ElTourStep = withNoopInstall(TourStep);
  56773. const anchorProps = buildProps({
  56774. container: {
  56775. type: definePropType([
  56776. String,
  56777. Object
  56778. ])
  56779. },
  56780. offset: {
  56781. type: Number,
  56782. default: 0
  56783. },
  56784. bound: {
  56785. type: Number,
  56786. default: 15
  56787. },
  56788. duration: {
  56789. type: Number,
  56790. default: 300
  56791. },
  56792. marker: {
  56793. type: Boolean,
  56794. default: true
  56795. },
  56796. type: {
  56797. type: definePropType(String),
  56798. default: "default"
  56799. },
  56800. direction: {
  56801. type: definePropType(String),
  56802. default: "vertical"
  56803. },
  56804. selectScrollTop: {
  56805. type: Boolean,
  56806. default: false
  56807. }
  56808. });
  56809. const anchorEmits = {
  56810. change: (href) => isString$1(href),
  56811. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  56812. };
  56813. const anchorKey = Symbol("anchor");
  56814. const __default__$6 = vue.defineComponent({
  56815. name: "ElAnchor"
  56816. });
  56817. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  56818. ...__default__$6,
  56819. props: anchorProps,
  56820. emits: anchorEmits,
  56821. setup(__props, { expose, emit }) {
  56822. const props = __props;
  56823. const currentAnchor = vue.ref("");
  56824. const anchorRef = vue.ref(null);
  56825. const markerRef = vue.ref(null);
  56826. const containerEl = vue.ref();
  56827. const links = {};
  56828. let isScrolling = false;
  56829. let currentScrollTop = 0;
  56830. const ns = useNamespace("anchor");
  56831. const cls = vue.computed(() => [
  56832. ns.b(),
  56833. props.type === "underline" ? ns.m("underline") : "",
  56834. ns.m(props.direction)
  56835. ]);
  56836. const addLink = (state) => {
  56837. links[state.href] = state.el;
  56838. };
  56839. const removeLink = (href) => {
  56840. delete links[href];
  56841. };
  56842. const setCurrentAnchor = (href) => {
  56843. const activeHref = currentAnchor.value;
  56844. if (activeHref !== href) {
  56845. currentAnchor.value = href;
  56846. emit(CHANGE_EVENT, href);
  56847. }
  56848. };
  56849. let clearAnimate = null;
  56850. const scrollToAnchor = (href) => {
  56851. if (!containerEl.value)
  56852. return;
  56853. const target = getElement(href);
  56854. if (!target)
  56855. return;
  56856. if (clearAnimate)
  56857. clearAnimate();
  56858. isScrolling = true;
  56859. const scrollEle = getScrollElement(target, containerEl.value);
  56860. const distance = getOffsetTopDistance(target, scrollEle);
  56861. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  56862. const to = Math.min(distance - props.offset, max);
  56863. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  56864. setTimeout(() => {
  56865. isScrolling = false;
  56866. }, 20);
  56867. });
  56868. };
  56869. const scrollTo = (href) => {
  56870. if (href) {
  56871. setCurrentAnchor(href);
  56872. scrollToAnchor(href);
  56873. }
  56874. };
  56875. const handleClick = (e, href) => {
  56876. emit("click", e, href);
  56877. scrollTo(href);
  56878. };
  56879. const handleScroll = throttleByRaf(() => {
  56880. if (containerEl.value) {
  56881. currentScrollTop = getScrollTop(containerEl.value);
  56882. }
  56883. const currentHref = getCurrentHref();
  56884. if (isScrolling || isUndefined(currentHref))
  56885. return;
  56886. setCurrentAnchor(currentHref);
  56887. });
  56888. const getCurrentHref = () => {
  56889. if (!containerEl.value)
  56890. return;
  56891. const scrollTop = getScrollTop(containerEl.value);
  56892. const anchorTopList = [];
  56893. for (const href of Object.keys(links)) {
  56894. const target = getElement(href);
  56895. if (!target)
  56896. continue;
  56897. const scrollEle = getScrollElement(target, containerEl.value);
  56898. const distance = getOffsetTopDistance(target, scrollEle);
  56899. anchorTopList.push({
  56900. top: distance - props.offset - props.bound,
  56901. href
  56902. });
  56903. }
  56904. anchorTopList.sort((prev, next) => prev.top - next.top);
  56905. for (let i = 0; i < anchorTopList.length; i++) {
  56906. const item = anchorTopList[i];
  56907. const next = anchorTopList[i + 1];
  56908. if (i === 0 && scrollTop === 0) {
  56909. return props.selectScrollTop ? item.href : "";
  56910. }
  56911. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  56912. return item.href;
  56913. }
  56914. }
  56915. };
  56916. const getContainer = () => {
  56917. const el = getElement(props.container);
  56918. if (!el || isWindow$1(el)) {
  56919. containerEl.value = window;
  56920. } else {
  56921. containerEl.value = el;
  56922. }
  56923. };
  56924. useEventListener(containerEl, "scroll", handleScroll);
  56925. const markerStyle = vue.computed(() => {
  56926. if (!anchorRef.value || !markerRef.value || !currentAnchor.value)
  56927. return {};
  56928. const currentLinkEl = links[currentAnchor.value];
  56929. if (!currentLinkEl)
  56930. return {};
  56931. const anchorRect = anchorRef.value.getBoundingClientRect();
  56932. const markerRect = markerRef.value.getBoundingClientRect();
  56933. const linkRect = currentLinkEl.getBoundingClientRect();
  56934. if (props.direction === "horizontal") {
  56935. const left = linkRect.left - anchorRect.left;
  56936. return {
  56937. left: `${left}px`,
  56938. width: `${linkRect.width}px`,
  56939. opacity: 1
  56940. };
  56941. } else {
  56942. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  56943. return {
  56944. top: `${top}px`,
  56945. opacity: 1
  56946. };
  56947. }
  56948. });
  56949. vue.onMounted(() => {
  56950. getContainer();
  56951. const hash = decodeURIComponent(window.location.hash);
  56952. const target = getElement(hash);
  56953. if (target) {
  56954. scrollTo(hash);
  56955. } else {
  56956. handleScroll();
  56957. }
  56958. });
  56959. vue.watch(() => props.container, () => {
  56960. getContainer();
  56961. });
  56962. vue.provide(anchorKey, {
  56963. ns,
  56964. direction: props.direction,
  56965. currentAnchor,
  56966. addLink,
  56967. removeLink,
  56968. handleClick
  56969. });
  56970. expose({
  56971. scrollTo
  56972. });
  56973. return (_ctx, _cache) => {
  56974. return vue.openBlock(), vue.createElementBlock("div", {
  56975. ref_key: "anchorRef",
  56976. ref: anchorRef,
  56977. class: vue.normalizeClass(vue.unref(cls))
  56978. }, [
  56979. _ctx.marker ? (vue.openBlock(), vue.createElementBlock("div", {
  56980. key: 0,
  56981. ref_key: "markerRef",
  56982. ref: markerRef,
  56983. class: vue.normalizeClass(vue.unref(ns).e("marker")),
  56984. style: vue.normalizeStyle(vue.unref(markerStyle))
  56985. }, null, 6)) : vue.createCommentVNode("v-if", true),
  56986. vue.createElementVNode("div", {
  56987. class: vue.normalizeClass(vue.unref(ns).e("list"))
  56988. }, [
  56989. vue.renderSlot(_ctx.$slots, "default")
  56990. ], 2)
  56991. ], 2);
  56992. };
  56993. }
  56994. });
  56995. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "anchor.vue"]]);
  56996. const anchorLinkProps = buildProps({
  56997. title: String,
  56998. href: String
  56999. });
  57000. const __default__$5 = vue.defineComponent({
  57001. name: "ElAnchorLink"
  57002. });
  57003. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  57004. ...__default__$5,
  57005. props: anchorLinkProps,
  57006. setup(__props) {
  57007. const props = __props;
  57008. const linkRef = vue.ref(null);
  57009. const {
  57010. ns,
  57011. direction,
  57012. currentAnchor,
  57013. addLink,
  57014. removeLink,
  57015. handleClick: contextHandleClick
  57016. } = vue.inject(anchorKey);
  57017. const cls = vue.computed(() => [
  57018. ns.e("link"),
  57019. ns.is("active", currentAnchor.value === props.href)
  57020. ]);
  57021. const handleClick = (e) => {
  57022. contextHandleClick(e, props.href);
  57023. };
  57024. vue.watch(() => props.href, (val, oldVal) => {
  57025. vue.nextTick(() => {
  57026. if (oldVal)
  57027. removeLink(oldVal);
  57028. if (val) {
  57029. addLink({
  57030. href: val,
  57031. el: linkRef.value
  57032. });
  57033. }
  57034. });
  57035. });
  57036. vue.onMounted(() => {
  57037. const { href } = props;
  57038. if (href) {
  57039. addLink({
  57040. href,
  57041. el: linkRef.value
  57042. });
  57043. }
  57044. });
  57045. vue.onBeforeUnmount(() => {
  57046. const { href } = props;
  57047. if (href) {
  57048. removeLink(href);
  57049. }
  57050. });
  57051. return (_ctx, _cache) => {
  57052. return vue.openBlock(), vue.createElementBlock("div", {
  57053. class: vue.normalizeClass(vue.unref(ns).e("item"))
  57054. }, [
  57055. vue.createElementVNode("a", {
  57056. ref_key: "linkRef",
  57057. ref: linkRef,
  57058. class: vue.normalizeClass(vue.unref(cls)),
  57059. href: _ctx.href,
  57060. onClick: handleClick
  57061. }, [
  57062. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  57063. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  57064. ])
  57065. ], 10, ["href"]),
  57066. _ctx.$slots["sub-link"] && vue.unref(direction) === "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  57067. key: 0,
  57068. class: vue.normalizeClass(vue.unref(ns).e("list"))
  57069. }, [
  57070. vue.renderSlot(_ctx.$slots, "sub-link")
  57071. ], 2)) : vue.createCommentVNode("v-if", true)
  57072. ], 2);
  57073. };
  57074. }
  57075. });
  57076. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "anchor-link.vue"]]);
  57077. const ElAnchor = withInstall(Anchor, {
  57078. AnchorLink
  57079. });
  57080. const ElAnchorLink = withNoopInstall(AnchorLink);
  57081. const defaultProps = {
  57082. label: "label",
  57083. value: "value",
  57084. disabled: "disabled"
  57085. };
  57086. const segmentedProps = buildProps({
  57087. direction: {
  57088. type: definePropType(String),
  57089. default: "horizontal"
  57090. },
  57091. options: {
  57092. type: definePropType(Array),
  57093. default: () => []
  57094. },
  57095. modelValue: {
  57096. type: [String, Number, Boolean],
  57097. default: void 0
  57098. },
  57099. props: {
  57100. type: definePropType(Object),
  57101. default: () => defaultProps
  57102. },
  57103. block: Boolean,
  57104. size: useSizeProp,
  57105. disabled: Boolean,
  57106. validateEvent: {
  57107. type: Boolean,
  57108. default: true
  57109. },
  57110. id: String,
  57111. name: String,
  57112. ...useAriaProps(["ariaLabel"])
  57113. });
  57114. const segmentedEmits = {
  57115. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  57116. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  57117. };
  57118. const __default__$4 = vue.defineComponent({
  57119. name: "ElSegmented"
  57120. });
  57121. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  57122. ...__default__$4,
  57123. props: segmentedProps,
  57124. emits: segmentedEmits,
  57125. setup(__props, { emit }) {
  57126. const props = __props;
  57127. const ns = useNamespace("segmented");
  57128. const segmentedId = useId();
  57129. const segmentedSize = useFormSize();
  57130. const _disabled = useFormDisabled();
  57131. const { formItem } = useFormItem();
  57132. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  57133. formItemContext: formItem
  57134. });
  57135. const segmentedRef = vue.ref(null);
  57136. const activeElement = useActiveElement();
  57137. const state = vue.reactive({
  57138. isInit: false,
  57139. width: 0,
  57140. height: 0,
  57141. translateX: 0,
  57142. translateY: 0,
  57143. focusVisible: false
  57144. });
  57145. const handleChange = (item) => {
  57146. const value = getValue(item);
  57147. emit(UPDATE_MODEL_EVENT, value);
  57148. emit(CHANGE_EVENT, value);
  57149. };
  57150. const aliasProps = vue.computed(() => ({ ...defaultProps, ...props.props }));
  57151. const getValue = (item) => {
  57152. return isObject$1(item) ? item[aliasProps.value.value] : item;
  57153. };
  57154. const getLabel = (item) => {
  57155. return isObject$1(item) ? item[aliasProps.value.label] : item;
  57156. };
  57157. const getDisabled = (item) => {
  57158. return !!(_disabled.value || (isObject$1(item) ? item[aliasProps.value.disabled] : false));
  57159. };
  57160. const getSelected = (item) => {
  57161. return props.modelValue === getValue(item);
  57162. };
  57163. const getOption = (value) => {
  57164. return props.options.find((item) => getValue(item) === value);
  57165. };
  57166. const getItemCls = (item) => {
  57167. return [
  57168. ns.e("item"),
  57169. ns.is("selected", getSelected(item)),
  57170. ns.is("disabled", getDisabled(item))
  57171. ];
  57172. };
  57173. const updateSelect = () => {
  57174. if (!segmentedRef.value)
  57175. return;
  57176. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  57177. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  57178. if (!selectedItem || !selectedItemInput) {
  57179. state.width = 0;
  57180. state.height = 0;
  57181. state.translateX = 0;
  57182. state.translateY = 0;
  57183. state.focusVisible = false;
  57184. return;
  57185. }
  57186. const rect = selectedItem.getBoundingClientRect();
  57187. state.isInit = true;
  57188. if (props.direction === "vertical") {
  57189. state.height = rect.height;
  57190. state.translateY = selectedItem.offsetTop;
  57191. } else {
  57192. state.width = rect.width;
  57193. state.translateX = selectedItem.offsetLeft;
  57194. }
  57195. try {
  57196. state.focusVisible = selectedItemInput.matches(":focus-visible");
  57197. } catch (e) {
  57198. }
  57199. };
  57200. const segmentedCls = vue.computed(() => [
  57201. ns.b(),
  57202. ns.m(segmentedSize.value),
  57203. ns.is("block", props.block)
  57204. ]);
  57205. const selectedStyle = vue.computed(() => ({
  57206. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  57207. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  57208. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  57209. display: state.isInit ? "block" : "none"
  57210. }));
  57211. const selectedCls = vue.computed(() => [
  57212. ns.e("item-selected"),
  57213. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  57214. ns.is("focus-visible", state.focusVisible)
  57215. ]);
  57216. const name = vue.computed(() => {
  57217. return props.name || segmentedId.value;
  57218. });
  57219. useResizeObserver(segmentedRef, updateSelect);
  57220. vue.watch(activeElement, updateSelect);
  57221. vue.watch(() => props.modelValue, () => {
  57222. var _a;
  57223. updateSelect();
  57224. if (props.validateEvent) {
  57225. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  57226. }
  57227. }, {
  57228. flush: "post"
  57229. });
  57230. return (_ctx, _cache) => {
  57231. return _ctx.options.length ? (vue.openBlock(), vue.createElementBlock("div", {
  57232. key: 0,
  57233. id: vue.unref(inputId),
  57234. ref_key: "segmentedRef",
  57235. ref: segmentedRef,
  57236. class: vue.normalizeClass(vue.unref(segmentedCls)),
  57237. role: "radiogroup",
  57238. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  57239. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  57240. }, [
  57241. vue.createElementVNode("div", {
  57242. class: vue.normalizeClass([vue.unref(ns).e("group"), vue.unref(ns).m(props.direction)])
  57243. }, [
  57244. vue.createElementVNode("div", {
  57245. style: vue.normalizeStyle(vue.unref(selectedStyle)),
  57246. class: vue.normalizeClass(vue.unref(selectedCls))
  57247. }, null, 6),
  57248. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  57249. return vue.openBlock(), vue.createElementBlock("label", {
  57250. key: index,
  57251. class: vue.normalizeClass(getItemCls(item))
  57252. }, [
  57253. vue.createElementVNode("input", {
  57254. class: vue.normalizeClass(vue.unref(ns).e("item-input")),
  57255. type: "radio",
  57256. name: vue.unref(name),
  57257. disabled: getDisabled(item),
  57258. checked: getSelected(item),
  57259. onChange: ($event) => handleChange(item)
  57260. }, null, 42, ["name", "disabled", "checked", "onChange"]),
  57261. vue.createElementVNode("div", {
  57262. class: vue.normalizeClass(vue.unref(ns).e("item-label"))
  57263. }, [
  57264. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  57265. vue.createTextVNode(vue.toDisplayString(getLabel(item)), 1)
  57266. ])
  57267. ], 2)
  57268. ], 2);
  57269. }), 128))
  57270. ], 2)
  57271. ], 10, ["id", "aria-label", "aria-labelledby"])) : vue.createCommentVNode("v-if", true);
  57272. };
  57273. }
  57274. });
  57275. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "segmented.vue"]]);
  57276. const ElSegmented = withInstall(Segmented);
  57277. const filterOption = (pattern, option) => {
  57278. const lowerCase = pattern.toLowerCase();
  57279. const label = option.label || option.value;
  57280. return label.toLowerCase().includes(lowerCase);
  57281. };
  57282. const getMentionCtx = (inputEl, prefix, split) => {
  57283. const { selectionEnd } = inputEl;
  57284. if (selectionEnd === null)
  57285. return;
  57286. const inputValue = inputEl.value;
  57287. const prefixArray = castArray$1(prefix);
  57288. let splitIndex = -1;
  57289. let mentionCtx;
  57290. for (let i = selectionEnd - 1; i >= 0; --i) {
  57291. const char = inputValue[i];
  57292. if (char === split || char === "\n" || char === "\r") {
  57293. splitIndex = i;
  57294. continue;
  57295. }
  57296. if (prefixArray.includes(char)) {
  57297. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  57298. const pattern = inputValue.slice(i + 1, end);
  57299. mentionCtx = {
  57300. pattern,
  57301. start: i + 1,
  57302. end,
  57303. prefix: char,
  57304. prefixIndex: i,
  57305. splitIndex,
  57306. selectionEnd
  57307. };
  57308. break;
  57309. }
  57310. }
  57311. return mentionCtx;
  57312. };
  57313. const getCursorPosition = (element, options = {
  57314. debug: false,
  57315. useSelectionEnd: false
  57316. }) => {
  57317. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  57318. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  57319. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  57320. const properties = [
  57321. "direction",
  57322. "boxSizing",
  57323. "width",
  57324. "height",
  57325. "overflowX",
  57326. "overflowY",
  57327. "borderTopWidth",
  57328. "borderRightWidth",
  57329. "borderBottomWidth",
  57330. "borderLeftWidth",
  57331. "borderStyle",
  57332. "paddingTop",
  57333. "paddingRight",
  57334. "paddingBottom",
  57335. "paddingLeft",
  57336. "fontStyle",
  57337. "fontVariant",
  57338. "fontWeight",
  57339. "fontStretch",
  57340. "fontSize",
  57341. "fontSizeAdjust",
  57342. "lineHeight",
  57343. "fontFamily",
  57344. "textAlign",
  57345. "textTransform",
  57346. "textIndent",
  57347. "textDecoration",
  57348. "letterSpacing",
  57349. "wordSpacing",
  57350. "tabSize",
  57351. "MozTabSize"
  57352. ];
  57353. if (options.debug) {
  57354. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  57355. if (el == null ? void 0 : el.parentNode)
  57356. el.parentNode.removeChild(el);
  57357. }
  57358. const div = document.createElement("div");
  57359. div.id = "input-textarea-caret-position-mirror-div";
  57360. document.body.appendChild(div);
  57361. const style = div.style;
  57362. const computed = window.getComputedStyle(element);
  57363. const isInput = element.nodeName === "INPUT";
  57364. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  57365. if (!isInput)
  57366. style.wordWrap = "break-word";
  57367. style.position = "absolute";
  57368. if (!options.debug)
  57369. style.visibility = "hidden";
  57370. properties.forEach((prop) => {
  57371. if (isInput && prop === "lineHeight") {
  57372. if (computed.boxSizing === "border-box") {
  57373. const height = Number.parseInt(computed.height);
  57374. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  57375. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  57376. if (height > targetHeight) {
  57377. style.lineHeight = `${height - outerHeight}px`;
  57378. } else if (height === targetHeight) {
  57379. style.lineHeight = computed.lineHeight;
  57380. } else {
  57381. style.lineHeight = "0";
  57382. }
  57383. } else {
  57384. style.lineHeight = computed.height;
  57385. }
  57386. } else {
  57387. style[prop] = computed[prop];
  57388. }
  57389. });
  57390. if (isFirefox()) {
  57391. if (element.scrollHeight > Number.parseInt(computed.height)) {
  57392. style.overflowY = "scroll";
  57393. }
  57394. } else {
  57395. style.overflow = "hidden";
  57396. }
  57397. div.textContent = element.value.slice(0, Math.max(0, position));
  57398. if (isInput && div.textContent) {
  57399. div.textContent = div.textContent.replace(/\s/g, "\xA0");
  57400. }
  57401. const span = document.createElement("span");
  57402. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  57403. span.style.position = "relative";
  57404. span.style.left = `${-element.scrollLeft}px`;
  57405. span.style.top = `${-element.scrollTop}px`;
  57406. div.appendChild(span);
  57407. const relativePosition = {
  57408. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  57409. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  57410. height: Number.parseInt(computed.fontSize) * 1.5
  57411. };
  57412. if (options.debug) {
  57413. span.style.backgroundColor = "#aaa";
  57414. } else {
  57415. document.body.removeChild(div);
  57416. }
  57417. if (relativePosition.left >= element.clientWidth) {
  57418. relativePosition.left = element.clientWidth;
  57419. }
  57420. return relativePosition;
  57421. };
  57422. const mentionProps = buildProps({
  57423. ...inputProps,
  57424. options: {
  57425. type: definePropType(Array),
  57426. default: () => []
  57427. },
  57428. prefix: {
  57429. type: definePropType([String, Array]),
  57430. default: "@",
  57431. validator: (val) => {
  57432. if (isString$1(val))
  57433. return val.length === 1;
  57434. return val.every((v) => isString$1(v) && v.length === 1);
  57435. }
  57436. },
  57437. split: {
  57438. type: String,
  57439. default: " ",
  57440. validator: (val) => val.length === 1
  57441. },
  57442. filterOption: {
  57443. type: definePropType([Boolean, Function]),
  57444. default: () => filterOption,
  57445. validator: (val) => {
  57446. if (val === false)
  57447. return true;
  57448. return isFunction$1(val);
  57449. }
  57450. },
  57451. placement: {
  57452. type: definePropType(String),
  57453. default: "bottom"
  57454. },
  57455. showArrow: Boolean,
  57456. offset: {
  57457. type: Number,
  57458. default: 0
  57459. },
  57460. whole: Boolean,
  57461. checkIsWhole: {
  57462. type: definePropType(Function)
  57463. },
  57464. modelValue: String,
  57465. loading: Boolean,
  57466. popperClass: {
  57467. type: String,
  57468. default: ""
  57469. },
  57470. popperOptions: {
  57471. type: definePropType(Object),
  57472. default: () => ({})
  57473. }
  57474. });
  57475. const mentionEmits = {
  57476. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  57477. search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  57478. select: (option, prefix) => isString$1(option.value) && isString$1(prefix),
  57479. focus: (evt) => evt instanceof FocusEvent,
  57480. blur: (evt) => evt instanceof FocusEvent
  57481. };
  57482. const mentionDropdownProps = buildProps({
  57483. options: {
  57484. type: definePropType(Array),
  57485. default: () => []
  57486. },
  57487. loading: Boolean,
  57488. disabled: Boolean,
  57489. contentId: String,
  57490. ariaLabel: String
  57491. });
  57492. const mentionDropdownEmits = {
  57493. select: (option) => isString$1(option.value)
  57494. };
  57495. const __default__$3 = vue.defineComponent({
  57496. name: "ElMentionDropdown"
  57497. });
  57498. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  57499. ...__default__$3,
  57500. props: mentionDropdownProps,
  57501. emits: mentionDropdownEmits,
  57502. setup(__props, { expose, emit }) {
  57503. const props = __props;
  57504. const ns = useNamespace("mention");
  57505. const { t } = useLocale();
  57506. const hoveringIndex = vue.ref(-1);
  57507. const scrollbarRef = vue.ref();
  57508. const optionRefs = vue.ref();
  57509. const dropdownRef = vue.ref();
  57510. const optionkls = (item, index) => [
  57511. ns.be("dropdown", "item"),
  57512. ns.is("hovering", hoveringIndex.value === index),
  57513. ns.is("disabled", item.disabled || props.disabled)
  57514. ];
  57515. const handleSelect = (item) => {
  57516. if (item.disabled || props.disabled)
  57517. return;
  57518. emit("select", item);
  57519. };
  57520. const handleMouseEnter = (index) => {
  57521. hoveringIndex.value = index;
  57522. };
  57523. const filteredAllDisabled = vue.computed(() => props.disabled || props.options.every((item) => item.disabled));
  57524. const hoverOption = vue.computed(() => props.options[hoveringIndex.value]);
  57525. const selectHoverOption = () => {
  57526. if (!hoverOption.value)
  57527. return;
  57528. emit("select", hoverOption.value);
  57529. };
  57530. const navigateOptions = (direction) => {
  57531. const { options } = props;
  57532. if (options.length === 0 || filteredAllDisabled.value)
  57533. return;
  57534. if (direction === "next") {
  57535. hoveringIndex.value++;
  57536. if (hoveringIndex.value === options.length) {
  57537. hoveringIndex.value = 0;
  57538. }
  57539. } else if (direction === "prev") {
  57540. hoveringIndex.value--;
  57541. if (hoveringIndex.value < 0) {
  57542. hoveringIndex.value = options.length - 1;
  57543. }
  57544. }
  57545. const option = options[hoveringIndex.value];
  57546. if (option.disabled) {
  57547. navigateOptions(direction);
  57548. return;
  57549. }
  57550. vue.nextTick(() => scrollToOption(option));
  57551. };
  57552. const scrollToOption = (option) => {
  57553. var _a, _b, _c, _d;
  57554. const { options } = props;
  57555. const index = options.findIndex((item) => item.value === option.value);
  57556. const target = (_a = optionRefs.value) == null ? void 0 : _a[index];
  57557. if (target) {
  57558. const menu = (_c = (_b = dropdownRef.value) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, `.${ns.be("dropdown", "wrap")}`);
  57559. if (menu) {
  57560. scrollIntoView(menu, target);
  57561. }
  57562. }
  57563. (_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
  57564. };
  57565. const resetHoveringIndex = () => {
  57566. if (filteredAllDisabled.value || props.options.length === 0) {
  57567. hoveringIndex.value = -1;
  57568. } else {
  57569. hoveringIndex.value = 0;
  57570. }
  57571. };
  57572. vue.watch(() => props.options, resetHoveringIndex, {
  57573. immediate: true
  57574. });
  57575. expose({
  57576. hoveringIndex,
  57577. navigateOptions,
  57578. selectHoverOption,
  57579. hoverOption
  57580. });
  57581. return (_ctx, _cache) => {
  57582. return vue.openBlock(), vue.createElementBlock("div", {
  57583. ref_key: "dropdownRef",
  57584. ref: dropdownRef,
  57585. class: vue.normalizeClass(vue.unref(ns).b("dropdown"))
  57586. }, [
  57587. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  57588. key: 0,
  57589. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "header"))
  57590. }, [
  57591. vue.renderSlot(_ctx.$slots, "header")
  57592. ], 2)) : vue.createCommentVNode("v-if", true),
  57593. vue.withDirectives(vue.createVNode(vue.unref(ElScrollbar), {
  57594. id: _ctx.contentId,
  57595. ref_key: "scrollbarRef",
  57596. ref: scrollbarRef,
  57597. tag: "ul",
  57598. "wrap-class": vue.unref(ns).be("dropdown", "wrap"),
  57599. "view-class": vue.unref(ns).be("dropdown", "list"),
  57600. role: "listbox",
  57601. "aria-label": _ctx.ariaLabel,
  57602. "aria-orientation": "vertical"
  57603. }, {
  57604. default: vue.withCtx(() => [
  57605. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  57606. return vue.openBlock(), vue.createElementBlock("li", {
  57607. id: `${_ctx.contentId}-${index}`,
  57608. ref_for: true,
  57609. ref_key: "optionRefs",
  57610. ref: optionRefs,
  57611. key: index,
  57612. class: vue.normalizeClass(optionkls(item, index)),
  57613. role: "option",
  57614. "aria-disabled": item.disabled || _ctx.disabled || void 0,
  57615. "aria-selected": hoveringIndex.value === index,
  57616. onMousemove: ($event) => handleMouseEnter(index),
  57617. onClick: vue.withModifiers(($event) => handleSelect(item), ["stop"])
  57618. }, [
  57619. vue.renderSlot(_ctx.$slots, "label", {
  57620. item,
  57621. index
  57622. }, () => {
  57623. var _a;
  57624. return [
  57625. vue.createElementVNode("span", null, vue.toDisplayString((_a = item.label) != null ? _a : item.value), 1)
  57626. ];
  57627. })
  57628. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"]);
  57629. }), 128))
  57630. ]),
  57631. _: 3
  57632. }, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
  57633. [vue.vShow, _ctx.options.length > 0 && !_ctx.loading]
  57634. ]),
  57635. _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  57636. key: 1,
  57637. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "loading"))
  57638. }, [
  57639. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  57640. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.mention.loading")), 1)
  57641. ])
  57642. ], 2)) : vue.createCommentVNode("v-if", true),
  57643. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  57644. key: 2,
  57645. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "footer"))
  57646. }, [
  57647. vue.renderSlot(_ctx.$slots, "footer")
  57648. ], 2)) : vue.createCommentVNode("v-if", true)
  57649. ], 2);
  57650. };
  57651. }
  57652. });
  57653. var ElMentionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "mention-dropdown.vue"]]);
  57654. const __default__$2 = vue.defineComponent({
  57655. name: "ElMention",
  57656. inheritAttrs: false
  57657. });
  57658. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  57659. ...__default__$2,
  57660. props: mentionProps,
  57661. emits: mentionEmits,
  57662. setup(__props, { expose, emit }) {
  57663. const props = __props;
  57664. const passInputProps = vue.computed(() => pick(props, Object.keys(inputProps)));
  57665. const ns = useNamespace("mention");
  57666. const disabled = useFormDisabled();
  57667. const contentId = useId();
  57668. const elInputRef = vue.ref();
  57669. const tooltipRef = vue.ref();
  57670. const dropdownRef = vue.ref();
  57671. const visible = vue.ref(false);
  57672. const cursorStyle = vue.ref();
  57673. const mentionCtx = vue.ref();
  57674. const computedPlacement = vue.computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  57675. const computedFallbackPlacements = vue.computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  57676. const filteredOptions = vue.computed(() => {
  57677. const { filterOption, options } = props;
  57678. if (!mentionCtx.value || !filterOption)
  57679. return options;
  57680. return options.filter((option) => filterOption(mentionCtx.value.pattern, option));
  57681. });
  57682. const dropdownVisible = vue.computed(() => {
  57683. return visible.value && (!!filteredOptions.value.length || props.loading);
  57684. });
  57685. const hoveringId = vue.computed(() => {
  57686. var _a;
  57687. return `${contentId.value}-${(_a = dropdownRef.value) == null ? void 0 : _a.hoveringIndex}`;
  57688. });
  57689. const handleInputChange = (value) => {
  57690. emit(UPDATE_MODEL_EVENT, value);
  57691. syncAfterCursorMove();
  57692. };
  57693. const handleInputKeyDown = (event) => {
  57694. var _a, _b, _c, _d;
  57695. if (!("code" in event) || ((_a = elInputRef.value) == null ? void 0 : _a.isComposing))
  57696. return;
  57697. switch (event.code) {
  57698. case EVENT_CODE.left:
  57699. case EVENT_CODE.right:
  57700. syncAfterCursorMove();
  57701. break;
  57702. case EVENT_CODE.up:
  57703. case EVENT_CODE.down:
  57704. if (!visible.value)
  57705. return;
  57706. event.preventDefault();
  57707. (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(event.code === EVENT_CODE.up ? "prev" : "next");
  57708. break;
  57709. case EVENT_CODE.enter:
  57710. case EVENT_CODE.numpadEnter:
  57711. if (!visible.value)
  57712. return;
  57713. event.preventDefault();
  57714. if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
  57715. (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
  57716. } else {
  57717. visible.value = false;
  57718. }
  57719. break;
  57720. case EVENT_CODE.esc:
  57721. if (!visible.value)
  57722. return;
  57723. event.preventDefault();
  57724. visible.value = false;
  57725. break;
  57726. case EVENT_CODE.backspace:
  57727. if (props.whole && mentionCtx.value) {
  57728. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  57729. const inputEl = getInputEl();
  57730. if (!inputEl)
  57731. return;
  57732. const inputValue = inputEl.value;
  57733. const matchOption = props.options.find((item) => item.value === pattern);
  57734. const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
  57735. if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  57736. event.preventDefault();
  57737. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  57738. emit(UPDATE_MODEL_EVENT, newValue);
  57739. const newSelectionEnd = prefixIndex;
  57740. vue.nextTick(() => {
  57741. inputEl.selectionStart = newSelectionEnd;
  57742. inputEl.selectionEnd = newSelectionEnd;
  57743. syncDropdownVisible();
  57744. });
  57745. }
  57746. }
  57747. }
  57748. };
  57749. const { wrapperRef } = useFocusController(elInputRef, {
  57750. beforeFocus() {
  57751. return disabled.value;
  57752. },
  57753. afterFocus() {
  57754. syncAfterCursorMove();
  57755. },
  57756. beforeBlur(event) {
  57757. var _a;
  57758. return (_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  57759. },
  57760. afterBlur() {
  57761. visible.value = false;
  57762. }
  57763. });
  57764. const handleInputMouseDown = () => {
  57765. syncAfterCursorMove();
  57766. };
  57767. const handleSelect = (item) => {
  57768. if (!mentionCtx.value)
  57769. return;
  57770. const inputEl = getInputEl();
  57771. if (!inputEl)
  57772. return;
  57773. const inputValue = inputEl.value;
  57774. const { split } = props;
  57775. const newEndPart = inputValue.slice(mentionCtx.value.end);
  57776. const alreadySeparated = newEndPart.startsWith(split);
  57777. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  57778. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  57779. emit(UPDATE_MODEL_EVENT, newValue);
  57780. emit("select", item, mentionCtx.value.prefix);
  57781. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  57782. vue.nextTick(() => {
  57783. inputEl.selectionStart = newSelectionEnd;
  57784. inputEl.selectionEnd = newSelectionEnd;
  57785. inputEl.focus();
  57786. syncDropdownVisible();
  57787. });
  57788. };
  57789. const getInputEl = () => {
  57790. var _a, _b;
  57791. return props.type === "textarea" ? (_a = elInputRef.value) == null ? void 0 : _a.textarea : (_b = elInputRef.value) == null ? void 0 : _b.input;
  57792. };
  57793. const syncAfterCursorMove = () => {
  57794. setTimeout(() => {
  57795. syncCursor();
  57796. syncDropdownVisible();
  57797. vue.nextTick(() => {
  57798. var _a;
  57799. return (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  57800. });
  57801. }, 0);
  57802. };
  57803. const syncCursor = () => {
  57804. const inputEl = getInputEl();
  57805. if (!inputEl)
  57806. return;
  57807. const caretPosition = getCursorPosition(inputEl);
  57808. const inputRect = inputEl.getBoundingClientRect();
  57809. const elInputRect = elInputRef.value.$el.getBoundingClientRect();
  57810. cursorStyle.value = {
  57811. position: "absolute",
  57812. width: 0,
  57813. height: `${caretPosition.height}px`,
  57814. left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,
  57815. top: `${caretPosition.top + inputRect.top - elInputRect.top}px`
  57816. };
  57817. };
  57818. const syncDropdownVisible = () => {
  57819. const inputEl = getInputEl();
  57820. if (document.activeElement !== inputEl) {
  57821. visible.value = false;
  57822. return;
  57823. }
  57824. const { prefix, split } = props;
  57825. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  57826. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  57827. visible.value = true;
  57828. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  57829. return;
  57830. }
  57831. visible.value = false;
  57832. };
  57833. expose({
  57834. input: elInputRef,
  57835. tooltip: tooltipRef,
  57836. dropdownVisible
  57837. });
  57838. return (_ctx, _cache) => {
  57839. return vue.openBlock(), vue.createElementBlock("div", {
  57840. ref_key: "wrapperRef",
  57841. ref: wrapperRef,
  57842. class: vue.normalizeClass(vue.unref(ns).b())
  57843. }, [
  57844. vue.createVNode(vue.unref(ElInput), vue.mergeProps(vue.mergeProps(vue.unref(passInputProps), _ctx.$attrs), {
  57845. ref_key: "elInputRef",
  57846. ref: elInputRef,
  57847. "model-value": _ctx.modelValue,
  57848. disabled: vue.unref(disabled),
  57849. role: vue.unref(dropdownVisible) ? "combobox" : void 0,
  57850. "aria-activedescendant": vue.unref(dropdownVisible) ? vue.unref(hoveringId) || "" : void 0,
  57851. "aria-controls": vue.unref(dropdownVisible) ? vue.unref(contentId) : void 0,
  57852. "aria-expanded": vue.unref(dropdownVisible) || void 0,
  57853. "aria-label": _ctx.ariaLabel,
  57854. "aria-autocomplete": vue.unref(dropdownVisible) ? "none" : void 0,
  57855. "aria-haspopup": vue.unref(dropdownVisible) ? "listbox" : void 0,
  57856. onInput: handleInputChange,
  57857. onKeydown: handleInputKeyDown,
  57858. onMousedown: handleInputMouseDown
  57859. }), vue.createSlots({
  57860. _: 2
  57861. }, [
  57862. vue.renderList(_ctx.$slots, (_, name) => {
  57863. return {
  57864. name,
  57865. fn: vue.withCtx((slotProps) => [
  57866. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  57867. ])
  57868. };
  57869. })
  57870. ]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
  57871. vue.createVNode(vue.unref(ElTooltip), {
  57872. ref_key: "tooltipRef",
  57873. ref: tooltipRef,
  57874. visible: vue.unref(dropdownVisible),
  57875. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  57876. "popper-options": _ctx.popperOptions,
  57877. placement: vue.unref(computedPlacement),
  57878. "fallback-placements": vue.unref(computedFallbackPlacements),
  57879. effect: "light",
  57880. pure: "",
  57881. offset: _ctx.offset,
  57882. "show-arrow": _ctx.showArrow
  57883. }, {
  57884. default: vue.withCtx(() => [
  57885. vue.createElementVNode("div", {
  57886. style: vue.normalizeStyle(cursorStyle.value)
  57887. }, null, 4)
  57888. ]),
  57889. content: vue.withCtx(() => {
  57890. var _a;
  57891. return [
  57892. vue.createVNode(ElMentionDropdown, {
  57893. ref_key: "dropdownRef",
  57894. ref: dropdownRef,
  57895. options: vue.unref(filteredOptions),
  57896. disabled: vue.unref(disabled),
  57897. loading: _ctx.loading,
  57898. "content-id": vue.unref(contentId),
  57899. "aria-label": _ctx.ariaLabel,
  57900. onSelect: handleSelect,
  57901. onClick: vue.withModifiers((_a = elInputRef.value) == null ? void 0 : _a.focus, ["stop"])
  57902. }, vue.createSlots({
  57903. _: 2
  57904. }, [
  57905. vue.renderList(_ctx.$slots, (_, name) => {
  57906. return {
  57907. name,
  57908. fn: vue.withCtx((slotProps) => [
  57909. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  57910. ])
  57911. };
  57912. })
  57913. ]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
  57914. ];
  57915. }),
  57916. _: 3
  57917. }, 8, ["visible", "popper-class", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
  57918. ], 2);
  57919. };
  57920. }
  57921. });
  57922. var Mention = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "mention.vue"]]);
  57923. const ElMention = withInstall(Mention);
  57924. var Components = [
  57925. ElAffix,
  57926. ElAlert,
  57927. ElAutocomplete,
  57928. ElAutoResizer,
  57929. ElAvatar,
  57930. ElBacktop,
  57931. ElBadge,
  57932. ElBreadcrumb,
  57933. ElBreadcrumbItem,
  57934. ElButton,
  57935. ElButtonGroup$1,
  57936. ElCalendar,
  57937. ElCard,
  57938. ElCarousel,
  57939. ElCarouselItem,
  57940. ElCascader,
  57941. ElCascaderPanel,
  57942. ElCheckTag,
  57943. ElCheckbox,
  57944. ElCheckboxButton,
  57945. ElCheckboxGroup$1,
  57946. ElCol,
  57947. ElCollapse,
  57948. ElCollapseItem,
  57949. ElCollapseTransition,
  57950. ElColorPicker,
  57951. ElConfigProvider,
  57952. ElContainer,
  57953. ElAside,
  57954. ElFooter,
  57955. ElHeader,
  57956. ElMain,
  57957. ElDatePicker,
  57958. ElDescriptions,
  57959. ElDescriptionsItem,
  57960. ElDialog,
  57961. ElDivider,
  57962. ElDrawer,
  57963. ElDropdown,
  57964. ElDropdownItem,
  57965. ElDropdownMenu,
  57966. ElEmpty,
  57967. ElForm,
  57968. ElFormItem,
  57969. ElIcon,
  57970. ElImage,
  57971. ElImageViewer,
  57972. ElInput,
  57973. ElInputNumber,
  57974. ElInputTag,
  57975. ElLink,
  57976. ElMenu,
  57977. ElMenuItem,
  57978. ElMenuItemGroup,
  57979. ElSubMenu,
  57980. ElPageHeader,
  57981. ElPagination,
  57982. ElPopconfirm,
  57983. ElPopover,
  57984. ElPopper,
  57985. ElProgress,
  57986. ElRadio,
  57987. ElRadioButton,
  57988. ElRadioGroup,
  57989. ElRate,
  57990. ElResult,
  57991. ElRow,
  57992. ElScrollbar,
  57993. ElSelect,
  57994. ElOption,
  57995. ElOptionGroup,
  57996. ElSelectV2,
  57997. ElSkeleton,
  57998. ElSkeletonItem,
  57999. ElSlider,
  58000. ElSpace,
  58001. ElStatistic,
  58002. ElCountdown,
  58003. ElSteps,
  58004. ElStep,
  58005. ElSwitch,
  58006. ElTable,
  58007. ElTableColumn,
  58008. ElTableV2,
  58009. ElTabs,
  58010. ElTabPane,
  58011. ElTag,
  58012. ElText,
  58013. ElTimePicker,
  58014. ElTimeSelect,
  58015. ElTimeline,
  58016. ElTimelineItem,
  58017. ElTooltip,
  58018. ElTooltipV2,
  58019. ElTransfer,
  58020. ElTree,
  58021. ElTreeSelect,
  58022. ElTreeV2,
  58023. ElUpload,
  58024. ElWatermark,
  58025. ElTour,
  58026. ElTourStep,
  58027. ElAnchor,
  58028. ElAnchorLink,
  58029. ElSegmented,
  58030. ElMention
  58031. ];
  58032. const SCOPE = "ElInfiniteScroll";
  58033. const CHECK_INTERVAL = 50;
  58034. const DEFAULT_DELAY = 200;
  58035. const DEFAULT_DISTANCE = 0;
  58036. const attributes = {
  58037. delay: {
  58038. type: Number,
  58039. default: DEFAULT_DELAY
  58040. },
  58041. distance: {
  58042. type: Number,
  58043. default: DEFAULT_DISTANCE
  58044. },
  58045. disabled: {
  58046. type: Boolean,
  58047. default: false
  58048. },
  58049. immediate: {
  58050. type: Boolean,
  58051. default: true
  58052. }
  58053. };
  58054. const getScrollOptions = (el, instance) => {
  58055. return Object.entries(attributes).reduce((acm, [name, option]) => {
  58056. var _a, _b;
  58057. const { type, default: defaultValue } = option;
  58058. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  58059. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  58060. value = value === "false" ? false : value;
  58061. value = type(value);
  58062. acm[name] = Number.isNaN(value) ? defaultValue : value;
  58063. return acm;
  58064. }, {});
  58065. };
  58066. const destroyObserver = (el) => {
  58067. const { observer } = el[SCOPE];
  58068. if (observer) {
  58069. observer.disconnect();
  58070. delete el[SCOPE].observer;
  58071. }
  58072. };
  58073. const handleScroll = (el, cb) => {
  58074. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  58075. const { disabled, distance } = getScrollOptions(el, instance);
  58076. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  58077. const delta = scrollTop - lastScrollTop;
  58078. el[SCOPE].lastScrollTop = scrollTop;
  58079. if (observer || disabled || delta < 0)
  58080. return;
  58081. let shouldTrigger = false;
  58082. if (container === el) {
  58083. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  58084. } else {
  58085. const { clientTop, scrollHeight: height } = el;
  58086. const offsetTop = getOffsetTopDistance(el, containerEl);
  58087. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  58088. }
  58089. if (shouldTrigger) {
  58090. cb.call(instance);
  58091. }
  58092. };
  58093. function checkFull(el, cb) {
  58094. const { containerEl, instance } = el[SCOPE];
  58095. const { disabled } = getScrollOptions(el, instance);
  58096. if (disabled || containerEl.clientHeight === 0)
  58097. return;
  58098. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  58099. cb.call(instance);
  58100. } else {
  58101. destroyObserver(el);
  58102. }
  58103. }
  58104. const InfiniteScroll = {
  58105. async mounted(el, binding) {
  58106. const { instance, value: cb } = binding;
  58107. if (!isFunction$1(cb)) {
  58108. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  58109. }
  58110. await vue.nextTick();
  58111. const { delay, immediate } = getScrollOptions(el, instance);
  58112. const container = getScrollContainer(el, true);
  58113. const containerEl = container === window ? document.documentElement : container;
  58114. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  58115. if (!container)
  58116. return;
  58117. el[SCOPE] = {
  58118. instance,
  58119. container,
  58120. containerEl,
  58121. delay,
  58122. cb,
  58123. onScroll,
  58124. lastScrollTop: containerEl.scrollTop
  58125. };
  58126. if (immediate) {
  58127. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  58128. el[SCOPE].observer = observer;
  58129. observer.observe(el, { childList: true, subtree: true });
  58130. checkFull(el, cb);
  58131. }
  58132. container.addEventListener("scroll", onScroll);
  58133. },
  58134. unmounted(el) {
  58135. if (!el[SCOPE])
  58136. return;
  58137. const { container, onScroll } = el[SCOPE];
  58138. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  58139. destroyObserver(el);
  58140. },
  58141. async updated(el) {
  58142. if (!el[SCOPE]) {
  58143. await vue.nextTick();
  58144. } else {
  58145. const { containerEl, cb, observer } = el[SCOPE];
  58146. if (containerEl.clientHeight && observer) {
  58147. checkFull(el, cb);
  58148. }
  58149. }
  58150. }
  58151. };
  58152. var InfiniteScroll$1 = InfiniteScroll;
  58153. const _InfiniteScroll = InfiniteScroll$1;
  58154. _InfiniteScroll.install = (app) => {
  58155. app.directive("InfiniteScroll", _InfiniteScroll);
  58156. };
  58157. const ElInfiniteScroll = _InfiniteScroll;
  58158. function createLoadingComponent(options) {
  58159. let afterLeaveTimer;
  58160. const afterLeaveFlag = vue.ref(false);
  58161. const data = vue.reactive({
  58162. ...options,
  58163. originalPosition: "",
  58164. originalOverflow: "",
  58165. visible: false
  58166. });
  58167. function setText(text) {
  58168. data.text = text;
  58169. }
  58170. function destroySelf() {
  58171. const target = data.parent;
  58172. const ns = vm.ns;
  58173. if (!target.vLoadingAddClassList) {
  58174. let loadingNumber = target.getAttribute("loading-number");
  58175. loadingNumber = Number.parseInt(loadingNumber) - 1;
  58176. if (!loadingNumber) {
  58177. removeClass(target, ns.bm("parent", "relative"));
  58178. target.removeAttribute("loading-number");
  58179. } else {
  58180. target.setAttribute("loading-number", loadingNumber.toString());
  58181. }
  58182. removeClass(target, ns.bm("parent", "hidden"));
  58183. }
  58184. removeElLoadingChild();
  58185. loadingInstance.unmount();
  58186. }
  58187. function removeElLoadingChild() {
  58188. var _a, _b;
  58189. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  58190. }
  58191. function close() {
  58192. var _a;
  58193. if (options.beforeClose && !options.beforeClose())
  58194. return;
  58195. afterLeaveFlag.value = true;
  58196. clearTimeout(afterLeaveTimer);
  58197. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  58198. data.visible = false;
  58199. (_a = options.closed) == null ? void 0 : _a.call(options);
  58200. }
  58201. function handleAfterLeave() {
  58202. if (!afterLeaveFlag.value)
  58203. return;
  58204. const target = data.parent;
  58205. afterLeaveFlag.value = false;
  58206. target.vLoadingAddClassList = void 0;
  58207. destroySelf();
  58208. }
  58209. const elLoadingComponent = vue.defineComponent({
  58210. name: "ElLoading",
  58211. setup(_, { expose }) {
  58212. const { ns, zIndex } = useGlobalComponentSettings("loading");
  58213. expose({
  58214. ns,
  58215. zIndex
  58216. });
  58217. return () => {
  58218. const svg = data.spinner || data.svg;
  58219. const spinner = vue.h("svg", {
  58220. class: "circular",
  58221. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  58222. ...svg ? { innerHTML: svg } : {}
  58223. }, [
  58224. vue.h("circle", {
  58225. class: "path",
  58226. cx: "25",
  58227. cy: "25",
  58228. r: "20",
  58229. fill: "none"
  58230. })
  58231. ]);
  58232. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  58233. return vue.h(vue.Transition, {
  58234. name: ns.b("fade"),
  58235. onAfterLeave: handleAfterLeave
  58236. }, {
  58237. default: vue.withCtx(() => [
  58238. vue.withDirectives(vue.createVNode("div", {
  58239. style: {
  58240. backgroundColor: data.background || ""
  58241. },
  58242. class: [
  58243. ns.b("mask"),
  58244. data.customClass,
  58245. data.fullscreen ? "is-fullscreen" : ""
  58246. ]
  58247. }, [
  58248. vue.h("div", {
  58249. class: ns.b("spinner")
  58250. }, [spinner, spinnerText])
  58251. ]), [[vue.vShow, data.visible]])
  58252. ])
  58253. });
  58254. };
  58255. }
  58256. });
  58257. const loadingInstance = vue.createApp(elLoadingComponent);
  58258. const vm = loadingInstance.mount(document.createElement("div"));
  58259. return {
  58260. ...vue.toRefs(data),
  58261. setText,
  58262. removeElLoadingChild,
  58263. close,
  58264. handleAfterLeave,
  58265. vm,
  58266. get $el() {
  58267. return vm.$el;
  58268. }
  58269. };
  58270. }
  58271. let fullscreenInstance = void 0;
  58272. const Loading = function(options = {}) {
  58273. if (!isClient)
  58274. return void 0;
  58275. const resolved = resolveOptions(options);
  58276. if (resolved.fullscreen && fullscreenInstance) {
  58277. return fullscreenInstance;
  58278. }
  58279. const instance = createLoadingComponent({
  58280. ...resolved,
  58281. closed: () => {
  58282. var _a;
  58283. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  58284. if (resolved.fullscreen)
  58285. fullscreenInstance = void 0;
  58286. }
  58287. });
  58288. addStyle(resolved, resolved.parent, instance);
  58289. addClassList(resolved, resolved.parent, instance);
  58290. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  58291. let loadingNumber = resolved.parent.getAttribute("loading-number");
  58292. if (!loadingNumber) {
  58293. loadingNumber = "1";
  58294. } else {
  58295. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  58296. }
  58297. resolved.parent.setAttribute("loading-number", loadingNumber);
  58298. resolved.parent.appendChild(instance.$el);
  58299. vue.nextTick(() => instance.visible.value = resolved.visible);
  58300. if (resolved.fullscreen) {
  58301. fullscreenInstance = instance;
  58302. }
  58303. return instance;
  58304. };
  58305. const resolveOptions = (options) => {
  58306. var _a, _b, _c, _d;
  58307. let target;
  58308. if (isString$1(options.target)) {
  58309. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  58310. } else {
  58311. target = options.target || document.body;
  58312. }
  58313. return {
  58314. parent: target === document.body || options.body ? document.body : target,
  58315. background: options.background || "",
  58316. svg: options.svg || "",
  58317. svgViewBox: options.svgViewBox || "",
  58318. spinner: options.spinner || false,
  58319. text: options.text || "",
  58320. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  58321. lock: (_c = options.lock) != null ? _c : false,
  58322. customClass: options.customClass || "",
  58323. visible: (_d = options.visible) != null ? _d : true,
  58324. beforeClose: options.beforeClose,
  58325. closed: options.closed,
  58326. target
  58327. };
  58328. };
  58329. const addStyle = async (options, parent, instance) => {
  58330. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  58331. const maskStyle = {};
  58332. if (options.fullscreen) {
  58333. instance.originalPosition.value = getStyle(document.body, "position");
  58334. instance.originalOverflow.value = getStyle(document.body, "overflow");
  58335. maskStyle.zIndex = nextZIndex();
  58336. } else if (options.parent === document.body) {
  58337. instance.originalPosition.value = getStyle(document.body, "position");
  58338. await vue.nextTick();
  58339. for (const property of ["top", "left"]) {
  58340. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  58341. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  58342. }
  58343. for (const property of ["height", "width"]) {
  58344. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  58345. }
  58346. } else {
  58347. instance.originalPosition.value = getStyle(parent, "position");
  58348. }
  58349. for (const [key, value] of Object.entries(maskStyle)) {
  58350. instance.$el.style[key] = value;
  58351. }
  58352. };
  58353. const addClassList = (options, parent, instance) => {
  58354. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  58355. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  58356. addClass(parent, ns.bm("parent", "relative"));
  58357. } else {
  58358. removeClass(parent, ns.bm("parent", "relative"));
  58359. }
  58360. if (options.fullscreen && options.lock) {
  58361. addClass(parent, ns.bm("parent", "hidden"));
  58362. } else {
  58363. removeClass(parent, ns.bm("parent", "hidden"));
  58364. }
  58365. };
  58366. const INSTANCE_KEY = Symbol("ElLoading");
  58367. const createInstance = (el, binding) => {
  58368. var _a, _b, _c, _d;
  58369. const vm = binding.instance;
  58370. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  58371. const resolveExpression = (key) => {
  58372. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  58373. if (data)
  58374. return vue.ref(data);
  58375. else
  58376. return data;
  58377. };
  58378. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  58379. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  58380. const options = {
  58381. text: getProp("text"),
  58382. svg: getProp("svg"),
  58383. svgViewBox: getProp("svgViewBox"),
  58384. spinner: getProp("spinner"),
  58385. background: getProp("background"),
  58386. customClass: getProp("customClass"),
  58387. fullscreen,
  58388. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  58389. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  58390. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  58391. };
  58392. el[INSTANCE_KEY] = {
  58393. options,
  58394. instance: Loading(options)
  58395. };
  58396. };
  58397. const updateOptions = (newOptions, originalOptions) => {
  58398. for (const key of Object.keys(originalOptions)) {
  58399. if (vue.isRef(originalOptions[key]))
  58400. originalOptions[key].value = newOptions[key];
  58401. }
  58402. };
  58403. const vLoading = {
  58404. mounted(el, binding) {
  58405. if (binding.value) {
  58406. createInstance(el, binding);
  58407. }
  58408. },
  58409. updated(el, binding) {
  58410. const instance = el[INSTANCE_KEY];
  58411. if (binding.oldValue !== binding.value) {
  58412. if (binding.value && !binding.oldValue) {
  58413. createInstance(el, binding);
  58414. } else if (binding.value && binding.oldValue) {
  58415. if (isObject$1(binding.value))
  58416. updateOptions(binding.value, instance.options);
  58417. } else {
  58418. instance == null ? void 0 : instance.instance.close();
  58419. }
  58420. }
  58421. },
  58422. unmounted(el) {
  58423. var _a;
  58424. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  58425. el[INSTANCE_KEY] = null;
  58426. }
  58427. };
  58428. const ElLoading = {
  58429. install(app) {
  58430. app.directive("loading", vLoading);
  58431. app.config.globalProperties.$loading = Loading;
  58432. },
  58433. directive: vLoading,
  58434. service: Loading
  58435. };
  58436. const messageTypes = ["success", "info", "warning", "error"];
  58437. const messageDefaults = mutable({
  58438. customClass: "",
  58439. dangerouslyUseHTMLString: false,
  58440. duration: 3e3,
  58441. icon: void 0,
  58442. id: "",
  58443. message: "",
  58444. onClose: void 0,
  58445. showClose: false,
  58446. type: "info",
  58447. plain: false,
  58448. offset: 16,
  58449. zIndex: 0,
  58450. grouping: false,
  58451. repeatNum: 1,
  58452. appendTo: isClient ? document.body : void 0
  58453. });
  58454. const messageProps = buildProps({
  58455. customClass: {
  58456. type: String,
  58457. default: messageDefaults.customClass
  58458. },
  58459. dangerouslyUseHTMLString: {
  58460. type: Boolean,
  58461. default: messageDefaults.dangerouslyUseHTMLString
  58462. },
  58463. duration: {
  58464. type: Number,
  58465. default: messageDefaults.duration
  58466. },
  58467. icon: {
  58468. type: iconPropType,
  58469. default: messageDefaults.icon
  58470. },
  58471. id: {
  58472. type: String,
  58473. default: messageDefaults.id
  58474. },
  58475. message: {
  58476. type: definePropType([
  58477. String,
  58478. Object,
  58479. Function
  58480. ]),
  58481. default: messageDefaults.message
  58482. },
  58483. onClose: {
  58484. type: definePropType(Function),
  58485. default: messageDefaults.onClose
  58486. },
  58487. showClose: {
  58488. type: Boolean,
  58489. default: messageDefaults.showClose
  58490. },
  58491. type: {
  58492. type: String,
  58493. values: messageTypes,
  58494. default: messageDefaults.type
  58495. },
  58496. plain: {
  58497. type: Boolean,
  58498. default: messageDefaults.plain
  58499. },
  58500. offset: {
  58501. type: Number,
  58502. default: messageDefaults.offset
  58503. },
  58504. zIndex: {
  58505. type: Number,
  58506. default: messageDefaults.zIndex
  58507. },
  58508. grouping: {
  58509. type: Boolean,
  58510. default: messageDefaults.grouping
  58511. },
  58512. repeatNum: {
  58513. type: Number,
  58514. default: messageDefaults.repeatNum
  58515. }
  58516. });
  58517. const messageEmits = {
  58518. destroy: () => true
  58519. };
  58520. const instances = vue.shallowReactive([]);
  58521. const getInstance = (id) => {
  58522. const idx = instances.findIndex((instance) => instance.id === id);
  58523. const current = instances[idx];
  58524. let prev;
  58525. if (idx > 0) {
  58526. prev = instances[idx - 1];
  58527. }
  58528. return { current, prev };
  58529. };
  58530. const getLastOffset = (id) => {
  58531. const { prev } = getInstance(id);
  58532. if (!prev)
  58533. return 0;
  58534. return prev.vm.exposed.bottom.value;
  58535. };
  58536. const getOffsetOrSpace = (id, offset) => {
  58537. const idx = instances.findIndex((instance) => instance.id === id);
  58538. return idx > 0 ? 16 : offset;
  58539. };
  58540. const __default__$1 = vue.defineComponent({
  58541. name: "ElMessage"
  58542. });
  58543. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  58544. ...__default__$1,
  58545. props: messageProps,
  58546. emits: messageEmits,
  58547. setup(__props, { expose, emit }) {
  58548. const props = __props;
  58549. const { Close } = TypeComponents;
  58550. const isStartTransition = vue.ref(false);
  58551. const { ns, zIndex } = useGlobalComponentSettings("message");
  58552. const { currentZIndex, nextZIndex } = zIndex;
  58553. const messageRef = vue.ref();
  58554. const visible = vue.ref(false);
  58555. const height = vue.ref(0);
  58556. let stopTimer = void 0;
  58557. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  58558. const typeClass = vue.computed(() => {
  58559. const type = props.type;
  58560. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58561. });
  58562. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  58563. const lastOffset = vue.computed(() => getLastOffset(props.id));
  58564. const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  58565. const bottom = vue.computed(() => height.value + offset.value);
  58566. const customStyle = vue.computed(() => ({
  58567. top: `${offset.value}px`,
  58568. zIndex: currentZIndex.value
  58569. }));
  58570. function startTimer() {
  58571. if (props.duration === 0)
  58572. return;
  58573. ({ stop: stopTimer } = useTimeoutFn(() => {
  58574. close();
  58575. }, props.duration));
  58576. }
  58577. function clearTimer() {
  58578. stopTimer == null ? void 0 : stopTimer();
  58579. }
  58580. function close() {
  58581. visible.value = false;
  58582. vue.nextTick(() => {
  58583. var _a;
  58584. if (!isStartTransition.value) {
  58585. (_a = props.onClose) == null ? void 0 : _a.call(props);
  58586. emit("destroy");
  58587. }
  58588. });
  58589. }
  58590. function keydown({ code }) {
  58591. if (code === EVENT_CODE.esc) {
  58592. close();
  58593. }
  58594. }
  58595. vue.onMounted(() => {
  58596. startTimer();
  58597. nextZIndex();
  58598. visible.value = true;
  58599. });
  58600. vue.watch(() => props.repeatNum, () => {
  58601. clearTimer();
  58602. startTimer();
  58603. });
  58604. useEventListener(document, "keydown", keydown);
  58605. useResizeObserver(messageRef, () => {
  58606. height.value = messageRef.value.getBoundingClientRect().height;
  58607. });
  58608. expose({
  58609. visible,
  58610. bottom,
  58611. close
  58612. });
  58613. return (_ctx, _cache) => {
  58614. return vue.openBlock(), vue.createBlock(vue.Transition, {
  58615. name: vue.unref(ns).b("fade"),
  58616. onBeforeEnter: ($event) => isStartTransition.value = true,
  58617. onBeforeLeave: _ctx.onClose,
  58618. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  58619. persisted: ""
  58620. }, {
  58621. default: vue.withCtx(() => [
  58622. vue.withDirectives(vue.createElementVNode("div", {
  58623. id: _ctx.id,
  58624. ref_key: "messageRef",
  58625. ref: messageRef,
  58626. class: vue.normalizeClass([
  58627. vue.unref(ns).b(),
  58628. { [vue.unref(ns).m(_ctx.type)]: _ctx.type },
  58629. vue.unref(ns).is("closable", _ctx.showClose),
  58630. vue.unref(ns).is("plain", _ctx.plain),
  58631. _ctx.customClass
  58632. ]),
  58633. style: vue.normalizeStyle(vue.unref(customStyle)),
  58634. role: "alert",
  58635. onMouseenter: clearTimer,
  58636. onMouseleave: startTimer
  58637. }, [
  58638. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  58639. key: 0,
  58640. value: _ctx.repeatNum,
  58641. type: vue.unref(badgeType),
  58642. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  58643. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  58644. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  58645. key: 1,
  58646. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  58647. }, {
  58648. default: vue.withCtx(() => [
  58649. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  58650. ]),
  58651. _: 1
  58652. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  58653. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  58654. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  58655. key: 0,
  58656. class: vue.normalizeClass(vue.unref(ns).e("content"))
  58657. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  58658. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  58659. vue.createElementVNode("p", {
  58660. class: vue.normalizeClass(vue.unref(ns).e("content")),
  58661. innerHTML: _ctx.message
  58662. }, null, 10, ["innerHTML"])
  58663. ], 2112))
  58664. ]),
  58665. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  58666. key: 2,
  58667. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  58668. onClick: vue.withModifiers(close, ["stop"])
  58669. }, {
  58670. default: vue.withCtx(() => [
  58671. vue.createVNode(vue.unref(Close))
  58672. ]),
  58673. _: 1
  58674. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  58675. ], 46, ["id"]), [
  58676. [vue.vShow, visible.value]
  58677. ])
  58678. ]),
  58679. _: 3
  58680. }, 8, ["name", "onBeforeEnter", "onBeforeLeave", "onAfterLeave"]);
  58681. };
  58682. }
  58683. });
  58684. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  58685. let seed$1 = 1;
  58686. const normalizeOptions = (params) => {
  58687. const options = !params || isString$1(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
  58688. const normalized = {
  58689. ...messageDefaults,
  58690. ...options
  58691. };
  58692. if (!normalized.appendTo) {
  58693. normalized.appendTo = document.body;
  58694. } else if (isString$1(normalized.appendTo)) {
  58695. let appendTo = document.querySelector(normalized.appendTo);
  58696. if (!isElement$1(appendTo)) {
  58697. appendTo = document.body;
  58698. }
  58699. normalized.appendTo = appendTo;
  58700. }
  58701. if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
  58702. normalized.grouping = messageConfig.grouping;
  58703. }
  58704. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
  58705. normalized.duration = messageConfig.duration;
  58706. }
  58707. if (isNumber(messageConfig.offset) && normalized.offset === 16) {
  58708. normalized.offset = messageConfig.offset;
  58709. }
  58710. if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
  58711. normalized.showClose = messageConfig.showClose;
  58712. }
  58713. return normalized;
  58714. };
  58715. const closeMessage = (instance) => {
  58716. const idx = instances.indexOf(instance);
  58717. if (idx === -1)
  58718. return;
  58719. instances.splice(idx, 1);
  58720. const { handler } = instance;
  58721. handler.close();
  58722. };
  58723. const createMessage = ({ appendTo, ...options }, context) => {
  58724. const id = `message_${seed$1++}`;
  58725. const userOnClose = options.onClose;
  58726. const container = document.createElement("div");
  58727. const props = {
  58728. ...options,
  58729. id,
  58730. onClose: () => {
  58731. userOnClose == null ? void 0 : userOnClose();
  58732. closeMessage(instance);
  58733. },
  58734. onDestroy: () => {
  58735. vue.render(null, container);
  58736. }
  58737. };
  58738. const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  58739. default: isFunction$1(props.message) ? props.message : () => props.message
  58740. } : null);
  58741. vnode.appContext = context || message._context;
  58742. vue.render(vnode, container);
  58743. appendTo.appendChild(container.firstElementChild);
  58744. const vm = vnode.component;
  58745. const handler = {
  58746. close: () => {
  58747. vm.exposed.close();
  58748. }
  58749. };
  58750. const instance = {
  58751. id,
  58752. vnode,
  58753. vm,
  58754. handler,
  58755. props: vnode.component.props
  58756. };
  58757. return instance;
  58758. };
  58759. const message = (options = {}, context) => {
  58760. if (!isClient)
  58761. return { close: () => void 0 };
  58762. const normalized = normalizeOptions(options);
  58763. if (normalized.grouping && instances.length) {
  58764. const instance2 = instances.find(({ vnode: vm }) => {
  58765. var _a;
  58766. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  58767. });
  58768. if (instance2) {
  58769. instance2.props.repeatNum += 1;
  58770. instance2.props.type = normalized.type;
  58771. return instance2.handler;
  58772. }
  58773. }
  58774. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  58775. return { close: () => void 0 };
  58776. }
  58777. const instance = createMessage(normalized, context);
  58778. instances.push(instance);
  58779. return instance.handler;
  58780. };
  58781. messageTypes.forEach((type) => {
  58782. message[type] = (options = {}, appContext) => {
  58783. const normalized = normalizeOptions(options);
  58784. return message({ ...normalized, type }, appContext);
  58785. };
  58786. });
  58787. function closeAll$1(type) {
  58788. const instancesToClose = [...instances];
  58789. for (const instance of instancesToClose) {
  58790. if (!type || type === instance.props.type) {
  58791. instance.handler.close();
  58792. }
  58793. }
  58794. }
  58795. message.closeAll = closeAll$1;
  58796. message._context = null;
  58797. var Message = message;
  58798. const ElMessage = withInstallFunction(Message, "$message");
  58799. const _sfc_main$1 = vue.defineComponent({
  58800. name: "ElMessageBox",
  58801. directives: {
  58802. TrapFocus
  58803. },
  58804. components: {
  58805. ElButton,
  58806. ElFocusTrap,
  58807. ElInput,
  58808. ElOverlay,
  58809. ElIcon,
  58810. ...TypeComponents
  58811. },
  58812. inheritAttrs: false,
  58813. props: {
  58814. buttonSize: {
  58815. type: String,
  58816. validator: isValidComponentSize
  58817. },
  58818. modal: {
  58819. type: Boolean,
  58820. default: true
  58821. },
  58822. lockScroll: {
  58823. type: Boolean,
  58824. default: true
  58825. },
  58826. showClose: {
  58827. type: Boolean,
  58828. default: true
  58829. },
  58830. closeOnClickModal: {
  58831. type: Boolean,
  58832. default: true
  58833. },
  58834. closeOnPressEscape: {
  58835. type: Boolean,
  58836. default: true
  58837. },
  58838. closeOnHashChange: {
  58839. type: Boolean,
  58840. default: true
  58841. },
  58842. center: Boolean,
  58843. draggable: Boolean,
  58844. overflow: Boolean,
  58845. roundButton: {
  58846. default: false,
  58847. type: Boolean
  58848. },
  58849. container: {
  58850. type: String,
  58851. default: "body"
  58852. },
  58853. boxType: {
  58854. type: String,
  58855. default: ""
  58856. }
  58857. },
  58858. emits: ["vanish", "action"],
  58859. setup(props, { emit }) {
  58860. const {
  58861. locale,
  58862. zIndex,
  58863. ns,
  58864. size: btnSize
  58865. } = useGlobalComponentSettings("message-box", vue.computed(() => props.buttonSize));
  58866. const { t } = locale;
  58867. const { nextZIndex } = zIndex;
  58868. const visible = vue.ref(false);
  58869. const state = vue.reactive({
  58870. autofocus: true,
  58871. beforeClose: null,
  58872. callback: null,
  58873. cancelButtonText: "",
  58874. cancelButtonClass: "",
  58875. confirmButtonText: "",
  58876. confirmButtonClass: "",
  58877. customClass: "",
  58878. customStyle: {},
  58879. dangerouslyUseHTMLString: false,
  58880. distinguishCancelAndClose: false,
  58881. icon: "",
  58882. closeIcon: "",
  58883. inputPattern: null,
  58884. inputPlaceholder: "",
  58885. inputType: "text",
  58886. inputValue: "",
  58887. inputValidator: void 0,
  58888. inputErrorMessage: "",
  58889. message: "",
  58890. modalFade: true,
  58891. modalClass: "",
  58892. showCancelButton: false,
  58893. showConfirmButton: true,
  58894. type: "",
  58895. title: void 0,
  58896. showInput: false,
  58897. action: "",
  58898. confirmButtonLoading: false,
  58899. cancelButtonLoading: false,
  58900. confirmButtonLoadingIcon: vue.markRaw(loading_default),
  58901. cancelButtonLoadingIcon: vue.markRaw(loading_default),
  58902. confirmButtonDisabled: false,
  58903. editorErrorMessage: "",
  58904. validateError: false,
  58905. zIndex: nextZIndex()
  58906. });
  58907. const typeClass = vue.computed(() => {
  58908. const type = state.type;
  58909. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58910. });
  58911. const contentId = useId();
  58912. const inputId = useId();
  58913. const iconComponent = vue.computed(() => {
  58914. const type = state.type;
  58915. return state.icon || type && TypeComponentsMap[type] || "";
  58916. });
  58917. const hasMessage = vue.computed(() => !!state.message);
  58918. const rootRef = vue.ref();
  58919. const headerRef = vue.ref();
  58920. const focusStartRef = vue.ref();
  58921. const inputRef = vue.ref();
  58922. const confirmRef = vue.ref();
  58923. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  58924. vue.watch(() => state.inputValue, async (val) => {
  58925. await vue.nextTick();
  58926. if (props.boxType === "prompt" && val) {
  58927. validate();
  58928. }
  58929. }, { immediate: true });
  58930. vue.watch(() => visible.value, (val) => {
  58931. var _a, _b;
  58932. if (val) {
  58933. if (props.boxType !== "prompt") {
  58934. if (state.autofocus) {
  58935. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  58936. } else {
  58937. focusStartRef.value = rootRef.value;
  58938. }
  58939. }
  58940. state.zIndex = nextZIndex();
  58941. }
  58942. if (props.boxType !== "prompt")
  58943. return;
  58944. if (val) {
  58945. vue.nextTick().then(() => {
  58946. var _a2;
  58947. if (inputRef.value && inputRef.value.$el) {
  58948. if (state.autofocus) {
  58949. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  58950. } else {
  58951. focusStartRef.value = rootRef.value;
  58952. }
  58953. }
  58954. });
  58955. } else {
  58956. state.editorErrorMessage = "";
  58957. state.validateError = false;
  58958. }
  58959. });
  58960. const draggable = vue.computed(() => props.draggable);
  58961. const overflow = vue.computed(() => props.overflow);
  58962. useDraggable(rootRef, headerRef, draggable, overflow);
  58963. vue.onMounted(async () => {
  58964. await vue.nextTick();
  58965. if (props.closeOnHashChange) {
  58966. window.addEventListener("hashchange", doClose);
  58967. }
  58968. });
  58969. vue.onBeforeUnmount(() => {
  58970. if (props.closeOnHashChange) {
  58971. window.removeEventListener("hashchange", doClose);
  58972. }
  58973. });
  58974. function doClose() {
  58975. if (!visible.value)
  58976. return;
  58977. visible.value = false;
  58978. vue.nextTick(() => {
  58979. if (state.action)
  58980. emit("action", state.action);
  58981. });
  58982. }
  58983. const handleWrapperClick = () => {
  58984. if (props.closeOnClickModal) {
  58985. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  58986. }
  58987. };
  58988. const overlayEvent = useSameTarget(handleWrapperClick);
  58989. const handleInputEnter = (e) => {
  58990. if (state.inputType !== "textarea") {
  58991. e.preventDefault();
  58992. return handleAction("confirm");
  58993. }
  58994. };
  58995. const handleAction = (action) => {
  58996. var _a;
  58997. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  58998. return;
  58999. }
  59000. state.action = action;
  59001. if (state.beforeClose) {
  59002. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  59003. } else {
  59004. doClose();
  59005. }
  59006. };
  59007. const validate = () => {
  59008. if (props.boxType === "prompt") {
  59009. const inputPattern = state.inputPattern;
  59010. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  59011. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  59012. state.validateError = true;
  59013. return false;
  59014. }
  59015. const inputValidator = state.inputValidator;
  59016. if (isFunction$1(inputValidator)) {
  59017. const validateResult = inputValidator(state.inputValue);
  59018. if (validateResult === false) {
  59019. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  59020. state.validateError = true;
  59021. return false;
  59022. }
  59023. if (isString$1(validateResult)) {
  59024. state.editorErrorMessage = validateResult;
  59025. state.validateError = true;
  59026. return false;
  59027. }
  59028. }
  59029. }
  59030. state.editorErrorMessage = "";
  59031. state.validateError = false;
  59032. return true;
  59033. };
  59034. const getInputElement = () => {
  59035. var _a, _b;
  59036. const inputRefs = (_a = inputRef.value) == null ? void 0 : _a.$refs;
  59037. return (_b = inputRefs == null ? void 0 : inputRefs.input) != null ? _b : inputRefs == null ? void 0 : inputRefs.textarea;
  59038. };
  59039. const handleClose = () => {
  59040. handleAction("close");
  59041. };
  59042. const onCloseRequested = () => {
  59043. if (props.closeOnPressEscape) {
  59044. handleClose();
  59045. }
  59046. };
  59047. if (props.lockScroll) {
  59048. useLockscreen(visible);
  59049. }
  59050. return {
  59051. ...vue.toRefs(state),
  59052. ns,
  59053. overlayEvent,
  59054. visible,
  59055. hasMessage,
  59056. typeClass,
  59057. contentId,
  59058. inputId,
  59059. btnSize,
  59060. iconComponent,
  59061. confirmButtonClasses,
  59062. rootRef,
  59063. focusStartRef,
  59064. headerRef,
  59065. inputRef,
  59066. confirmRef,
  59067. doClose,
  59068. handleClose,
  59069. onCloseRequested,
  59070. handleWrapperClick,
  59071. handleInputEnter,
  59072. handleAction,
  59073. t
  59074. };
  59075. }
  59076. });
  59077. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  59078. const _component_el_icon = vue.resolveComponent("el-icon");
  59079. const _component_el_input = vue.resolveComponent("el-input");
  59080. const _component_el_button = vue.resolveComponent("el-button");
  59081. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  59082. const _component_el_overlay = vue.resolveComponent("el-overlay");
  59083. return vue.openBlock(), vue.createBlock(vue.Transition, {
  59084. name: "fade-in-linear",
  59085. onAfterLeave: ($event) => _ctx.$emit("vanish"),
  59086. persisted: ""
  59087. }, {
  59088. default: vue.withCtx(() => [
  59089. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  59090. "z-index": _ctx.zIndex,
  59091. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  59092. mask: _ctx.modal
  59093. }, {
  59094. default: vue.withCtx(() => [
  59095. vue.createElementVNode("div", {
  59096. role: "dialog",
  59097. "aria-label": _ctx.title,
  59098. "aria-modal": "true",
  59099. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  59100. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  59101. onClick: _ctx.overlayEvent.onClick,
  59102. onMousedown: _ctx.overlayEvent.onMousedown,
  59103. onMouseup: _ctx.overlayEvent.onMouseup
  59104. }, [
  59105. vue.createVNode(_component_el_focus_trap, {
  59106. loop: "",
  59107. trapped: _ctx.visible,
  59108. "focus-trap-el": _ctx.rootRef,
  59109. "focus-start-el": _ctx.focusStartRef,
  59110. onReleaseRequested: _ctx.onCloseRequested
  59111. }, {
  59112. default: vue.withCtx(() => [
  59113. vue.createElementVNode("div", {
  59114. ref: "rootRef",
  59115. class: vue.normalizeClass([
  59116. _ctx.ns.b(),
  59117. _ctx.customClass,
  59118. _ctx.ns.is("draggable", _ctx.draggable),
  59119. { [_ctx.ns.m("center")]: _ctx.center }
  59120. ]),
  59121. style: vue.normalizeStyle(_ctx.customStyle),
  59122. tabindex: "-1",
  59123. onClick: vue.withModifiers(() => {
  59124. }, ["stop"])
  59125. }, [
  59126. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  59127. key: 0,
  59128. ref: "headerRef",
  59129. class: vue.normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  59130. }, [
  59131. vue.createElementVNode("div", {
  59132. class: vue.normalizeClass(_ctx.ns.e("title"))
  59133. }, [
  59134. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  59135. key: 0,
  59136. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  59137. }, {
  59138. default: vue.withCtx(() => [
  59139. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  59140. ]),
  59141. _: 1
  59142. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  59143. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  59144. ], 2),
  59145. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  59146. key: 0,
  59147. type: "button",
  59148. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  59149. "aria-label": _ctx.t("el.messagebox.close"),
  59150. onClick: ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"),
  59151. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])
  59152. }, [
  59153. vue.createVNode(_component_el_icon, {
  59154. class: vue.normalizeClass(_ctx.ns.e("close"))
  59155. }, {
  59156. default: vue.withCtx(() => [
  59157. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || "close")))
  59158. ]),
  59159. _: 1
  59160. }, 8, ["class"])
  59161. ], 42, ["aria-label", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true)
  59162. ], 2)) : vue.createCommentVNode("v-if", true),
  59163. vue.createElementVNode("div", {
  59164. id: _ctx.contentId,
  59165. class: vue.normalizeClass(_ctx.ns.e("content"))
  59166. }, [
  59167. vue.createElementVNode("div", {
  59168. class: vue.normalizeClass(_ctx.ns.e("container"))
  59169. }, [
  59170. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  59171. key: 0,
  59172. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  59173. }, {
  59174. default: vue.withCtx(() => [
  59175. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  59176. ]),
  59177. _: 1
  59178. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  59179. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  59180. key: 1,
  59181. class: vue.normalizeClass(_ctx.ns.e("message"))
  59182. }, [
  59183. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  59184. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  59185. key: 0,
  59186. for: _ctx.showInput ? _ctx.inputId : void 0
  59187. }, {
  59188. default: vue.withCtx(() => [
  59189. vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  59190. ]),
  59191. _: 1
  59192. }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  59193. key: 1,
  59194. for: _ctx.showInput ? _ctx.inputId : void 0,
  59195. innerHTML: _ctx.message
  59196. }, null, 8, ["for", "innerHTML"]))
  59197. ])
  59198. ], 2)) : vue.createCommentVNode("v-if", true)
  59199. ], 2),
  59200. vue.withDirectives(vue.createElementVNode("div", {
  59201. class: vue.normalizeClass(_ctx.ns.e("input"))
  59202. }, [
  59203. vue.createVNode(_component_el_input, {
  59204. id: _ctx.inputId,
  59205. ref: "inputRef",
  59206. modelValue: _ctx.inputValue,
  59207. "onUpdate:modelValue": ($event) => _ctx.inputValue = $event,
  59208. type: _ctx.inputType,
  59209. placeholder: _ctx.inputPlaceholder,
  59210. "aria-invalid": _ctx.validateError,
  59211. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  59212. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  59213. }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  59214. vue.createElementVNode("div", {
  59215. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  59216. style: vue.normalizeStyle({
  59217. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  59218. })
  59219. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  59220. ], 2), [
  59221. [vue.vShow, _ctx.showInput]
  59222. ])
  59223. ], 10, ["id"]),
  59224. vue.createElementVNode("div", {
  59225. class: vue.normalizeClass(_ctx.ns.e("btns"))
  59226. }, [
  59227. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  59228. key: 0,
  59229. loading: _ctx.cancelButtonLoading,
  59230. "loading-icon": _ctx.cancelButtonLoadingIcon,
  59231. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  59232. round: _ctx.roundButton,
  59233. size: _ctx.btnSize,
  59234. onClick: ($event) => _ctx.handleAction("cancel"),
  59235. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])
  59236. }, {
  59237. default: vue.withCtx(() => [
  59238. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  59239. ]),
  59240. _: 1
  59241. }, 8, ["loading", "loading-icon", "class", "round", "size", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true),
  59242. vue.withDirectives(vue.createVNode(_component_el_button, {
  59243. ref: "confirmRef",
  59244. type: "primary",
  59245. loading: _ctx.confirmButtonLoading,
  59246. "loading-icon": _ctx.confirmButtonLoadingIcon,
  59247. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  59248. round: _ctx.roundButton,
  59249. disabled: _ctx.confirmButtonDisabled,
  59250. size: _ctx.btnSize,
  59251. onClick: ($event) => _ctx.handleAction("confirm"),
  59252. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])
  59253. }, {
  59254. default: vue.withCtx(() => [
  59255. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  59256. ]),
  59257. _: 1
  59258. }, 8, ["loading", "loading-icon", "class", "round", "disabled", "size", "onClick", "onKeydown"]), [
  59259. [vue.vShow, _ctx.showConfirmButton]
  59260. ])
  59261. ], 2)
  59262. ], 14, ["onClick"])
  59263. ]),
  59264. _: 3
  59265. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  59266. ], 42, ["aria-label", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  59267. ]),
  59268. _: 3
  59269. }, 8, ["z-index", "overlay-class", "mask"]), [
  59270. [vue.vShow, _ctx.visible]
  59271. ])
  59272. ]),
  59273. _: 3
  59274. }, 8, ["onAfterLeave"]);
  59275. }
  59276. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  59277. const messageInstance = /* @__PURE__ */ new Map();
  59278. const getAppendToElement = (props) => {
  59279. let appendTo = document.body;
  59280. if (props.appendTo) {
  59281. if (isString$1(props.appendTo)) {
  59282. appendTo = document.querySelector(props.appendTo);
  59283. }
  59284. if (isElement$1(props.appendTo)) {
  59285. appendTo = props.appendTo;
  59286. }
  59287. if (!isElement$1(appendTo)) {
  59288. appendTo = document.body;
  59289. }
  59290. }
  59291. return appendTo;
  59292. };
  59293. const initInstance = (props, container, appContext = null) => {
  59294. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  59295. default: isFunction$1(props.message) ? props.message : () => props.message
  59296. } : null);
  59297. vnode.appContext = appContext;
  59298. vue.render(vnode, container);
  59299. getAppendToElement(props).appendChild(container.firstElementChild);
  59300. return vnode.component;
  59301. };
  59302. const genContainer = () => {
  59303. return document.createElement("div");
  59304. };
  59305. const showMessage = (options, appContext) => {
  59306. const container = genContainer();
  59307. options.onVanish = () => {
  59308. vue.render(null, container);
  59309. messageInstance.delete(vm);
  59310. };
  59311. options.onAction = (action) => {
  59312. const currentMsg = messageInstance.get(vm);
  59313. let resolve;
  59314. if (options.showInput) {
  59315. resolve = { value: vm.inputValue, action };
  59316. } else {
  59317. resolve = action;
  59318. }
  59319. if (options.callback) {
  59320. options.callback(resolve, instance.proxy);
  59321. } else {
  59322. if (action === "cancel" || action === "close") {
  59323. if (options.distinguishCancelAndClose && action !== "cancel") {
  59324. currentMsg.reject("close");
  59325. } else {
  59326. currentMsg.reject("cancel");
  59327. }
  59328. } else {
  59329. currentMsg.resolve(resolve);
  59330. }
  59331. }
  59332. };
  59333. const instance = initInstance(options, container, appContext);
  59334. const vm = instance.proxy;
  59335. for (const prop in options) {
  59336. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  59337. if (prop === "closeIcon" && isObject$1(options[prop])) {
  59338. vm[prop] = vue.markRaw(options[prop]);
  59339. } else {
  59340. vm[prop] = options[prop];
  59341. }
  59342. }
  59343. }
  59344. vm.visible = true;
  59345. return vm;
  59346. };
  59347. function MessageBox(options, appContext = null) {
  59348. if (!isClient)
  59349. return Promise.reject();
  59350. let callback;
  59351. if (isString$1(options) || vue.isVNode(options)) {
  59352. options = {
  59353. message: options
  59354. };
  59355. } else {
  59356. callback = options.callback;
  59357. }
  59358. return new Promise((resolve, reject) => {
  59359. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  59360. messageInstance.set(vm, {
  59361. options,
  59362. callback,
  59363. resolve,
  59364. reject
  59365. });
  59366. });
  59367. }
  59368. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  59369. const MESSAGE_BOX_DEFAULT_OPTS = {
  59370. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  59371. confirm: { showCancelButton: true },
  59372. prompt: { showCancelButton: true, showInput: true }
  59373. };
  59374. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  59375. MessageBox[boxType] = messageBoxFactory(boxType);
  59376. });
  59377. function messageBoxFactory(boxType) {
  59378. return (message, title, options, appContext) => {
  59379. let titleOrOpts = "";
  59380. if (isObject$1(title)) {
  59381. options = title;
  59382. titleOrOpts = "";
  59383. } else if (isUndefined(title)) {
  59384. titleOrOpts = "";
  59385. } else {
  59386. titleOrOpts = title;
  59387. }
  59388. return MessageBox(Object.assign({
  59389. title: titleOrOpts,
  59390. message,
  59391. type: "",
  59392. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  59393. }, options, {
  59394. boxType
  59395. }), appContext);
  59396. };
  59397. }
  59398. MessageBox.close = () => {
  59399. messageInstance.forEach((_, vm) => {
  59400. vm.doClose();
  59401. });
  59402. messageInstance.clear();
  59403. };
  59404. MessageBox._context = null;
  59405. const _MessageBox = MessageBox;
  59406. _MessageBox.install = (app) => {
  59407. _MessageBox._context = app._context;
  59408. app.config.globalProperties.$msgbox = _MessageBox;
  59409. app.config.globalProperties.$messageBox = _MessageBox;
  59410. app.config.globalProperties.$alert = _MessageBox.alert;
  59411. app.config.globalProperties.$confirm = _MessageBox.confirm;
  59412. app.config.globalProperties.$prompt = _MessageBox.prompt;
  59413. };
  59414. const ElMessageBox = _MessageBox;
  59415. const notificationTypes = [
  59416. "success",
  59417. "info",
  59418. "warning",
  59419. "error"
  59420. ];
  59421. const notificationProps = buildProps({
  59422. customClass: {
  59423. type: String,
  59424. default: ""
  59425. },
  59426. dangerouslyUseHTMLString: Boolean,
  59427. duration: {
  59428. type: Number,
  59429. default: 4500
  59430. },
  59431. icon: {
  59432. type: iconPropType
  59433. },
  59434. id: {
  59435. type: String,
  59436. default: ""
  59437. },
  59438. message: {
  59439. type: definePropType([
  59440. String,
  59441. Object,
  59442. Function
  59443. ]),
  59444. default: ""
  59445. },
  59446. offset: {
  59447. type: Number,
  59448. default: 0
  59449. },
  59450. onClick: {
  59451. type: definePropType(Function),
  59452. default: () => void 0
  59453. },
  59454. onClose: {
  59455. type: definePropType(Function),
  59456. required: true
  59457. },
  59458. position: {
  59459. type: String,
  59460. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  59461. default: "top-right"
  59462. },
  59463. showClose: {
  59464. type: Boolean,
  59465. default: true
  59466. },
  59467. title: {
  59468. type: String,
  59469. default: ""
  59470. },
  59471. type: {
  59472. type: String,
  59473. values: [...notificationTypes, ""],
  59474. default: ""
  59475. },
  59476. zIndex: Number,
  59477. closeIcon: {
  59478. type: iconPropType,
  59479. default: close_default
  59480. }
  59481. });
  59482. const notificationEmits = {
  59483. destroy: () => true
  59484. };
  59485. const __default__ = vue.defineComponent({
  59486. name: "ElNotification"
  59487. });
  59488. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  59489. ...__default__,
  59490. props: notificationProps,
  59491. emits: notificationEmits,
  59492. setup(__props, { expose }) {
  59493. const props = __props;
  59494. const { ns, zIndex } = useGlobalComponentSettings("notification");
  59495. const { nextZIndex, currentZIndex } = zIndex;
  59496. const visible = vue.ref(false);
  59497. let timer = void 0;
  59498. const typeClass = vue.computed(() => {
  59499. const type = props.type;
  59500. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  59501. });
  59502. const iconComponent = vue.computed(() => {
  59503. if (!props.type)
  59504. return props.icon;
  59505. return TypeComponentsMap[props.type] || props.icon;
  59506. });
  59507. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  59508. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  59509. const positionStyle = vue.computed(() => {
  59510. var _a;
  59511. return {
  59512. [verticalProperty.value]: `${props.offset}px`,
  59513. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  59514. };
  59515. });
  59516. function startTimer() {
  59517. if (props.duration > 0) {
  59518. ({ stop: timer } = useTimeoutFn(() => {
  59519. if (visible.value)
  59520. close();
  59521. }, props.duration));
  59522. }
  59523. }
  59524. function clearTimer() {
  59525. timer == null ? void 0 : timer();
  59526. }
  59527. function close() {
  59528. visible.value = false;
  59529. }
  59530. function onKeydown({ code }) {
  59531. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  59532. clearTimer();
  59533. } else if (code === EVENT_CODE.esc) {
  59534. if (visible.value) {
  59535. close();
  59536. }
  59537. } else {
  59538. startTimer();
  59539. }
  59540. }
  59541. vue.onMounted(() => {
  59542. startTimer();
  59543. nextZIndex();
  59544. visible.value = true;
  59545. });
  59546. useEventListener(document, "keydown", onKeydown);
  59547. expose({
  59548. visible,
  59549. close
  59550. });
  59551. return (_ctx, _cache) => {
  59552. return vue.openBlock(), vue.createBlock(vue.Transition, {
  59553. name: vue.unref(ns).b("fade"),
  59554. onBeforeLeave: _ctx.onClose,
  59555. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  59556. persisted: ""
  59557. }, {
  59558. default: vue.withCtx(() => [
  59559. vue.withDirectives(vue.createElementVNode("div", {
  59560. id: _ctx.id,
  59561. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  59562. style: vue.normalizeStyle(vue.unref(positionStyle)),
  59563. role: "alert",
  59564. onMouseenter: clearTimer,
  59565. onMouseleave: startTimer,
  59566. onClick: _ctx.onClick
  59567. }, [
  59568. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  59569. key: 0,
  59570. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  59571. }, {
  59572. default: vue.withCtx(() => [
  59573. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  59574. ]),
  59575. _: 1
  59576. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  59577. vue.createElementVNode("div", {
  59578. class: vue.normalizeClass(vue.unref(ns).e("group"))
  59579. }, [
  59580. vue.createElementVNode("h2", {
  59581. class: vue.normalizeClass(vue.unref(ns).e("title")),
  59582. textContent: vue.toDisplayString(_ctx.title)
  59583. }, null, 10, ["textContent"]),
  59584. vue.withDirectives(vue.createElementVNode("div", {
  59585. class: vue.normalizeClass(vue.unref(ns).e("content")),
  59586. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  59587. }, [
  59588. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  59589. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", { key: 0 }, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  59590. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  59591. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, ["innerHTML"])
  59592. ], 2112))
  59593. ])
  59594. ], 6), [
  59595. [vue.vShow, _ctx.message]
  59596. ]),
  59597. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  59598. key: 0,
  59599. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  59600. onClick: vue.withModifiers(close, ["stop"])
  59601. }, {
  59602. default: vue.withCtx(() => [
  59603. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon)))
  59604. ]),
  59605. _: 1
  59606. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  59607. ], 2)
  59608. ], 46, ["id", "onClick"]), [
  59609. [vue.vShow, visible.value]
  59610. ])
  59611. ]),
  59612. _: 3
  59613. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  59614. };
  59615. }
  59616. });
  59617. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  59618. const notifications = {
  59619. "top-left": [],
  59620. "top-right": [],
  59621. "bottom-left": [],
  59622. "bottom-right": []
  59623. };
  59624. const GAP_SIZE = 16;
  59625. let seed = 1;
  59626. const notify = function(options = {}, context) {
  59627. if (!isClient)
  59628. return { close: () => void 0 };
  59629. if (isString$1(options) || vue.isVNode(options)) {
  59630. options = { message: options };
  59631. }
  59632. const position = options.position || "top-right";
  59633. let verticalOffset = options.offset || 0;
  59634. notifications[position].forEach(({ vm: vm2 }) => {
  59635. var _a;
  59636. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  59637. });
  59638. verticalOffset += GAP_SIZE;
  59639. const id = `notification_${seed++}`;
  59640. const userOnClose = options.onClose;
  59641. const props = {
  59642. ...options,
  59643. offset: verticalOffset,
  59644. id,
  59645. onClose: () => {
  59646. close(id, position, userOnClose);
  59647. }
  59648. };
  59649. let appendTo = document.body;
  59650. if (isElement$1(options.appendTo)) {
  59651. appendTo = options.appendTo;
  59652. } else if (isString$1(options.appendTo)) {
  59653. appendTo = document.querySelector(options.appendTo);
  59654. }
  59655. if (!isElement$1(appendTo)) {
  59656. appendTo = document.body;
  59657. }
  59658. const container = document.createElement("div");
  59659. const vm = vue.createVNode(NotificationConstructor, props, isFunction$1(props.message) ? props.message : vue.isVNode(props.message) ? () => props.message : null);
  59660. vm.appContext = isUndefined(context) ? notify._context : context;
  59661. vm.props.onDestroy = () => {
  59662. vue.render(null, container);
  59663. };
  59664. vue.render(vm, container);
  59665. notifications[position].push({ vm });
  59666. appendTo.appendChild(container.firstElementChild);
  59667. return {
  59668. close: () => {
  59669. vm.component.exposed.visible.value = false;
  59670. }
  59671. };
  59672. };
  59673. notificationTypes.forEach((type) => {
  59674. notify[type] = (options = {}, appContext) => {
  59675. if (isString$1(options) || vue.isVNode(options)) {
  59676. options = {
  59677. message: options
  59678. };
  59679. }
  59680. return notify({ ...options, type }, appContext);
  59681. };
  59682. });
  59683. function close(id, position, userOnClose) {
  59684. const orientedNotifications = notifications[position];
  59685. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  59686. var _a;
  59687. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  59688. });
  59689. if (idx === -1)
  59690. return;
  59691. const { vm } = orientedNotifications[idx];
  59692. if (!vm)
  59693. return;
  59694. userOnClose == null ? void 0 : userOnClose(vm);
  59695. const removedHeight = vm.el.offsetHeight;
  59696. const verticalPos = position.split("-")[0];
  59697. orientedNotifications.splice(idx, 1);
  59698. const len = orientedNotifications.length;
  59699. if (len < 1)
  59700. return;
  59701. for (let i = idx; i < len; i++) {
  59702. const { el, component } = orientedNotifications[i].vm;
  59703. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  59704. component.props.offset = pos;
  59705. }
  59706. }
  59707. function closeAll() {
  59708. for (const orientedNotifications of Object.values(notifications)) {
  59709. orientedNotifications.forEach(({ vm }) => {
  59710. vm.component.exposed.visible.value = false;
  59711. });
  59712. }
  59713. }
  59714. notify.closeAll = closeAll;
  59715. notify._context = null;
  59716. var Notify = notify;
  59717. const ElNotification = withInstallFunction(Notify, "$notify");
  59718. var Plugins = [
  59719. ElInfiniteScroll,
  59720. ElLoading,
  59721. ElMessage,
  59722. ElMessageBox,
  59723. ElNotification,
  59724. ElPopoverDirective
  59725. ];
  59726. var installer = makeInstaller([...Components, ...Plugins]);
  59727. const install = installer.install;
  59728. const version = installer.version;
  59729. exports.BAR_MAP = BAR_MAP;
  59730. exports.CAROUSEL_ITEM_NAME = CAROUSEL_ITEM_NAME;
  59731. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  59732. exports.CHANGE_EVENT = CHANGE_EVENT;
  59733. exports.ClickOutside = ClickOutside;
  59734. exports.CommonPicker = CommonPicker;
  59735. exports.CommonProps = CommonProps;
  59736. exports.DEFAULT_EMPTY_VALUES = DEFAULT_EMPTY_VALUES;
  59737. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  59738. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  59739. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  59740. exports.DEFAULT_VALUE_ON_CLEAR = DEFAULT_VALUE_ON_CLEAR;
  59741. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  59742. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  59743. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  59744. exports.DefaultProps = DefaultProps;
  59745. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  59746. exports.DynamicSizeList = DynamicSizeList$1;
  59747. exports.EVENT_CODE = EVENT_CODE;
  59748. exports.Effect = Effect;
  59749. exports.ElAffix = ElAffix;
  59750. exports.ElAlert = ElAlert;
  59751. exports.ElAnchor = ElAnchor;
  59752. exports.ElAnchorLink = ElAnchorLink;
  59753. exports.ElAside = ElAside;
  59754. exports.ElAutoResizer = ElAutoResizer;
  59755. exports.ElAutocomplete = ElAutocomplete;
  59756. exports.ElAvatar = ElAvatar;
  59757. exports.ElBacktop = ElBacktop;
  59758. exports.ElBadge = ElBadge;
  59759. exports.ElBreadcrumb = ElBreadcrumb;
  59760. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  59761. exports.ElButton = ElButton;
  59762. exports.ElButtonGroup = ElButtonGroup$1;
  59763. exports.ElCalendar = ElCalendar;
  59764. exports.ElCard = ElCard;
  59765. exports.ElCarousel = ElCarousel;
  59766. exports.ElCarouselItem = ElCarouselItem;
  59767. exports.ElCascader = ElCascader;
  59768. exports.ElCascaderPanel = ElCascaderPanel;
  59769. exports.ElCheckTag = ElCheckTag;
  59770. exports.ElCheckbox = ElCheckbox;
  59771. exports.ElCheckboxButton = ElCheckboxButton;
  59772. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  59773. exports.ElCol = ElCol;
  59774. exports.ElCollapse = ElCollapse;
  59775. exports.ElCollapseItem = ElCollapseItem;
  59776. exports.ElCollapseTransition = ElCollapseTransition;
  59777. exports.ElCollection = ElCollection;
  59778. exports.ElCollectionItem = ElCollectionItem;
  59779. exports.ElColorPicker = ElColorPicker;
  59780. exports.ElConfigProvider = ElConfigProvider;
  59781. exports.ElContainer = ElContainer;
  59782. exports.ElCountdown = ElCountdown;
  59783. exports.ElDatePicker = ElDatePicker;
  59784. exports.ElDescriptions = ElDescriptions;
  59785. exports.ElDescriptionsItem = ElDescriptionsItem;
  59786. exports.ElDialog = ElDialog;
  59787. exports.ElDivider = ElDivider;
  59788. exports.ElDrawer = ElDrawer;
  59789. exports.ElDropdown = ElDropdown;
  59790. exports.ElDropdownItem = ElDropdownItem;
  59791. exports.ElDropdownMenu = ElDropdownMenu;
  59792. exports.ElEmpty = ElEmpty;
  59793. exports.ElFooter = ElFooter;
  59794. exports.ElForm = ElForm;
  59795. exports.ElFormItem = ElFormItem;
  59796. exports.ElHeader = ElHeader;
  59797. exports.ElIcon = ElIcon;
  59798. exports.ElImage = ElImage;
  59799. exports.ElImageViewer = ElImageViewer;
  59800. exports.ElInfiniteScroll = ElInfiniteScroll;
  59801. exports.ElInput = ElInput;
  59802. exports.ElInputNumber = ElInputNumber;
  59803. exports.ElInputTag = ElInputTag;
  59804. exports.ElLink = ElLink;
  59805. exports.ElLoading = ElLoading;
  59806. exports.ElLoadingDirective = vLoading;
  59807. exports.ElLoadingService = Loading;
  59808. exports.ElMain = ElMain;
  59809. exports.ElMention = ElMention;
  59810. exports.ElMenu = ElMenu;
  59811. exports.ElMenuItem = ElMenuItem;
  59812. exports.ElMenuItemGroup = ElMenuItemGroup;
  59813. exports.ElMessage = ElMessage;
  59814. exports.ElMessageBox = ElMessageBox;
  59815. exports.ElNotification = ElNotification;
  59816. exports.ElOption = ElOption;
  59817. exports.ElOptionGroup = ElOptionGroup;
  59818. exports.ElOverlay = ElOverlay;
  59819. exports.ElPageHeader = ElPageHeader;
  59820. exports.ElPagination = ElPagination;
  59821. exports.ElPopconfirm = ElPopconfirm;
  59822. exports.ElPopover = ElPopover;
  59823. exports.ElPopoverDirective = ElPopoverDirective;
  59824. exports.ElPopper = ElPopper;
  59825. exports.ElPopperArrow = ElPopperArrow;
  59826. exports.ElPopperContent = ElPopperContent;
  59827. exports.ElPopperTrigger = ElPopperTrigger;
  59828. exports.ElProgress = ElProgress;
  59829. exports.ElRadio = ElRadio;
  59830. exports.ElRadioButton = ElRadioButton;
  59831. exports.ElRadioGroup = ElRadioGroup;
  59832. exports.ElRate = ElRate;
  59833. exports.ElResult = ElResult;
  59834. exports.ElRow = ElRow;
  59835. exports.ElScrollbar = ElScrollbar;
  59836. exports.ElSegmented = ElSegmented;
  59837. exports.ElSelect = ElSelect;
  59838. exports.ElSelectV2 = ElSelectV2;
  59839. exports.ElSkeleton = ElSkeleton;
  59840. exports.ElSkeletonItem = ElSkeletonItem;
  59841. exports.ElSlider = ElSlider;
  59842. exports.ElSpace = ElSpace;
  59843. exports.ElStatistic = ElStatistic;
  59844. exports.ElStep = ElStep;
  59845. exports.ElSteps = ElSteps;
  59846. exports.ElSubMenu = ElSubMenu;
  59847. exports.ElSwitch = ElSwitch;
  59848. exports.ElTabPane = ElTabPane;
  59849. exports.ElTable = ElTable;
  59850. exports.ElTableColumn = ElTableColumn;
  59851. exports.ElTableV2 = ElTableV2;
  59852. exports.ElTabs = ElTabs;
  59853. exports.ElTag = ElTag;
  59854. exports.ElText = ElText;
  59855. exports.ElTimePicker = ElTimePicker;
  59856. exports.ElTimeSelect = ElTimeSelect;
  59857. exports.ElTimeline = ElTimeline;
  59858. exports.ElTimelineItem = ElTimelineItem;
  59859. exports.ElTooltip = ElTooltip;
  59860. exports.ElTour = ElTour;
  59861. exports.ElTourStep = ElTourStep;
  59862. exports.ElTransfer = ElTransfer;
  59863. exports.ElTree = ElTree;
  59864. exports.ElTreeSelect = ElTreeSelect;
  59865. exports.ElTreeV2 = ElTreeV2;
  59866. exports.ElUpload = ElUpload;
  59867. exports.ElWatermark = ElWatermark;
  59868. exports.FIRST_KEYS = FIRST_KEYS;
  59869. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  59870. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  59871. exports.FixedSizeGrid = FixedSizeGrid$1;
  59872. exports.FixedSizeList = FixedSizeList$1;
  59873. exports.GAP = GAP;
  59874. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  59875. exports.INPUT_EVENT = INPUT_EVENT;
  59876. exports.INSTALLED_KEY = INSTALLED_KEY;
  59877. exports.IconComponentMap = IconComponentMap;
  59878. exports.IconMap = IconMap;
  59879. exports.LAST_KEYS = LAST_KEYS;
  59880. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  59881. exports.Mousewheel = Mousewheel;
  59882. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  59883. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  59884. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  59885. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  59886. exports.RowAlign = RowAlign;
  59887. exports.RowJustify = RowJustify;
  59888. exports.SCOPE = SCOPE$3;
  59889. exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY;
  59890. exports.SelectProps = SelectProps$1;
  59891. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  59892. exports.TableV2 = TableV2$1;
  59893. exports.TableV2Alignment = Alignment;
  59894. exports.TableV2FixedDir = FixedDir;
  59895. exports.TableV2Placeholder = placeholderSign;
  59896. exports.TableV2SortOrder = SortOrder;
  59897. exports.TimePickPanel = TimePickPanel;
  59898. exports.TrapFocus = TrapFocus;
  59899. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  59900. exports.WEEK_DAYS = WEEK_DAYS;
  59901. exports.ZINDEX_INJECTION_KEY = ZINDEX_INJECTION_KEY;
  59902. exports.affixEmits = affixEmits;
  59903. exports.affixProps = affixProps;
  59904. exports.alertEffects = alertEffects;
  59905. exports.alertEmits = alertEmits;
  59906. exports.alertProps = alertProps;
  59907. exports.anchorEmits = anchorEmits;
  59908. exports.anchorProps = anchorProps;
  59909. exports.ariaProps = ariaProps;
  59910. exports.arrowMiddleware = arrowMiddleware;
  59911. exports.autoResizerProps = autoResizerProps;
  59912. exports.autocompleteEmits = autocompleteEmits;
  59913. exports.autocompleteProps = autocompleteProps;
  59914. exports.avatarEmits = avatarEmits;
  59915. exports.avatarProps = avatarProps;
  59916. exports.backtopEmits = backtopEmits;
  59917. exports.backtopProps = backtopProps;
  59918. exports.badgeProps = badgeProps;
  59919. exports.breadcrumbItemProps = breadcrumbItemProps;
  59920. exports.breadcrumbKey = breadcrumbKey;
  59921. exports.breadcrumbProps = breadcrumbProps;
  59922. exports.buildLocaleContext = buildLocaleContext;
  59923. exports.buildTimeList = buildTimeList;
  59924. exports.buildTranslator = buildTranslator;
  59925. exports.buttonEmits = buttonEmits;
  59926. exports.buttonGroupContextKey = buttonGroupContextKey;
  59927. exports.buttonNativeTypes = buttonNativeTypes;
  59928. exports.buttonProps = buttonProps;
  59929. exports.buttonTypes = buttonTypes;
  59930. exports.calendarEmits = calendarEmits;
  59931. exports.calendarProps = calendarProps;
  59932. exports.cardProps = cardProps;
  59933. exports.carouselContextKey = carouselContextKey;
  59934. exports.carouselEmits = carouselEmits;
  59935. exports.carouselItemProps = carouselItemProps;
  59936. exports.carouselProps = carouselProps;
  59937. exports.cascaderEmits = cascaderEmits;
  59938. exports.cascaderProps = cascaderProps;
  59939. exports.checkTagEmits = checkTagEmits;
  59940. exports.checkTagProps = checkTagProps;
  59941. exports.checkboxEmits = checkboxEmits;
  59942. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  59943. exports.checkboxGroupEmits = checkboxGroupEmits;
  59944. exports.checkboxGroupProps = checkboxGroupProps;
  59945. exports.checkboxProps = checkboxProps;
  59946. exports.colProps = colProps;
  59947. exports.collapseContextKey = collapseContextKey;
  59948. exports.collapseEmits = collapseEmits;
  59949. exports.collapseItemProps = collapseItemProps;
  59950. exports.collapseProps = collapseProps;
  59951. exports.colorPickerContextKey = colorPickerContextKey;
  59952. exports.colorPickerEmits = colorPickerEmits;
  59953. exports.colorPickerProps = colorPickerProps;
  59954. exports.componentSizeMap = componentSizeMap;
  59955. exports.componentSizes = componentSizes;
  59956. exports.configProviderContextKey = configProviderContextKey;
  59957. exports.configProviderProps = configProviderProps;
  59958. exports.countdownEmits = countdownEmits;
  59959. exports.countdownProps = countdownProps;
  59960. exports.createModelToggleComposable = createModelToggleComposable;
  59961. exports.dateEquals = dateEquals;
  59962. exports.datePickTypes = datePickTypes;
  59963. exports.datePickerProps = datePickerProps;
  59964. exports.dayOrDaysToDate = dayOrDaysToDate;
  59965. exports.dayjs = dayjs;
  59966. exports["default"] = installer;
  59967. exports.defaultInitialZIndex = defaultInitialZIndex;
  59968. exports.defaultNamespace = defaultNamespace;
  59969. exports.defaultProps = defaultProps;
  59970. exports.descriptionItemProps = descriptionItemProps;
  59971. exports.descriptionProps = descriptionProps;
  59972. exports.dialogEmits = dialogEmits;
  59973. exports.dialogInjectionKey = dialogInjectionKey;
  59974. exports.dialogProps = dialogProps;
  59975. exports.dividerProps = dividerProps;
  59976. exports.drawerEmits = drawerEmits;
  59977. exports.drawerProps = drawerProps;
  59978. exports.dropdownItemProps = dropdownItemProps;
  59979. exports.dropdownMenuProps = dropdownMenuProps;
  59980. exports.dropdownProps = dropdownProps;
  59981. exports.elPaginationKey = elPaginationKey;
  59982. exports.emitChangeFn = emitChangeFn;
  59983. exports.emptyProps = emptyProps;
  59984. exports.emptyValuesContextKey = emptyValuesContextKey;
  59985. exports.extractDateFormat = extractDateFormat;
  59986. exports.extractTimeFormat = extractTimeFormat;
  59987. exports.formContextKey = formContextKey;
  59988. exports.formEmits = formEmits;
  59989. exports.formItemContextKey = formItemContextKey;
  59990. exports.formItemProps = formItemProps;
  59991. exports.formItemValidateStates = formItemValidateStates;
  59992. exports.formMetaProps = formMetaProps;
  59993. exports.formProps = formProps;
  59994. exports.formatter = formatter;
  59995. exports.genFileId = genFileId;
  59996. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  59997. exports.iconProps = iconProps;
  59998. exports.imageEmits = imageEmits;
  59999. exports.imageProps = imageProps;
  60000. exports.imageViewerEmits = imageViewerEmits;
  60001. exports.imageViewerProps = imageViewerProps;
  60002. exports.inputEmits = inputEmits;
  60003. exports.inputNumberEmits = inputNumberEmits;
  60004. exports.inputNumberProps = inputNumberProps;
  60005. exports.inputProps = inputProps;
  60006. exports.inputTagEmits = inputTagEmits;
  60007. exports.inputTagProps = inputTagProps;
  60008. exports.install = install;
  60009. exports.linkEmits = linkEmits;
  60010. exports.linkProps = linkProps;
  60011. exports.localeContextKey = localeContextKey;
  60012. exports.makeInstaller = makeInstaller;
  60013. exports.makeList = makeList;
  60014. exports.mentionEmits = mentionEmits;
  60015. exports.mentionProps = mentionProps;
  60016. exports.menuEmits = menuEmits;
  60017. exports.menuItemEmits = menuItemEmits;
  60018. exports.menuItemGroupProps = menuItemGroupProps;
  60019. exports.menuItemProps = menuItemProps;
  60020. exports.menuProps = menuProps;
  60021. exports.messageConfig = messageConfig;
  60022. exports.messageDefaults = messageDefaults;
  60023. exports.messageEmits = messageEmits;
  60024. exports.messageProps = messageProps;
  60025. exports.messageTypes = messageTypes;
  60026. exports.namespaceContextKey = namespaceContextKey;
  60027. exports.notificationEmits = notificationEmits;
  60028. exports.notificationProps = notificationProps;
  60029. exports.notificationTypes = notificationTypes;
  60030. exports.overlayEmits = overlayEmits;
  60031. exports.overlayProps = overlayProps;
  60032. exports.pageHeaderEmits = pageHeaderEmits;
  60033. exports.pageHeaderProps = pageHeaderProps;
  60034. exports.paginationEmits = paginationEmits;
  60035. exports.paginationProps = paginationProps;
  60036. exports.parseDate = parseDate;
  60037. exports.popconfirmEmits = popconfirmEmits;
  60038. exports.popconfirmProps = popconfirmProps;
  60039. exports.popoverEmits = popoverEmits;
  60040. exports.popoverProps = popoverProps;
  60041. exports.popperArrowProps = popperArrowProps;
  60042. exports.popperContentEmits = popperContentEmits;
  60043. exports.popperContentProps = popperContentProps;
  60044. exports.popperCoreConfigProps = popperCoreConfigProps;
  60045. exports.popperProps = popperProps;
  60046. exports.popperTriggerProps = popperTriggerProps;
  60047. exports.progressProps = progressProps;
  60048. exports.provideGlobalConfig = provideGlobalConfig;
  60049. exports.radioButtonProps = radioButtonProps;
  60050. exports.radioEmits = radioEmits;
  60051. exports.radioGroupEmits = radioGroupEmits;
  60052. exports.radioGroupKey = radioGroupKey;
  60053. exports.radioGroupProps = radioGroupProps;
  60054. exports.radioProps = radioProps;
  60055. exports.radioPropsBase = radioPropsBase;
  60056. exports.rangeArr = rangeArr;
  60057. exports.rateEmits = rateEmits;
  60058. exports.rateProps = rateProps;
  60059. exports.renderThumbStyle = renderThumbStyle$1;
  60060. exports.resultProps = resultProps;
  60061. exports.roleTypes = roleTypes;
  60062. exports.rowContextKey = rowContextKey;
  60063. exports.rowProps = rowProps;
  60064. exports.scrollbarContextKey = scrollbarContextKey;
  60065. exports.scrollbarEmits = scrollbarEmits;
  60066. exports.scrollbarProps = scrollbarProps;
  60067. exports.segmentedEmits = segmentedEmits;
  60068. exports.segmentedProps = segmentedProps;
  60069. exports.selectEmits = selectEmits$1;
  60070. exports.selectGroupKey = selectGroupKey;
  60071. exports.selectKey = selectKey;
  60072. exports.selectV2InjectionKey = selectV2InjectionKey;
  60073. exports.skeletonItemProps = skeletonItemProps;
  60074. exports.skeletonProps = skeletonProps;
  60075. exports.sliderContextKey = sliderContextKey;
  60076. exports.sliderEmits = sliderEmits;
  60077. exports.sliderProps = sliderProps;
  60078. exports.spaceItemProps = spaceItemProps;
  60079. exports.spaceProps = spaceProps;
  60080. exports.statisticProps = statisticProps;
  60081. exports.stepProps = stepProps;
  60082. exports.stepsEmits = stepsEmits;
  60083. exports.stepsProps = stepsProps;
  60084. exports.subMenuProps = subMenuProps;
  60085. exports.switchEmits = switchEmits;
  60086. exports.switchProps = switchProps;
  60087. exports.tabBarProps = tabBarProps;
  60088. exports.tabNavEmits = tabNavEmits;
  60089. exports.tabNavProps = tabNavProps;
  60090. exports.tabPaneProps = tabPaneProps;
  60091. exports.tableV2Props = tableV2Props;
  60092. exports.tableV2RowProps = tableV2RowProps;
  60093. exports.tabsEmits = tabsEmits;
  60094. exports.tabsProps = tabsProps;
  60095. exports.tabsRootContextKey = tabsRootContextKey;
  60096. exports.tagEmits = tagEmits;
  60097. exports.tagProps = tagProps;
  60098. exports.textProps = textProps;
  60099. exports.thumbProps = thumbProps;
  60100. exports.timePickerDefaultProps = timePickerDefaultProps;
  60101. exports.timePickerRangeTriggerProps = timePickerRangeTriggerProps;
  60102. exports.timePickerRngeTriggerProps = timePickerRngeTriggerProps;
  60103. exports.timeSelectProps = timeSelectProps;
  60104. exports.timeUnits = timeUnits$1;
  60105. exports.timelineItemProps = timelineItemProps;
  60106. exports.tooltipEmits = tooltipEmits;
  60107. exports.tourContentEmits = tourContentEmits;
  60108. exports.tourContentProps = tourContentProps;
  60109. exports.tourEmits = tourEmits;
  60110. exports.tourPlacements = tourPlacements;
  60111. exports.tourProps = tourProps;
  60112. exports.tourStepEmits = tourStepEmits;
  60113. exports.tourStepProps = tourStepProps;
  60114. exports.tourStrategies = tourStrategies;
  60115. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  60116. exports.transferEmits = transferEmits;
  60117. exports.transferProps = transferProps;
  60118. exports.translate = translate;
  60119. exports.uploadBaseProps = uploadBaseProps;
  60120. exports.uploadContentProps = uploadContentProps;
  60121. exports.uploadContextKey = uploadContextKey;
  60122. exports.uploadDraggerEmits = uploadDraggerEmits;
  60123. exports.uploadDraggerProps = uploadDraggerProps;
  60124. exports.uploadListEmits = uploadListEmits;
  60125. exports.uploadListProps = uploadListProps;
  60126. exports.uploadListTypes = uploadListTypes;
  60127. exports.uploadProps = uploadProps;
  60128. exports.useAriaProps = useAriaProps;
  60129. exports.useAttrs = useAttrs;
  60130. exports.useCalcInputWidth = useCalcInputWidth;
  60131. exports.useCascaderConfig = useCascaderConfig;
  60132. exports.useComposition = useComposition;
  60133. exports.useCursor = useCursor;
  60134. exports.useDelayedRender = useDelayedRender;
  60135. exports.useDelayedToggle = useDelayedToggle;
  60136. exports.useDelayedToggleProps = useDelayedToggleProps;
  60137. exports.useDeprecated = useDeprecated;
  60138. exports.useDialog = useDialog;
  60139. exports.useDisabled = useDisabled;
  60140. exports.useDraggable = useDraggable;
  60141. exports.useEmptyValues = useEmptyValues;
  60142. exports.useEmptyValuesProps = useEmptyValuesProps;
  60143. exports.useEscapeKeydown = useEscapeKeydown;
  60144. exports.useFloating = useFloating$1;
  60145. exports.useFloatingProps = useFloatingProps;
  60146. exports.useFocus = useFocus;
  60147. exports.useFocusController = useFocusController;
  60148. exports.useFormDisabled = useFormDisabled;
  60149. exports.useFormItem = useFormItem;
  60150. exports.useFormItemInputId = useFormItemInputId;
  60151. exports.useFormSize = useFormSize;
  60152. exports.useForwardRef = useForwardRef;
  60153. exports.useForwardRefDirective = useForwardRefDirective;
  60154. exports.useGetDerivedNamespace = useGetDerivedNamespace;
  60155. exports.useGlobalComponentSettings = useGlobalComponentSettings;
  60156. exports.useGlobalConfig = useGlobalConfig;
  60157. exports.useGlobalSize = useGlobalSize;
  60158. exports.useId = useId;
  60159. exports.useIdInjection = useIdInjection;
  60160. exports.useLocale = useLocale;
  60161. exports.useLockscreen = useLockscreen;
  60162. exports.useModal = useModal;
  60163. exports.useModelToggle = useModelToggle;
  60164. exports.useModelToggleEmits = useModelToggleEmits;
  60165. exports.useModelToggleProps = useModelToggleProps;
  60166. exports.useNamespace = useNamespace;
  60167. exports.useOrderedChildren = useOrderedChildren;
  60168. exports.usePopper = usePopper;
  60169. exports.usePopperArrowProps = usePopperArrowProps;
  60170. exports.usePopperContainer = usePopperContainer;
  60171. exports.usePopperContainerId = usePopperContainerId;
  60172. exports.usePopperContentEmits = usePopperContentEmits;
  60173. exports.usePopperContentProps = usePopperContentProps;
  60174. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  60175. exports.usePopperProps = usePopperProps;
  60176. exports.usePopperTriggerProps = usePopperTriggerProps;
  60177. exports.usePreventGlobal = usePreventGlobal;
  60178. exports.useProp = useProp;
  60179. exports.useSameTarget = useSameTarget;
  60180. exports.useSize = useSize;
  60181. exports.useSizeProp = useSizeProp;
  60182. exports.useSizeProps = useSizeProps;
  60183. exports.useSpace = useSpace;
  60184. exports.useTeleport = useTeleport;
  60185. exports.useThrottleRender = useThrottleRender;
  60186. exports.useTimeout = useTimeout;
  60187. exports.useTooltipContentProps = useTooltipContentProps;
  60188. exports.useTooltipModelToggle = useTooltipModelToggle;
  60189. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  60190. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  60191. exports.useTooltipProps = useTooltipProps;
  60192. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  60193. exports.useTransitionFallthrough = useTransitionFallthrough;
  60194. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  60195. exports.useZIndex = useZIndex;
  60196. exports.vLoading = vLoading;
  60197. exports.vRepeatClick = vRepeatClick;
  60198. exports.valueEquals = valueEquals;
  60199. exports.version = version;
  60200. exports.virtualizedGridProps = virtualizedGridProps;
  60201. exports.virtualizedListProps = virtualizedListProps;
  60202. exports.virtualizedProps = virtualizedProps;
  60203. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  60204. exports.watermarkProps = watermarkProps;
  60205. exports.zIndexContextKey = zIndexContextKey;
  60206. Object.defineProperty(exports, '__esModule', { value: true });
  60207. }));